Flashlight Firmware Repository

1943 posts / 0 new
Last post
ToyKeeper
ToyKeeper's picture
Offline
Last seen: 3 hours 31 min ago
Joined: 01/12/2013 - 14:40
Posts: 8256
Location: (469219) 2016 HO3

pilotdog68 wrote:
If I power the driver with the charger attached but not powered, it comes on in mode 2.
If I power the driver with charger also powered, it comes on in mode 3.

Yes, but… what happens if you power up the light without the charger attached? It needs to distinguish between either of these two…
  • Charger isn’t attached.
  • Charger is attached but not powered.

… and this:

  • Charger is attached and powered.

Earlier it sounded like “attached and powered” gave the same result as “not attached”, which isn’t very useful.

Given a way to distinguish those different states, making it change while on isn’t terribly difficult.

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

but the charger will always be attached…. When i say charger, I am referring to the X6R charging circuit, not the actual charging cord

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

Major Projects:  Illuminated Tailcap, TripleDown/TripleStack Driver

ToyKeeper
ToyKeeper's picture
Offline
Last seen: 3 hours 31 min ago
Joined: 01/12/2013 - 14:40
Posts: 8256
Location: (469219) 2016 HO3

… oh. Then that definitely makes things easier. Smile

Sometimes I over-complicate things.

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

I’ve spend a good few hours today playing with this trying different tweaks on different firmwares.

Best I go was tweaking MTN_momentary_temp so that if the temp sensor reads 255 then mode_idx = 0 when I had the if, else the wrong way round it would just set mode to 0 when ever I tried to change mode but when they were to correct way round I just got very odd mode changes.

Pastebin                                      &nbs

vestureofblood
vestureofblood's picture
Offline
Last seen: 2 hours 59 min ago
Joined: 08/17/2012 - 15:21
Posts: 1664
Location: Missouri

Hi TK,

Someone asked me to flash some micros for him with this firmware.
http://bazaar.launchpad.net/~toykeeper/flashlight-firmware/trunk/files/h...

His boards are not the FET+1 so my question is will this firmware work with a regular FET driver?

I was thinking maybe if  I disable the second channel and change the PWM values for the first?

Or is it more complicated than than?

In Him (Jesus Christ) was life; and the life was the light of men. And the light shineth in darkness; and the darkness comprehended it not.
http://asflashlights.com/ Everyday Carry Flashlights, plus Upgrades for Maglite.

ToyKeeper
ToyKeeper's picture
Offline
Last seen: 3 hours 31 min ago
Joined: 01/12/2013 - 14:40
Posts: 8256
Location: (469219) 2016 HO3

It should work on a FET-only driver if you disable moon and replace all the 7135 modes with FET modes and recalculate the levels and recalibrate the OTC and voltage values.

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

I have been making some progress with this Pin3 turn off. The code here turns the light off when the usb cable is connected. Smile

It does have a bug tho. Once it’s turned the light off and you unplug the charger cable it will allow you to change modes then turn off again after .5s

EDIT: Made one last tweak and now it works!!! Code HERE

I’ve added an extra beacon mode, very long press to activate.

But hey it’s getting there. (BTW voltage monitoring is switched off atm so I know its not interfering with turning off ect…)

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

Sweeeet. I’m excited to try it this afternoon. When you unplug the cable, does it automatically come on, or do you need to press switch?

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 2 weeks ago
Joined: 03/21/2013 - 08:18
Posts: 432
Location: UK

press switch and it comes back on. Sometimes it needs a moment to check its unplugged but i think if we just reduce the ticks it will be ok.

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

pyro1son wrote:
I have been making some progress with this Pin3 turn off. The code here turns the light off when the usb cable is connected. Smile

It does have a bug tho. Once it’s turned the light off and you unplug the charger cable it will allow you to change modes then turn off again after .5s

EDIT: Made one last tweak and now it works!!! Code HERE

I’ve added an extra beacon mode, very long press to activate.

But hey it’s getting there. (BTW voltage monitoring is switched off atm so I know its not interfering with turning off ect…)

hmm did you try it with or without a resistor on pin3?

I flashed the one in the second link above and it isn’t reacting to the charger cord. I do have a resistor on it.

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 2 weeks ago
Joined: 03/21/2013 - 08:18
Posts: 432
Location: UK

I’m using a 4.3v zener

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 see you retained a lot of the temp monitoring code. I wonder if we can clean it up so that it’s essentially “If it’s connected, off. If it isn’t connected, on” (as it is now, I have no idea what’s actually going on in that code :bigsmile: )

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 2 weeks ago
Joined: 03/21/2013 - 08:18
Posts: 432
Location: UK

I’ve tried to strip lots out but I kept loosing the functionality. Maybe somebody else might have better luck. If it’s not working you should only need to reduce the charger high and low values to lower ones.
I’ll have another go at reducing the code during the week, I’m just glad I got it to work.

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
Beer yep well done. glad it is working for you. I have a few things to work on before it fits my usage. I’m hoping TK get’s a chance to look at it when her X6R arrives

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 2 weeks ago
Joined: 03/21/2013 - 08:18
Posts: 432
Location: UK

Yeh, I’m sure that she’ll be able to clean it up a bit and polish it off.

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

pyro1son wrote:
. If it’s not working you should only need to reduce the charger high and low values to lower ones.

I must be going insane. I’ve tried a wide range of values with no love.

I’m to the point where I would pay someone to just get this FW working for me as a whole.

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

Major Projects:  Illuminated Tailcap, TripleDown/TripleStack Driver

ToyKeeper
ToyKeeper's picture
Offline
Last seen: 3 hours 31 min ago
Joined: 01/12/2013 - 14:40
Posts: 8256
Location: (469219) 2016 HO3

I haven’t ordered a X6R yet or the driver / parts to upgrade it, but I might be able to get something working anyway.

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:
I haven’t ordered a X6R yet or the driver / parts to upgrade it, but I might be able to get something working anyway.

You have no idea how appreciative I would be. I was hoping to have this light ready for my grandfather’s birthday… That was yesterday. Oops.

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 2 weeks ago
Joined: 03/21/2013 - 08:18
Posts: 432
Location: UK

Wonder why it’s not working for you? Have you tried bypassing the resistor? I’m sure what ever TK comes up with will be much more elegant that what I have.

Pastebin                                      &nbs

vestureofblood
vestureofblood's picture
Offline
Last seen: 2 hours 59 min ago
Joined: 08/17/2012 - 15:21
Posts: 1664
Location: Missouri

Its mystery time again gangCool

I am using JCs dual switch firmware.   I did use this once before without issue in a 12V setup and it was fine.   However not so much today.

I flashed a FET driver with it today and changed only the modes and turbo time length.     But the driver will randomly change modes.    Always in the upward direction.    It can be sitting still on the work bench on low for example, and in a few seconds will jump to the next mode or possibly even bounce a couple in a row.

Other than that it works perfectly.   Stays in the same mode when power is disconnected, and switches like normal when the e switch pin is grounded ( I just touch the wire to ground for now there is not actual switch).

At first I thought bad connection so I redid them all.   This did not effect it at all so I thought bad driver.    Nope.   New driver same exact result.   


Anyone care to wager a guess?

In Him (Jesus Christ) was life; and the life was the light of men. And the light shineth in darkness; and the darkness comprehended it not.
http://asflashlights.com/ Everyday Carry Flashlights, plus Upgrades for Maglite.

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

I have tried to slim the firmware down, removing extra parts of the temp mon code and the low_to_high (as we can go either way with the switch) then got carried away adding features I’d like and Attiny25 support.
I will try and get a slimmed down version with just modes and for an Attiny13A

EDIT:
Lightweight version here
I will test later tonight confirm it works.

Pastebin                                      &nbs

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

Been testing needs more work not 100% yet. Lightweight version doesn’t work.

Pastebin                                      &nbs

vestureofblood
vestureofblood's picture
Offline
Last seen: 2 hours 59 min ago
Joined: 08/17/2012 - 15:21
Posts: 1664
Location: Missouri

vestureofblood wrote:

Its mystery time again gangCool

I am using JCs dual switch firmware.   I did use this once before without issue in a 12V setup and it was fine.   However not so much today.

I flashed a FET driver with it today and changed only the modes and turbo time length.     But the driver will randomly change modes.    Always in the upward direction.    It can be sitting still on the work bench on low for example, and in a few seconds will jump to the next mode or possibly even bounce a couple in a row.

Other than that it works perfectly.   Stays in the same mode when power is disconnected, and switches like normal when the e switch pin is grounded ( I just touch the wire to ground for now there is not actual switch).

At first I thought bad connection so I redid them all.   This did not effect it at all so I thought bad driver.    Nope.   New driver same exact result.   


Anyone care to wager a guess?




At this point if someone even had a wild guess I'd entertain the thought Smile

In Him (Jesus Christ) was life; and the life was the light of men. And the light shineth in darkness; and the darkness comprehended it not.
http://asflashlights.com/ Everyday Carry Flashlights, plus Upgrades for Maglite.

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

There is a feature in the voltage monitoring to increase mode is the volts bounce back up. Something might be wrong there.

Pastebin                                      &nbs

ohaya
Offline
Last seen: 7 months 2 weeks ago
Joined: 03/16/2013 - 19:01
Posts: 5337
Location: US
vestureofblood wrote:

vestureofblood wrote:

Its mystery time again gangCool

I am using JCs dual switch firmware.   I did use this once before without issue in a 12V setup and it was fine.   However not so much today.

I flashed a FET driver with it today and changed only the modes and turbo time length.     But the driver will randomly change modes.    Always in the upward direction.    It can be sitting still on the work bench on low for example, and in a few seconds will jump to the next mode or possibly even bounce a couple in a row.

Other than that it works perfectly.   Stays in the same mode when power is disconnected, and switches like normal when the e switch pin is grounded ( I just touch the wire to ground for now there is not actual switch).

At first I thought bad connection so I redid them all.   This did not effect it at all so I thought bad driver.    Nope.   New driver same exact result.   


Anyone care to wager a guess?




At this point if someone even had a wild guess I’d entertain the thought Smile

Was the original version of the firmware working before you changed it? In other words, did you try flashing the original unmodified version of the firmware and test that before you modified it and re-flashed it? And if so when you tested the unmodified version did that work?

If so, try re-flashing with the unmodified version again and see if it works again.

If not, then maybe there’s something wrong or incompatible with the original version?

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

pyro1son wrote:
Been testing needs more work not 100% yet. Lightweight version doesn’t work.

Any further progress?

I finally found work (yay) so I’ve been busy this week and haven’t had time to work on it anymore

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 2 weeks ago
Joined: 03/21/2013 - 08:18
Posts: 432
Location: UK

Still not 100% I’ve got rid of extra bits and the turn off function works beautifully but when you unplug and try to turn it back on sometimes it will shut off after a second but if left for 6 ish seconds it works perfectly just need to get the turn back on function tweaked. I’ve just been really busy with work this week and trying to get some outstanding builds done. (Red S2+, MTG2 Mag and MTG2 MT40) I’ll keep playing with it after the weekend.

Pastebin                                      &nbs

ohaya
Offline
Last seen: 7 months 2 weeks ago
Joined: 03/16/2013 - 19:01
Posts: 5337
Location: US

pilotdog68 wrote:
pyro1son wrote:
Been testing needs more work not 100% yet. Lightweight version doesn’t work.

Any further progress?

I finally found work (yay) so I’ve been busy this week and haven’t had time to work on it anymore

When you say “I finally found work (yay)”, did you mean you just got a new job? If so, congrats!!!

Jim

ReManG
Offline
Last seen: 1 month 5 days ago
Joined: 04/25/2015 - 22:52
Posts: 2540
Location: Between the Mexico's

Is this a good program for flashing?

AVRDUDESS

It looks good to me, but most of this is still martian at my level of understanding…

I have been playing with it a bit, but not flashed anything yet…

I would appreciate more experienced “flashers” opinion.

ALL of my links are non-affiliated for your pleasure...

My Reviews

Lithium Ion Battery Safety 101

 

ToyKeeper
ToyKeeper's picture
Offline
Last seen: 3 hours 31 min ago
Joined: 01/12/2013 - 14:40
Posts: 8256
Location: (469219) 2016 HO3

Looks fine to me, a GUI wrapper for avrdude. I can’t really say much about GUIs or Windows or OSX though, since I don’t use them. Perhaps someone else has thoughts? Does AVR Studio have avrdude stuff built in?

My typical development session looks about like this:

tk  home : ~/> cd src/torches/sandbox/ToyKeeper/foo
tk  home : foo/> gvim foo.c
tk  home : foo/> ../../bin/build.sh foo
tk  home : foo/> ../../bin/flash.sh foo.hex
tk  home : foo/> ../../bin/build.sh foo
tk  home : foo/> ../../bin/flash.sh foo.hex
tk  home : foo/> ../../bin/build.sh foo
tk  home : foo/> ../../bin/flash.sh foo.hex
...

Except I don’t have to type most of that. The tab key auto-completes a lot of things, and the repeated commands at the end are simply “up, up, enter”. And I left out the revision control commands, but I recommend using bzr or git if you want to do much serious development.

Pages