Anduril ... 2?

Thank you and all the other folks posting requests, for coming with all these great ideas for us Anduril modders to implement!

For other folks that might be interested:

diff -ruN '--exclude=*.hex' '--exclude=*.o' '--exclude=*.orig*' '--exclude=*.elf' 620/~gabe/flashlight-firmware/anduril2/ToyKeeper/spaghetti-monster/anduril/aux-leds.h 620-8C_quick_aux_switch/~gabe/flashlight-firmware/anduril2/ToyKeeper/spaghetti-monster/anduril/aux-leds.h
--- 620/~gabe/flashlight-firmware/anduril2/ToyKeeper/spaghetti-monster/anduril/aux-leds.h	2022-07-04 17:28:25.000000000 -0400
+++ 620-8C_quick_aux_switch/~gabe/flashlight-firmware/anduril2/ToyKeeper/spaghetti-monster/anduril/aux-leds.h	2023-10-01 13:48:21.670503492 -0300
@@ -83,5 +83,14 @@
     #endif
 #endif
 
+#ifdef USE_QUICK_AUX_SWITCH
+  #ifdef USE_INDICATOR_LED
+          uint8_t previous_indicator_led_mode = ~INDICATOR_LED_DEFAULT_MODE;
+  #endif
+  #ifdef USE_AUX_RGB_LEDS
+          uint8_t previous_rgb_led_off_mode = ~RGB_LED_OFF_DEFAULT;
+          uint8_t previous_rgb_led_lockout_mode = ~RGB_LED_LOCKOUT_DEFAULT;
+  #endif
+#endif
 
 #endif
diff -ruN '--exclude=*.hex' '--exclude=*.o' '--exclude=*.orig*' '--exclude=*.elf' 620/~gabe/flashlight-firmware/anduril2/ToyKeeper/spaghetti-monster/anduril/cfg-wurkkos-ts10.h 620-8C_quick_aux_switch/~gabe/flashlight-firmware/anduril2/ToyKeeper/spaghetti-monster/anduril/cfg-wurkkos-ts10.h
--- 620/~gabe/flashlight-firmware/anduril2/ToyKeeper/spaghetti-monster/anduril/cfg-wurkkos-ts10.h	2022-07-19 19:43:49.000000000 -0400
+++ 620-8C_quick_aux_switch/~gabe/flashlight-firmware/anduril2/ToyKeeper/spaghetti-monster/anduril/cfg-wurkkos-ts10.h	2023-10-01 13:58:41.943828699 -0300
@@ -76,4 +76,7 @@
 #endif
 #ifdef BLINK_AT_RAMP_CEIL
 #undef BLINK_AT_RAMP_CEIL
-#endif
\ No newline at end of file
+#endif
+
+#define USE_INDICATOR_LED
+#define USE_QUICK_AUX_SWITCH
diff -ruN '--exclude=*.hex' '--exclude=*.o' '--exclude=*.orig*' '--exclude=*.elf' 620/~gabe/flashlight-firmware/anduril2/ToyKeeper/spaghetti-monster/anduril/config-default.h 620-8C_quick_aux_switch/~gabe/flashlight-firmware/anduril2/ToyKeeper/spaghetti-monster/anduril/config-default.h
--- 620/~gabe/flashlight-firmware/anduril2/ToyKeeper/spaghetti-monster/anduril/config-default.h	2021-12-08 19:36:58.000000000 -0300
+++ 620-8C_quick_aux_switch/~gabe/flashlight-firmware/anduril2/ToyKeeper/spaghetti-monster/anduril/config-default.h	2023-10-01 13:48:21.682503908 -0300
@@ -194,4 +194,7 @@
 // those oscillations
 //#define USE_LOWPASS_WHILE_ASLEEP
 
+// enable quick switch to/from current aux mode to off
+#define USE_QUICK_AUX_SWITCH
+
 #endif
diff -ruN '--exclude=*.hex' '--exclude=*.o' '--exclude=*.orig*' '--exclude=*.elf' 620/~gabe/flashlight-firmware/anduril2/ToyKeeper/spaghetti-monster/anduril/load-save-config.c 620-8C_quick_aux_switch/~gabe/flashlight-firmware/anduril2/ToyKeeper/spaghetti-monster/anduril/load-save-config.c
--- 620/~gabe/flashlight-firmware/anduril2/ToyKeeper/spaghetti-monster/anduril/load-save-config.c	2021-11-03 07:16:05.000000000 -0300
+++ 620-8C_quick_aux_switch/~gabe/flashlight-firmware/anduril2/ToyKeeper/spaghetti-monster/anduril/load-save-config.c	2023-10-01 13:48:21.650502797 -0300
@@ -95,6 +95,15 @@
         #ifdef USE_AUTOLOCK
         autolock_time = eeprom[autolock_time_e];
         #endif
+        #ifdef USE_QUICK_AUX_SWITCH
+            #ifdef USE_INDICATOR_LED
+                previous_indicator_led_mode = eeprom[previous_indicator_led_mode_e];
+            #endif
+            #ifdef USE_AUX_RGB_LEDS
+                previous_rgb_led_off_mode = eeprom[previous_rgb_led_off_mode_e];
+                previous_rgb_led_lockout_mode = eeprom[previous_rgb_led_lockout_mode_e];
+            #endif
+        #endif
     }
     #ifdef START_AT_MEMORIZED_LEVEL
     if (load_eeprom_wl()) {
@@ -174,6 +183,15 @@
     #ifdef USE_AUTOLOCK
     eeprom[autolock_time_e] = autolock_time;
     #endif
+    #ifdef USE_QUICK_AUX_SWITCH
+        #ifdef USE_INDICATOR_LED
+            eeprom[previous_indicator_led_mode_e] = previous_indicator_led_mode;
+        #endif
+        #ifdef USE_AUX_RGB_LEDS
+            eeprom[previous_rgb_led_off_mode_e] = previous_rgb_led_off_mode;
+            eeprom[previous_rgb_led_lockout_mode_e] = previous_rgb_led_lockout_mode;
+        #endif
+    #endif
 
     save_eeprom();
 }
diff -ruN '--exclude=*.hex' '--exclude=*.o' '--exclude=*.orig*' '--exclude=*.elf' 620/~gabe/flashlight-firmware/anduril2/ToyKeeper/spaghetti-monster/anduril/load-save-config-fsm.h 620-8C_quick_aux_switch/~gabe/flashlight-firmware/anduril2/ToyKeeper/spaghetti-monster/anduril/load-save-config-fsm.h
--- 620/~gabe/flashlight-firmware/anduril2/ToyKeeper/spaghetti-monster/anduril/load-save-config-fsm.h	2021-11-03 07:16:05.000000000 -0300
+++ 620-8C_quick_aux_switch/~gabe/flashlight-firmware/anduril2/ToyKeeper/spaghetti-monster/anduril/load-save-config-fsm.h	2023-10-01 13:48:21.674503630 -0300
@@ -95,6 +95,11 @@
     #ifdef USE_AUTOLOCK
     autolock_time_e,
     #endif
+    #ifdef USE_QUICK_AUX_SWITCH
+    previous_indicator_led_mode_e,
+    previous_rgb_led_off_mode_e,
+    previous_rgb_led_lockout_mode_e,
+    #endif
     eeprom_indexes_e_END
 } eeprom_indexes_e;
 #define EEPROM_BYTES eeprom_indexes_e_END
diff -ruN '--exclude=*.hex' '--exclude=*.o' '--exclude=*.orig*' '--exclude=*.elf' 620/~gabe/flashlight-firmware/anduril2/ToyKeeper/spaghetti-monster/anduril/lockout-mode.c 620-8C_quick_aux_switch/~gabe/flashlight-firmware/anduril2/ToyKeeper/spaghetti-monster/anduril/lockout-mode.c
--- 620/~gabe/flashlight-firmware/anduril2/ToyKeeper/spaghetti-monster/anduril/lockout-mode.c	2022-07-04 17:28:25.000000000 -0400
+++ 620-8C_quick_aux_switch/~gabe/flashlight-firmware/anduril2/ToyKeeper/spaghetti-monster/anduril/lockout-mode.c	2023-10-01 13:48:21.658503075 -0300
@@ -185,6 +185,49 @@
     }
     #endif
 
+    #ifdef USE_QUICK_AUX_SWITCH
+         #if defined(USE_INDICATOR_LED)
+         // 8 clicks: if indicator LEDs (aka "aux LEDs") mode is not off, save it and change it to off; if it's already off, change it back to saved
+         //  See: https://budgetlightforum.com/t/anduril-2-feature-change-suggestions/218045/145
+         else if (event == EV_8clicks) {
+             uint8_t mode = indicator_led_mode >> 2;
+                uint8_t previous_mode = previous_indicator_led_mode >> 2;
+             if (mode) {
+                 previous_mode = mode;
+                 mode = 0;
+             } else {
+                 mode = previous_mode;
+                 previous_mode = 0;
+             }
+             indicator_led_mode = (mode << 2) + (indicator_led_mode & 0x03);
+             previous_indicator_led_mode = (previous_mode << 2) + (previous_indicator_led_mode & 0x03);
+             // redundant, sleep tick does the same thing
+             //indicator_led_update(indicator_led_mode >> 2, arg);
+             save_config();
+             return MISCHIEF_MANAGED;
+         }
+         #elif defined(USE_AUX_RGB_LEDS)
+         // 8 clicks: if RGB aux LED pattern mode is not off, save it and change it to off; if it's already off, change it back to saved
+         else if (event == EV_8clicks) {
+             uint8_t mode = (rgb_led_lockout_mode >> 4);
+             uint8_t previous_mode = (previous_rgb_led_lockout_mode >> 4);
+             if (mode) {
+                 previous_mode = mode;
+                 mode = 0;
+             } else {
+                 mode = previous_mode;
+                 previous_mode = 0;
+             }
+             rgb_led_lockout_mode = (mode << 4) | (rgb_led_lockout_mode & 0x0f);
+             previous_rgb_led_lockout_mode = (previous_mode << 4) | (previous_rgb_led_lockout_mode & 0x0f);
+             rgb_led_update(rgb_led_lockout_mode, 0);
+             save_config();
+             blink_once();
+             return MISCHIEF_MANAGED;
+         }
+         #endif // end 8 clicks
+     #endif
+
     return EVENT_NOT_HANDLED;
 }
 
diff -ruN '--exclude=*.hex' '--exclude=*.o' '--exclude=*.orig*' '--exclude=*.elf' 620/~gabe/flashlight-firmware/anduril2/ToyKeeper/spaghetti-monster/anduril/off-mode.c 620-8C_quick_aux_switch/~gabe/flashlight-firmware/anduril2/ToyKeeper/spaghetti-monster/anduril/off-mode.c
--- 620/~gabe/flashlight-firmware/anduril2/ToyKeeper/spaghetti-monster/anduril/off-mode.c	2022-07-04 17:28:25.000000000 -0400
+++ 620-8C_quick_aux_switch/~gabe/flashlight-firmware/anduril2/ToyKeeper/spaghetti-monster/anduril/off-mode.c	2023-10-01 13:48:21.618501687 -0300
@@ -316,6 +316,49 @@
     }
     #endif  // end 7 clicks
 
+    #ifdef USE_QUICK_AUX_SWITCH
+        #ifdef USE_INDICATOR_LED
+        // 8 clicks: if indicator LEDs (aka "aux LEDs") are not off, change them to off; if they're already off, change them to low
+        //  See: https://budgetlightforum.com/t/anduril-2-feature-change-suggestions/218045/145
+        else if (event == EV_8clicks) {
+            uint8_t mode = (indicator_led_mode & 3);
+            uint8_t previous_mode = (previous_indicator_led_mode & 3);
+            if (mode) {
+                previous_mode = mode;
+                mode = 0;
+           } else {
+                mode = previous_mode;
+                previous_mode = 0;
+            }
+            indicator_led_mode = (indicator_led_mode & 0b11111100) | mode;
+            previous_indicator_led_mode = (previous_indicator_led_mode & 0b11111100) | previous_mode;
+            // redundant, sleep tick does the same thing
+            //indicator_led_update(indicator_led_mode & 0x03, arg);
+            save_config();
+            return MISCHIEF_MANAGED;
+        }
+        #elif defined(USE_AUX_RGB_LEDS)
+        // 8 clicks: if RGB aux LED pattern is not off, change it to off; if it's already off, change it to low
+        else if (event == EV_8clicks) {
+            uint8_t mode = (rgb_led_off_mode >> 4);
+            uint8_t previous_mode = (previous_rgb_led_off_mode >> 4);
+            if (mode) {
+                previous_mode = mode;
+                mode = 0;
+            } else {
+                mode = previous_mode;
+                previous_mode = 0;
+            }
+            rgb_led_off_mode = (mode << 4) | (rgb_led_off_mode & 0x0f);
+            previous_rgb_led_off_mode = (previous_mode << 4) | (previous_rgb_led_off_mode & 0x0f);
+            rgb_led_update(rgb_led_off_mode, 0);
+            save_config();
+            blink_once();
+            return MISCHIEF_MANAGED;
+        }
+        #endif  // end 8 clicks
+    #endif
+
     #ifdef USE_GLOBALS_CONFIG
     // 9 clicks, but hold last click: configure misc global settings
     else if ((event == EV_click9_hold) && (!arg)) {

3 Thanks