aboutsummaryrefslogtreecommitdiff
path: root/ui.c
diff options
context:
space:
mode:
Diffstat (limited to 'ui.c')
-rw-r--r--ui.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/ui.c b/ui.c
index e71db36..8f34591 100644
--- a/ui.c
+++ b/ui.c
@@ -277,19 +277,24 @@ static void doIdle () {
}
}
-/* Run timer, alarm when count==0 or abort when horizon changed
+/* Run timer
*/
static void doRun () {
+ /* horizon change is more important than timer, thus checked first */
+ if (horizonChanged) {
+ /* stop timer */
+ speakerStart (SPEAKER_BEEP);
+
+ enterIdle ();
+ return;
+ }
+
const uint32_t t = timerHit ();
if (t > 0) {
timerElapsed += t;
if (timerElapsed >= timerValue) {
- /* ring the alarm! */
- for (uint8_t i = 0; i < PWM_LED_COUNT; i++) {
- pwmSet (i, PWM_MAX_BRIGHTNESS);
- }
timerStop ();
- /* beep only once */
+ /* ring the alarm! */
speakerStart (SPEAKER_BEEP);
enterFlash (FLASH_ALARM);
} else if (currLed > 0) {
@@ -302,11 +307,6 @@ static void doRun () {
--currLed;
}
}
- } else if (horizonChanged) {
- /* stop timer */
- speakerStart (SPEAKER_BEEP);
-
- enterIdle ();
}
}