Flashlight Firmware Repository

Thanks Billy. I knew it was here somewhere. :+1:

You’re welcome.

Hi, I’m not really familiar with what you’re doing, and I don’t think I understand what you’re asking. Care to elaborate?

I guess the easiest fix would be to move the FET pin for 1 channel version moved to pin 3 Indicator to pin 7
I am totally puzzled looking in the channels file how it works

I have the FET output as in 3 channel, P-FET is one channel only so low blinks should do on the FET channel

Calibration files can be generated by following the instructions in battcheck/README. It’s meant to be relatively easy to calibrate any hardware, and relatively easy to plug into each code project, since calibration varies quite a bit from one driver to the next.

I’m not really doing any hardware design yet, so I can’t really make a driver for tiny841. It does look like a nice upgrade though, and I’ll probably port code to such a thing as soon as I have hardware to use for development.

Toykeeper, thanks for the work you do in maintaining the flashlight firmware repository. I successfully flashed the AK-47 driver in a red XP-E2 Convoy S2+ I built as a bike light using the firmware you developed in this thread, and I also updated my BLF Q8 to Anduril.

Now down the rabbit hole of customizing firmware code, since apparently hardware mods aren’t enough :slight_smile:

It’s a deep rabbit hole.

Hi guys
I wanted to change the modes in my astrolux s41 (blf a6 firmware), but I can’t understand this speed pwm. Could anyone write to me how it should look corrrect in my modes? (Blue)

Green. Can I set the brightness of these modes there?

Fast is about 15 kHz, but doesn’t work well for moon and turbo and anything which needs to ever shut off the LED completely. Phase-correct behaves better, but is only ~8 kHz.

The numbers below, starting at 255 and counting down, are not the brightness. They are simply internal codes to represent each special mode. To change the brightness you’ll need to edit other parts of the code. Some of it can be changed with the BLINK_BRIGHTNESS setting, but turbo and strobe are hardcoded to full output and you’ll need to change the code directly.

I think I understand. So it’s ok.
Unfortunately, I have another problem. The medium press doesn’t work properly. It should be 0.5s to 1.5s, and I have about 3 to 6 seconds. The original firmware worked correctly.

this is a common problem
physically reducing the OTC from 1uF to 0.33uF should fix it

no clue where in the code the OTC voltage is interpreted and how to adjust it

Leviatan, look in the battcheck/ directory. A “README” there explains how to calibrate the voltage and OTC. It involves doing some measurements then editing a calibration header file (“tk-calibration.h”).

The OTC is pretty sensitive to slight differences in hardware, so it’s a good idea to calibrate each batch of drivers. Even just changing the supplier of a single component can throw it off.

Got it. Thank you again TK.

In INDEX: Extras>turbo timer should be blf-A6

Andúril’s Candle Mode on a reverse clicky light?

I really like Candle Mode from Andúril as used on my Q8. To better emulate a real candle, I’d like to put Candle Mode on a 3000K emitter light I built, but Anduril won’t work directly with that light due to it being a reverse clicky.

Can anyone tell me how difficult it would be to port Candle Mode into some firmware that would work on the hardware described below? It’s been a few years since my Arduino tinkering gave me a little bit of experience with C code, so I am by no means an expert. If this is a bit much as a first project, I’d like to know that now, not after my hair is all pulled out. :weary:

Realistically, I’d be happy to just get Candle Mode by itself if there are reasons (space on the driver?) the rest isn’t possible.

Any tips on references to read or paths to go down (or avoid), I’m all ears.


  • Convoy S2+
  • Reverse clicky
  • Nanjg AK-47A driver, 3 x 7135
  • ATtiny13A

My ideal firmware for this light would have:

  • 3 or 4 regular modes (lowest being a moonlight)
  • 1 or 2 Candle Modes (lower and higher brightness)
  • Battery check

Thanks for the help!

I’d have to extract the candle routines from Anduril and see how large the code is once built. I’m curious though, so I might take a stab at that.

In the meantime, however, there is a firmware called CandleFlicker from a couple years ago that is solely a candle mode without any other niceties (including LVP). Even with just that basic set up, it compiles at 980 bytes (95.7% full).

Candle mode stuff relies on random numbers and lots of math, so it’s going to take up a bit of room.

Is it possible for Narsil to run the strobe modes at a lower level than 100%?


It’s probably do-able, but not trivial. I’ve put all sorts of fancy modes into tiny13-based reverse clicky drivers, but they’re usually a lot simpler than how candle mode works. The main difficulty will be getting everything to fit. Also, instead of running via interrupt at 62.5 Hz, you’ll need to put it in its own timing loop with periodic exits to handle LVP and such.

The random number generator will also definitely need some changes to work on tiny13.

Not that I’m aware of. I mean, not without changing the code.

I have Qlite Rev.A 7135*8. I was thinking about cutting a trace to one of the 7135 and connecting it to the star (so other attiny13 pin), so effectively it will be 7135+7*7135 driver. Is there any firmware that can handle such modification? I’ve found JonnyC double PWM firmware, but it doesn’t have full 1*7135 mode. So I’m looking for something like BLF-A6 firmware without OTC.