aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSelene ToyKeeper2018-09-01 17:34:45 -0600
committerSelene ToyKeeper2018-09-01 17:34:45 -0600
commit895349ffb2f15ad05de57bf0c5a08d24b5d2a42c (patch)
tree961f1261b2f1c4e9bdcf99310604646676518a88
parentReduced moon-during-lockout code size by 10 bytes. (diff)
downloadanduril-895349ffb2f15ad05de57bf0c5a08d24b5d2a42c.tar.gz
anduril-895349ffb2f15ad05de57bf0c5a08d24b5d2a42c.tar.bz2
anduril-895349ffb2f15ad05de57bf0c5a08d24b5d2a42c.zip
Fixed bug introduced in trunk r211.1.9, where Anduril's goodnight mode didn't work sometimes.
The problem was that goodnight's EV_enter was executing before battcheck's loop() finished. This meant battcheck's exit code would turn the emitter off right after goodnight's init set it to the desired level.
-rw-r--r--spaghetti-monster/fsm-events.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/spaghetti-monster/fsm-events.c b/spaghetti-monster/fsm-events.c
index aa5c3d6..c71e822 100644
--- a/spaghetti-monster/fsm-events.c
+++ b/spaghetti-monster/fsm-events.c
@@ -160,11 +160,15 @@ uint8_t nice_delay_ms(uint16_t ms) {
_delay_loop_2(BOGOMIPS*98/100);
#endif // ifdef USE_DYNAMIC_UNDERCLOCKING
- process_emissions();
if ((nice_delay_interrupt) || (old_state != current_state)) {
- //nice_delay_interrupt = 0;
return 0; // state changed; abort
}
+ // handle events only afterward, so that any collapsed delays will
+ // finish running the UI's loop() code before taking any further actions
+ // (this helps make sure code runs in the correct order)
+ // (otherwise, a new state's EV_enter runs before the old state's
+ // loop() has finished, and things can get weird)
+ process_emissions();
}
return 1;
}
If you find this content useful please consider a small donation via bitcoin: bitcoin:1mxKyQsHHugqRxPKgwaA7wUwJEGCNthn2?amount=0.001&message=Donation Scraping git contents via cgit is very resource intensive. The continued hosting of these git repositories is entirely financed by your bitcoin contributions. For donations of a least 1 mBTC you include your IP address in the message of your bitcoin donation. This will remove this message in the future for requests from your IP, which will significantly reduce token usage. In any case, any contributions to bitcoin address 1mxKyQsHHugqRxPKgwaA7wUwJEGCNthn2 are very welcome. Thanks in advance for you contribution to a self-sustaining ecosystem.