aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSelene ToyKeeper2023-04-29 00:38:41 -0600
committerSelene ToyKeeper2023-04-29 00:38:41 -0600
commit4c091c23be5854524aa8773960da286f807901ce (patch)
tree1007ba9f4e61fcebe7ab01b8412a1de9afd5047b
parentD4v2: tweaked ramp to make it smoother (diff)
downloadanduril-4c091c23be5854524aa8773960da286f807901ce.tar.gz
anduril-4c091c23be5854524aa8773960da286f807901ce.tar.bz2
anduril-4c091c23be5854524aa8773960da286f807901ce.zip
lockout mode: fixed manual memory timer and tint, added 3H next channel,
and made 3H+ use mem level instead of lowest moon (this is needed for making the channel discernible, and also helps make aux LED controls stand out more) The 3H mapping allows users to change channels without leaving lockout, which was possible before with 3H to ramp tint, but doesn't work in new multi-channel code because it uses 3C instead... and 3C is already used. So the new 3H does sort of what the old 3H did, but in a way which is more relevant to the new channel system.
-rw-r--r--spaghetti-monster/anduril/lockout-mode.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/spaghetti-monster/anduril/lockout-mode.c b/spaghetti-monster/anduril/lockout-mode.c
index 2439580..c755a61 100644
--- a/spaghetti-monster/anduril/lockout-mode.c
+++ b/spaghetti-monster/anduril/lockout-mode.c
@@ -18,13 +18,13 @@ uint8_t lockout_state(Event event, uint16_t arg) {
// hold: lowest floor
// click, hold: highest floor (or manual mem level)
uint8_t lvl = cfg.ramp_floors[0];
- if ((event & 0x0f) == 2) { // second click
+ if (1 == (event & 0x0f)) { // first 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];
#ifdef USE_MANUAL_MEMORY
if (cfg.manual_memory) lvl = cfg.manual_memory;
#endif
- } else { // anything except second click
- if (cfg.ramp_floors[1] < lvl) lvl = cfg.ramp_floors[1];
}
set_level(lvl);
}
@@ -65,6 +65,13 @@ uint8_t lockout_state(Event event, uint16_t arg) {
#if defined(TICK_DURING_STANDBY) && (defined(USE_INDICATOR_LED) || defined(USE_AUX_RGB_LEDS))
else if (event == EV_sleep_tick) {
+ #ifdef USE_MANUAL_MEMORY_TIMER
+ // reset to manual memory level when timer expires
+ if (cfg.manual_memory &&
+ (arg >= (cfg.manual_memory_timer * SLEEP_TICKS_PER_MINUTE))) {
+ manual_memory_restore();
+ }
+ #endif
#if defined(USE_INDICATOR_LED)
indicator_led_update(cfg.indicator_led_mode >> 2, arg);
#elif defined(USE_AUX_RGB_LEDS)
@@ -83,8 +90,9 @@ uint8_t lockout_state(Event event, uint16_t arg) {
// 4 clicks: exit and turn on
else if (event == EV_4clicks) {
- #ifdef USE_MANUAL_MEMORY
- // FIXME: memory timer is totally ignored
+ #if defined(USE_MANUAL_MEMORY) && !defined(USE_MANUAL_MEMORY_TIMER)
+ // this clause probably isn't used by any configs any more
+ // but is included just in case someone configures it this way
if (cfg.manual_memory)
set_state(steady_state, cfg.manual_memory);
else
@@ -110,6 +118,16 @@ uint8_t lockout_state(Event event, uint16_t arg) {
return MISCHIEF_MANAGED;
}
+ #if NUM_CHANNEL_MODES > 1
+ // 3H: next channel mode
+ else if (event == EV_click3_hold) {
+ if (0 == (arg % TICKS_PER_SECOND)) {
+ // pretend the user clicked 3 times to change channels
+ return channel_mode_state(EV_3clicks, 0);
+ }
+ }
+ #endif
+
////////// Every action below here is blocked in the (non-Extended) Simple UI //////////
#if defined(USE_SIMPLE_UI) && !defined(USE_EXTENDED_SIMPLE_UI)
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.