From 15f4e4feb2b717c91a991ec5ac271a50523e078c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Ha=C3=9Fel?= Date: Thu, 13 Mar 2025 14:08:33 +0100 Subject: [PATCH] integrated endSequence into mainloop (instead of delay) 2 --- src/countdown.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/countdown.cpp b/src/countdown.cpp index a7669e2..1ad49e9 100644 --- a/src/countdown.cpp +++ b/src/countdown.cpp @@ -2,7 +2,8 @@ #include #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); } }