aboutsummaryrefslogtreecommitdiff
path: root/spaghetti-monster
diff options
context:
space:
mode:
authorSelene ToyKeeper2023-05-02 08:37:07 -0600
committerSelene ToyKeeper2023-05-02 08:37:07 -0600
commitd12e533a547d95a3ac340d59aa0dd6f6765de3f5 (patch)
treef22b31f0e6e29186b3d416065e1d712d54e0264d /spaghetti-monster
parentdocumented ramp 6C, ramp 4H, lockout 3H, and battcheck 3C (diff)
downloadanduril-d12e533a547d95a3ac340d59aa0dd6f6765de3f5.tar.gz
anduril-d12e533a547d95a3ac340d59aa0dd6f6765de3f5.tar.bz2
anduril-d12e533a547d95a3ac340d59aa0dd6f6765de3f5.zip
fixed bug: channel change could stick when activating a config menu from battcheck
(the blink function changed the channel, then the config menu saved it, then the blink function restored it, then the config menu restored it to the value it saved, which was wrong)
Diffstat (limited to 'spaghetti-monster')
-rw-r--r--spaghetti-monster/fsm-misc.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/spaghetti-monster/fsm-misc.c b/spaghetti-monster/fsm-misc.c
index 1c40b81..dacca85 100644
--- a/spaghetti-monster/fsm-misc.c
+++ b/spaghetti-monster/fsm-misc.c
@@ -33,15 +33,29 @@ uint8_t blink_digit(uint8_t num) {
if (!num) { ontime = 8; num ++; }
#ifdef BLINK_CHANNEL
+ // channel is set per blink, to prevent issues
+ // if another mode interrupts us (like a config menu)
uint8_t old_channel = CH_MODE;
- set_channel_mode(BLINK_CHANNEL);
#endif
for (; num>0; num--) {
// TODO: allow setting a blink channel mode per build target
+ #ifdef BLINK_CHANNEL
+ set_channel_mode(BLINK_CHANNEL);
+ #endif
set_level(BLINK_BRIGHTNESS);
+ #ifdef BLINK_CHANNEL
+ CH_MODE = old_channel;
+ #endif
nice_delay_ms(ontime);
+
+ #ifdef BLINK_CHANNEL
+ set_channel_mode(BLINK_CHANNEL);
+ #endif
set_level(0);
+ #ifdef BLINK_CHANNEL
+ CH_MODE = old_channel;
+ #endif
nice_delay_ms(BLINK_SPEED * 3 / 12);
}