aboutsummaryrefslogtreecommitdiff
path: root/spaghetti-monster/fsm-events.c
diff options
context:
space:
mode:
authorSelene ToyKeeper2018-08-22 23:46:32 -0600
committerSelene ToyKeeper2018-08-22 23:46:32 -0600
commit00c177bb32715fc5b3f9873cc981e6c263b0ae66 (patch)
tree750f9763d723a443fcb008f5fa925e309ab1e33e /spaghetti-monster/fsm-events.c
parentRemoved symlinks to fix Windows checkouts. Copies those files from their ori... (diff)
parentMade anduril.c no longer executable. (diff)
downloadanduril-00c177bb32715fc5b3f9873cc981e6c263b0ae66.tar.gz
anduril-00c177bb32715fc5b3f9873cc981e6c263b0ae66.tar.bz2
anduril-00c177bb32715fc5b3f9873cc981e6c263b0ae66.zip
merged in zeroflow's fixes and my related changes:
- fixed main emitters coming on while changing aux LED mode - made strobe group mode selection more configurable at compile time - refactored eeprom indexes in the same manner as strobe indexes, for cleaner and more robust code - added -fshort-enums to compile options for smaller ROM size - made interrupt_nice_delays() automatic every time the user completes a button press sequence, so all delays collapse until the next trip through main()... this reduces ROM size and simplifies code and eliminates risk of not responding right away Tested on D4 and D4S.
Diffstat (limited to 'spaghetti-monster/fsm-events.c')
-rw-r--r--spaghetti-monster/fsm-events.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/spaghetti-monster/fsm-events.c b/spaghetti-monster/fsm-events.c
index b8e9018..aa5c3d6 100644
--- a/spaghetti-monster/fsm-events.c
+++ b/spaghetti-monster/fsm-events.c
@@ -39,6 +39,12 @@ uint8_t compare_event_sequences(uint8_t *a, const uint8_t *b) {
void empty_event_sequence() {
for(uint8_t i=0; i<EV_MAX_LEN; i++) current_event[i] = 0;
+ // when the user completes an input sequence, interrupt any running timers
+ // to cancel any delays currently in progress
+ // This eliminates a whole bunch of extra code:
+ // before: if (! nice_delay_ms(ms)) {break;}
+ // after: nice_delay_ms(ms);
+ interrupt_nice_delays();
}
uint8_t push_event(uint8_t ev_type) {
@@ -156,7 +162,7 @@ uint8_t nice_delay_ms(uint16_t ms) {
process_emissions();
if ((nice_delay_interrupt) || (old_state != current_state)) {
- nice_delay_interrupt = 0;
+ //nice_delay_interrupt = 0;
return 0; // state changed; abort
}
}