Flashlight Firmware Repository

1798 posts / 0 new
Last post
cajampa
Offline
Last seen: 2 years 3 months ago
Joined: 08/01/2014 - 01:55
Posts: 1963
Location: Sweden

Good, LVP is the most important bit anyway.

Bat check is another nice feature to have, also 2 pwm channels support. But that could get complicated.

Is you pwm fast for the lower pwm levels & phase for the max output mode, as is often recommended?

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

None of my firmwares support dual-pwm even though they’re kinda prepared for it. As you say it will get a tad complicated as different people will have different opinions on how it’s going to be used. Just setting both outputs to the same value is easy though. And yes I’m using phase for full output (mostly just doing as ToyKeeper says :)):

https://github.com/xerxes2/flashlight-firmware/blob/master/geniedrv/geni...

I haven’t thought of battery check, yet. Don’t think I’m gonna bother with it but you should never say never. If I do it I think I’m gonna hide it in 30 short presses or something like that. Will maybe have to throw out something else to make it fit though.

zeremefico
zeremefico's picture
Offline
Last seen: 1 hour 35 min ago
Joined: 03/27/2012 - 02:44
Posts: 1289
Location: Greece

Hi TK, do you have any ramping firmware in your repository?

₪₪₪₪ ΟΥΔΕΝ ΚΡΥΠΤΟΝ ΥΠΟ ΤΟΝ ΗΛΙΟ ₪₪₪₪

My YouTube channel

Flashlights & edc gear

K40M F16

ToyKeeper
ToyKeeper's picture
Offline
Last seen: 1 hour 23 min ago
Joined: 01/12/2013 - 14:40
Posts: 7910
Location: (469219) 2016 HO3

zeremefico wrote:
Hi TK, do you have any ramping firmware in your repository?

Yes. To get a list, browse to the index file, and search for “ramp”:
http://bazaar.launchpad.net/~toykeeper/flashlight-firmware/trunk/view/he...
Mike C
Mike C's picture
Offline
Last seen: 2 months 3 weeks ago
Joined: 01/22/2014 - 08:03
Posts: 2009
Location: Sweden

Is there any firmware in the repository that has a good formula for smooth PWM brightness adjusting? The ones I have looked at all have a predefined arrays. I’m looking to avoid that and would rather do it with coding. Increasing by the same amount just doesn’t work very well. So far I haven’t come up with one that smoothly and evenly goes from moon to 255.

ToyKeeper
ToyKeeper's picture
Offline
Last seen: 1 hour 23 min ago
Joined: 01/12/2013 - 14:40
Posts: 7910
Location: (469219) 2016 HO3

Mike C wrote:
Is there any firmware in the repository that has a good formula for smooth PWM brightness adjusting? The ones I have looked at all have a predefined arrays. I’m looking to avoid that and would rather do it with coding. Increasing by the same amount just doesn’t work very well. So far I haven’t come up with one that smoothly and evenly goes from moon to 255.

Take a look at ToyKeeper/Ferrero_Rocher/Ramping_UI_Table.c and the ramp_calc.py tool. It calculates a small variety of visually-linear ramps with an arbitrary number of steps. I find that 64 steps works well for a 2-second ramp, though Ideally I’d like more steps per second. I only used 64 because it was the most I could fit.

Calculating a smooth ramp on the device itself is difficult because it doesn’t do floating point math and doesn’t have much space. It’s much much easier to use a table instead, even if it’s a large table.

In any case, the models I’ve tried are logarithmic, quadratic, and cubic. I personally like logarithmic ramps because it gives me more resolution toward the lower levels, but cubic is technically more correct. Quadratic gives sort of a compromise between the two.

Additionally, the lowest levels can benefit from using PFM (pulse frequency modulation) in addition to PWM (pulse width modulation), because the lowest few PWM levels produce pretty large visual jumps in brightness. PFM can smooth out those lower levels, but it only works on single-channel drivers (no FET+1) and it can be very sensitive to battery voltage.

Mike C
Mike C's picture
Offline
Last seen: 2 months 3 weeks ago
Joined: 01/22/2014 - 08:03
Posts: 2009
Location: Sweden

I’ll check it out, thanks.

jhalb
jhalb's picture
Offline
Last seen: 1 year 6 months ago
Joined: 03/23/2015 - 21:24
Posts: 1350
Location: California

I have a ramping clicky, is there a ramping MOM anywhere? For an 8X ~ 12X Nanjg...

ToyKeeper
ToyKeeper's picture
Offline
Last seen: 1 hour 23 min ago
Joined: 01/12/2013 - 14:40
Posts: 7910
Location: (469219) 2016 HO3

jhalb wrote:

I have a ramping clicky, is there a ramping MOM anywhere? For an 8X ~ 12X Nanjg…


Yes, that’s what the one a couple posts ago is — a ramping UI for momentary switch lights like the SRK or Roche F6: ToyKeeper/Ferrero_Rocher/Ramping_UI_Table.c

For a nanjg-based driver, you might need to recalculate the ramp values. By default it’s calibrated for a FET driver or a 32×7135 driver, but regular nanjgs need a higher zero point. The ramp_calc.py tool can generate new values for you; just tell it the lowest PWM value which actually produces light and adjust the goal multiplier… it might take some trial and error to get it to produce the right number of steps though.

jhalb
jhalb's picture
Offline
Last seen: 1 year 6 months ago
Joined: 03/23/2015 - 21:24
Posts: 1350
Location: California

I'll check into it.

Thank you!

pyro1son
pyro1son's picture
Offline
Last seen: 3 weeks 8 hours ago
Joined: 03/21/2013 - 08:18
Posts: 432
Location: UK

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. I have tried a different firmware on the driver to confirm it work and that’s all good so has to be the firmware that’s causing my issues, yet I can’t see what the matter is.
Any chance you could give it a look?
CODE

Thanks
Pyro

Pastebin                                      &nbs

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

cajampa wrote:
Bat check is another nice feature to have

I actually did end up implementing batcheck, put it at 30 short presses. Using a five step scale and ToyKeepers values it works quite well. Took a battery directly from the charger and it showed five. Used it for a day and it showed four. Used it for another day and it showed three and now it’s down to two. Will see what happens when it goes down to zero. I took away low battery step down though, don’t like it anyway. Low battery shut off makes more sense to me so I kept that, haven’t tested it yet though. Now it’s summer around here and the sun is up all the bloody time so not much time for testing firmwares. Testing inside is just boring. I wrote this firmware almost as a joke but it’s actually growing on me. It’s kinda the ultimate flashaholic firmware as it’s empty from the beginning and you must program everything yourself. Seven modes possible so five normal levels, strobe and sos ought to be enough for everybody yes. Smile
guardior
Offline
Last seen: 3 years 3 months ago
Joined: 04/06/2015 - 14:06
Posts: 129
Location: Sweden

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. I have tried a different firmware on the driver to confirm it work and that’s all good so has to be the firmware that’s causing my issues, yet I can’t see what the matter is.
Any chance you could give it a look?
CODE

Thanks
Pyro


You got a ton of compiler errors. Start with installing avr-libc as the headers are missing.
pyro1son
pyro1son's picture
Offline
Last seen: 3 weeks 8 hours ago
Joined: 03/21/2013 - 08:18
Posts: 432
Location: UK

I didn’t get any errors when compiling in a avr studio. How odd?

Pastebin                                      &nbs

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

pyro1son wrote:
I didn’t get any errors when compiling in a avr studio. How odd?

Isn’t the “output” you pasted yours? Or maybe that is something that is automatically generated? If so then you can ignore my previous comment.
Tom E
Tom E's picture
Offline
Last seen: 1 month 5 days ago
Joined: 08/19/2012 - 08:23
Posts: 10899
Location: LI NY

codepad.org seems to be a compile/interpreter as well - not just file sharing, so I think it tried to compile your code. = that explains it.

Tom E
Tom E's picture
Offline
Last seen: 1 month 5 days ago
Joined: 08/19/2012 - 08:23
Posts: 10899
Location: LI NY

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?

pyro1son
pyro1son's picture
Offline
Last seen: 3 weeks 8 hours ago
Joined: 03/21/2013 - 08:18
Posts: 432
Location: UK

Ahhhh that may be causing some issues here then.

Pastebin                                      &nbs

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

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

pyro1son wrote:
Ahhhh that may be causing some issues here then.

He meant the pasting site so you can safely ignore my comment. But finding bugs in that code is not easy as there are tons of ifdefs and whatnot. Smile
pyro1son
pyro1son's picture
Offline
Last seen: 3 weeks 8 hours ago
Joined: 03/21/2013 - 08:18
Posts: 432
Location: UK

Ahhhh OK well no worries if it’s an issue.

Pastebin                                      &nbs

Tom E
Tom E's picture
Offline
Last seen: 1 month 5 days ago
Joined: 08/19/2012 - 08:23
Posts: 10899
Location: LI NY

Ok - I'm getting BLF'ers confused Smile.

pyro1son - sorry: are you also trying to use it on a stock Nanjg? If so, you have to disable the secondary PWM output which looks like you attempted to do.

MODES1x1 and MODES1x2 should be zeroed out. You zeroed one but not both. I believe MCU pin #6 (PB1) is the standard output pin on a Nanjg, while pin #5 (PB0) is the alternate PWM pin called: ALT_PWM_PIN. It might be you are defaulting to group #2 which won't work.

 I'd try swapping mode sets. You have CONFIG_STARS turned on, but it's support appears to be commented out. I mught have to punt at this point - not sure what you changed for what reason....

pyro1son
pyro1son's picture
Offline
Last seen: 3 weeks 8 hours ago
Joined: 03/21/2013 - 08:18
Posts: 432
Location: UK

I’m using a board with dual PWM output. Config stars?

Pastebin                                      &nbs

Joat
Offline
Last seen: 3 months 10 hours ago
Joined: 06/13/2013 - 23:43
Posts: 521
Location: Minnesota
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.

JackCY
JackCY's picture
Offline
Last seen: 3 years 4 months ago
Joined: 12/28/2012 - 16:30
Posts: 588
Location: Czech

BLF VLD gone?

What’s the current state of experiments with adding a capacitor to be able to determine between short and long press?
Some had success before it seems with only a capacitor for some functionality but the original idea had more parts (R,D,C if I remember right, that’s what I got but didn’t build yet) and made more sense.
Might get to it again, I see there are now many more codes than the “crazy” VLD.

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?
I can see the index in trunk but that’s more or less only useful for searching for specific features to then look them up in code or reuse the hex file if no code. But no mention of say wear leveling, if it’s implemented or not. I understand this is stuff hidden in code and might need to be filled in the meta files by someone who made or at least read the code.

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

You can add it, but if you can’t shoot me a PM I should get a notification and can add things to the Wiki.
It’s easier to navigate wiki than search every flashlight forum threads in the world for data/information.
This is yet another 1000 pages long driver thread, impossible for anyone to read over for what has been shared and said here, it’s important to take the useful information and save it at places like Wiki.

cajampa
Offline
Last seen: 2 years 3 months ago
Joined: 08/01/2014 - 01:55
Posts: 1963
Location: Sweden
guardior wrote:
cajampa wrote:
Bat check is another nice feature to have
I actually did end up implementing batcheck, put it at 30 short presses. Using a five step scale and ToyKeepers values it works quite well. Took a battery directly from the charger and it showed five. Used it for a day and it showed four. Used it for another day and it showed three and now it’s down to two. Will see what happens when it goes down to zero. I took away low battery step down though, don’t like it anyway. Low battery shut off makes more sense to me so I kept that, haven’t tested it yet though. Now it’s summer around here and the sun is up all the bloody time so not much time for testing firmwares. Testing inside is just boring. I wrote this firmware almost as a joke but it’s actually growing on me. It’s kinda the ultimate flashaholic firmware as it’s empty from the beginning and you must program everything yourself. Seven modes possible so five normal levels, strobe and sos ought to be enough for everybody yes. Smile

Nice Smile agree about the step down, LV shut off should be plenty, and with these new high Vf emitters, we already have a step down when it drops under the Vf Wink

I think i will absolutely test this out when i start flashing drivers (soon i hope).

Its horrible we have like no night at all here in Sweden now, just a few hours & even then the sky is so bright it is not really dark Sad

This is my first year in the flashlight rabbit hole :D, and i really miss the early dark evening at winter when you could mod a light & test it out right away Smile now it is just soooo bright outside.

Tom E
Tom E's picture
Offline
Last seen: 1 month 5 days ago
Joined: 08/19/2012 - 08:23
Posts: 10899
Location: LI NY

Jack - TK should really respond to you on this - she's the keeper Smile. She implemented a nice short/long press detection on using a cap - it's pretty standard now and is being used in the BLF EE A6 group buy light (http://budgetlightforum.com/node/36667). I've built a couple of lights with the same firmware. I much prefer an e-switch light for short /long press's though - easier, more consistent, much better UX/UI.

Ohh - haven't seen you on BLF for a while, hope all is well. If you just came back recently, there's lots to catch up on. RMM's website: http://www.mtnelectronics.com has many of the latest things we are building - parts, drivers, hosts, etc. Triples and quads have gotten to a whole new level, as well as insanely high amps in smaller and smaller lights.

I just did some browsing on the wiki - didn't know it was still maintained - there's lots of out-dated info there, but also lots that's still very useful. I can't find how to participate and post to it though. I never used BLF-VLD, always went with my own version of luxdrv, but now, luxdrv is pretty out-dated. I use OSHPark custom drivers almost exclusively now - the" FET+1" drivers where you get best of both - high powered modes from a FET, low modes off a single 7135.

JackCY
JackCY's picture
Offline
Last seen: 3 years 4 months ago
Joined: 12/28/2012 - 16:30
Posts: 588
Location: Czech

Hey, yeah I’ve been away for a while, just peeking back here and there. I still have my triple nichias to be finished so might get to it hence need to make or find in the new large amount of FWs that has popped up something that I can learn from. Datasheet for ATtiny is nice but it says zero about an API itself/the functions, header files, Atmel specific libraries to talk to the chip. Will have to move my programming environment to current PC.

MTN has new offers yes, seen it but it’s mostly an option for US only. Plus I already have the FET+1 drivers built for over a year, only running with FET and not using the single 7135 on secondary PWM output for moon nor low mode. Didn’t get to make the FW back then. MTN doesn’t say much about FET specs or the UI/click behavior.

What other new parts are there?
I’ve noticed the new Convoy S2+ red metal switch, but apart from that don’t see any newer hosts. Same old stuff.
What is new in triples? Noctigon + Nichias or XPs with Carclo, probably same as ever. Except now people have the option to cheap out with KD lotteries and the newer Nichias that have lower CRI?
High amps and small lights never mix well, anything 120×25mm sized can only run high amps for so long before getting hot. I guess smaller drivers with higher output are available? 15 or 10mm? But no high amps boost/buck 17mm Nanjg105c sized? Or has it been achieved? No copper pills instead of brass by default, still has to be made by someone and moded. Any new small high amps switches and springs?

Yes FET+1 I have. But I did a 105c Nanjg mod, took 7×7135 off and added a single FET, Vishay 424DP. The budget way instead of buying a $15 driver premade that wasn’t available anyway Big Smile No one was making these yet to sell, and from POV it wasn’t feasible to do so. It maybe works for already established shops to make $1 on an expensive driver. I’m surprised though that they don’t ride it out all the way, have it made in Asia in bulk, not “solder it on OSHpark PCBs in the shop”, probably reflects how many they sell, very few.

So what drivers are there that support double PWM output, hence support FET+1?
Plus short/long press. I guess I will need to modify the UI anyway, I think someone made it before, there aren’t that many options for UI with a single button but it’s not the usual.
No memory, which needs short/long press to work right. And short press mode advance.
As in, 1xshort advance mode, long reset to default.

I run nLite now but that’s the usual messy UI without short/long and hence incomplete no memory. It works, sort of, only one light shows PWM noise though, no idea why, maybe nLite doesn’t run as high PWM freq. it’s one light of 3 that does it.

What is outdated on Wiki? I can check it when I get back to programming and update that part. Last add was probably nLite link there on the drivers page. Tools seem to be the same and still working. WinAVR is dead for real so there is AVR Tools instead. You have to register, then you can edit. True almost no one does, which is a shame since it’s crazy for anyone to go through these 1000 posts threads to find that hidden piece of useful information about drivers and FW.

Tom E
Tom E's picture
Offline
Last seen: 1 month 5 days ago
Joined: 08/19/2012 - 08:23
Posts: 10899
Location: LI NY

Oh boy. lots of Q's - not sure if I can answer all. The Red Convoy S2+ is a great little light - my favorite tube EDC without an e-switch - it's a perfect match for the BLF-A6 firmware. But I prefer e-switch lights mostly. The meteor M43 is the big thing now, but availability is scarce. OSHPark, I believe, is a revolution in the evolution. For $2-$4 you can qty 3 of custom made drivers. I've reflowed and programmed a ton of them, as many others have.

 The Eagle Eye X6 was probably the biggest group buy deal ever, here on BLF, but had it's issues - it never achieved the stock amps it was supposed to get, and the UI never matched exactly what we requested. The Eagle Eye A6 also represents another phase of evolution - collaboration of BLF hobbyists and china manufacturers to finally get something to market we really want: custom driver, custom high end firmware pre-built in the budget quality light, bringing the state-of-the-art us modders are doing to the masses at a significant cost savings.

CREE, of course, is advancing but with noted concerns the new LED's can't take as high as amps anymore. Where older XM-L2's could achieve 6.5A, now the new ones do about 5.1A at max from a single cell DD setup.

For the best DD+1 and tap/med/long OTC cap support, seems like ToyKeeper has the best firmware offering - the BLF A6 driver, in her repository: http://bazaar.launchpad.net/~toykeeper/flashlight-firmware/trunk/files

For the wiki, I just got approval today for posting/updating. There are all sort of areas lacking:

  • XM-L2 U4 missing
  • other LED's also seem to be missing the latest bin now available
  • no mention of the XHP50 and XHP70 (latest hot rod LED's)
  • the manufacturer and website listings are wayyy dated
  • the review listings are dated by a couple of years, and light-reviews.com is listed before CPF and BLF - weird because light-reviews.com has the latest review dated June 2013 and latest news is from Aug 2012
  • the "popular drivers" is way out of date - today you can buy a true buck driver in 3 different sizes, up to 4-5A, buy the kit of parts if you want or assembled, and program it the way you want with a selection of assorted firmware drivers -- this is a huge advance after many disappointments in trying to do exactly this in BLF over the last 2 years or so
  • the terminology section is fantastic, but also dated. For example, OTC should definitely be there -- it's an indication it's dated

 I'm not saying it's not hugely valuable - it is. The technical ref areas are outstanding and still applicable and relevant. I don't see how a team of people can keep this updated - it's a huge effort.

ToyKeeper
ToyKeeper's picture
Offline
Last seen: 1 hour 23 min ago
Joined: 01/12/2013 - 14:40
Posts: 7910
Location: (469219) 2016 HO3

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?

Pages