aboutsummaryrefslogtreecommitdiff
path: root/spaghetti-monster
diff options
context:
space:
mode:
authorSelene ToyKeeper2020-07-30 03:24:17 -0600
committerSelene ToyKeeper2020-07-30 03:24:17 -0600
commitb6802208afdadb40b2e99c242ec82b4aa71f5975 (patch)
tree27f81b7eaef48a24f5ca1ba963ef98c99c6055f0 /spaghetti-monster
parentmoved sunset bump from 3C to 4H, fixed candle sunset behavior (was overflowin... (diff)
downloadanduril-b6802208afdadb40b2e99c242ec82b4aa71f5975.tar.gz
anduril-b6802208afdadb40b2e99c242ec82b4aa71f5975.tar.bz2
anduril-b6802208afdadb40b2e99c242ec82b4aa71f5975.zip
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)
Diffstat (limited to 'spaghetti-monster')
-rw-r--r--spaghetti-monster/anduril/off-mode.c7
1 files changed, 7 insertions, 0 deletions
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; }