Flashlight Firmware Repository

2161 posts / 0 new
Last post
ToyKeeper
ToyKeeper's picture
Offline
Last seen: 4 hours 5 min ago
Joined: 01/12/2013 - 14:40
Posts: 10107
Location: (469219) 2016 HO3

chouster wrote:
Finally I’ve been able to get a hex file, but it’s 2685 bytes.

The hex file size isn’t so important; it’s the size of what the hex file represents.

I have .hex files at 2893 bytes which still fit. When I run avr-size on it, it tells me how big the file actually is, and that limit can go up to 1024 bytes. I’m not sure where to get the avr-size data in Atmel Studio though.

chouster
Offline
Last seen: 1 week 3 days ago
Joined: 02/20/2014 - 15:05
Posts: 690
Location: germany

Thank you very much, Toykeeper.

jhalb
jhalb's picture
Offline
Last seen: 2 years 8 months ago
Joined: 03/23/2015 - 21:24
Posts: 1350
Location: California

http://budgetlightforum.com/node/29081

The pictures are broken but I think you get the idea. Way back when I started programming these 13a's these instructions worked for me on 6.x.

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

Hey TK (or anyone else)

In blf-a6, how do I get the tactical strobe into the main loop? I see it is given 253 as a convenience code, but I can’t see anywhere that it’s actually used?

Can I just transplant the code I’ve used in STAR_OT?

//mode_idx==254 is the Strobe Mode if (modes[mode_idx]==254) { while (1) { PWM_LVL = 255; _delay_ms(50); PWM_LVL=0; _delay_ms(175);

Edit: Just gave it a try, all it takes is to put the convenience code into the normal mode order. easy as pie. Now i feel silly for flapping my lips before switching on my iron. Oops

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

Major Projects:  Illuminated Tailcap, TripleDown/TripleStack Driver

vestureofblood
vestureofblood's picture
Offline
Last seen: 1 day 8 hours ago
Joined: 08/17/2012 - 15:21
Posts: 1840
Location: Missouri

Hi TK,

 I decided to take your advice about using the FET + 7135 driver to get the super low mode I want with an XHP setup ( parts are on the way)

What I am wandering now is will I be able to tweak the Star_off_time code to get what I want out of that?

I see that there is a line of code there to enable a second PWM ( line 86)

//#define DUAL_PWM_START 8 // Above what output level should we switch from the alternate PWM output to both PWM outputs?


What else would I need to do to get this rolling with the dual?

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.

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

Not sure what you and TK talked about, but that’s all that’s needed.

As it sits, and modes under pwm level 8 will use the 7135 channel only, and anything above 8 will use both the 7135 and the FET. (you’ll need to un-comment it [remove the // ])

Is that what you were asking?

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

Major Projects:  Illuminated Tailcap, TripleDown/TripleStack Driver

ImA4Wheelr
Offline
Last seen: 3 weeks 4 days ago
Joined: 02/03/2013 - 14:51
Posts: 7918
Location: SC

^ I think 255 is FET only too with the "stock" code.

EDIT: Sorry, my above response is incorrect.  I was thinking about Phase vs Fast.  Phase being used for the first and highest modes.

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

pilotdog68 wrote:
In blf-a6, how do I get the tactical strobe into the main loop? I see it is given 253 as a convenience code, but I can’t see anywhere that it’s actually used?

To get it into the main loop, add “STROBE” or 253 to the main channel in one of the two mode groups, and make the other entries longer too. For example, adding it to the end of the second mode group:

#define NUM_MODES2 5
#define MODESNx2 0,0,79,255,STROBE
#define MODES1×2 20,200,255,0,0
#define MODES_PWM2 FAST,FAST,FAST,PHASE,PHASE

pilotdog68 wrote:
Can I just transplant the code I’ve used in STAR_OT?

//mode_idx==254 is the Strobe Mode if (modes[mode_idx]==254) { while (1) { PWM_LVL = 255; _delay_ms(50); PWM_LVL=0; _delay_ms(175);


I think that looks about right, but I haven’t tried it.
ToyKeeper
ToyKeeper's picture
Offline
Last seen: 4 hours 5 min ago
Joined: 01/12/2013 - 14:40
Posts: 10107
Location: (469219) 2016 HO3
vestureofblood wrote:

Hi TK,

 I decided to take your advice about using the FET + 7135 driver to get the super low mode I want with an XHP setup ( parts are on the way)

What I am wandering now is will I be able to tweak the Star_off_time code to get what I want out of that?

I see that there is a line of code there to enable a second PWM ( line 86)

<span class="pyg-c1">//#define DUAL_PWM_START 8 // Above what output level should we switch from the alternate PWM output to both PWM outputs?<br><br><br><span style="font-size: medium;">What else would I need to do to get this rolling with the dual?</span><br></span>

FWIW, I haven’t tried a single 7135 chip on a XHP or MT-G2 or other higher-voltage higher-output emitter. I’m not sure what to expect from it.

As for tweaking Star_off_time, any code can be modified to do pretty much anything. It depends on how much you’re willing to modify it.

By default, Star_off_time uses the same PWM level for both the FET and the 7135 simultaneously, unless the level is below the threshold you quoted above. In that case, it’ll use only the 7135 by itself. Tying the two together makes it simple, but it also means you have less control over each channel individually — it won’t let you ramp up the 7135 alone then turn on the FET only when needed; instead the 7135 and FET will both be active and have a fixed ratio of how much power each one contributes to the whole.

However, if you were going to have a lot of mode groups, the joint-PWM approach only needs to store one number instead of two, so it cuts the storage needs in half.

ImA4Wheelr
Offline
Last seen: 3 weeks 4 days ago
Joined: 02/03/2013 - 14:51
Posts: 7918
Location: SC

I just built a quick dual channel driver using an old DD only driver.  Loaded it with BLF-A6 unmodified.  It doesn't do anything but Moon Light Mode with the OTC in place.  It works fine without the OTC in place.

Is that the way this FW is supposed to work stock?

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

ImA4Wheelr wrote:

I just built a quick dual channel driver using an old DD only driver.  Loaded it with BLF-A6 unmodified.  It doesn’t do anything but Moon Light Mode with the OTC in place.  It works fine without the OTC in place.

Is that the way this FW is supposed to work stock?


Nope.

Sounds like the OTC calibration is way off. You can get OTC values by flashing battcheck/offtime-cap.hex and then pressing the button for the length of time you want it to use. It should then blink out the OTC value for that amount of time, which can be plugged back into other firmwares. Similar story for voltage calibration, only using battcheck.hex instead.

ImA4Wheelr
Offline
Last seen: 3 weeks 4 days ago
Joined: 02/03/2013 - 14:51
Posts: 7918
Location: SC

^ Thank you TK.  You must have one of the deepest knowledge bases on BLF in that brain of yours.

Unfortunately, my mod put an AMC7135 on top of the MCU with some wires.  Now that I know the QTC is required, I'll first investigate the 1uf Cap.  Maybe it was shorted or something.  If that doesn't fix the issue, I'll follow your above advice.

Much appreciated Smile

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

Maybe it’s just me, but one of my modding rules is to always make sure the MCU will be accessible (with no extra pins grounded) so I can reflash it later. I reflash pretty much everything from time to time, and I generally expect that I’ll need to flash each one a few times to get the calibration right. There’s always something a little off, whether it’s the PWM level for moon or the OTC timings or the voltage levels or … whatever.

ImA4Wheelr
Offline
Last seen: 3 weeks 4 days ago
Joined: 02/03/2013 - 14:51
Posts: 7918
Location: SC

^ That's a very good rule.  I just didn't want to wait for the OSH Park DD +7135 boards to arrive.  No matter what, I had to solder a wire to at least one of the MCU pins and it was late last night.  But you have me thinking that I need to move the 7135 over to the top of the FET.

I have to give you a huge thumbs up TK.  I just read much of the parts of this thread that deal with BLF-A6.  Wow!  Really impressive all the functionality and performance.  And that UI diagram.  I absolutely love that.  It really helped me understand the UI.  And what an impressive UI it is.  Really excited about this new direction wight and you have opened up.  Thank you.

vestureofblood
vestureofblood's picture
Offline
Last seen: 1 day 8 hours ago
Joined: 08/17/2012 - 15:21
Posts: 1840
Location: Missouri

Hey all,

Is there a way to power more than one LED separately  using an FET driver and code.

What I mean is this.   I am working on a head lamp for a guy that has the one main led that is white.   And another LED that is red.    His setup now is manual through a multi poll switch and a pile of resistors.     Is it possible to get both LEDs included  using a momentary switch and FET driver?

Thanks

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.

Tom E
Tom E's picture
Offline
Last seen: 17 hours 10 min ago
Joined: 08/19/2012 - 08:23
Posts: 12408
Location: LI NY

For two channels of output w/ATTiny13A, yes - we do that now with the FET+1 7135 drivers, accept the 7135 output goes to the same LED+ pad as the FET -- if you separate those outputs, they can drive 2 different LED's. For a 3rd channel, little more tricky - actually I don't think you can PWM on a 3rd channel, but for the 2 channels the FET+1 drivers support, PWM's work great per channel. For 3 PWM outputs, I believe the PIC MCU's are a better choice, as C_K used.

So, you could driver 2 banks of 7135's, or 2 FET's, or the combo as the stock BLF wight FET+1 drivers do. It's all a matter of wiring the outputs.

Hope someone can confirm or clarify this - think I'm wight right Smile.

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

You’re right. A few people have done it, including myself. Wight even made a driver specifically for driving white and secondary red led’s. (although that driver is a royal pain)

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

Major Projects:  Illuminated Tailcap, TripleDown/TripleStack Driver

ImA4Wheelr
Offline
Last seen: 3 weeks 4 days ago
Joined: 02/03/2013 - 14:51
Posts: 7918
Location: SC

Update on the problem I mentioned about.  Got it working better, but still weird by doing the following (I don't know which change mattered):

  • Used a different new 1uf Cap
  • Relocated the 7135 to the top of the FET
  • Removed the solder to ground on Star 3

Now I can go up through the modes, but not down.  It always goes into configuration mode when I switch connect the cell.  Meaning, I connect the cell, there is a delay, then the 2 short flashes for 7/4 mode groups, another pause, then the 2 flashes for memory, another pause, then moonlight mode turns on.  I can click between the first 2 flashes to pick the other mode group and that works.  I can't seem to get memory to work.

I'll try to run battcheck/offtime-cap.hex as TK recommended sometime soon, but reported the above in case it means something to anyone.

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

That sounds annoying to deal with.

The only way it should be able to enter config mode is if the OTC reads out a short press and the “fast_presses” value has its 0×10 bit set. This shouldn’t happen on “first boot” unless your OTC values are way, way off and you’re unlucky enough to have the RAM decayed into an unfavorable state.

You might want to try uncommenting this line and rebuilding:
if (fast_presses > 0x20) { fast_presses = 0; }

This will make it reset the counter if it appears to have decayed, which should prevent the immediate config mode. However, you’ll still need to fix the OTC if you want to access hidden modes or be able to move backward.

It sounds like your OTC must be always reading 255 no matter how long it has been off. This is likely a hardware problem, not just a matter of calibrating the software. This issue would also interfere with the mode memory function, since that’s only used on a long press (and it seems you can only get short presses).

In case you have trouble building it, I put up a custom build here:
http://toykeeper.net/torches/blf-a6/otc-fail-workaround.hex

ImA4Wheelr
Offline
Last seen: 3 weeks 4 days ago
Joined: 02/03/2013 - 14:51
Posts: 7918
Location: SC

^ I'm leaning towards hardware problem too.  I probably won't get a chance to work on the driver until this weekend.  I'll follow your advice and report back hopefully this weekend.

Thanks again for taking the time to share your thoughts on matter. Smile

EDIT: It just occurred to me that I tested the driver (in all cases) right after doing solder work (including soldering the OTC).  So the driver was probably quite warm.  I understand from some the posts that temp is currently presenting a challenge with this driver/FW.  I will try the driver out again tonight while it is normal room temp.

pyro1son
pyro1son's picture
Offline
Last seen: 6 months 1 week ago
Joined: 03/21/2013 - 08:18
Posts: 432
Location: UK
pilotdog68 wrote:
You’re right. A few people have done it, including myself. Wight even made a driver specifically for driving white and secondary red led’s. (although that driver is a royal pain)

I second that! Results are amazing, but the work is a nightmare

Pastebin                                      &nbs

Tom E
Tom E's picture
Offline
Last seen: 17 hours 10 min ago
Joined: 08/19/2012 - 08:23
Posts: 12408
Location: LI NY

Got a link for this driver? Not familiar with it (thought I knew all the wight drivers -- big fan!).

Ooops, here for the 2 output driver board: http://budgetlightforum.com/node/37686

 

18sixfifty
18sixfifty's picture
Offline
Last seen: 1 month 2 weeks ago
Joined: 12/25/2012 - 20:19
Posts: 4161

Just starting to get back to modding after I had my shoulder operated on and trying to catch up. Wow you guys move fast.!!

Anyone have a VERY basic program with a hidden strobe, like a minidvr with strobe? How about something simple that starts on high? I see the one that can start on high set up for “stars” but I’m talking about something for a basic FET driver.

I’m a junky, I mod lights so I can sell lights so I can buy more light to mod so I can sell lights to buy more lights to mod.

Tom E
Tom E's picture
Offline
Last seen: 17 hours 10 min ago
Joined: 08/19/2012 - 08:23
Posts: 12408
Location: LI NY

I don't have anything very basic... Smile

I got a somewhat hidden strobe in a e-switch driver: click for ON to 1st mode or next mode, hold for prev mode, long hold for strobe. Once a mode is set for ~1.2 secs, next click turns the light OFF. My favorite modes for this driver is 5, including a moonlight as the 1st.

n10sivern
n10sivern's picture
Offline
Last seen: 1 day 18 hours ago
Joined: 11/09/2014 - 21:37
Posts: 1520
Location: biloxi, ms

A little while ago I asked about a single mode program with LVP. Nobody really had one. Could the standard nlite program just be modified so that each mode is 100%?

Three tomatoes are walking down the street- a poppa tomato, a momma tomato, and a little baby tomato. Baby tomato starts lagging behind. Poppa tomato gets angry, goes over to the baby tomato, and smooches him… and says, Catch up.

ImA4Wheelr
Offline
Last seen: 3 weeks 4 days ago
Joined: 02/03/2013 - 14:51
Posts: 7918
Location: SC

^ That (Tom E's post above) is absolutely my favorite momentary switch FW Tom.  I use it in all my momentary lights (which is slowly becoming all of them). 

Do you think you could make a variation that doesn't turn off?

It would force lock out to turn off.  Most of buck drivers and zenier DD's have pretty bad parasitic drain.

18sixfifty
18sixfifty's picture
Offline
Last seen: 1 month 2 weeks ago
Joined: 12/25/2012 - 20:19
Posts: 4161
Tom E wrote:

I don’t have anything very basic… Smile

I got a somewhat hidden strobe in a e-switch driver: click for ON to 1st mode or next mode, hold for prev mode, long hold for strobe. Once a mode is set for ~1.2 secs, next click turns the light OFF. My favorite modes for this driver is 5, including a moonlight as the 1st.

Yep I have used that one and it’s great thanks. Anyway I can make that work on a clicky light?

I’m a junky, I mod lights so I can sell lights so I can buy more light to mod so I can sell lights to buy more lights to mod.

chouster
Offline
Last seen: 1 week 3 days ago
Joined: 02/20/2014 - 15:05
Posts: 690
Location: germany
n10sivern wrote:
A little while ago I asked about a single mode program with LVP. Nobody really had one. Could the standard nlite program just be modified so that each mode is 100%?

Toykeeper has a STAR_1mode firmware in her repository.

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

ImA4Wheelr wrote:
EDIT: It just occurred to me that I tested the driver (in all cases) right after doing solder work (including soldering the OTC).  So the driver was probably quite warm.  I understand from some the posts that temp is currently presenting a challenge with this driver/FW.  I will try the driver out again tonight while it is normal room temp.

I doubt the temperature is the issue. Being hot makes the timings shorter, so it should be easier to get med/long presses while hot and harder to get short presses. But you’re only getting short presses, and it sounds like it’s acting worse than it would if it was below freezing.

If you used 1912 and 4701 resistors, the temperature sensitivity is greatly reduced. 22k and 4701 is where the temperature issue happens.

Anyway, if you can’t get the OTC to show different values for different off-times, the only options are the mem-decay/noinit method or on-time.

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

18sixfifty wrote:
Anyone have a VERY basic program with a hidden strobe, like a minidvr with strobe? How about something simple that starts on high? I see the one that can start on high set up for “stars” but I’m talking about something for a basic FET driver.

You might be able to get a STAR variant to do it… depends on how much code you’re willing to change, and how you define “hidden”.

For example, you could do an offtime-based driver which goes H/M/L/H/M/L/strobe (like EagleTac does), or go with _the_'s approach where on-time will reset the normal mode loop after it has been on a while. So, you could loop H/M/L over and over as much as you like, as long as you pause at least once per cycle to let it reset. The only way to move past it is to go through the cycle twice quickly.

Pages