starryalley / Anduril2

my Anduril2 fork that provides much more features
GNU General Public License v3.0
45 stars 2 forks source link
anduril2 c firmware flashlight torch

Jan 2024 Update

I've since moved on to the new Anduril repo here which is based on the latest Toykeeper's Anduril repo on github. This old fork here will probably not be updated and I will slowly move all the features I've done to the new Anduril codebase.

The short story is that the Anduril code has changed a lot, and moved to github. The new multi-channel related code has many conflicts with what I've done here. Currently only a small portion of features are moved to the new repo:

Please consider using the firmware from the new Anduril if you like what I did here. However expect things to go slowly there. Thanks.

ToyKeeper's Anduril flashlight firmware fork

This is a clone from ToyKeeper's Flashlight Firmware from branch anduril2, revision 653

For ToyKeeper's binary see here

What's here

Since I plan to only work with my existing Anduril2 lights (see below list), I've deleted unrelated FW for other flashlights and many more stuffs from the huge repository. Basically I copied the ToyKeeper/ stuff from the original repo and removed unrelated hwdef and configs here.

This repo contains my own changes to Anduril2 firmware for my several D4v2's, a DW4, a D4K, and some SP10 Pro's and TS10's (as of Aug 2023). For other Anduril2 lights that I don't own, I won't be able to test or support. Please file a bug report if you see any issue.

Build targets (which I own):

noctigon-kr4-nofet (0212):

noctigon-kr4 (0211):

noctigon-kr4-noaux (0217):

noctigon-kr4-219b (0214) (50% FET):

emisar-d4sv2-tintramp (0135): (for D4v2 tintramp)

emisar-d1v2-linear-fet (0124):

emisar-d1v2-no-fet (0125):

noctigon-k1-12v (0253):

sofirn-sp10-pro (0631):

wurkkos-ts10 (0714):

sofirn-lt1s-pro (0623): (Not included yet as this is better worked on Toykeeper's new multi-channel branch which I haven't got time yet)

Other build targets (that I don't own):

noctigon-dm11-nofet (0272):

noctigon-dm11-12v (0273):

wurkkos-ts25 (0715):

Since I've made use of AUX light a lot in this Anduril2 fork, some functions become dependent on AUX and won't work on lights that do not have AUX. So for mule or lights that do not have AUX (for example, KR1 and D1V2), I have added the following in MODELS that has NO_AUX defined in the config header:

Use this build instead so the following features/changes is ineffective/reverted:

Features

Disclaimer: Use at your own risk. I'm not responsible for any loss caused by these firmware changes.

In ON modes

Allow fine ramping up (smallest increment of brightness) using 3C in ramp mode

Ramp up main emitters output in 1 level using 3C.

Use 9C to switch between smooth and discrete ramp style (not used often, and makes it harder to reach by mistake than default 3C)

Momentary mode using 8C

Use 8C to enter momentary mode (not used often, and makes it harder to reach by mistake than default 5C)

Smooth sunset from SammysHP

Direct copy from SammysHP's Smooth sunset v2 patches or smooth sunset which is awesome.

Allow the use of AUX/Indicator LED in lower levels (< DEFAULT_LEVEL) level (6C/6H while light is on)

When in lower levels (< DEFAULT_LEVEL), optionally we can turn on AUX LED along with main emitters.

6C: in lower levels, allow AUX colour LED to be turned on along with main emitters for possible tint mix. 6H changes AUX colour from RED to WHITE (total 7 colours).

6C: in lower levels, cycle through these additional states (only for AUX LEDs):

No extra state is defined and the AUX LED on is temporary (not remembered) so if there is any button event (ramp up for example), AUX LED will be off. If later user enters moonlight, only main emitters will be lit (default). You need to re-enable this through 6C or 6H. The current AUX LED colour is remembered until reboot(factory reset).

Note that in lights with AUX but without button LED (ex. Wurkkos TS25), there will be just 2 modes in 6C:

When AUX isn't available but indicator LED is:

6C: turn on indicator LED 6H: turn off indicator LED

Note that in newer Hank lights where there is a RGB switch/button LED, if the light comes with front-facing AUX LED, the RGB switch/button LED is wired to the AUX LED so the button LED control (second and third state in 6C) won't work. This is not a firmware or hardware issue, but rather expected due to how it is.

8H to middle tint, 5C to tint edge

In a tint ramping light, use 8H to go to middle tint. (Copied from 4h to go to middle, not in the middle of 3h )

In addition, there is a shortcut 5C to go to tint edge. Note that 5C is for controlling parameters in some strobe modes so this shortcut won't work in candle/lightning/fireworks/lighthouse/tint alternating/tint smooth ramp modes.

Note that when lights are off or locked out, 5C and 8H still works but not visible until the emitters are turned on.

Stepped tint ramping from SammysHP

Direct copy from SammysHP's stepped tint ramping. Brilliant work there.

In STROBE modes

With the additional strobes I implemented, there are now maximum ten modes when doing 3H:

  1. Candle, with two additional wobble styles:
  2. Lightning
  3. Fireworks
  4. Lighthouse Beacon
  5. Broken Fluorescent
  6. Bike flasher
  7. Party strobe
  8. Tactical strobe
  9. Tint alternating strobe
  10. Tint smooth ramping strobe

Strobe mode is entered via 3H, and strobes can be cycled using 2C to go forward and 3C to go back

Strobe mode can cycle back to the previous state by 3C

2C is to cycle to the next strobe state. Add 3C to cycle back to the previous state. The purpose of this is that the most used strobe states are candle and lightning mode. If I'm already at lightning mode but want to go to candle mode, there was no option but to go through the blinding tactical strobe or party mode. While I don't want to disable tactical strobe nor party mode, let's add an option to just go back to the previous state.

More configurable candle mode

In candle mode, add the following options which are saved:

Additionally, in lights with just indicator LED (single colour AUX, such as TS10), we can use 7C to cycle through the indicator LED state in candle mode:

Fireplace mode (in Candle mode)

Two additional wobble styles: fireplace_slow and fireplace_fast. Use 4H to cycle through all 3 wobble styles. This is a saved configuration.

In candle wobble style (default/stock) and with AUX LEDs present, we can additional use 7C to toggle if we want to use aux led to assist in tint mixing. Red or yellow aux LED will light up along with the wobbling light.

For lights with just indicator LED, 7C is used to cycle through indicator off/low/high.

More configurable lightning mode

In lightning mode, add the following options which are saved:

Fireworks mode

An additional strobe mode called Fireworks, right after Lightning mode. The main emitters will light up like fireworks.

Adjust firework brightness (explosion brightness):

For dual channel lights, fireworks mode will randomly choose from the following tint modes when doing the strobes:

Lighthouse Beacon mode

An additional strobe mode called Lighthouse Beacon, right after Fireworks mode. The main emitters will light up periodically like a lighthouse where the intensity rapidly accelerates to turbo (level 150) and then ramps back down to 0 (when it rotates away from the viewer). It will wait for a few seconds (configurable) before doing it again.

Adjust the delay by:

Broken Fluorescent mode

An additional strobe mode called broken fluorescent, right after Lighthouse Beacon mode. The main emitters will flicker continously that simulates a broken fluorescent light. Brightness of the flicker can be adjusted by the usual 1H and 2H and is remembered.

Tint Alternating Strobe mode

A tint alternating strobe mode (after tactical strobe) for dual channel lights. It switches between channel 1 and 2 continously with configurable brightness (the usual 1H and 2H) and interval (4C for decreasing and 5C for increasing the interval by 0.5 second). The setting (brightness and interval) is saved.

Tint Smooth Ramping Strobe mode

A tint ramping strobe mode (after tint alternating strobe) for dual channel lights. It ramps between both channels repeatedly with configurable brightness (the usual 1H and 2H) and pause at each tint step (4C for decreasing and 5C for increasing the interval by 2 microseconds). The setting (brightness and pause) is saved.

In BLINKY/UTILITY modes

Use AUX LED (red to be specific) or Indicator LED when blinking numbers (For showing voltage/temperature etc)

It's a bit too harsh when using the main emitters to blink voltage/temperature readout. Use red AUX LED instead. For lights with indicator LED only (TS10 for example), the indicator LED (high) will be used.

In STANDBY/LOCKOUT modes or POWERED OFF

Start Up Mode

Idea from this post.

When doing 1-click from off to turn on the light, there are additionally 3 modes that can be selected through Misc Config Menu (9H from off).

See this youtube video for demo.

The Misc Config menu has the following items:

Based on different light's config this can be 1st, 2nd or 3rd item in the menu. For dual channel with jump start, it is the third. For single channel with jump start, it is the second. For SP10 pro and TS10 it's the first and only item.

Please note that when start up mode is not 0 (instant on), jump start is disabled because it doesn't make sense to have jump start.

Two more indicator LED modes (currently only for TS10 which uses indicator LED as single-colour AUX)

Idea from SammysHP's commit

Add mode 4 and mode 5 for low/high blinking.

Modes:

AUX LED can show different colours based on ambient temperature in standby/lockout mode

Add an additional mode "temperature" in AUX LED mode (for standby/lockout) after "voltage". The AUX LED will change colour based on the on-chip temperature reading.

This setting is after "voltage" mode. Use 7H from off to loop each mode.

When it's time to change battery, blink AUX red (or indicator led) in standby/lockout mode

When voltage is < 3.2V when light is off, the off/lockout AUX mode will not activate. Instead, the AUX red LED will blink. Original idea from reddit user connorkmiec93 at this post.

The blinking is in a pattern called breathing (although it's only low/high mode in AUX LED) so it's less distracting to the original blinking and one can tell the difference to the normal blinking in RED mode.

For lights with the indicator LED, the indicator LED will be used.

Note that a similar feature is now implemented in r654 that is not yet integrated into this fork as of now.

Blink AUX green LED when powered on (if there is AUX)

Instead of blinking the main emitter, blink the AUX green LED at high power to indicate it's powered on. Original idea from here

Child Mode (a Simple UI with limited brightness)

There is an additional UI (in addition to Simple and Advanced) that is basically the same as Simple UI but with the following differences (limitations):

Enter by 12C from off, exit by 12H from off.

Switch to this mode before handling the light to the kids.

Configuration changes

Planned modification/features

Low power (night) mode (not implemented yet)

11C/11H to go to this mode and back to advanced mode.

In this mode:

Other useful branch/commits

Development environment

Refer to a great guide here