aboutsummaryrefslogtreecommitdiff
path: root/spaghetti-monster/fsm-standby.c
diff options
context:
space:
mode:
Diffstat (limited to 'spaghetti-monster/fsm-standby.c')
-rw-r--r--spaghetti-monster/fsm-standby.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/spaghetti-monster/fsm-standby.c b/spaghetti-monster/fsm-standby.c
index 50e6e30..2ce3a24 100644
--- a/spaghetti-monster/fsm-standby.c
+++ b/spaghetti-monster/fsm-standby.c
@@ -40,6 +40,15 @@ void sleep_until_eswitch_pressed()
#endif
// configure sleep mode
+ #ifdef TICK_DURING_STANDBY
+ // needs a special sleep mode to get accurate measurements
+ // quickly ... full power-down ends up using more power
+ // overall, and causes some weird issues when the MCU
+ // doesn't stay awake enough cycles to complete a reading
+ if (adc_active_now)
+ set_sleep_mode(SLEEP_MODE_ADC);
+ else
+ #endif
set_sleep_mode(SLEEP_MODE_PWR_DOWN);
sleep_enable();