Guest User

Mainsail.cfg

a guest
Sep 26th, 2023
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 3.24 KB | None | 0 0
  1. # Mainsail klipper definitions
  2. #
  3. # Copyright (C) 2021 Alex Zellner <[email protected]>
  4. #
  5. # This file may be distributed under the terms of the GNU GPLv3 license
  6. #
  7. # Version 1.11
  8.  
  9. # add [include mainsail.cfg] to your printer.cfg to include it to your printer.cfg
  10. # modify x_park, y_park, z_park_delta and extrude value at the macro _TOOLHEAD_PARK_PAUSE_CANCEL if needed
  11.  
  12. # use variable_park: False at CANCEL_PRINT to disallow the parking move
  13.  
  14. [virtual_sdcard]
  15. path: ~/gcode_files
  16. on_error_gcode:
  17.   CANCEL_PRINT
  18.  
  19. [pause_resume]
  20.  
  21. [display_status]
  22.  
  23. [gcode_macro CANCEL_PRINT]
  24. description: Cancel the actual running print
  25. rename_existing: CANCEL_PRINT_BASE
  26. variable_park: True
  27. gcode:
  28.   ## Move head and retract only if not already in the pause state and park set to true
  29.   {% if printer.pause_resume.is_paused|lower == 'false' and park|lower == 'true'%}
  30.     _TOOLHEAD_PARK_PAUSE_CANCEL
  31.   {% endif %}
  32.   TURN_OFF_HEATERS
  33.   M106 S0
  34.   CANCEL_PRINT_BASE
  35.  
  36. [gcode_macro PAUSE]
  37. description: Pause the actual running print
  38. rename_existing: PAUSE_BASE
  39. gcode:
  40.   PAUSE_BASE
  41.   SAVE_GCODE_STATE NAME=PAUSEPARK
  42.   SAVE_GCODE_STATE NAME=PAUSE
  43.   #_TOOLHEAD_PARK_PAUSE_CANCEL
  44.  
  45. [gcode_macro RESUME]
  46. description: Resume the actual running print
  47. rename_existing: RESUME_BASE
  48. gcode:
  49.   # ##### read extrude from  _TOOLHEAD_PARK_PAUSE_CANCEL  macro #####
  50.   # {% set extrude = printer['gcode_macro _TOOLHEAD_PARK_PAUSE_CANCEL'].extrude %}
  51.   # #### get VELOCITY parameter if specified ####
  52.   # {% if 'VELOCITY' in params|upper %}
  53.   #   {% set get_params = ('VELOCITY=' + params.VELOCITY)  %}
  54.   # {%else %}
  55.   #   {% set get_params = "" %}
  56.   # {% endif %}
  57.   # ##### end of definitions #####
  58.   # {% if printer.extruder.can_extrude|lower == 'true' %}
  59.   #   M83
  60.   #   G1 E{extrude} F2100
  61.   #   {% if printer.gcode_move.absolute_extrude |lower == 'true' %} M82 {% endif %}
  62.   # {% else %}
  63.   #   {action_respond_info("Extruder not hot enough")}
  64.   # {% endif %}
  65.   RESUME_BASE # {get_params}
  66.  
  67. [gcode_macro _TOOLHEAD_PARK_PAUSE_CANCEL]
  68. description: Helper: park toolhead used in PAUSE and CANCEL_PRINT
  69. variable_extrude: 1.0
  70. gcode:
  71.   ##### set park positon for x and y #####
  72.   # default is your max posion from your printer.cfg
  73.   {% set x_park = printer.toolhead.axis_maximum.x|float - 5.0 %}
  74.   {% set y_park = printer.toolhead.axis_maximum.y|float - 5.0 %}
  75.   {% set z_park_delta = 2.0 %}
  76.   ##### calculate save lift position #####
  77.   {% set max_z = printer.toolhead.axis_maximum.z|float %}
  78.   {% set act_z = printer.toolhead.position.z|float %}
  79.   {% if act_z < (max_z - z_park_delta) %}
  80.     {% set z_safe = z_park_delta %}
  81.   {% else %}
  82.     {% set z_safe = max_z - act_z %}
  83.   {% endif %}
  84.   ##### end of definitions #####
  85.   {% if printer.extruder.can_extrude|lower == 'true' %}
  86.     M83
  87.     G1 E-{extrude} F2100
  88.     {% if printer.gcode_move.absolute_extrude |lower == 'true' %} M82 {% endif %}
  89.   {% else %}
  90.     {action_respond_info("Extruder not hot enough")}
  91.   {% endif %}
  92.   {% if "xyz" in printer.toolhead.homed_axes %}
  93.     G91
  94.     G1 Z{z_safe} F900
  95.     G90
  96.     G1 X{x_park} Y{y_park} F6000
  97.     {% if printer.gcode_move.absolute_coordinates|lower == 'false' %} G91 {% endif %}
  98.   {% else %}
  99.     {action_respond_info("Printer not homed")}
  100.   {% endif %}
  101.  
Advertisement
Add Comment
Please, Sign In to add comment