Advertisement
KirboWnz

sample-pwm-tool.cfg

Sep 7th, 2023
1,244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 1.50 KB | None | 0 0
  1. root@creality /usr/share [#] cat klipper/config/sample-pwm-tool.cfg
  2. # This file contains an example configuration to use a PWM-controlled tool
  3. # such as a laser or spindle.
  4. # See docs/Using_PWM_Tools.md for a more detailed description.
  5.  
  6. [output_pin TOOL]
  7. pin: !ar9       # use your fan's pin number
  8. pwm: True
  9. hardware_pwm: True
  10. cycle_time: 0.001
  11. shutdown_value: 0
  12. maximum_mcu_duration: 5
  13. # Default: 0 (disabled)
  14. # Amount of time in which the host has to acknowledge
  15. # a non-shutdown output value.
  16. # Suggested value is around 5 seconds.
  17. # Use a value that does not burn up your stock.
  18. # Please note that during homing, your tool
  19. # needs to be in default speed.
  20.  
  21. [gcode_macro M3]
  22. gcode:
  23.    {% set S = params.S|default(0.0)|float %}
  24.     SET_PIN PIN=TOOL VALUE={S / 255.0}
  25.  
  26. [gcode_macro M4]
  27. gcode:
  28.    {% set S = params.S|default(0.0)|float %}
  29.     SET_PIN PIN=TOOL VALUE={S / 255.0}
  30.  
  31. [gcode_macro M5]
  32. gcode:
  33.    SET_PIN PIN=TOOL VALUE=0
  34.  
  35.  
  36. # Optional: LCD Menu Control
  37.  
  38. [menu __main __control __toolonoff]
  39. type: input
  40. enable: {'output_pin TOOL' in printer}
  41. name: Fan: {'ON ' if menu.input else 'OFF'}
  42. input: {printer['output_pin TOOL'].value}
  43. input_min: 0
  44. input_max: 1
  45. input_step: 1
  46. gcode:
  47.    M3 S{255 if menu.input else 0}
  48.  
  49. [menu __main __control __toolspeed]
  50. type: input
  51. enable: {'output_pin TOOL' in printer}
  52. name: Tool speed: {'%3d' % (menu.input*100)}%
  53. input: {printer['output_pin TOOL'].value}
  54. input_min: 0
  55. input_max: 1
  56. input_step: 0.01
  57. gcode:
  58.    M3 S{'%d' % (menu.input*255)}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement