aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSelene ToyKeeper2019-09-28 23:25:54 -0600
committerSelene ToyKeeper2019-09-28 23:25:54 -0600
commita86db913783008a14996415e09183a1097ab5389 (patch)
tree7ec9050406dd4ddb5b611e00fd60bd95085b8459
parentadded a version check function on 15+ clicks from off, added a safety ramp-do... (diff)
downloadanduril-a86db913783008a14996415e09183a1097ab5389.tar.gz
anduril-a86db913783008a14996415e09183a1097ab5389.tar.bz2
anduril-a86db913783008a14996415e09183a1097ab5389.zip
after safety ramp-down, if the button remains stuck, lock the light
-rw-r--r--spaghetti-monster/anduril/anduril.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/spaghetti-monster/anduril/anduril.c b/spaghetti-monster/anduril/anduril.c
index 1505f59..48f4ac1 100644
--- a/spaghetti-monster/anduril/anduril.c
+++ b/spaghetti-monster/anduril/anduril.c
@@ -810,6 +810,11 @@ uint8_t steady_state(Event event, uint16_t arg) {
else if ((arg > TICKS_PER_SECOND * 5) && (actual_level >= mode_max)) {
ramp_direction = -1;
}
+ // if the button is still stuck, lock the light
+ else if ((arg > TICKS_PER_SECOND * 10) && (actual_level <= mode_min)) {
+ blip();
+ set_state(lockout_state, 0);
+ }
memorized_level = nearest_level((int16_t)actual_level \
+ (ramp_step_size * ramp_direction));
#else
@@ -2589,10 +2594,13 @@ void loop() {
blink_digit(pgm_read_byte(version_number + i) - '0');
nice_delay_ms(300);
}
- set_state(off_state, 0);
// FIXME: when user interrupts with button, "off" takes an extra click
// before it'll turn back on, because the click to cancel gets sent
// to the "off" state instead of version_check_state
+ //while (button_is_pressed()) {}
+ //empty_event_sequence();
+
+ set_state(off_state, 0);
}
#endif // #ifdef USE_VERSION_CHECK