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

So I finally managed to take a few hours off and adapted with my 8C_Quick_Aux_Switch mod into TK’s rev 767:

I’m using it on both my TS10 and FC13 (with my own custom configuration) and they seem to be working as good as with my previous general hex release (for rev.725).

I do like the “slow start” and “slow stop” features; the other improvements TK has surely incorporated are not apparent, at least after just a few hours of use. I didn’t like the new tuning for the candle mode, tho – the light intensity varies too much and too fast compared to rev.725, I will probably retune it for my own lights later and incorporate the changes to my custom config.

Anyone that downloads and flashes one of these, please let me know how it goes! TIA!

2 Thanks

Thank you so much DM :vulcan_salute:t2:
I try KR4 NO Fet today

EDIT: awesome!!! 8C is a great command!

1 Thank

Thank you for your efforts.
Unfortunately, I have to tell you that the second firmware does not work cleanly either. Again, only the button LED is lit, the main LED remains dark. There must be a bug somewhere.

I installed the noctigon-dm11-boost FW from @dmenezes - just for fun and it works. There only unfortunately the button LED remains dark when you turn on the lamp, but I knew that.

The last working firmware from toykeeper for my lamp is the anduril.2022-10-21.noctigon-k1-12v.hex.

1 Thank

I installed the noctigon-dm11-boost FW from @dmenezes - just for fun and it works. There only unfortunately the button LED remains dark when you turn on the lamp, but I knew that.
[…]
The last working firmware from toykeeper for my lamp is the anduril.2022-10-21.noctigon-k1-12v.hex.

I don’t have any Hanklights, much less a DM11 – so it’s impossible for me to test, but if you are willing to help with that part, I could have a look. The fact it works with the previous firmware you indicated could help by comparing the changes from it to r767 affecting that light. Or it could even be as simple as configuration – there’s a couple of USE_INDICATOR_LED_* defines that could have changed between versions.

I’m curious why you said “but I knew that” – can you please clarify?

@dmenezes If you have your aux switch mod source code on github or somewhere, I can add it to my modded versions, and then do a build for @Bastelnator with configurable aux on dm11-12V as well as the aux switch.

Sure thing! here it is, already in raw form ready for wget or copy/pasting: 767-undef_USE_SIMPLE_UI_fix.diff

BTW, the day I release any binaries of GPL code to anyone without posting the source code for it along, is the day you can be sure my brain was eaten from the inside by some hostile alien from outer space or whatever, and it’s no longer me in that body – so please shoot it and put it out of its misery :smiley:

Thanks for that! You, along with @Toykeeper, are my two personal heros in Anduril-land, and you finding my code worthy enough for adding to yours, means a lot to me. :+1:

And then @Bastelnator can have it all, my 8C mod and the others you authored and/or incorporated. I myself could then switch to your code base instead of having to adapt my code every time TK put something out. So yes, please go ahead. And if there’s anything I can do to help, just let me know!

PS: also for rev.767, you might as well take the opportunity to incorporate these two fixes to compile-time syntax errors when #undef USE_MANUAL_MEMORY and #undef USE_SIMPLE_UI are in effect; I submitted both to TK a while ago (grumble, and more grumble) but she for some reason (haven’t had the leisure, I hope) didn’t incorporate them yet:
767-undef_use_manual_memory_fix-diff
767-undef_USE_SIMPLE_UI_fix.diff

2 Thanks

Thanks, I think I already fixed the simple UI one but not the manual mem, I’ll add that.

It’ll be nice when it’s on github so there’s an issue tracker and patches can just be sent as merge requests.

1 Thank

First of all - thanks for your support.
Of course, if I can’t contribute anything else, I’ll do the testing part.

My statement “But I knew that” refers to the different behavior of the illuminated button between the noctigon-dm11-boost and the noctigon-k1-12V firmware.
I still have a DM11 (with button- and AUX-LED) and on that one I noticed earlier, compared to the D1/D1K, that the button LED is dark after power up.
I do not have a clear idea of the differences between the two firmware versions, but perhaps it is due to the control of the button LED and the AUX LED. Button LED have both flashlights (D1 and DM11), AUX LED only the DM11.

Of course, it would be great if the noctigon-dm11-boost firmware were also available with an illuminated button LED - if that is technically possible at all. On the other hand, there must be a reason for the existence of the noctigon-k1-12V firmware.

It’s because the DM11 has forward aux, and it used to be that those lights were configured to not use RGB voltage in the cfg.h. Some people want them to have it, some don’t, which is why I made the configurable RGB mod.

2 Thanks

Thanks @wolfgirl42 for the usual complete and inteligible explanation!

URW!

Perfect, but I think we both better wait for @wolfgirl42 as she’s much ahead of me in this game, and seems to have actual experience with the DM11 (if not an actual specimen to test on), none of which I do…

I will keep watching this space, if I can be of help just holler!

@ToyKeeper here’s the 2-var version of the configurable RGB voltage aux patch.

For other people: This is a variant of my “switchable RGB aux” mod, cut down to 2 vars and without the 8C toggle, for the main codebase so I don’t need to keep making people custom configurable builds. I will still maintain my version with the 8C if anyone still wants that, but this patch is designed to hopefully be included in standard builds, and 2 vars was a tradeoff between simplicity and ease of configuration.

The config options have been moved to battcheck mode (since people generally configure that less often than ramp extras) 7H. Items 3 and 4: 3 is threshold for RGB voltage aux to switch to high level. 0 means “always high”, and 151 “never high”. In addition, 152 disables the feature entirely (low or high). Item 4 is the threshold below which RGB voltage aux will always be off, regardless of high/low threshold setting, for lights where the aux are with the main emitters and may interfere with moon mode.

2 Thanks

@Bastelnator

Got k1-boost working, after I remembered that the D1/D1K/KR1 boost uses k1-boost too… so I totally forgot I had usable test hardware :woman_facepalming:

Still not full dynamic PWM, but has 10-bit PWM, and is a multichannel build for those lights, and should be an updated ramp at some point, just still beyond my skills to get anything anywhere resembling a smooth ramp.

EDIT: Updated: https://raw.githubusercontent.com/SiteRelEnby/anduril2/be737e2004020b26780cb0f5bfc825263921d3ed/spaghetti-monster/anduril/anduril.noctigon-k1-boost.hex

Diffs and stuff:

3 Thanks

Yeah works like a charm now - great work @wolfgirl42 :smile:
I will test it more thoroughly today and report back if I notice anything else that looks like a bug.
Thanks a lot.

2 Thanks

I merged a few new commits from TK for general bugfixes etc, updated version; https://raw.githubusercontent.com/SiteRelEnby/anduril2/be737e2004020b26780cb0f5bfc825263921d3ed/spaghetti-monster/anduril/anduril.noctigon-k1-boost.hex

1 Thank

Awesome @wolfgirl42! I’m eager to start using your repo, please let me know when it’s safe to :smiley:

I already subscribed to it so I will know when you make a release, but seems the latest one there is from 20230420? :man_shrugging:

In terms of premade builds, yeah, I haven’t created a release for anything, but it’s fine to go off the documentation and the examples to make one, at some point I’m going to start creating a few example configs and ahving a CI script build them with pushes to main. It’s just a lot of effort to create releases manually so I stopped bothering.

1 Thank

OK, but I was referring to the release-YYYYMMDD source code (either in the *.tar.gz, or directly from the repo via the equivalent label), not to the HEXes.

Unless I’ve got a good reason otherwise, I try to stick with releases as a ‘known-good’ (as in ‘stabler’) point-in-time, instead of git cloneing directly from master/main.

So, do you only create a release when you’re publishing binaries?

Yeah, I haven’t been creating releases in general, although probably should, but any set of changes that I merge to main should be stable.

1 Thank

Thanks for the clarifications. Will be watching your commits/main page and pull the trigger at your next set of changes.

I see no commit notes for incorporating 8C_Quick_Aux_Switch or undef_use_manual_memory_fix, if it would help I can try and do it myself and send you a PR for them.