pwm_tool: Add support for high-speed PWM pin updates

The output_pin module is only capable of updating an output pin at
most once every 100ms.  Add a new pwm_tool module that is capable of
queuing updates in the micro-controller and thus allowing for much
higher update rates.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor
2023-10-13 21:10:11 -04:00
parent 48a05eaa54
commit 29b7550ce5
8 changed files with 201 additions and 17 deletions

View File

@@ -2,9 +2,8 @@
# such as a laser or spindle.
# See docs/Using_PWM_Tools.md for a more detailed description.
[output_pin TOOL]
[pwm_tool TOOL]
pin: !ar9 # use your fan's pin number
pwm: True
hardware_pwm: True
cycle_time: 0.001
shutdown_value: 0
@@ -36,9 +35,9 @@ gcode:
[menu __main __control __toolonoff]
type: input
enable: {'output_pin TOOL' in printer}
enable: {'pwm_tool TOOL' in printer}
name: Fan: {'ON ' if menu.input else 'OFF'}
input: {printer['output_pin TOOL'].value}
input: {printer['pwm_tool TOOL'].value}
input_min: 0
input_max: 1
input_step: 1
@@ -47,9 +46,9 @@ gcode:
[menu __main __control __toolspeed]
type: input
enable: {'output_pin TOOL' in printer}
enable: {'pwm_tool TOOL' in printer}
name: Tool speed: {'%3d' % (menu.input*100)}%
input: {printer['output_pin TOOL'].value}
input: {printer['pwm_tool TOOL'].value}
input_min: 0
input_max: 1
input_step: 0.01