edge case for when threshold is smaller than timer
This commit is contained in:
parent
06fd7ad3cd
commit
e2607ffe6d
@ -81,7 +81,7 @@ namespace Display {
|
|||||||
int8 timer = 0, current = 0;
|
int8 timer = 0, current = 0;
|
||||||
void (*timerCallback)(int8);
|
void (*timerCallback)(int8);
|
||||||
|
|
||||||
Task tDisplayTimer(SECONDS(10), 2,
|
Task tDisplayTimer(SECONDS(10), TASK_ONCE + 1,
|
||||||
[]{
|
[]{
|
||||||
if (current >= 0) {
|
if (current >= 0) {
|
||||||
clockDisplay.print(current, DEC);
|
clockDisplay.print(current, DEC);
|
||||||
@ -94,13 +94,17 @@ namespace Display {
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
[]{
|
[]{
|
||||||
|
tDisplayTimer.setIterations(TASK_ONCE + 1);
|
||||||
tDisplayTime.enable();
|
tDisplayTime.enable();
|
||||||
});
|
});
|
||||||
Task tTimer(MINUTES(1), TASK_FOREVER,
|
Task tTimer(MINUTES(1), TASK_FOREVER,
|
||||||
[]{
|
[]{
|
||||||
|
static constexpr uint8 threshold = 16;
|
||||||
current--;
|
current--;
|
||||||
if (current == timer) tDisplayTimer.restart();
|
if (current == timer) {
|
||||||
if (current == 16) {
|
if (timer <= threshold) tDisplayTimer.setIterations(TASK_FOREVER);
|
||||||
|
tDisplayTimer.restart();
|
||||||
|
} else if (current == threshold) {
|
||||||
tDisplayTimer.setIterations(TASK_FOREVER);
|
tDisplayTimer.setIterations(TASK_FOREVER);
|
||||||
tDisplayTimer.restart();
|
tDisplayTimer.restart();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user