integrated endSequence into mainloop (instead of delay) 2

This commit is contained in:
Patrick Haßel 2025-03-13 14:08:33 +01:00
parent 241dc3c2b5
commit 15f4e4feb2

View File

@ -2,7 +2,8 @@
#include <LittleFS.h>
#include "display.h"
#define COUNTDOWN_END_SEQUENCE_REPEAT 2
#define COUNTDOWN_END_SEQUENCE_STEPS 5
#define COUNTDOWN_END_SEQUENCE_REPEAT 3
enum CountdownState {
CONFIG, READY, RUNNING, PAUSED, END
@ -64,12 +65,14 @@ void drawSequence() {
if (countdownEndSequenceLast != 0 && now - countdownEndSequenceLast < countdownEndSequenceDelay) {
return;
}
switch (countdownEndSequenceStep % 3) {
switch (countdownEndSequenceStep % COUNTDOWN_END_SEQUENCE_STEPS) {
case 0:
case 2:
drawAll(WHITE);
countdownEndSequenceDelay = 100;
break;
case 1:
case 3:
drawBlack();
countdownEndSequenceDelay = 100;
break;
@ -80,7 +83,7 @@ void drawSequence() {
}
countdownEndSequenceStep++;
countdownEndSequenceLast = now;
if (countdownEndSequenceStep >= 3 * COUNTDOWN_END_SEQUENCE_REPEAT) {
if (countdownEndSequenceStep >= COUNTDOWN_END_SEQUENCE_STEPS * COUNTDOWN_END_SEQUENCE_REPEAT) {
setState(READY);
}
}