Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Heaters control is reactive, the faster we apply new PWM - the faster we will see a response.
Add command to directly apply PWM as fast as it arrives.
As a bonus, we relaxed time constraints,
Timer Too Close
should happen "never".As a safety check, we still have
Missed scheduling of next digital out event
.This code is mostly related to this topic/comment: https://klipper.discourse.group/t/remove-the-300ms-heater-control-delay/17771/11
I'm not sure about the right value for
reqclock
. If I understood the code correctly thereqclock=0
command should be sent in the next batch.This is more like a simple and safe solution because we just avoid timer calculation on the host.
I think the proper way to do this for heaters is to make another timer function and update fields
on_duration, off_duration, end_time
on each command arrival. In addition, if we want to remove the 5-second limit, cycles counter can be used there, which will be decremented on each cycle, and then there will be no dependence on timer resolution.Thanks.