FWIW, I updated bin/level_calc.py to support dual PWM drivers, and to make it friendlier to being used in Windowsā¦ though I donāt actually have Windows so I havenāt tried that yet.
It accepts parameters either on the command line or as interactive questions. Hereās an example session where I asked it to estimate the PWM levels for the BLF EE A6 light. The FET channel ranges from about 15 lumens to 1300 lumens, on an average batteryā¦ while the 1x7135 channel goes from about 0.25 to 140 lumens. I asked it to give me seven evenly-spaced modes covering the entire range:
> ./level_calc.py
How many total levels do you want? (4) 7
Lowest visible PWM level, for moon mode: (6) 1
How bright is moon mode, in lumens? (0.25) 15
How bright is the highest level, in lumens? (1000) 1300
Use dual PWM? [y/n] (n) y
Second channel, lowest visible PWM level: (6) 4
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, 4.00/255
2: visually 2.34 (12.88 lm): 0.00/255, 26.68/255
3: visually 4.06 (66.82 lm): 0.00/255, 123.57/255
4: visually 5.77 (192.29 lm): 8.37/255, 255.00/255
5: visually 7.49 (419.51 lm): 53.28/255, 255.00/255
6: visually 9.20 (778.67 lm): 124.28/255, 255.00/255
7: visually 10.91 (1300.00 lm): 255.00/255, 0.00/255
PWM1/FET values: 0,0,0,8,53,124,255
PWM2/7135 values: 4,27,124,255,255,255,0
On a non-FET driver, the last mode should be 255 on both channels.
Press Enter to exit:
(the same calculations can be done minus the interactive prompts, by running ālevel_calc.py 7 1 15 1300 y 4 0.25 140ā)
The results are fairly close to what I ended up with after manual tweaking with the help of a light box:
- PWM1: 0,0,0,6,56,135,255
- PWM2: 3,20,100,255,255,255,0
Moon mode here is a bit off because the real thing uses phase-correct PWM instead of fast PWM, so thatās expected. The other āoffā values are because the tool uses a linear estimate but the actual hardware isnāt quite linear. And also because I think I manually changed the values a bit and probably had some measurement error. But overall, this at least gives a pretty good ballpark estimate to start from.
I hope this will help people who want to get visually-linear mode spacing, both on regular drivers and dual-channel drivers. Those dual-PWM drivers can be a little tricky.