Anduril ... 2?

Anduril 2 MC :blush:

(For multi channel)

One thing I was exploring the possibility of with a friend (who I need to remind to get on here / IRCā€¦) was of being able to reflash firmware via USB, and building a charge controller into the driver as a more integrated component, so the driver is aware of USB charging state etc.

1 Thank

Pretty much, yes. For single channel lights, there are some new featuresā€¦ but no significant backward-incompatible UI changes. User-visible things have been added, but not broken or removed.

1 Thank

That would rock! Would make things both more useful and customizable, and much simpler for beginners to get started with (and easier for us more experienced folks, as there would be no need to even open up the light to flash it, to say nothing of aligning pogo pins, etc). And I donā€™t think it would be that much harder than the things Anduril already does.

If/when you get down to that, please tag me as I wouldnā€™t want to miss it for the world!

Itā€™s just the shape of the curve, if the brightness of the individual frames was put on a graph.

After testing a few options to see what looks best, I ended up with different curves on the way up and down:

  • When going up, it rises by a percentage of the remaining distance each frame, with a constant frame rate. So it adjusts quickly at first, then slows down as it nears its destination.
  • When going down, it drops by just 1 ramp step at a time, in a way which is linear in terms of ramp stepsā€¦ but it adjusts the frame rate to get a constant total time.

Using a ramp-linear solution going up made it look weird, because the brightness would accelerate and then suddenly stop. It seemed like an unnatural motion. Using a percentage-remaining solution on the way down looked weird too, because it would drop rapidly at first and then slow down so far it seemed like it got stuck, before finally turning off.

However, two different curves together look much closer to what it should be.

3 Thanks

Hi @Toykeeper,

Iā€™ve seen that with introduction of set_level_zero() in hwdef-wurkkos-ts10.c and hwdef-wurkkos-ts25.c revision 763 (maybe some revisions earlier, I didnā€™t check) one line of code disappeared from set_level_main():

level --; // PWM array index = level - 1

Is this by intention?

1 Thank

Yes, thatā€™s removed on purpose. I changed the API a bit, to make the hwdef code smaller and simpler, and to reduce overall code size.

Before:

///// FSM:
set_level(lvl) {
    set_level_func = channel_modes[cm].set_level;
    set_level_func(lvl);
}
///// HWDEF:
set_level_a(lvl) {
    if (0 == lvl) {
        turn_off;
        return;
    }
    lvl --;
    channel_a = ramp_a[lvl];
}
set_level_b(lvl) {
    if (0 == lvl) {
        turn_off;
        return;
    }
    lvl --;
    channel_b = ramp_b[lvl];
}

After:

///// FSM:
set_level(lvl) {
    if (0 == lvl) {
        set_level_zero();
        return;
    }
    lvl --;
    set_level_func = channel_modes[cm].set_level;
    set_level_func(lvl);
}
///// HWDEF:
set_level_zero() {
    turn_off;
}
set_level_a(lvl) {
    channel_a = ramp_a[lvl];
}
set_level_b(lvl) {
    channel_b = ramp_b[lvl];
}
2 Thanks

Thanks a lot for the explanation ā€¦ I didnā€™t see that the decrement of level switched from hwdef to fsm. Now itā€™s clear!

Tried out the soft start feature, and itā€™s just beautiful, thank you for implementing it!

I did find some strange behavior with Wurkkos TS10, though. When using smooth ramping mode and smooth starting from off to some level, first 90-95% of the way the brightness is ramped smoothly. But last 5-10% or so it jumps instantly. This happens for any target brightness level, but it more noticeable on high outputs. When switched to stepped ramping, soft start is smooth all the way up without any jumps, on any brightness level. Smooth transitions between different levels in stepped ramp mode are working perfect as well.

On Emisar D4K boost, this is not reproducible: smooth start is working, well, smoothly, in both ramping modes without any issues.

I used self-built binaries of r763 with original configs (except for moving some code from set_level_main to set_level_zero in hwdef file for Emisar, so it will compile), and did reset the settings after flashing.

Ah, thanks for catching that. I think I know exactly whatā€™s happeningā€¦

It uses soft steps in stepped mode, but not smooth ramping modeā€¦ because smooth is already smooth. But this could make it jump if it changes from Off mode to Ramp mode mid-animation. Like, itā€™d do most of the animation in Off mode, then time out and switch to Ramp mode, and then try to set the level againā€¦ which would cause it to jump the rest of the way up.

Iā€™m guessing itā€™ll be a pretty easy fix, but I didnā€™t notice it before because I was mostly testing in the stepped mode. The animation works fine, even when interrupted halfway through by a state change, in most casesā€¦ but it probably needs to make sure an animation isnā€™t already in progress, instead of checking only the ramp style.

Hello, I picked up two of the new D4K-3Ch and seeing an odd behaviour. I made sure I updated to 763 first. The first channel doesnt seem to ramp at all. If I manually set a ramp floor of 1, it enables moonlight. When i turn on to moonlight, as soon as I ramp up it just goes straight to max output. Ch2 and Ch3 on both lights seem to behave normally with both smooth and step ramping. (One has Cree Pink/Cyan/Yellow, the other SST20 Red/W2 Green/W2 Blue). Putting Ch1 on stepped takes away moonlight (ramp floor 20) so it basically has only max output.

Interestingly, in Bike Flasher, both Pink and Red Ch1 do not pulse properly. It is just a single blink (and also the same seemingly narrow ramp).

1 Thank

Thatā€™s strange. It should be able to ramp normally, though the low modes on channel 1 donā€™t have as much resolution since itā€™s 8-bit instead of 16-bit.

On both lights, what LEDs+channels were specified when ordering, and what order do they appear in when changing channel modes?

When I turn on at moonlight, it also goes up a bit, then comes back down a bit.

PCY Light How I Ordered:
Ch1 Cree XP-E Pink (2)
Ch2 Cree XP-E Cyan
Ch3 Cree XP-E Yellow
Channel Order: Pink > Yellow (closest to light switch) > Cyan > All 4 > 2+3 ā€¦ Looks like Hank put Yellow on Ch2, no biggie.

RGB Light How I Ordered:
Ch1 Luminus SST20 Red (2)
Ch2 Osram W2 Green
Ch3 Osram W2 Blue
Channel Order: Red > Green (closest to light switch) > Blue > All 4 > 2 + 3

I just posted two videos on r/HankLights (subject Pink Moon/Red Moon). With each light I turn on to moonlight 3 times then show a ramp up (straight to max), then a ramp down (straight back to moon)

Dang, Iā€™ve been trying to get confirmation about the order those go inā€¦ and this shows both ways! :confused:

I have a RGB model, with red on ch1 (2 LEDs). The red channel ramps up and down normally. I donā€™t have a pink model, but I hear the response curve on the pink LEDs is a bit different than usual.

In any case, the moon level uses PWM of 0/255, so itā€™s the absolute minimum the regulator will allow. Above that, the next level is 1/255, which should be pretty dim, but if the response curve isnā€™t right, it could be significantly brighter than intended. There isnā€™t much I can do about that in firmware though.

If I turn on either light at moonlight, ramp up and let go -immediately-, i get full brightness, and it lets me doubleclick to bump to turbo. So its like moonlight > full > turbo is all they have.

By putting Cyan onto Ch3 he at least made my two lights ā€˜consistentā€™ hehehe. Basically I am using Ch2 and Ch3 for all mode memories to taste, and Red and Pink are the secret super power of these lights for now

Sorry Iā€™ve been so inactive on the development (and general activity hereā€¦) side recently, life getting in the way. Hereā€™s something nice for everyone:

With the 3 channel lights, USE_AUX_RGB_LEDS_WHILE_ON is now set for all lights, enabling the voltage to be displayed on the aux while the light is on, but Iā€™ve seen a few people who donā€™t like it, especially as it can interfere with tint mixing on the 3ch, so I present my solution.

I built a modded version of anduril with a few extra options. Added to the end of the 9H menu from off, there are 3 new options:

  • Enable/disable voltage aux while on (1C = disable, 2C = enable)
  • Set threshold for low aux brightness for voltage - this is the brightness that the aux LEDs will come on at. 1C for 0 (i.e. aux are always on at at least low (could be high instead of low, depending on the next config item)), otherwise sets the threshold to n-1 (e.g. 11C sets the threshold to level 10)
  • Set threshold for high aux brightness for voltage - this is the brightness that the aux LEDs will come onto high mode at. 1C for 0 (i.e. aux are always on at high), otherwise sets the threshold to n-1 (e.g. 11C sets the threshold to level 10). This threshold will override the low one, e.g. if you set your low and high thresholds to 10, the aux will be high at level 10.

(i.e. for 2ch/3ch: tint ramp steps, jumpstart, RGB on/off, RGB low threshold, RGB high threshold)

In addition, when in ramp mode (edit: and advanced UI - see below), 8C can be used to switch the voltage aux on/off directly without exiting to off mode and going through a config menu.

This is based on the latest version at the time of writing (763).

This is a mod Iā€™ve been using for a few months and have done builds for other people but not posted a general release so far because Iā€™ve been busy - one thing Iā€™ve been working on is a system for automating builds of anduril with different sets of modifications.

Release with hex files: Release aux-control-20230910 Ā· SiteRelEnby/anduril2 Ā· GitHub

At the moment only built for emisar-2ch, emisar-2ch-fet, emisar-3ch, noctigon-kr4, and noctigon-kr4-nofet as there are some recent breaking changes in anduril and other build targets donā€™t work yet, but more should be available soon.

EDIT: 8C to toggle on/off only works in advanced mode, which wasnā€™t intentional (some of my modded lights donā€™t even have simple UI (waste of MCU space if I never use it) and the ones that do default to advanced UI rather than simple) but Iā€™m interested in opinions on whether this should be included in simple UI or not, I guess.

Edit 1: Added KR4 FET and noFET builds

I think that with the complexity of 3ch, especially if people start emitter swapping them, having multiple build targets for it is probably inevitable, maybe needs a bit of thought as how to best implement that and describe the difference to the userā€¦ I have one straight from Hank where Iā€™d prefer the 8-bit PWM to be on one of the two single LED channels as the 2-LED channel overpowers the others otherwise (but I am capable of making that changem yself, but a lot of people arenā€™tā€¦)

4 Thanks

If anyone was looking for the d4k-3ch hex, I have now actually added the right file to the release :sweat_smile:, also edited the post to clarify a few things.

Edit: Added KR4 and KR4-noFET as well by request.

3 Thanks

Happy to inform that with r767 the soft start animation on TS10 is smooth all the way to the target level! Thank you very much for your work.