aboutsummaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
Diffstat (limited to 'ui')
-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
If you find this content useful please consider a small donation via bitcoin: bitcoin:1mxKyQsHHugqRxPKgwaA7wUwJEGCNthn2?amount=0.001&message=Donation Scraping git contents via cgit is very resource intensive. The continued hosting of these git repositories is entirely financed by your bitcoin contributions. For donations of a least 1 mBTC you include your IP address in the message of your bitcoin donation. This will remove this message in the future for requests from your IP, which will significantly reduce token usage. In any case, any contributions to bitcoin address 1mxKyQsHHugqRxPKgwaA7wUwJEGCNthn2 are very welcome. Thanks in advance for you contribution to a self-sustaining ecosystem.