pass parameter with current timer to timerCallback
This commit is contained in:
parent
d123fe06ea
commit
06fd7ad3cd
@ -137,8 +137,8 @@ namespace Devices {
|
||||
Display::Brightness::brightnessChangedCallback = []{
|
||||
brightnessMqtt->updateState(Display::Brightness::current);
|
||||
};
|
||||
Display::Timer::timerCallback = []{
|
||||
timerRemainingMqtt->updateState(to_string(Display::Timer::current).c_str());
|
||||
Display::Timer::timerCallback = [](int8 current){
|
||||
timerRemainingMqtt->updateState(to_string(current).c_str());
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -79,7 +79,7 @@ namespace Display {
|
||||
|
||||
namespace Timer {
|
||||
int8 timer = 0, current = 0;
|
||||
void (*timerCallback)();
|
||||
void (*timerCallback)(int8);
|
||||
|
||||
Task tDisplayTimer(SECONDS(10), 2,
|
||||
[]{
|
||||
@ -104,7 +104,7 @@ namespace Display {
|
||||
tDisplayTimer.setIterations(TASK_FOREVER);
|
||||
tDisplayTimer.restart();
|
||||
}
|
||||
if (timerCallback) timerCallback();
|
||||
if (timerCallback) timerCallback(current);
|
||||
}, &ts, false, nullptr,
|
||||
[]{
|
||||
tDisplayTimer.disable();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user