From 0499082b50b00d942e00d2d272a0c74b4c5ca1cd Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Wed, 22 Aug 2018 23:28:35 -0600 Subject: Reduced ROM size by making successive nice_delay_ms calls collapse any time the user completes an input sequence. All nice delays then get aborted until the next trip through the main() loop. Eliminates the need to wrap nice_delay_ms() calls and handle the exit condition. Also eliminates the risk of getting the UI out of sync with button events. --- spaghetti-monster/fsm-misc.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'spaghetti-monster/fsm-misc.c') diff --git a/spaghetti-monster/fsm-misc.c b/spaghetti-monster/fsm-misc.c index acef28c..e60909e 100644 --- a/spaghetti-monster/fsm-misc.c +++ b/spaghetti-monster/fsm-misc.c @@ -49,11 +49,9 @@ uint8_t blink_digit(uint8_t num) { for (; num>0; num--) { set_level(BLINK_BRIGHTNESS); - if (! nice_delay_ms(ontime)) { return 0; } + nice_delay_ms(ontime); set_level(0); - //if (current_state != old_state) return 0; - if (! nice_delay_ms(400)) return 0; - //if (current_state != old_state) return 0; + nice_delay_ms(400); } return nice_delay_ms(600); } @@ -77,7 +75,7 @@ uint8_t blink_num(uint8_t num) { #if 0 // wait a moment in the dark before starting set_level(0); - if (! nice_delay_ms(200)) return 0; + nice_delay_ms(200); #endif #if 0 @@ -102,7 +100,7 @@ uint8_t blink_num(uint8_t num) { volts = voltage / 10; tenths = voltage % 10; if (! blink(volts)) return; - if (! nice_delay_ms(200)) return; + nice_delay_ms(200); if (! blink(tenths)) return; nice_delay_ms(200); */ -- cgit v1.2.3