OK, from the date (2021-12-13) I presume this is not the ‘development’ multi-channel branch, but the ‘stable’ anduril2 branch, and probably at or around rev.642 (it would be so much easier if Anduril would just blink the rev along with, or even instead of, the build date…)
By 0135, you mean the model number, right? I ask because checking the MODELS file, I see this: 0135 emisar-d4sv2-tintramp [...]
OTOH I see no specific code for the D2, so I infer it uses the same code as the D2SV2 above – but would like confirmation.
No problem, it’s a pleasure to be able to contribute, however humbly, to that wonderful community that is BLF, where I have learned (and continue to learn) so much.
Specially RE: #1, I only ask for your patience because I don’t have a D2 (and worse, none of my lights have this “button led” thing), so I can’t test it before sending it to you – add to that the fact that I’ve not dwelt in that part of the code before, and the result is that I will probably need a few interactions to get it right.
I will also follow the “first principle of the ignorant engineer”, that an old friend of mine who was actually an engineer once stated as “when you don’t know what you are doing, change just one thing at a time” so I will first send you the hex with #1, and when we get that right, will send you #2 plus #3 (I think there will not much of a problem bunching these two together as #3 is pretty much tested and working by now).
To keep what will probably be useless traffic off this thread, let’s interact over PMs and when it’s ready and done, I will post the final and hopefully working version here along with my patches to the source.
I already have a first candidate for #1 ready, sending the link to you via PM now.
1 and 2 are very simple there are compile time options already in place for both, just undef them… Or anyway the top ramp blink is that way, and use of aux leds looks to be that simple, I’ve not actually tried to turn it off.
Re; a light to test with, I thought you had an FC13?
It reminds me though, is the code for the 8C aux mod uploaded/posted somewhere?
I’d really like to incorporate it into my custom build.
In obedience of Anduril’s licence (GPL), here are the sources for my patches (against rev.642 on the anduril2 branch):
#1: 642-DONT_USE_BUTTON_LED_WHILE_ON.diff:
--- ./642/~toykeeper/flashlight-firmware/anduril2/ToyKeeper/spaghetti-monster/anduril/anduril.c.orig-2023090901 2021-01-25 02:21:06.000000000 -0300
+++ ./642/~toykeeper/flashlight-firmware/anduril2/ToyKeeper/spaghetti-monster/anduril/anduril.c 2023-09-09 17:09:02.906883996 -0300
@@ -270,6 +270,11 @@
if (! setting_rgb_mode_now) rgb_led_voltage_readout(1);
#endif
+ #if defined(USE_BUTTON_LED) && defined(DONT_USE_BUTTON_LED_WHILE_ON)
+ // turn button led off while the flashlight is on
+ button_led_set(0);
+ #endif
+
if (0) {} // placeholder
#ifdef USE_VERSION_CHECK
--- ./642/~toykeeper/flashlight-firmware/anduril2/ToyKeeper/spaghetti-monster/anduril/cfg-emisar-d4sv2-tintramp.h.orig-2023090901 2021-10-31 06:19:13.000000000 -0300
+++ ./642/~toykeeper/flashlight-firmware/anduril2/ToyKeeper/spaghetti-monster/anduril/cfg-emisar-d4sv2-tintramp.h 2023-09-09 17:09:49.100193496 -0300
@@ -9,6 +9,8 @@
// the aux LEDs are front-facing, so turn them off while main LEDs are on
// it also has an independent LED in the button
#define USE_BUTTON_LED
+#define DONT_USE_BUTTON_LED_WHILE_ON //turn button LED off when the flashlight is on
+
// TODO: the whole "indicator LED" thing needs to be refactored into
// "aux LED(s)" and "button LED(s)" since they work a bit differently
// enabling this option breaks the button LED on D4v2.5
#2: 642-DONT_BLINK_AT_RAMP_CEIL.diff
--- 642/~toykeeper/flashlight-firmware/anduril2/ToyKeeper/spaghetti-monster/anduril/cfg-emisar-d4sv2-tintramp.h.orig-2023090902 2021-10-31 06:19:13.000000000 -0300
+++ 642/~toykeeper/flashlight-firmware/anduril2/ToyKeeper/spaghetti-monster/anduril/cfg-emisar-d4sv2-tintramp.h 2023-09-09 17:20:33.786628035 -0300
@@ -16,6 +16,8 @@
#undef USE_INDICATOR_LED_WHILE_RAMPING
#endif
+#undef BLINK_AT_RAMP_CEIL //Do NOT blink at ramp ceil
+
// has two channels of independent LEDs
#define USE_TINT_RAMPING
// how much to increase total brightness at middle tint
See above: you are right about #2. For #1, I looked for but wasn’t able to find an existing #define, so I created my own.
#3 is being way more work than I expected because there were a lot of changes in the parts of Anduril code it depends on, between the multi-channel branch where I implemented it first, and the anduril2 branch which we’re working on for @jon_slider’s D2, so I’m still working on it.
I do have one. But the FC13 switch LEDs are treated in Anduril as RGB_AUX_LEDs, not BUTTON_LEDs like the one in the D2 switch – so, different parts of the code.
Thanks to @jon_slider for coming up with the idea, and for helping me with the testing.
I would just like to add that, to my great surprise, this last mod also worked first try despite its relative complexity.
This goes on to show what a great programmer @Toykeeper is, her code is so well-written that even being a relatively ignorant person (meaning, I know C well, and embedded programming relatively well, but very little flashlight electronics and even less Anduril internals) I was able to ‘parachute’ into her code and easily make these changes. Kudos to her!
Heads-up to all of you interested in my 8C_Quick_Aux_Switch mod: I just refactored it for TK’s latest rev (767), please see my post on the other topic for all the HEXes, source code, etc: Anduril ... 2? - #1685 by dmenezes
Given the TS10 is 1+FET, I presume PWM1_LEVELS refers to its single 7035 regulator, and PWM2_LEVELS refers to its FET, is that correct? In that case, what is PWM_TOPS for?
I apologize if I’m asking something obvious, but at least it wasn’t obvious to me after some grepping of the source tree and delving into some of the files that popped up (ramp-mode.c, ../fsm-ramping.c, ../../hwdef-wurkkos-ts10.c, ../../../bin/level_calc.py among others). If there are other files (or forum topics, or blog posts, etc) that I should consult in order to make more sense of these tables, I will be much obliged if someone can point them to me.
The exact same diff I already posted for rev.767 applied (with a few fuzzies, but no issues) so anyone interested can see the source code there.
(*) Flashlights with an AT85 don’t build because they don’t have enough flash memory to support TK’s latest changes plus my mod, but all the others are building.
Does your FW3A blink one of these 3 model codes? If yes, perhaps we can get it to compile by removing some Anduril feature you don’t use, like SIMPLE_UI.