Flashlight Firmware Repository

2123 posts / 0 new
Last post
pilotdog68
pilotdog68's picture
Offline
Last seen: 1 week 6 days ago
Joined: 05/30/2013 - 23:31
Posts: 6420
Location: Held against my will in IOWA, USA

So PWM 2, or ramp 2 so PWM4 ?

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

Major Projects:  Illuminated Tailcap, TripleDown/TripleStack Driver

Tom E
Tom E's picture
Offline
Last seen: 35 min 2 sec ago
Joined: 08/19/2012 - 08:23
Posts: 12332
Location: LI NY

pilotdog68 wrote:
So PWM 2, or ramp 2 so PWM4 ?

It's used as a parameter to set_level(), so it's an index into the ramping tables, not a PWM value direct.

Also, it's used in the function toggle(), where its multiplied by 3/4, resulting in a value of only 1! So, in one case it's a ramping level of 2, another case it's a ramping level of 1.

 

Ok, think I see what's goin on, and why you are seeing 3 modes. You are using mode group 8, and you have it configured as follows:

RAMP,BATTCHECK,6,ONE7135,TURBO,0,0,0,  // 8: special group B

So, the first 2 modes are accessible thru reverse navigation, therefore your first mode should be level 6, the ONE7135 is your 2nd, and TURBO your third mode.

TURBO is defined as max FET.

So, you should see levels 6, 4 then 10, but you are describing/measuring what appears to be 5, 6, then 10? Maybe?

 

 

pilotdog68
pilotdog68's picture
Offline
Last seen: 1 week 6 days ago
Joined: 05/30/2013 - 23:31
Posts: 6420
Location: Held against my will in IOWA, USA

Are we sure moon is just ramp level 1? Because I have tried multiple LEDs and they should be lighting up at PWM 3, but I’m getting nothing.

edit: I think the firmware is working fine. The issues I’m having seem to involve the differences between the 13a vs 25, made worse by my not having any 350ma 7135’s on hand

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

Major Projects:  Illuminated Tailcap, TripleDown/TripleStack Driver

Tom E
Tom E's picture
Offline
Last seen: 35 min 2 sec ago
Joined: 08/19/2012 - 08:23
Posts: 12332
Location: LI NY

Yea, in the function count_modes(), if you have moon mode enabled, it adds it as level 1.

Yea, I'm always using 350's now - you would not believe when I'm seeing using PWM value of 1 with these 350's - amaz'n the LED lights up, but oh so very very low... Not sure if this is only working with our new driver design - DEL's changes, or not.

pilotdog68
pilotdog68's picture
Offline
Last seen: 1 week 6 days ago
Joined: 05/30/2013 - 23:31
Posts: 6420
Location: Held against my will in IOWA, USA

Well the same driver (with 380’s) was perfect at PWM 3 on the 13a, it even lit up at PWM 2. But with the 25 it takes PWM 5 just to light up, a more usable level at PWM 6.

………………

Can I change the order of programming mode?

I want:
1. Muggle
2. Mode group
3. Memory
4. moon
5. Temp Cal
6. medium press
7. Mode order
8. Reset

edit: figured it out. I think I’m finally happy with it. With all of 2 mode groups! Party

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

Major Projects:  Illuminated Tailcap, TripleDown/TripleStack Driver

Texas_Ace
Texas_Ace's picture
Offline
Last seen: 5 hours 38 min ago
Joined: 03/24/2016 - 07:44
Posts: 8537
Location: Everything is brighter in Texas

Odd, I also get it to light up fine with PWM 2 on the tripledown, I only use 350 7135’s, never saw the point to the 380’s honestly. Twice the price for an extra 30ma?

Maybe it is the stacked design?

pilotdog68
pilotdog68's picture
Offline
Last seen: 1 week 6 days ago
Joined: 05/30/2013 - 23:31
Posts: 6420
Location: Held against my will in IOWA, USA

it was working fine on this exact driver with 3pwm. All I did was swap the MCU. Maybe it’s the fuses I’m using? Regardless, I get the same exact light from 6pwm,so I’m not worried too much.

I’ve got a normal mode group, a blinky group, and I’ve changed muggle mode to be charging mode on the X2R. It just shuts off the LED so I can charge next to my bed

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

Major Projects:  Illuminated Tailcap, TripleDown/TripleStack Driver

Texas_Ace
Texas_Ace's picture
Offline
Last seen: 5 hours 38 min ago
Joined: 03/24/2016 - 07:44
Posts: 8537
Location: Everything is brighter in Texas

You might try reflowing the MCU real quick, sometimes the solder joint is just not quite right. I have had many times where I chase a problem only to eventually touch a soldering iron to the part and then it suddenly works, even though the joint looked perfect to start out with.

pilotdog68
pilotdog68's picture
Offline
Last seen: 1 week 6 days ago
Joined: 05/30/2013 - 23:31
Posts: 6420
Location: Held against my will in IOWA, USA

Its giving me the same light as before, and pulling the same amps as before, it just takes a higher pwm number. So it’s not a problem, just took a while to figure out.

What’s the best way to get temp monitoring working well? Pot the MCU to the bottom of the emitter shelf? It’s throttling up and down too much

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

Major Projects:  Illuminated Tailcap, TripleDown/TripleStack Driver

Texas_Ace
Texas_Ace's picture
Offline
Last seen: 5 hours 38 min ago
Joined: 03/24/2016 - 07:44
Posts: 8537
Location: Everything is brighter in Texas

pilotdog68 wrote:
Its giving me the same light as before, and pulling the same amps as before, it just takes a higher pwm number. So it’s not a problem, just took a while to figure out.

What’s the best way to get temp monitoring working well? Pot the MCU to the bottom of the emitter shelf? It’s throttling up and down too much

Yeah, I have used those silicone cubes to make direct contact with the pill and that works well but the best thing is to adjust the time between adjustments, it is setup for ~8 seconds IIRC, you can extend that to keep it from adjusting it as much. Also calibrate the temp and/or set the temp correctly in the firmware.

pilotdog68
pilotdog68's picture
Offline
Last seen: 1 week 6 days ago
Joined: 05/30/2013 - 23:31
Posts: 6420
Location: Held against my will in IOWA, USA

Yeah I calibrated it in the firmware to where I couldn’t hold on to the head anymore, but then if I let it cool and just turn it on in 1amp mode, it still steps down even though it isn’t hot on the outside.

So I re-calibrated it to the point where it was uncomfortably hot all the way at the tail end of the battery tube, and that seems to be working better now.

I made muggle mode into basically a “soft-off” to use when charging the X2R. That and the batt-check mode that flashes volts and tenths is really nice to have in a rechargeable light.

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

Major Projects:  Illuminated Tailcap, TripleDown/TripleStack Driver

Texas_Ace
Texas_Ace's picture
Offline
Last seen: 5 hours 38 min ago
Joined: 03/24/2016 - 07:44
Posts: 8537
Location: Everything is brighter in Texas

Once you get the hang of bistro it leaves the A6 firmware in the dust IMHO. Far more options and features. I don’t use most of them but it is great to have them avalible so I can change the setup at any time without having to reflash firmware.

Texas_Ace
Texas_Ace's picture
Offline
Last seen: 5 hours 38 min ago
Joined: 03/24/2016 - 07:44
Posts: 8537
Location: Everything is brighter in Texas

I have been playing with bistro today, trying to get it setup just so for the tripledown drivers mode wise.

I did notice something today, how is the SOFT_START supposed to work? It is supposed to ramp to the next mode gradually correct? I even tried changing the comment so that the “slow ramp” was enabled but yet I don’t get any kind of ramping? It just jumps directly to the next mode.

I did notice that I seem to get a bright flash as it changes modes with soft start enabled. Without it enabled I still get a smaller flash in the lower modes but very little in the higher modes? I think this flash is because I am using a tripledown that doesn’t have the new components, I didn’t see the flash with the TA drivers. Although that doesn’t explain why it is worse with soft start enabled?

Now I don’t really care myself but was curious why it would not work?

pilotdog68
pilotdog68's picture
Offline
Last seen: 1 week 6 days ago
Joined: 05/30/2013 - 23:31
Posts: 6420
Location: Held against my will in IOWA, USA

Hey TK, what do you think of a dual-switch version of bistro-tripledown?

Basically everything is the same, except short and medium presses are performed on the side switch only, and the main power switch (clicky) only does on/off. That way if memory is enabled you can use a forward-clicky for signaling, etc.

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

Major Projects:  Illuminated Tailcap, TripleDown/TripleStack Driver

LightRider
LightRider's picture
Offline
Last seen: 1 year 6 months ago
Joined: 08/05/2015 - 09:52
Posts: 2007
Location: U.P. MI, USA

pilotdog68 wrote:
Hey TK, what do you think of a dual-switch version of bistro-tripledown?

Basically everything is the same, except short and medium presses are performed on the side switch only, and the main power switch (clicky) only does on/off. That way if memory is enabled you can use a forward-clicky for signaling, etc.

I like it!

pilotdog68
pilotdog68's picture
Offline
Last seen: 1 week 6 days ago
Joined: 05/30/2013 - 23:31
Posts: 6420
Location: Held against my will in IOWA, USA

You’d have to add code for the side switch, but you can get rid of the OTC code, so I’d think it would fit

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

Major Projects:  Illuminated Tailcap, TripleDown/TripleStack Driver

Serp
Serp's picture
Offline
Last seen: 1 month 3 weeks ago
Joined: 01/14/2014 - 11:29
Posts: 626
Location: Ukraine

#define RAMP_FET 1,10,42,75,122,133,255
Is it not too little difference between 122 and 133?
ok, it’s 20% and 35% (1, 4 groups)

Nanjg 105D 8*7135 (tiny13A) XML2 moonlight work only with #define RAMP_FET *2*,15,42,75,122,133,255

Texas_Ace
Texas_Ace's picture
Offline
Last seen: 5 hours 38 min ago
Joined: 03/24/2016 - 07:44
Posts: 8537
Location: Everything is brighter in Texas

As I was finishing working with my version of bistro, I was thinking, is it possible to make turbo an option in the menu? I started to try my hand at adding this but it looks like it needs code in so many different places (by looking at the moon mode options) I didn’t feel like trying to figure it all out.

With the triple channel drivers sometimes the regulated bank of 7135’s is simply all you need and there is no reason to use turbo. For example in one light I only get an extra ~300 lumens out of turbo at an extra 2 amps. It is simply not worth it. It would be nice to simply be able to remove or enable turbo from the menu vs having to make custom mode groups both with and without it.

Texas_Ace
Texas_Ace's picture
Offline
Last seen: 5 hours 38 min ago
Joined: 03/24/2016 - 07:44
Posts: 8537
Location: Everything is brighter in Texas

ToyKeeper wrote:
Texas_Ace wrote:
Strobe IS fun to play with due to the way people seem to go into stop motion on the other hand and the constant strobe does this better. I actually added a few different constant strobes to my version of bistro since I had some extra space left. Great way to have fun at night with kids!

My personal lights are usually loaded up with stop-motion strobes because I like the effect it has on moving water and other motions. I don’t generally include any tactical strobes at all.
Quote:
… safety of blinking headlights …
I picked a default bike mode based on what I liked, not based on actual research. If anyone has studies or polls showing that a different behavior would be better, I’d be happy to change it.

What settings are you using for stop motion strobe? I could not totally figure out how you were calculating the pulse timing into hz so I just used the 10hz strobe and then each of the tactical strobe timing by themselves. Have not had a chance to try them yet other then testing though.

Far as the bike mode goes, like I said, I am of the mind that the single flash bike strobe is both safer and easier on drivers while still getting their attention. A single flash doesn’t instantly bring to mind a cop (and the inevitable check of the speedo and driving conditions to see if he is after you). Plus you are not likely to stare at it which means there is less chance of hitting it.

I also have not science to back up my side, just my personal feelings based on being a driver. Another user also had some good points about the german laws as well.

As a bonus if you went to the single flash you would free up space for other features.

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

pilotdog68 wrote:
All I did was swap the MCU. … it just takes a higher pwm number.

The tiny25 runs at 8 MHz while the tiny13 runs anywhere from 3.6 to 4.4 MHz. So, to get the same pulse length it needs a PWM value about twice as high, at least on the lowest modes.

In both cases, it’s likely using phase-correct PWM to slow down the pulses by half, but that just means ~8 vs 15.6 kHz instead of ~16 vs 31.2 kHz.

So yes, it’s caused by swapping the MCU.

Also, if moon is on the third channel (pin 2 or 3), IIRC, the PWM speed is twice as fast again. So, it’d be running at 31.2 kHz. I never figured out how to slow down the 3rd and 4th PWM channels. But IIRC the driver puts the FET there, which should work out better since the FET can handle faster speeds and it eliminates whining sounds on the high modes.

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

Texas_Ace wrote:
how is the SOFT_START supposed to work? It is supposed to ramp to the next mode gradually correct? I even tried changing the comment so that the “slow ramp” was enabled but yet I don’t get any kind of ramping? It just jumps directly to the next mode.

I did notice that I seem to get a bright flash as it changes modes with soft start enabled. Without it enabled I still get a smaller flash in the lower modes but very little in the higher modes? I think this flash is because I am using a tripledown that doesn’t have the new components, I didn’t see the flash with the TA drivers. Although that doesn’t explain why it is worse with soft start enabled?


The soft start bit ramps quickly from the old mode (usually “off”) to the new mode, using a very crude decelerating curve. So, it moves quickly at first then slows down as it approaches the desired level. It does this by sliding along the ramp, so it only works with a pretty large ramp, like at least 40 values long. The code is optimized for size, not accuracy.

In general, soft start is only visible when turning the light on, when it ramps from off to whatever mode is selected, in something approximating a constant amount of time. This makes the ramp more visible on low modes because it moves slower. Soft transitions can also be seen on LVP step-down. The intent was to use it for all mode changes on an e-switch light, but I haven’t made e-switch code with it yet…

Anyway, some drivers have a preflash issue, visible when going from a high mode to a very low mode. This is entirely a hardware issue and can’t be solved in code. For bistro, it’ll be especially visible because of soft start, because every mode starts low. It should look like a very quick bright flash followed by the usual ramp-up. It only happens when the previous mode was pretty high, and only if the power was off for a short time. It’s by far the worst on high-amp triples and quads. I forget what exactly caused it, but it took the circuit folks around here a while to figure it out and eliminate it.

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

pilotdog68 wrote:
Hey TK, what do you think of a dual-switch version of bistro-tripledown?

The bistro code was initially designed with this in mind, but I haven’t actually done the rest yet…

Rewriting it to do everything with an e-switch would be a pretty big project though. Clicky switches and e-switches require very different code. I have a design in mind for an entirely new e-switch code base, intended as a foundation for others to build on, but haven’t really started on it yet. Have been talking about it for at least a year now and haven’t done it.

The basic idea is to build a flexible “finite state machine” driven by an event parser and callback system. People would create new interfaces mostly by putting data into a big table describing the various states, event types, and state changes. Basically, build a flowchart of the interface you want, and dump the flowchart into table form. Plug in small custom functions here and there as necessary, or some useful defaults will be provided too.

Once I have the code base working, the actual interfaces should be relatively simple without the need to write much (if any) logic code. Instead you’d just define a bunch of data in tables. Each position on a flowchart is a state, each arrow is a state change, and the label on the arrow is the event type. You define the states, changes, and events.

I don’t know what kind of MCU it will require, but probably a tiny25 or bigger.

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

Serp wrote:
#define RAMP_FET 1,10,42,75,122,133,255
Nanjg 105D 8*7135 (tiny13A) XML2 moonlight work only with #define RAMP_FET *2*,15,42,75,122,133,255

That’s weird. A 8×7135 Nanjg 105D is what I used to create and test the code, and what Convoy is using in the new C8. I tried a few and they all worked, then tried the 3×7135 and 4×7135 and 6×7135 versions which also worked.

Did you change anything else in the code? That 1/255 value should be running at 1 kHz instead of 16 kHz, meaning it’s actually on for 16 clock cycles per pulse. (or was it 2 kHz? I should really measure it) Then the 15/255 value is running at 8 kHz, so it’s on for 30 clock cycles per pulse. The others are more straightforward.

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

Texas_Ace wrote:
bistro, I was thinking, is it possible to make turbo an option in the menu?

Yes, but it’s a lot simpler and smaller to make no-turbo mode groups instead.
Texas_Ace
Texas_Ace's picture
Offline
Last seen: 5 hours 38 min ago
Joined: 03/24/2016 - 07:44
Posts: 8537
Location: Everything is brighter in Texas
ToyKeeper wrote:
Texas_Ace wrote:
bistro, I was thinking, is it possible to make turbo an option in the menu?
Yes, but it’s a lot simpler and smaller to make no-turbo mode groups instead.

Easy enough, I already did that so I will just stick with that. Thumbs Up

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

Texas_Ace wrote:
What settings are you using for stop motion strobe? I could not totally figure out how you were calculating the pulse timing into hz so I just used the 10hz strobe and then each of the tactical strobe timing by themselves.

Far as the bike mode goes, like I said, I am of the mind that the single flash bike strobe is both safer and easier on drivers while still getting their attention.


For stop-motion strobes, I generally do a turbo pulse for 1ms or 0.3ms, depending on the strobe speed, and then leave it off for much longer. The frequency is simple to calculate; a delay of 41ms (plus 0.3ms for each pulse) is 1000 ms / 41.3 ms, or 24.2 Hz. The speed will vary per-MCU though, especially on tiny13a.

I find that a 1ms pulse is a bit long for things like falling water, so I only use it for slower strobes. However, a 0.3ms pulse is both somewhat dim and a little unstable. This is because I’m still using PWM=255 for the strobe modes instead of using the pin as a simple on/off switch. That means each strobe pulse must last for a multiple of 256 frames, and I’m not synchronizing to the PWM counter so most pulses end up being 0.384 ms while some are 0.512 ms. Or maybe it’s 0.256 ms vs 0.384 ms, it’s hard to tell. Regardless, they’re short enough that the PWM cycles become an issue, and I’ve been meaning to fix it for ages.

If you prefer single-flash for bike mode, go for it. It saves space and might look nicer. I put it in the code for those reasons. Smile

Texas_Ace
Texas_Ace's picture
Offline
Last seen: 5 hours 38 min ago
Joined: 03/24/2016 - 07:44
Posts: 8537
Location: Everything is brighter in Texas

So those values are ms? I could not tell if they were clock cycles or ms. That makes things simpler, although how would you set it to .3ms?

Yep, I swapped to the single flash bike strobe.

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

For the 0.3ms delay, I added a “delay_zero” thing in some projects. Look at s7.c or blf-a6/cypreus2 for an example.

LightRider
LightRider's picture
Offline
Last seen: 1 year 6 months ago
Joined: 08/05/2015 - 09:52
Posts: 2007
Location: U.P. MI, USA

I’ve built two drivers with where soft start caused a very slight studder when advancing modes. It would jump to a level close to the intended level and then reach that level. Reflashing with soft start disabled eliminated the problem in both lights and reappeared when flashing back to enabled. Just a weird observation.

Texas_Ace
Texas_Ace's picture
Offline
Last seen: 5 hours 38 min ago
Joined: 03/24/2016 - 07:44
Posts: 8537
Location: Everything is brighter in Texas
LightRider wrote:
I’ve built two drivers with where soft start caused a very slight studder when advancing modes. It would jump to a level close to the intended level and then reach that level. Reflashing with soft start disabled eliminated the problem in both lights and reappeared when flashing back to enabled. Just a weird observation.

Same thing I noticed wen using the tripledown drivers. I did not notice it on the Avenger drivers, so pretty sure it is due to the voltage spike that DEL discovered.

Pages