aboutsummaryrefslogtreecommitdiff
path: root/spaghetti-monster/fsm-wdt.c
diff options
context:
space:
mode:
Diffstat (limited to 'spaghetti-monster/fsm-wdt.c')
-rw-r--r--spaghetti-monster/fsm-wdt.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/spaghetti-monster/fsm-wdt.c b/spaghetti-monster/fsm-wdt.c
index 7c25e9f..64f006e 100644
--- a/spaghetti-monster/fsm-wdt.c
+++ b/spaghetti-monster/fsm-wdt.c
@@ -122,8 +122,10 @@ void WDT_inner() {
#ifndef USE_SLEEP_LVP
return; // no sleep LVP needed if nothing drains power while off
#else
- // stop here, usually... but proceed often enough for sleep LVP to work
- if (0 != (ticks_since_last & 0x07)) return;
+ // stop here, usually... except during the first few seconds asleep,
+ // and once in a while afterward for sleep LVP
+ if ((ticks_since_last > (8 * SLEEP_TICKS_PER_SECOND))
+ && (0 != (ticks_since_last & 0x0f))) return;
adc_trigger = 0; // make sure a measurement will happen
adc_active_now = 1; // use ADC noise reduction sleep mode