aboutsummaryrefslogtreecommitdiff
path: root/spaghetti-monster/fsm-standby.c
diff options
context:
space:
mode:
authorSelene ToyKeeper2019-11-20 15:29:51 -0700
committerSelene ToyKeeper2019-11-20 15:29:51 -0700
commitedede40c7ae37c5e13bce7c31d3ffba9e9fefdf8 (patch)
tree4485bcd34b8e43ac8bf24aa55f89971ce2a389de /spaghetti-monster/fsm-standby.c
parentMateminco MF01S can fit muggle mode again, barely (diff)
downloadanduril-edede40c7ae37c5e13bce7c31d3ffba9e9fefdf8.tar.gz
anduril-edede40c7ae37c5e13bce7c31d3ffba9e9fefdf8.tar.bz2
anduril-edede40c7ae37c5e13bce7c31d3ffba9e9fefdf8.zip
fixed unintentional wakeup right after going to sleep
(by enabling the PCINT slightly sooner, before setting its "handled" flag)
Diffstat (limited to 'spaghetti-monster/fsm-standby.c')
-rw-r--r--spaghetti-monster/fsm-standby.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/spaghetti-monster/fsm-standby.c b/spaghetti-monster/fsm-standby.c
index e4ef92c..9398f52 100644
--- a/spaghetti-monster/fsm-standby.c
+++ b/spaghetti-monster/fsm-standby.c
@@ -43,6 +43,8 @@ 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;
@@ -53,8 +55,6 @@ void sleep_until_eswitch_pressed()
go_to_standby = 0;
#endif
- PCINT_on(); // wake on e-switch event
-
// configure sleep mode
set_sleep_mode(SLEEP_MODE_PWR_DOWN);