Flashlight Firmware Repository

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

Tried flashing with AVRDudess (GUI for AVRDude) and I’ve not got the error message. Will find out how well this has worked on thursday

Pastebin                                      &nbs

s1m888
s1m888's picture
Offline
Last seen: 16 hours 8 min ago
Joined: 07/12/2014 - 02:18
Posts: 169
Location: S. E. Asia

I have a problem with one of the eight fet + 1 drivers that i built. All of them are running the blf a6 firmware but one driver i can’t get to the soft config mode (blink where i have to select the 2nd group and memory mode). It just continuously goes to the next mode after 15 or more taps. I don’t know if it’s a bug in the firmwware but all of my drivers are using the same firmware and this is the only one that is having that problem so maybe not firmware. May it’s the mcu? or the otc?

prisma
Offline
Last seen: 16 hours 30 min ago
Joined: 12/02/2011 - 11:07
Posts: 126
Location: Germany

I´m searching for a FW similar to TKs STAR_momentary (which I use atm), but with the possibility to switch off faster. I believe I will like dth_Momentary_v1_1 but I need also dual PWM output.

Any ideas?

BTW I´m not familiar in programming, just able to change mode values and flashing to driver.

Thanks for your help!

And yes, I didn´t read the whole thread… Wink

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

It’s not difficult to change STAR (not TK’s btw) so that a long(er/ish) press goes to off instead of going backwards. That’s what I use. Short press always goes forward, long press from off goes to turbo, long press from on turns off.

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

Major Projects:  Illuminated Tailcap, TripleDown/TripleStack Driver

prisma
Offline
Last seen: 16 hours 30 min ago
Joined: 12/02/2011 - 11:07
Posts: 126
Location: Germany

My mistake, sorry JonnyC…

Yes, the way you describe would fit my needs. But it’s not easy for me to change it, probably impossible.

May I see your changes or get the source code?

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 can upload the code I used when I get home tonight, but someone else might be able to do it sooner. It really is a simple change, just part of one line if I remember correctly.

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

Major Projects:  Illuminated Tailcap, TripleDown/TripleStack Driver

prisma
Offline
Last seen: 16 hours 30 min ago
Joined: 12/02/2011 - 11:07
Posts: 126
Location: Germany

Thanks pd, that would be great.

I know I have to learn a lot about the codes work but it takes time… even to see which change will lead to an effect is one step forward

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

If you’re in a hurry, you could probably find the answer in the STAR thread a few pages back. I had to ask for help doing it about a year ago(?).

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

Major Projects:  Illuminated Tailcap, TripleDown/TripleStack Driver

prisma
Offline
Last seen: 16 hours 30 min ago
Joined: 12/02/2011 - 11:07
Posts: 126
Location: Germany

I´m not in a hurry but in the meawhile I found it, changed it and it works Big Smile

Now it fits my needs and I have one more nice light with a great UI. Thank you!!!

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

prisma wrote:
I´m not in a hurry but in the meawhile I found it, changed it and it works Big Smile

Now it fits my needs and I have one more nice light with a great UI. Thank you!!!


Cool. That’s what I use in all of my e-switch lights (so far). I also shorten up the long press so that it’s only about 0.3 seconds.

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

Major Projects:  Illuminated Tailcap, TripleDown/TripleStack Driver

ToyKeeper
ToyKeeper's picture
Online
Last seen: 2 min 45 sec ago
Joined: 01/12/2013 - 14:40
Posts: 8243
Location: (469219) 2016 HO3

pilotdog68 wrote:
I’m sure this information has been laid out somewhere for the simple-minded, but I don’t understand all of the “include…… .h” all over the code. This must be the reason I’ve stuck with blf-a6 code from May.

It’s just a small step toward giving it a more normal code layout. Putting everything in one file is pretty unusual, and frowned on in most software development. Instead of using a single code file to represent the state of a project (like saving the build for a specific light), snapshots are more often taken in the form of a code branch or repository tag or a tarball or some other complete snapshot of the entire project.

So… Common functions, things which don’t usually change from project to project, were moved into shared headers. When one project gets an improvement to these bits, all the others benefit too. The individual projects have less boilerplate code and focus more on the parts which make them unique. And if there’s a common component you like to do differently (such as hardware calibration), you can swap out one file and it’ll apply to every project automatically.

I limited this to only my directory though, since other people manage their code in different ways. And I added ‘tk-’ to the beginning of each file to avoid name collisions. C doesn’t have real namespaces, so I basically kludged one together in flat space instead.

I’ve still tried to avoid a lot of typical C idioms though, like depending on a specific build system or external libraries or anything else which makes it significantly harder to use in WinAVR or OSX. These projects are still simple enough to be manageable without a massive complex internal structure.

ToyKeeper
ToyKeeper's picture
Online
Last seen: 2 min 45 sec ago
Joined: 01/12/2013 - 14:40
Posts: 8243
Location: (469219) 2016 HO3

chouster wrote:
Here’s a little little minor correction, …

I went with _delay_ms(RAMP_SIZE * 3/8), because I like it that slow …and TURBO, BATTCHECK, RAMP as hidden modes. RAMP is sweet.


Oh, right. I tried a whole lot of different code while making the soft start ramp-up/down code, and it looks like I missed a few things when cleaning it up afterward. You could also make the ramp slower by increasing the number of steps instead of the delay between steps. This way it’d be smoother.

On some later firmware, the same code should be able to provide smooth transitions between levels on an e-switch light… but that ability isn’t really used much in bistro.

ToyKeeper
ToyKeeper's picture
Online
Last seen: 2 min 45 sec ago
Joined: 01/12/2013 - 14:40
Posts: 8243
Location: (469219) 2016 HO3

pilotdog68 wrote:
TK: I feel this would be a good one to add to the repository. It is so far the only one that works with my TripleDown driver boards.

Just to make sure, what is the link for the most recent working version?
I’d prefer to add that one instead of an earlier one which didn’t work. Smile
ToyKeeper
ToyKeeper's picture
Online
Last seen: 2 min 45 sec ago
Joined: 01/12/2013 - 14:40
Posts: 8243
Location: (469219) 2016 HO3

pilotdog68 wrote:
prisma wrote:
I´m not in a hurry but in the meawhile I found it, changed it and it works Big Smile

Now it fits my needs and I have one more nice light with a great UI. Thank you!!!


Cool. That’s what I use in all of my e-switch lights (so far). I also shorten up the long press so that it’s only about 0.3 seconds.

Perhaps this should be added too?

I just did a quick check, and I don’t think anything in the repository matches all of the following:

  • e-switch
  • dual PWM
  • single-click off
  • attiny13a

I see everything except tiny13 in one of Tom E’s projects, and everything except dual PWM in one of my projects, and everything except single-click off in JonnyC’s code… but nothing with all of them in one place. Unless I missed something.

ToyKeeper
ToyKeeper's picture
Online
Last seen: 2 min 45 sec ago
Joined: 01/12/2013 - 14:40
Posts: 8243
Location: (469219) 2016 HO3

s1m888 wrote:
I have a problem with one of the eight fet + 1 drivers that i built. All of them are running the blf a6 firmware but one driver i can’t get to the soft config mode (blink where i have to select the 2nd group and memory mode). It just continuously goes to the next mode after 15 or more taps. I don’t know if it’s a bug in the firmwware but all of my drivers are using the same firmware and this is the only one that is having that problem so maybe not firmware. May it’s the mcu? or the otc?

That sounds like it’s definitely a hardware difference. You can measure some hardware traits using the files under ToyKeeper/battcheck/* , but that’s just one option.

One possibility is that maybe the fast_presses variable on that exact MCU happens to decay to a useless value. This would be rare, but is possible. You could try changing around the order of variable definitions to maybe align that with a different part of RAM… or try dumping out its value on boot in order to check if it’s even relevant.

Anyway, it’s hard to say for sure what the issue is.

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:
pilotdog68 wrote:
TK: I feel this would be a good one to add to the repository. It is so far the only one that works with my TripleDown driver boards.

Just to make sure, what is the link for the most recent working version?
I’d prefer to add that one instead of an earlier one which didn’t work. Smile

The one in the post is the most recent version, I have it installed in the S8 in my sig line. I was going to ask though, can one of you wizards take a look at the LVP code? I’ve experienced some strange behavior that I haven’t totally found a pattern for. It’s almost like mode cycling stops working when LVP is kicking in. Like you’ll be in turbo/fet mode, lvp will step down to medium, then you can jump back up to turbo, but you can’t cycle past turbo to low. No matter how many “short presses” you do it stays in turbo until lvp starts to step it down again.

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

Major Projects:  Illuminated Tailcap, TripleDown/TripleStack Driver

prisma
Offline
Last seen: 16 hours 30 min ago
Joined: 12/02/2011 - 11:07
Posts: 126
Location: Germany

ToyKeeper wrote:
pilotdog68 wrote:
prisma wrote:
I´m not in a hurry but in the meawhile I found it, changed it and it works Big Smile

Now it fits my needs and I have one more nice light with a great UI. Thank you!!!


Cool. That’s what I use in all of my e-switch lights (so far). I also shorten up the long press so that it’s only about 0.3 seconds.

Perhaps this should be added too?

I just did a quick check, and I don’t think anything in the repository matches all of the following:

  • e-switch
  • dual PWM
  • single-click off
  • attiny13a

I see everything except tiny13 in one of Tom E’s projects, and everything except dual PWM in one of my projects, and everything except single-click off in JonnyC’s code… but nothing with all of them in one place. Unless I missed something.

Yes, I couldn’t find a matching FW too, that’s why I was asking.

But after the changes I’m satisfied with it so far. The next time the light is opened I’m going to set the long press to about .3s as well. And delete the first mode which is off. I think pd’s solution should be the best. BTW then it is exactly the same UI that Nitecore is using e.g. in their HC30.

The only thing I’m not happy so far is that the turbo stepdown is happening in PWM-channel 1 only (where are my AMCs) and not in PWM-channel 2 (where is the FET). This has to be changed but I want to find out myself first. If I can’t do it I will ask again.

fatboy
Offline
Last seen: 1 year 9 months ago
Joined: 11/17/2012 - 08:18
Posts: 223
Location: MN

sub

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

Ok firmware wizards, I can’t remember if I have asked this before or not. I’m looking for a firmware to use in a dual-switch light. I’ll list what I’m looking for, and hopefully there’s already something close or a more advanced FW that I can dumb down or something. If it runs on a 13 that’s preferred, but I could use a 25 or 85 if need be.

- on/off by tail power switch only
—- always comes back on in last mode
- side switch changes modes
—- click forward, hold for backward
- precise control of two pwm channels

That’s the main stuff, other nice things would be a shortcut to a certain mode by holding the side switch while applying power, or double click then hold enters a second mode group.

So what’s out there?

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

Major Projects:  Illuminated Tailcap, TripleDown/TripleStack Driver

ToyKeeper
ToyKeeper's picture
Online
Last seen: 2 min 45 sec ago
Joined: 01/12/2013 - 14:40
Posts: 8243
Location: (469219) 2016 HO3

There’s not a lot out there for dual switch.

I think, at the moment, there may be only STAR_dual_switch (tiny13) and Tom E’s Narsil (eswBrOutCfg, tiny45/85). I haven’t gotten to try either one, but Narsil is pretty full-featured.

I keep wanting to make something, but I don’t actually have a dual-switch light and I keep putting it off. I’ve only got one test driver with an e-switch, and it’s a FET-only board.

What’s a good way to rig up an e-switch to a floating driver without making it fragile or blocking SOIC8 clip access?

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:
What’s a good way to rig up an e-switch to a floating driver without making it fragile or blocking SOIC8 clip access?

Sometimes I use a Forward clicky with leads soldered to OTC pads, but usually I just take a wire, solder one end to the pad that connects to pin 2, then tap the free end to the ground ring to simulate button presses

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

Major Projects:  Illuminated Tailcap, TripleDown/TripleStack Driver

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 always thought Ferrero Rocher constantly displayed battery level with secondary led’s through that little window in the Roche F6, but I don’t see any mention of that in the .text file. Am I thinking of a different firmware? I’d really like something that can do this and use a clicky switch to control the main LED. It’s for a rather complicated project I’m working on.

edit: one more question, does baton keep it’s mode memory if power is removed? Or does that totally reset it?

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

Major Projects:  Illuminated Tailcap, TripleDown/TripleStack Driver

chouster
Offline
Last seen: 10 hours 46 min ago
Joined: 02/20/2014 - 15:05
Posts: 685
Location: germany

I can’t help with the firmware, but that sounds very interesting…

pilotdog68 wrote:
… I’d really like something that can do this and use a clicky switch to control the main LED. It’s for a rather complicated project I’m working on…
Tom E
Tom E's picture
Offline
Last seen: 6 hours 16 min ago
Joined: 08/19/2012 - 08:23
Posts: 10995
Location: LI NY

ToyKeeper wrote:
What's a good way to rig up an e-switch to a floating driver without making it fragile or blocking SOIC8 clip access?

Boy, haven't been keep'n up here. Lot more attractive drama in the GB threads Smile.

I bought off of eBay a ton (maybe 100) of e-switch's, the kind similar to those mounted in a SRK - very small, very thin. I wired up 2 wires, maybe 26 AWG, to the contacts and use this rig as my e-switch test. I usually use pin #2 so can take advantage of the OTC pad on our drivers, the other wire to a grnd point. Not the most stable and easiest think to use, because the tiny switch is floating in air, but worked out for me. Mostly I don't need a test switch because I'm attaching my driver in piggyback fashion to the stock driver, and making use of the stock driver mounted switch.

if you need this mainly for testing firmware, my absolute best setup was using Richard's SupFire M2-Z lights - cheap, simple, and use extra long LED wires so you can easy re-program. It fits a 22 mm driver -- better still, because a 22 is easier to work with as well. Just wire up the switch and use the real switch - sooo much easier, nicer setup. Mostly I tested without re-assembling the light - simply wired up a cell with alligator clips.

Tom E
Tom E's picture
Offline
Last seen: 6 hours 16 min ago
Joined: 08/19/2012 - 08:23
Posts: 10995
Location: LI NY

PD68 post #739 - Narsil won't do exactly that, but kind of sort of close. Narsil will have a turn OFF from the side switch (small parasitic drain), and it does sort of use hold for back -- well a short hold goes back one mode, keep holding and you get strobed.

It does have mode memory on the tail power switch, though it uses the brown out feature for doing this, and allows full mode switching on the tail, not just power. Mode changes made on the e-switch are not "remembered".

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

Thanks Tom. I’ve been meaning to install Narsil in my 7G3CS, but other projects keep taking priority. One day it will happen.

Does anyone else remember a firmware with active battery monitoring on little SMD led’s? I really thought it was written for the Roche F6.

Edit: i didn’t see anything about it in the .txt file, but now that I look at the .c file I’m convinced ferrero rocher is the one I was thinking of. Can anyone explain how the voltage monitoring works with the red and green leds? I see it has dual-pwm support, but how does that mesh? There aren’t enough mcu pins for all of it to work, are there?

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

Major Projects:  Illuminated Tailcap, TripleDown/TripleStack Driver

chouster
Offline
Last seen: 10 hours 46 min ago
Joined: 02/20/2014 - 15:05
Posts: 685
Location: germany

PD, there is also the ATtiny13A diagram in that .c-file, right at the beginning. So there are enough pins. I think you’re confusing dual PWM with dual-channel or something?

For indication purposes maybe we could control 2 LEDs with one MCU-pin by charlieplexing. Has anyone done that before here at BLF, or thought of it at least?

ToyKeeper
ToyKeeper's picture
Online
Last seen: 2 min 45 sec ago
Joined: 01/12/2013 - 14:40
Posts: 8243
Location: (469219) 2016 HO3

Yes, Ferrero Rocher and its siblings display realtime voltage on the SMD LEDs.

No, it doesn’t actually support dual PWM. I think that was dead code inherited from an earlier project, and was never fully removed.

No, there aren’t enough pins for dual PWM and two indicator LEDs and an e-switch. After RESET, GND, VCC, and voltage sense, there are only four pins left. You could use RESET for something, but then you would need a high-voltage flashing tool to re-flash it.

No, Baton (and Ferrero Rocher) doesn’t remember the mode after the power is cut. This is really the only thing keeping it from being usable for a dual-switch light. Well, that, and it doesn’t immediately turn on when power is connected.

No, I don’t think anyone on BLF has multi-plexed multiple color LEDs onto fewer pins. However, the Noctigon Meteor does it that way.

I seem to recall that Mike C did some interesting things with using a single pin for multiple purposes. The results were somewhat vague though, and no code has been posted.

The Ferrero Rocher code only displays three levels — green, green+red, and red. The voltage boundaries for each can be configured. I’ve noticed that it tends to display more fine-grained status though, by flickering from green to green+red at a rate proportional to the voltage. Probably due to measurement noise, but it’s kind of nice so I haven’t really tried to fix it. It gives kind of a continuous blend during part of its range.

chouster
Offline
Last seen: 10 hours 46 min ago
Joined: 02/20/2014 - 15:05
Posts: 685
Location: germany

Ok, than it was me who didn’t understand what dual pwm is, sorry for that.

It seems like controlling two indicator-LEDs with one pin isn’t that hard to do, but it would require additional diodes if we wanted to controll a red and a green LED for example.

ToyKeeper
ToyKeeper's picture
Online
Last seen: 2 min 45 sec ago
Joined: 01/12/2013 - 14:40
Posts: 8243
Location: (469219) 2016 HO3

Tom E wrote:
if you need this mainly for testing firmware, my absolute best setup was using Richard’s SupFire M2-Z lights – cheap, simple, and use extra long LED wires so you can easy re-program. It fits a 22 mm driver — better still, because a 22 is easier to work with as well. Just wire up the switch and use the real switch – sooo much easier, nicer setup.

Sounds nice. It doesn’t like like RMM makes any 22mm FET+1 drivers though.

The FET+1 I’ve been using for clicky-switch development has a place to add an e-switch wire, and I’ve got a switch to hook up… the pad is awfully tiny though. I’ll have to see if I can possibly find a tiny wire and get it connected without blocking SOIC8 clip access… It’s the little copper dot next to the “3” here:

It would be easier to use the OTC pads, but then I wouldn’t have an OTC… and that might be important for a dual-switch light.

Pages