Sorry to post so many times in a row… I’ve been trying to fix the code for ADC, voltage, and thermal regulation for months now, and I finally got it working well.
0-8-15 User motivated a lot of this, since he did a lot of work to fix thermal regulation after I half-broke it in the mid-November update. (it worked, but was too slow and allowed high-power lights to get pretty hot) So he did a bunch of experiments and coding to make it respond better. He used 2560X oversampling with a new thermal algorithm, and got pretty good results on D4 and D4S.
When I tried it here though, I found it was still sometimes unstable and required extra tweaking to make it work on other hosts, and there were several details in the code I wanted to fix before merging. So that got me started down a rabbit hole which was deeper than I expected.
Pretty soon, I had gotten a bit lost in ADC signal processing algorithms and PID theory and a bunch of other stuff, and none of it wanted to work right.
Eventually though, I set all that aside and kinda started over, thinking through it from scratch one day in the shower. By the end of the shower, I had an idea worked out and a pretty detailed plan for the code. So I tried it, and … it worked. A couple small things needed tweaking, but overall it basically just worked.
The shower is the best place to write code.
I’ve been testing it on a variety of different hosts for the past few days, and so far everything has been fairly close to an ideal response… even without tweaking anything per host.
So I merged it (and the K1 branch, while I was at it, since I wanted to test on K1 too) and finally uploaded the code today.
Testing would be helpful, to get some independent verification that it works.
Here are my results so far. Everything used mild fan cooling unless otherwise noted:
(small house fan about 1m away on its lowest setting, to make a gentle breeze)
D4v2:
D4Sv2:
BLF Q8:
Noctigon K1 W1:
FW3A 219B (test by Bob_McBob with no cooling):
FF E01:
FF PL47 G2:
MF01S: (graph is weird; the ceilingbounce app had some sort of bug during the test)
(also, this particular MF01S is a prototype which is known to have unstable output)
MF01-Mini: I tested both turbo and the ramp ceiling, because this thread indicated regulation problems at the ramp ceiling level. Here are the results for both. I let the second test run until the battery was empty, to see how the rest of the graph would look:
Prototype of an upcoming light:
The code is in the FSM branch on Launchpad, and I uploaded some new .hex files for testing too.
I’m not considering it stable until it has had more testing, but if no big issues are found I’ll probably mark it as stable and merge it into trunk.
Edit: Added MF01-Mini test results. Also, if anyone was wondering about those small but sharp-looking stairstep adjustments later on in the graphs, they’re not actually sharp. Here’s a close-up of one. It took 32 seconds to adjust output by about 3%, moving up one small step every 4 seconds:
Each of those 8 steps is the smallest adjustment possible using the given hardware’s PWM controls. The changes are not visible by eye during use.