D4(S)V2 - Lower Lows by Firmware

18 posts / 0 new
Last post
tocirahl
Offline
Last seen: 6 days 8 hours ago
Joined: 10/18/2016 - 13:00
Posts: 149
Location: Austin, TX
D4(S)V2 - Lower Lows by Firmware

Hello BLF community! I’ve been looking into a way to get lows to be lower on the new dual-channel Emisar lights and I think things are at the point where I’m ready to make a thread.

First of all here’s a link to the firmware you can try out: https://drive.google.com/file/d/1DFkklHk0c2XYYMjDBmLbKgKtTOTx2_ZF/view?u...

Here’s a version that I’ve compiled later for a single-channel light (w/ a constant current driver, not FET + 1): https://drive.google.com/file/d/1pUeLX2NMbp3Tsl8iQE5QDG8oWu_7bw3O/view?u...

Features:

  • Significantly lower lows on levels 1/150 (~5-10% of the lowest lows on stock) and slightly lower lows on 2/150 (~50% of the lowest lows on stock; this level should be roughly equivalent to the moon mode in a single-channel light); 3/150 is equivalent to 1/150 on the stock firmware

Stock config moonlight (now level 3/150):

Leakage-only (i.e. 0/511 + channel on, level 2/150):

Leakage-only + PWR_DOWN (level 1/150):

Limitations:

  • The ultra-low low on 1/150 can only be achieved when the button is released and will immediately ramp back up to 2/150 any time the button is pressed; this is technically fixable, but I really don’t feel like figuring it out as there are some significant assumptions in the firmware that need to be broken
  • Because of the above, 1H in lockout mode will not be able to achieve the ultra-low low
  • Since the lowest levels are achieved by leakage only with no PWM control, enabling both channels in 1/150 and 2/150 will be twice as bright as only having a single channel enabled. For the lowest lows, use only one channel on moonlight
  • Right now because of the way the firmware is written, this special ultra-low low can only be activated after a click and hold; so you can get to it by doing one of the following – 1H from off to get to moonlight, 1H or 2H from on to ramp down to it, 3H to tint ramp will drop you back down to ultra-low if you’re already there, 4H to unlock from lockout mode. If ultra-low moonlight gets memorized, a 1C from off will not trigger it correctly
  • Thermal regulation and LVP are disabled when this special mode is activated as the microcontroller is unable to execute any instructions
  • Reminder that there’s a decent chance that 1/150 or 2/150 will not work depending on your exact light and driver; same disclaimer that applies to normal Anduril firmware. For me, 1/150 works fine on my D4V2 with W2s, but doesn’t even light up the LEDs on my D4SV2 with W1s + LH351Ds.

For those interested in the details, here’s what I did:

  • First I modified the firmware to remove the 2/16383 that was present on level 1/150 on the default firmware and add a few tricks to make sure the LEDs don’t turn off when fed a signal of 0
  • Next I noticed that with leakage only, the LEDs were WAY dimmer when the microcontroller is put into SLEEP_MODE_PWR_DOWN instead of SLEEP_MODE_IDLE
  • Unfortunately we cannot execute any instructions when in SLEEP_MODE_PWR_DOWN, so I had to play some tricks to get things to work; this is the reason that this mode doesn’t work on clicks and only on holds as activating it prematurely will cause the driver to hang
Edited by: tocirahl on 08/07/2022 - 16:03
TitaniumDust
Offline
Last seen: 1 month 4 days ago
Joined: 11/13/2020 - 12:34
Posts: 29
Location: Toronto, Canada

This looks very interesting! I love my dual channel lights, but wish they had a better low mode. I would be happy to test with some of my D4V2s. I’m not sure if the 1/150 mode will work with some LEDs, since the w2 has a very low Vf, so it might only be possible with that emitter. However the 2/150 mode still looks to be an improvement. Do you have a github or similar link to the code changes?

tocirahl
Offline
Last seen: 6 days 8 hours ago
Joined: 10/18/2016 - 13:00
Posts: 149
Location: Austin, TX

Unfortunately I don’t have a link for the code changes at the moment, but the pre-compiled binaries should work fine for testing. I can provide the code changes once I have time to do a diff. I’m out of town for the weekend and don’t have access to the code.

derfyled
derfyled's picture
Offline
Last seen: 1 week 2 days ago
Joined: 04/16/2013 - 07:51
Posts: 352
Location: Canada

I like this idea, a lot. I wish all of my light would have that ultra-ultra-low mode, sort of a tritium vial glow. It’s the perfect mode not to light things up but it’s a ‘‘find me’‘ mode. Perfect to leave your light on in the tent or bedside table and not being blinded.

Too technical for my little brain however, I wouldn’t be able to flash the firmware on my D4V2 but I would probably buy a new one if they came stock with this firmware. I love your work. Thumbs Up

Adair21
Offline
Last seen: 5 hours 38 min ago
Joined: 06/28/2020 - 21:58
Posts: 23

I’m also interested it seeing the code needed to accomplish this. That would also let me build the firmware for other lights.

starryalley
Offline
Last seen: 15 hours 55 min ago
Joined: 09/17/2020 - 01:14
Posts: 50
Location: Melbourne, AU

Really love the idea and thank you for making this possible. However I suspect how useful it goes really depends on what LED and variation of hardware components. May I know what LED is on those photos? I’ve tested this firmware on my E21A 2000k/5000k D4v2 and the level 1 is too unstable (flickering a lot) but is remarkably dim. Dimmer than the aux LED on low which is awesome. Level 2 isn’t that obviously dimmer than the original on mine though.

Looking forwards to the code change whenever you have it available. Thanks again.

starryalley
Offline
Last seen: 15 hours 55 min ago
Joined: 09/17/2020 - 01:14
Posts: 50
Location: Melbourne, AU

Just tested on my other 2-ch D4v2 with 2700/4500 219b and the level 1 is much more stable than the E21A one tested above. Level 1 per-LED brightness is visually the same as my 219b 3500k single channel D4v2 on level 1. On stock firmware lower levels flicker a bit too so this firmware is great on this 219b 2-ch light that I have.

tocirahl
Offline
Last seen: 6 days 8 hours ago
Joined: 10/18/2016 - 13:00
Posts: 149
Location: Austin, TX
TitaniumDust wrote:
This looks very interesting! I love my dual channel lights, but wish they had a better low mode. I would be happy to test with some of my D4V2s. I’m not sure if the 1/150 mode will work with some LEDs, since the w2 has a very low Vf, so it might only be possible with that emitter. However the 2/150 mode still looks to be an improvement. Do you have a github or similar link to the code changes?
Adair21 wrote:
I’m also interested it seeing the code needed to accomplish this. That would also let me build the firmware for other lights.

Sorry for not having a github link, but here’s a zip with the patches:

https://drive.google.com/file/d/19rR30-pp5rkZDC4zEN-8cBGhpmUUIK5Y/view?u...

tocirahl
Offline
Last seen: 6 days 8 hours ago
Joined: 10/18/2016 - 13:00
Posts: 149
Location: Austin, TX
starryalley wrote:
Just tested on my other 2-ch D4v2 with 2700/4500 219b and the level 1 is much more stable than the E21A one tested above. Level 1 per-LED brightness is visually the same as my 219b 3500k single channel D4v2 on level 1. On stock firmware lower levels flicker a bit too so this firmware is great on this 219b 2-ch light that I have.

Interesting. Is your single-channel light Linear + FET or the old 7135 + FET? If Linear, how many amps?

I would suspect that my firmware should be substantially dimmer than even a single-channel Linear + FET.

starryalley
Offline
Last seen: 15 hours 55 min ago
Joined: 09/17/2020 - 01:14
Posts: 50
Location: Melbourne, AU
tocirahl wrote:
starryalley wrote:
Just tested on my other 2-ch D4v2 with 2700/4500 219b and the level 1 is much more stable than the E21A one tested above. Level 1 per-LED brightness is visually the same as my 219b 3500k single channel D4v2 on level 1. On stock firmware lower levels flicker a bit too so this firmware is great on this 219b 2-ch light that I have.

Interesting. Is your single-channel light Linear + FET or the old 7135 + FET? If Linear, how many amps?

I would suspect that my firmware should be substantially dimmer than even a single-channel Linear + FET.

It is a 9A linear + FET driver on that 219b 3500K. I used my own firmware but it was based on the latest Anduril2 rev 650 and I didn’t change the moonlight part of code. On my E21A tint ramping D4v2 it is indeed substantially dimmer though.
May I ask on what rev of Anduril2 your patches are based? Thanks.

tocirahl
Offline
Last seen: 6 days 8 hours ago
Joined: 10/18/2016 - 13:00
Posts: 149
Location: Austin, TX

starryalley wrote:

It is a 9A linear + FET driver on that 219b 3500K. I used my own firmware but it was based on the latest Anduril2 rev 650 and I didn’t change the moonlight part of code. On my E21A tint ramping D4v2 it is indeed substantially dimmer though.
May I ask on what rev of Anduril2 your patches are based? Thanks.

It was downloaded on 1/7/2022; sorry I don’t have the revision number.

starryalley
Offline
Last seen: 15 hours 55 min ago
Joined: 09/17/2020 - 01:14
Posts: 50
Location: Melbourne, AU

Based on the date downloaded it could be rev 642. I’ve created a gist to make reading the change more easily:
https://gist.github.com/starryalley/e774419d5521ca28e6c789bf154c2cbd

I haven’t got time to check your modification though. Thanks for sharing the code.

TitaniumDust
Offline
Last seen: 1 month 4 days ago
Joined: 11/13/2020 - 12:34
Posts: 29
Location: Toronto, Canada

I tested this with my two tint ramp lights.

  • D4V2 with 219B 2700k and 219B 4500k I could not get level 1 to light up on either channel.
  • D4V2 with E21A 2000k and E21A 3500k I could get the 2000k channel to light up (very faintly, almost too low to be useful), and the 3500k failed to stay on.

However I think there is an advantage in the new level 2 (vs. level 1 stock).

Looking at the code that seems to be entirely down to adjustments to the PWM levels.

How did you generate these? It looks like the entire ramp has been adjusted. I would like to include this into my builds, but I think I’ll just include the adjusted level 2 as the new level 1.

tocirahl
Offline
Last seen: 6 days 8 hours ago
Joined: 10/18/2016 - 13:00
Posts: 149
Location: Austin, TX

There’s a bunch of adjustments to make the DEV SLEEP mode, but for level 2 yes it’s mostly just adjustments to the PWM level plus some other small changes.

I regenerated the levels using the levels.py script in the repo

TitaniumDust
Offline
Last seen: 1 month 4 days ago
Joined: 11/13/2020 - 12:34
Posts: 29
Location: Toronto, Canada

Thanks! Are the other small changes you refer to the changes to `fsm-ramping.c`?

tocirahl
Offline
Last seen: 6 days 8 hours ago
Joined: 10/18/2016 - 13:00
Posts: 149
Location: Austin, TX

Yup that sounds right!

Champfc3000
Offline
Last seen: 8 hours 14 min ago
Joined: 10/14/2020 - 15:41
Posts: 28
Location: New york

Does this work on single channel 9amp cc linear driver d4v2?

tocirahl
Offline
Last seen: 6 days 8 hours ago
Joined: 10/18/2016 - 13:00
Posts: 149
Location: Austin, TX

Theoretically it should, but it’s not compiled for a single-channel light; you’d have the make the modifications on your own and re-compile.