From b6802208afdadb40b2e99c242ec82b4aa71f5975 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Thu, 30 Jul 2020 03:24:17 -0600 Subject: fixed bug where light would shut itself off immediately if sunset timer was aborted and then light was turned back on (turn light on, enable sunset timer, turn light off, turn light back on... it would then turn itself off immediately, but it shouldn't) --- spaghetti-monster/anduril/off-mode.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'spaghetti-monster') diff --git a/spaghetti-monster/anduril/off-mode.c b/spaghetti-monster/anduril/off-mode.c index a640b5c..2defc27 100644 --- a/spaghetti-monster/anduril/off-mode.c +++ b/spaghetti-monster/anduril/off-mode.c @@ -22,6 +22,10 @@ #include "off-mode.h" +#ifdef USE_SUNSET_TIMER +#include "sunset-timer.h" +#endif + uint8_t off_state(Event event, uint16_t arg) { // turn emitter off when entering state if (event == EV_enter_state) { @@ -31,6 +35,9 @@ uint8_t off_state(Event event, uint16_t arg) { #elif defined(USE_AUX_RGB_LEDS) rgb_led_update(rgb_led_off_mode, 0); #endif + #ifdef USE_SUNSET_TIMER + sunset_timer = 0; // needs a reset in case previous timer was aborted + #endif // sleep while off (lower power use) // (unless delay requested; give the ADC some time to catch up) if (! arg) { go_to_standby = 1; } -- cgit v1.2.3