Flashlight Firmware Repository

1941 posts / 0 new
Last post
ToyKeeper
ToyKeeper's picture
Offline
Last seen: 16 min 4 sec ago
Joined: 01/12/2013 - 14:40
Posts: 8247
Location: (469219) 2016 HO3

JackCY wrote:
BLF VLD gone?

What’s the current state of experiments with adding a capacitor to be able to determine between short and long press?

Is there some feature and UI overview of the different FWs copied in the repo? Say an overview sheet of what each FW and version supports?
… no mention of say wear leveling, …

Might be a good idea to add a link to the repo to wiki and if there would be a table overview of the features it would be grand to have there.
http://flashlightwiki.com/AVR_Drivers

This is yet another 1000 pages long driver thread, … important to take the useful information and save it at places like Wiki.


I’m not familiar with the BLF VLD… must have been before I got involved.

The capacitor for detecting long/short presses is very common now, and works pretty well. It has also been extended to detect short/medium/long presses to allow for more detailed interfaces. Some firmwares use a different trick to measure “off’ time without a capacitor — set part of the RAM to zero, then check whether it’s still zero when the light comes back on. The RAM decays to mostly 1s after about half a second, so this can distinguish between short/long presses without extra hardware.

The closest we have to a detailed firmware index is the index file you already found, which is pretty brief. I didn’t think of mentioning wear leveling, since pretty much everything does that. Feel free to add that to the meta files yourself though, if you like. I’m happy to accept patches, and all help is greatly appreciated. Smile

Also, feel free to add links and such to the wiki. I haven’t attempted to edit the wiki but it sounds like a good idea. That’s kind of the same reason I started a code repository; there was too much information scattered in too many places, so I wanted to collect it into one place to help people find what they need.

ToyKeeper
ToyKeeper's picture
Offline
Last seen: 16 min 4 sec ago
Joined: 01/12/2013 - 14:40
Posts: 8247
Location: (469219) 2016 HO3

Tom E wrote:
I much prefer an e-switch light for short /long press’s though – easier, more consistent, much better UX/UI.

An e-switch definitely offers more possibilities. I’d like to have more e-switch lights, but they also kind of need a better MCU and more development effort in order to work well. I can fit a lot more features into 1024 bytes on a clicky-switch light than on an e-switch light.

I’ve also noticed an obnoxious issue with clicky lights using an offtime capacitor… the OTC drains at different speeds depending on temperature, so it’s hard to do a medium or long press when the light is cold. Instead of the usual ~0.6s for a medium press, a near-freezing light took more like 6 seconds. I run into this when biking in the colder months.

Maybe I should use memory decay instead of OTC to measure the short press, and keep using OTC for longer presses. I don’t think the memory decay is as sensitive to cold.

ToyKeeper
ToyKeeper's picture
Offline
Last seen: 16 min 4 sec ago
Joined: 01/12/2013 - 14:40
Posts: 8247
Location: (469219) 2016 HO3

JackCY wrote:
So what drivers are there that support double PWM output, hence support FET+1?
Plus short/long press. … No memory, …

RMM and wight both designed some nice dual-pwm drivers in a variety of sizes and configurations. I’d suggest browsing RMM’s store and wight’s driver index thread to find more details.

As for code, there are a few projects with dual-pwm support, listed under “dual PWM:” in the repository index file. Quite a few support off-time switching with no memory, listed under “OTC” and “mem decay” and “offtime” in the index, and Memory :: “none”.

STAR should give you something similar to NLITE but with more features and options. Starry-offtime adds a couple more options. Or the blf-a6 and cypreus2 code currently have the most features available for dual PWM, but that might be more complex than you want, with lots of hidden blinkies and such.

Jaimelito
Offline
Last seen: 1 month 4 days ago
Joined: 05/06/2015 - 10:08
Posts: 26
Location: Jerez de la Frontera, SPAIN

I'm near to finishing my collage code but the lockmode don't work basicaly i've copy paste.

All works fine unless lockmode

 

http://pastebin.com/ZJ6mYumW

pyro1son
pyro1son's picture
Offline
Last seen: 2 months 1 week ago
Joined: 03/21/2013 - 08:18
Posts: 432
Location: UK

ToyKeeper wrote:
pyro1son wrote:
Hi guys, I’ve been playing around with the blf-a6 firmware for a light that I’m trying to build. I’ve compiled it and it just doesn’t work just a quick flash then no output.

What was the other firmware you tried? I think you said the driver has two power channels, but does it use a FET and a 7135 or is it all 7135s or is it some other type? What kind of emitter is it hooked up to? How much programming have you done before?

Depending on your compiler setup, it may also be unable to fit the compiled code into 1024 bytes, since blf-a6 is 1022 bytes by default and any compiler changes can make it significantly bigger even without touching the code.

Did you try the default blf-a6.hex file, and did it behave any differently?

It’s a FET +1 driver hooked up to an XP-L and XQ-E, I used a firmware I had flashed to a different driver I build and that all worked fine. I have done no programming but can understand the basics of whats going on in the code (just about).
I will give it a go with the default hex file later and see it that works.

Pastebin                                      &nbs

guardior
Offline
Last seen: 3 years 5 months ago
Joined: 04/06/2015 - 14:06
Posts: 129
Location: Sweden
Joat wrote:
guardior wrote:
Tom E wrote:

guardior – which exact driver/board are you using? Are you sure it’ a DD+1, and if so, connected on the same pinouts as TK has it configured for?

No no, I’m still only on 105d. And will be for some more time, I’m not really good with soldering but trying to learn. Smile

You can get a Fet + 7135 driver from MTN Electronics that would be just two wires to solder, or if you don’t want to do that much you could buy all the parts for a light and have him assemble it for you.


Yeah I know mtn ships to Europe now. But I have lots of stuff planned before trying out dual-pwm. I’m not really interested in the EE A6 either as I think it’s way too small to be running DD. If it was a Convoy M1 I would have signed up for one though. I could of course get the A6 and move the driver to a M1, will have to think about that.
guardior
Offline
Last seen: 3 years 5 months ago
Joined: 04/06/2015 - 14:06
Posts: 129
Location: Sweden

@Jaimelito

Ever heard of pastebin services? Silly

ToyKeeper
ToyKeeper's picture
Offline
Last seen: 16 min 4 sec ago
Joined: 01/12/2013 - 14:40
Posts: 8247
Location: (469219) 2016 HO3

pyro1son wrote:
It’s a FET +1 driver hooked up to an XP-L and XQ-E, …

That’s interesting. Do you want the two emitters to light up at the same time, or at different times? I’m not aware of any FET+1 drivers which were intended for two independent LEDs…
ToyKeeper
ToyKeeper's picture
Offline
Last seen: 16 min 4 sec ago
Joined: 01/12/2013 - 14:40
Posts: 8247
Location: (469219) 2016 HO3

guardior wrote:
I’m not really interested in the EE A6 either as I think it’s way too small to be running DD.

Hah, I have same-sized lights running at 3X the power of the BLF A6. It just requires being more careful with the light… You can run 15 amps in an 18650 tube light for short periods of time; just don’t leave it on high modes for very long.

I generally won’t run a light that size at more than one amp for any extended amounts of time, and usually the highest I use is 350mA (98% duty cycle) with a 1Hz full-power stutter (2% duty cycle), for an average of about 500mA or 600mA. This works well for biking, and the air flow keeps the light not only cool but actually cold.

Basically, I treat it as a 1-amp light with a really nice blinding turbo mode and bright party strobes.

pyro1son
pyro1son's picture
Offline
Last seen: 2 months 1 week ago
Joined: 03/21/2013 - 08:18
Posts: 432
Location: UK
ToyKeeper wrote:
pyro1son wrote:
It’s a FET +1 driver hooked up to an XP-L and XQ-E, …
That’s interesting. Do you want the two emitters to light up at the same time, or at different times? I’m not aware of any FET+1 drivers which were intended for two independent LEDs…

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.

Pastebin                                      &nbs

pyro1son
pyro1son's picture
Offline
Last seen: 2 months 1 week ago
Joined: 03/21/2013 - 08:18
Posts: 432
Location: UK

Just given it another go building it slightly differently and it WORKS!!!! So excited managed to finish my build! 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.

Pastebin                                      &nbs

ToyKeeper
ToyKeeper's picture
Offline
Last seen: 16 min 4 sec ago
Joined: 01/12/2013 - 14:40
Posts: 8247
Location: (469219) 2016 HO3

pyro1son wrote:
Just given it another go building it slightly differently and it WORKS!!!! So excited managed to finish my build! 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.

Crux
Crux's picture
Offline
Last seen: 10 months 2 weeks ago
Joined: 05/03/2011 - 16:27
Posts: 227
Location: Northcoast, Ohio, USA

ToyKeeper wrote:
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). Wink But the end effect is the same.

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

ToyKeeper
ToyKeeper's picture
Offline
Last seen: 16 min 4 sec ago
Joined: 01/12/2013 - 14:40
Posts: 8247
Location: (469219) 2016 HO3

Crux wrote:

Actually, it’s because the 7135 isn’t fast enough to react to a half-a-clock tick (@18kHz).


Interesting.

I have a 32×7135 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.

pyro1son
pyro1son's picture
Offline
Last seen: 2 months 1 week ago
Joined: 03/21/2013 - 08:18
Posts: 432
Location: UK

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

Pastebin                                      &nbs

Jaimelito
Offline
Last seen: 1 month 4 days ago
Joined: 05/06/2015 - 10:08
Posts: 26
Location: Jerez de la Frontera, SPAIN

guardior wrote:
@Jaimelito

Ever heard of pastebin services? Silly

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

_the_
_the_'s picture
Offline
Last seen: 5 days 15 hours ago
Joined: 07/08/2011 - 06:22
Posts: 3587
Location: Finland

Jaimelito wrote:
guardior wrote:
@Jaimelito Ever heard of pastebin services? :p

I don't understand you, what's the meaning of "pastebin" ?

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

=the=

Disclaimer: Above post might contain referral links, but only to items that I myself have bought, tested & approved. Or items that, based on my experience, can be considered as good deals & worth sharing.

guardior
Offline
Last seen: 3 years 5 months ago
Joined: 04/06/2015 - 14:06
Posts: 129
Location: Sweden

Jaimelito wrote:
guardior wrote:
@Jaimelito

Ever heard of pastebin services? Silly

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


Ever heard of search services? Silly 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.
Jaimelito
Offline
Last seen: 1 month 4 days ago
Joined: 05/06/2015 - 10:08
Posts: 26
Location: Jerez de la Frontera, SPAIN

Ok,Fixed!!!

pilotdog68
pilotdog68's picture
Offline
Last seen: 2 months 2 weeks ago
Joined: 05/30/2013 - 23:31
Posts: 6419
Location: Held against my will in IOWA, USA

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.

My Favorite Modded Lights: X6R, S8 , X2R , M6, SP03

Major Projects:  Illuminated Tailcap, TripleDown/TripleStack Driver

ToyKeeper
ToyKeeper's picture
Offline
Last seen: 16 min 4 sec ago
Joined: 01/12/2013 - 14:40
Posts: 8247
Location: (469219) 2016 HO3

pilotdog68 wrote:
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?


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.

pilotdog68
pilotdog68's picture
Offline
Last seen: 2 months 2 weeks ago
Joined: 05/30/2013 - 23:31
Posts: 6419
Location: Held against my will in IOWA, USA

ToyKeeper wrote:
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.

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!

My Favorite Modded Lights: X6R, S8 , X2R , M6, SP03

Major Projects:  Illuminated Tailcap, TripleDown/TripleStack Driver

ToyKeeper
ToyKeeper's picture
Offline
Last seen: 16 min 4 sec ago
Joined: 01/12/2013 - 14:40
Posts: 8247
Location: (469219) 2016 HO3

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?

pilotdog68
pilotdog68's picture
Offline
Last seen: 2 months 2 weeks ago
Joined: 05/30/2013 - 23:31
Posts: 6419
Location: Held against my will in IOWA, USA

ToyKeeper wrote:
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.

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

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

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.

My Favorite Modded Lights: X6R, S8 , X2R , M6, SP03

Major Projects:  Illuminated Tailcap, TripleDown/TripleStack Driver

pyro1son
pyro1son's picture
Offline
Last seen: 2 months 1 week ago
Joined: 03/21/2013 - 08:18
Posts: 432
Location: UK

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

Pastebin                                      &nbs

pilotdog68
pilotdog68's picture
Offline
Last seen: 2 months 2 weeks ago
Joined: 05/30/2013 - 23:31
Posts: 6419
Location: Held against my will in IOWA, USA

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

My Favorite Modded Lights: X6R, S8 , X2R , M6, SP03

Major Projects:  Illuminated Tailcap, TripleDown/TripleStack Driver

guardior
Offline
Last seen: 3 years 5 months ago
Joined: 04/06/2015 - 14:06
Posts: 129
Location: Sweden
pilotdog68 wrote:
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.

pilotdog68
pilotdog68's picture
Offline
Last seen: 2 months 2 weeks ago
Joined: 05/30/2013 - 23:31
Posts: 6419
Location: Held against my will in IOWA, USA

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

My Favorite Modded Lights: X6R, S8 , X2R , M6, SP03

Major Projects:  Illuminated Tailcap, TripleDown/TripleStack Driver

guardior
Offline
Last seen: 3 years 5 months ago
Joined: 04/06/2015 - 14:06
Posts: 129
Location: Sweden

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.

pilotdog68
pilotdog68's picture
Offline
Last seen: 2 months 2 weeks ago
Joined: 05/30/2013 - 23:31
Posts: 6419
Location: Held against my will in IOWA, USA

I’ve never had any problems with my supply before, but I’ll try some different settings (or even just use a battery) when i get home.

My Favorite Modded Lights: X6R, S8 , X2R , M6, SP03

Major Projects:  Illuminated Tailcap, TripleDown/TripleStack Driver

Pages