aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSelene ToyKeeper2025-06-04 00:24:47 -0600
committerSelene ToyKeeper2025-06-04 00:24:47 -0600
commit84129176fa2a316d26ed0bd1d252ef2703e79ca6 (patch)
tree38283669c918e9c99e1e8c66e8eb716320b8f9de
parentemisar-d3aa: reduced preflash by changing timing of power enable steps (diff)
downloadanduril-84129176fa2a316d26ed0bd1d252ef2703e79ca6.tar.gz
anduril-84129176fa2a316d26ed0bd1d252ef2703e79ca6.tar.bz2
anduril-84129176fa2a316d26ed0bd1d252ef2703e79ca6.zip
lockout mode now only does momentary moon/low on 1st and 2nd presses,
so it no longer flashes on each click while advancing to other functions
-rw-r--r--ui/anduril/lockout-mode.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/ui/anduril/lockout-mode.c b/ui/anduril/lockout-mode.c
index c3f82ea..255ab22 100644
--- a/ui/anduril/lockout-mode.c
+++ b/ui/anduril/lockout-mode.c
@@ -12,24 +12,30 @@ uint8_t lockout_state(Event event, uint16_t arg) {
// button is being held
#ifdef USE_AUX_RGB_LEDS
// don't turn on during RGB aux LED configuration
- if (event == EV_click7_hold) { set_level(0); } else
+ //if (event == EV_click7_hold) { set_level(0); } else
#endif
- if ((event & (B_CLICK | B_PRESS)) == (B_CLICK | B_PRESS)) {
- // hold: lowest floor
- // click, hold: highest floor (or manual mem level)
+ uint8_t click_num = event & B_COUNT;
+ if ( // button pressed 1st or 2nd time
+ ((B_CLICK | B_PRESS) == (event & (B_CLICK | B_PRESS)))
+ && (click_num <= 2)
+ ) {
uint8_t lvl = cfg.ramp_floors[0];
- if (1 == (event & 0x0f)) { // first click
+ // hold: lowest floor
+ if (1 == click_num) { // 1st click
if (cfg.ramp_floors[1] < lvl) lvl = cfg.ramp_floors[1];
- } else { // 2nd click or later
- if (cfg.ramp_floors[1] > lvl) lvl = cfg.ramp_floors[1];
+ }
+ // click, hold: highest floor (or manual mem level)
+ else { // 2nd click
#ifdef USE_MANUAL_MEMORY
if (cfg.manual_memory) lvl = cfg.manual_memory;
+ else
#endif
+ if (cfg.ramp_floors[1] > lvl) lvl = cfg.ramp_floors[1];
}
off_state_set_level(lvl);
}
// button was released
- else if ((event & (B_CLICK | B_PRESS)) == (B_CLICK)) {
+ else if ((B_CLICK) == (event & (B_CLICK | B_PRESS))) {
off_state_set_level(0);
}
#endif // ifdef USE_MOON_DURING_LOCKOUT_MODE