Flashlight Firmware Repository

Thanks I might actually switch it so the star isn’t soldered because soldering it doesn’t seem to work.

Fresh driver and same problems. I am getting three out of four modes now, so I’m closer. But still no moon. I’m using star 1.1

I’m having problems trying to figure out where to change the pwm settings. That has to be it.

I got it working and I think it was just a combination of me having a case of the dumbspits and possibly bad mcu’s. I ended up using an older driver that I hadn’t used from way back and that along with phase-correct PWM did the trick. I ended up getting the moonlight mode stable at about half of what it was on the original star 1.1 version.

Does anyone have software that will wipe these mcu’s really clean? Maybe I got a batch that was used previously? Can that happen? They came from China instead of Richard, teach me to cheap out.

TK, how do you use the ramp_calc.py?
I’t trying to get some new values as I need it to start at 3 and I’d like 64 steps but I don’t know how to use this file.

I’d suggest using bin/level_calc.py instead… because Ferrero_Rocher/ramp_calc.py is old and less accurate and harder to use, and the only extra thing it offers is pulse frequency modulation to make the low end of the ramp look smoother.

If you aren’t using a single-channel driver with both PWM and PFM, use bin/level_calc.py instead.

For example, a FET+7135 driver with a single XP-L:

(~/src/torches/trunk/)-]> ./bin/level_calc.py
How many total levels do you want? (4) 64
Lowest visible PWM level, for moon mode: (6) 1
How bright is moon mode, in lumens? (0.25) 8
How bright is the highest level, in lumens? (1000) 1500
Use dual PWM? [y/n] (n) y
Second channel, lowest visible PWM level: (6) 3
Second channel, how bright is the lowest mode, in lumens? (0.25) 0.25
Second channel, how bright is maximum, in lumens? (140) 140
1: visually 0.63 (0.25 lm): 0.00/255, 3.00/255
2: visually 0.80 (0.52 lm): 0.00/255, 3.48/255
3: visually 0.97 (0.92 lm): 0.00/255, 4.21/255
...
62: visually 11.10 (1369.01 lm): 208.87/255, 255.00/255
63: visually 11.28 (1433.51 lm): 219.85/255, 255.00/255
64: visually 11.45 (1500.00 lm): 255.00/255, 0.00/255
PWM1/FET  values: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,3,6,9,12,15,18,22,26,30,34,38,43,48,53,58,63,69,75,81,88,95,102,109,117,124,133,141,150,159,168,178,188,198,209,220,255
PWM2/7135 values: 3,3,4,5,7,8,11,14,17,21,26,31,38,45,53,62,72,83,95,109,124,140,157,176,196,218,241,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0

OK how does it work?
I’m only using single channel with 3x 7135

Oh, that should be pretty straightforward then. :slight_smile:

Basically just tell it you want 64 levels, minimum PWM of 3, lowest mode of 0.5 lumens, highest mode of 400 lumens, and no dual PWM. It looks like 64 levels will get you a few duplicates at the beginning though. That’s what pulse frequency modulation helps with, but it’s also more than a little finicky and might not be worth the effort.

Are you putting this into an e-switch light with Ferrero_Rocher, or something else?

Yeh it’s an e-switch light using Ferrero_Rocher Ramping UI. Maybe 64 levels might be too much, might just stick with 40. When I try run this I just get syntax errors.

As in ToyKeeper’s example, you just run level_calc.py and it will ask you questions. Copy and paste the errors are you are getting.

I don’t know how to run it tho.

EDIT: Figured it out thanks!

You’re on windows? You need to have python installed and the level_calc.py script is then run from a command line prompt.

A little windows how-to would be helpful I’m sure. Anyone up for it? I don’t even have a windows pc at the moment. :stuck_out_tongue:

Sure I’ll make a how to next week now that I’ve figured it out.

Can anyone help me with this. I have a FET + 7135 driver, i just removed the FET because i want to use one 7135 only. I am using the blf a6 firmware. I thought that i will get a very stable moon mode using only one 7135 but i was wrong. At 4.2v i get around 1 lumen(just my estimate) on moon mode. But at 3.7v i get a very dim moon mode. At 3.6v the moon don’t light up.
Here is my code

// PWM levels for the big circuit (FET or Nx7135)
#define MODESNx1 0,0,0,0
// PWM levels for the small circuit (1x7135)
#define MODES1x1 3,12,42,255
#define MODES_PWM1 FAST,PHASE,PHASE,PHASE

At 3.6v on high mode i can still get 350mA so i don’t know why moon mode doesn’t light up at the same voltage 3.6v.

Don’t use “FAST” PWM mode for moon. Try using PHASE instead, and it should be a lot more stable.

The reason is because the LED takes like 2 to 5 “frames” to visibly light up, depending on voltage. With FAST mode, it’s only powered for 3 out of every 256 frames, and the first 2 to 5 of those frames are dark. After voltage drops low enough to need 4 frames, it won’t light up at all.

With PHASE mode it instead lights for 6 out of every 512 “frames”. So, it still gets dimmer with voltage but even with a nearly-empty cell it should still light up at least a little bit.

I’d suggest using PHASE for moon and turbo, and FAST for every other mode.

Thanks. I’ll try that.

Hi TK,

I am using your Firmware for Ferrero Rocher driver and I was wandering what is the maximum number of ticks I can use for the turbo timer? I need to be out about 10 min.


EDIT: Also I dont see where to set the turbo low at. What is the default?

The turbo timer is a 16-bit integer, so the maximum value is 65535 (one less than 2 16). Each “tick” should be about 0.016 seconds. 10 minutes * 60 seconds / 0.016 seconds per tick = 37500 ticks per 10 minutes.

The turbo function in Ferrero_Rocher.c simply steps down one level as if the user had told it to drop one step. So, it should go to the second-highest level.

Awesome, thats just what I need. Is there any option on this firmware for a linear ramp down from turbo to high vs the drop ( like in star firmware)?

Nope. But if you want a ramping interface you could use Ramping_UI_table.c instead.


I think a ramp UI would be a bit much for this project. Are you aware of any e-switch UIs that do have the smooth drop from turbo to high?