From 41d2a02a8c1b41a118e24058e4ee5fd36a171e57 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Fri, 31 Jul 2020 20:13:42 -0600 Subject: fixed bug: sunset timer didn't adjust MCU clock speed at low levels, so the moon level was way too dim and used too much power also fixed some sunset timer comments --- spaghetti-monster/anduril/sunset-timer.c | 6 +++--- spaghetti-monster/fsm-ramping.c | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'spaghetti-monster') diff --git a/spaghetti-monster/anduril/sunset-timer.c b/spaghetti-monster/anduril/sunset-timer.c index 7340ff1..55da935 100644 --- a/spaghetti-monster/anduril/sunset-timer.c +++ b/spaghetti-monster/anduril/sunset-timer.c @@ -24,7 +24,7 @@ uint8_t sunset_timer_state(Event event, uint16_t arg) { - // blink on start + // reset on start if (event == EV_enter_state) { sunset_timer = 0; sunset_ticks = 0; @@ -42,7 +42,7 @@ uint8_t sunset_timer_state(Event event, uint16_t arg) { else if (event == EV_click4_hold) { if (0 == (arg % TICKS_PER_SECOND)) { if (sunset_timer < (255 - SUNSET_TIMER_UNIT)) { - // add 30m to the timer + // add a few minutes to the timer sunset_timer += SUNSET_TIMER_UNIT; sunset_timer_peak = sunset_timer; // reset ceiling sunset_ticks = 0; // reset phase @@ -57,7 +57,7 @@ uint8_t sunset_timer_state(Event event, uint16_t arg) { } return MISCHIEF_MANAGED; } - // tick: step down (maybe) or off (maybe) + // tick: count down until time expires else if (event == EV_tick) { // time passed sunset_ticks ++; diff --git a/spaghetti-monster/fsm-ramping.c b/spaghetti-monster/fsm-ramping.c index c3ad8b4..6c6d0cb 100644 --- a/spaghetti-monster/fsm-ramping.c +++ b/spaghetti-monster/fsm-ramping.c @@ -200,6 +200,9 @@ void gradual_tick() { { actual_level = gt + 1; } + #ifdef USE_DYNAMIC_UNDERCLOCKING + auto_clock_speed(); + #endif } #endif -- cgit v1.2.3