diff options
| -rw-r--r-- | spaghetti-monster/anduril/sunset-timer.c | 8 | ||||
| -rw-r--r-- | spaghetti-monster/anduril/sunset-timer.h | 6 |
2 files changed, 11 insertions, 3 deletions
diff --git a/spaghetti-monster/anduril/sunset-timer.c b/spaghetti-monster/anduril/sunset-timer.c index 4c91723..7340ff1 100644 --- a/spaghetti-monster/anduril/sunset-timer.c +++ b/spaghetti-monster/anduril/sunset-timer.c @@ -30,6 +30,14 @@ uint8_t sunset_timer_state(Event event, uint16_t arg) { sunset_ticks = 0; return MISCHIEF_MANAGED; } + // hold: maybe "bump" the timer if it's active and almost expired + else if (event == EV_hold) { + // ramping up should "bump" the timer to extend the deadline a bit + if ((sunset_timer > 0) && (sunset_timer < 4)) { + sunset_timer = 3; + sunset_timer_peak = 3; + } + } // 4H: add 10m to timer, per second, until released else if (event == EV_click4_hold) { if (0 == (arg % TICKS_PER_SECOND)) { diff --git a/spaghetti-monster/anduril/sunset-timer.h b/spaghetti-monster/anduril/sunset-timer.h index 2e39e5d..d197f0e 100644 --- a/spaghetti-monster/anduril/sunset-timer.h +++ b/spaghetti-monster/anduril/sunset-timer.h @@ -26,9 +26,9 @@ #define TICKS_PER_MINUTE (TICKS_PER_SECOND*60) // automatic shutoff timer -uint8_t sunset_timer = 0; -uint8_t sunset_timer_peak = 0; -uint16_t sunset_ticks = 0; +uint8_t sunset_timer = 0; // minutes remaining in countdown +uint8_t sunset_timer_peak = 0; // total minutes in countdown +uint16_t sunset_ticks = 0; // counts from 0 to TICKS_PER_MINUTE, then repeats uint8_t sunset_timer_state(Event event, uint16_t arg); |
