Testing request: Heater response time improvement

Greetings Klipper-folk!

I’ve put together a set of commits that allow for heaters to have their PWM changes apply as soon as possible instead of using the MCU clock scheduling process. This allows for changes to be applied up to ~300ms earlier than they currently are, which removes a significant amount of error in the heating feedback loop, especially on heaters with low thermal mass and high wattage. It Works on My Machine - would love to have a few folks who aren’t afraid to flash their firmware with heater code that works on one printer before putting up a PR.

The impact of this change in isolation is noticeable but not particularly impressive. I believe it opens the door for industry-standard PID auto-tuning to be put in place and allow for a much more aggressive control setup. I did not implement such a tuner 'cause I don’t want to step on the toes of the excellent work done by Daniel. I’m very much looking forward to seeing the combination of the two - I’ll probably take that for a spin tomorrow.

To motivate it a bit, here’s a couple temperature graphs showing the response a Revo sitting in a Stealthburner had to the part cooling fan being changed from 0%->100%->0% when settled at 250c:

Baseline is head revision as of today, Upd-Software is this change with 100ms cycle software PWM, Upd-Hardware is 1ms cycle hardware PWM. PID_CALIBRATE as currently exists was run on each configuration targeting 250c. Line represents the average of 10 runs each.

This fork branch thingy has the codes!

Appreciate anyone who takes it for a spin, and those who don’t 'cause you’re probably cool too.
~Brian

5 Likes

i tried your changes - works really really good so far!
only 0,1°C deviation by 120mm/s print speed ( all walls, all print moves, 120mm/s ) and high acceleration ( huge Flow rate changes )

/edit: Results ( yeah i forgot to increase the pa value a bit, im playing around with pa a.t.m ) :

2 Likes

Cool work. Testing it on mine now. If nothing else, it certainly seems to hold a steady state temperature much more closely on my rapido

Screen Shot 2023-03-25 at 10.53.25 PM

vs

Screen Shot 2023-03-25 at 10.53.05 PM