Flashlight Firmware Repository

I want them separate so one group of modes for one and another group for the other. I’m using a FET +1 with cut traces to give two different LED - outputs.

Just given it another go building it slightly differently and it WORKS!!! So excited managed to finish my build! :slight_smile:
Only thing is on the second group in the two lower modes both LEDs come on but not in high or in the first mode group. Odd but I can live with it for now.
Here is the new code I used.

That’s because you used fast PWM, which still turns on for about half a clock tick each cycle even at level zero. If you switch that to phase-correct, it shouldn’t turn on the main LED while the second LED is on.

This only happens on the FET channel because the 7135 channel isn’t powerful enough to make the effect visible.

Actually, it's because the 7135 isn't fast enough to react to a half-a-clock tick (@18kHz). But the end effect is the same.

P.S. Thanks TK, for all your help, you are much appreciated!

Interesting.

I have a 32x7135 SRK driver which still lights up at fast PWM level 0. I guess with enough of them in parallel it can rise high enough to barely light the emitter at that speed. But yeah, the rise time is slower so it’s not normally visible until like six ticks or so on regular nanjg drivers.

Ahhhh I shall make that adjustment! Thanks for all the help guys! :slight_smile:

I don’t understand you, what’s the meaning of “pastebin” ?

Your code in pastebin --> http://pastebin.com/ZJ6mYumW

Ever heard of search services? :stuck_out_tongue: Nah just kidding, as the previous poster showed a pastebin is a place where you can put code to get it away from the forum flow and also get line numbering and syntax highlighting if wanted. You ask a question which only a few people can answer and the rest that can’t don’t have to scroll past your code in the forum if you put at a pastebin instead. If you’re interested you just click the link to the pastebin and you can see the code there.

Ok,Fixed!!!

I have a couple quick questions:

1. I currently have blf-A6 configured so that “turbo” isn’t the last mode in the group. I think because of this, the turbo stepdown isn’t working. Is there any way around this, or does turbo have to be either the first or last mode?

2. This may not be something fixable by firmware, but I have noticed that OTC times speed up dramatically as the light gets hot. The values I have are perfect for forward/reversing normally, but after the light heats up even the shortest of taps makes the mode go backwards.

3. This firmware is in my light with red and white led’s. The small circuit goes to the red. On the last mode in the second group, it should be full-on red and no white, but the white led’s do light up at a moon level. Is this just leakage through the FET, or did I crew something up in the firmware?

Here is the code I was using. I am planning to update it with the newest version of blf-A6 anyways.

  1. Turbo knows what to step down from, but not what to step down to. You can change this by changing “mode_idx = solid_modes - 2;” to “mode_idx = mode_idx - 1;”. It looks like this should work in your case, even though it wouldn’t have worked if you had a turbo in the hidden loop. You could also just comment out the “#define NON_WDT_TURBO” to get rid of turbo step-down entirely.

2. I’ve been trying to fix that too, but I haven’t figured out a way to do it. I tried to use memory decay in combination with OTC measurements, hoping that mem decay wouldn’t have temperature issues… but that doesn’t work either. The OTC discharge keeps the memory from decaying when it’s supposed to. In any case, the temperature scaling is annoying.

3. Change all your red-only modes to use PHASE instead of FAST, and it should prevent the white LED from coming on. You can’t completely turn anything off in FAST mode.

Thanks, I’ll try that. Based on the code I posted earlier do you think that’s what the problem was? Turbo stepdown was working in the first mode group, but not the second group. Btw, I’ve been wondering what does the “NON_WDT” part refer to?

I guessed switching to PHASE would fix that 3rd issue, at least i’m starting to learn something!

You had turbo as the second-to-last mode in one of the groups, and it was configured to step down to the second-to-last mode. So it stepped down from turbo to turbo.

The reason it didn’t do “mode_idx —;” before is that one of the default turbo modes is hidden / negative, and I didn’t want it to “step down” from turbo to strobe. Your version doesn’t have to worry about that though.

The “NON_WDT” bit should probably be renamed. The code was originally based on STAR which used the watchdog timer to measure time for turbo, but it took too much room so I got rid of that and replaced it with a non-watchdog version. At one point there was an option to switch between the two methods, WDT turbo and non-WDT turbo, but I removed one.

BTW, why do you have both red and white turned on at the same time in one of the mode groups?

Ok, I wasn’t understanding that. Makes sense now.

I was just playing around with stuff to see what it would look like. The light has two dedomed XP-L’s and a deep red XP-E on the same 20mm triple noctigon. It actually helps bring out the red spectrum quite a bit. My “CRI test” involves shining the light at my wife’s clothes in the closet. You don’t really notice much of a tint change, but the added red really makes the patterns “pop”, even more so than my Nichia light. It does some cool/interesting things to shadows too.

Just recently changed the firmware in the majority of my lights to BLF-A6 wonderful firmware just wish there was an e-switch version now

I just flashed my revised firmware, and something is wrong with the turbo timer. I’m testing it on my power supply, and it is stepping down after 4-5seconds. I tried values of both 60 and 90 ticks. What’s my problem? code paste

It sounds like the battery monitoring kicks in. Try to raise the voltage to at least 3.2V.

That’s with voltage at around 4v, and it only does it on turbo

Your power supply may not be stable on full output. Just to make sure increase the value on line 648 or disable battery monitoring.

Edit: In your code battery monitoring counts 8 ticks which is around 4 seconds.