diff options
| author | Selene ToyKeeper | 2019-11-18 23:59:49 -0700 |
|---|---|---|
| committer | Selene ToyKeeper | 2019-11-18 23:59:49 -0700 |
| commit | 36b0f74974140093e1b4b9cd6c358ba89f286f48 (patch) | |
| tree | 97bba0dabaa294d7a9b68f74f6123311ed32528f /spaghetti-monster | |
| parent | turned off muggle mode on Q8 and MF01S, to make builds small enough again (diff) | |
| download | anduril-36b0f74974140093e1b4b9cd6c358ba89f286f48.tar.gz anduril-36b0f74974140093e1b4b9cd6c358ba89f286f48.tar.bz2 anduril-36b0f74974140093e1b4b9cd6c358ba89f286f48.zip | |
fixed issue where button-press-during-sleep could occasionally cause a reboot
(by turning off PCINT when the light is awake)
Diffstat (limited to 'spaghetti-monster')
| -rw-r--r-- | spaghetti-monster/fsm-standby.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/spaghetti-monster/fsm-standby.c b/spaghetti-monster/fsm-standby.c index 4124d92..e4ef92c 100644 --- a/spaghetti-monster/fsm-standby.c +++ b/spaghetti-monster/fsm-standby.c @@ -43,8 +43,6 @@ void sleep_until_eswitch_pressed() while (button_is_pressed()) {} empty_event_sequence(); // cancel pending input on suspend - PCINT_on(); // wake on e-switch event - #ifdef TICK_DURING_STANDBY // detect which type of event caused a wake-up irq_adc = 0; @@ -54,6 +52,9 @@ void sleep_until_eswitch_pressed() #else go_to_standby = 0; #endif + + PCINT_on(); // wake on e-switch event + // configure sleep mode set_sleep_mode(SLEEP_MODE_PWR_DOWN); @@ -89,7 +90,10 @@ void sleep_until_eswitch_pressed() #endif // go back to normal running mode - //PCINT_on(); // should be on already + // PCINT not needed any more, and can cause problems if on + // (occasional reboots on wakeup-by-button-press) + PCINT_off(); + // restore normal awake-mode interrupts ADC_on(); WDT_on(); } |
