diff options
| author | Selene ToyKeeper | 2018-11-11 16:01:12 -0700 |
|---|---|---|
| committer | Selene ToyKeeper | 2018-11-11 16:01:12 -0700 |
| commit | 69d0d92c7902aa27510ab52a533bf91c37363910 (patch) | |
| tree | e2387e102758e573eb0ff311f8cc168b2640a96c /spaghetti-monster/fsm-wdt.c | |
| parent | Fixed the corner case of a button release when the previous state was already... (diff) | |
| download | anduril-69d0d92c7902aa27510ab52a533bf91c37363910.tar.gz anduril-69d0d92c7902aa27510ab52a533bf91c37363910.tar.bz2 anduril-69d0d92c7902aa27510ab52a533bf91c37363910.zip | |
Fixed the sleep tick counter wrapping around to 0 instead of 32768.
Diffstat (limited to 'spaghetti-monster/fsm-wdt.c')
| -rw-r--r-- | spaghetti-monster/fsm-wdt.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/spaghetti-monster/fsm-wdt.c b/spaghetti-monster/fsm-wdt.c index 3606c67..d5bbdb9 100644 --- a/spaghetti-monster/fsm-wdt.c +++ b/spaghetti-monster/fsm-wdt.c @@ -64,7 +64,9 @@ ISR(WDT_vect) { // handle standby mode specially if (go_to_standby) { // emit a halfsleep tick, and process it - emit(EV_sleep_tick, sleep_counter++); + emit(EV_sleep_tick, sleep_counter); + // wrap around from 65535 to 32768, not 0 + sleep_counter = (sleep_counter + 1) | (sleep_counter & 0x8000); process_emissions(); return; } |
