cigarginger

Klipper pause_resume_cancel neptune 3 pro

Jan 27th, 2025
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.32 KB | Software | 0 0
  1. ######################################################################################################################################################
  2. # Pause
  3. ######################################################################################################################################################
  4. [gcode_macro PAUSE]
  5. description: Pause running print
  6. rename_existing: PAUSE_BASE
  7. gcode:
  8. # set park position
  9. {% set x_park = printer.toolhead.axis_maximum.x|float %}
  10. {% set y_park = printer.toolhead.axis_maximum.y|float %}
  11. # calculate save lift position
  12. {% set max_z = printer.toolhead.axis_maximum.z|float %}
  13. {% set current_z = printer.toolhead.position.z|float %}
  14. {% if current_z < (max_z - 2.0) %}
  15. {% set z_safe = 2.0 %}
  16. {% else %}
  17. {% set z_safe = max_z - current_z %}
  18. {% endif %}
  19. # define variables
  20. {% set position_x = printer.toolhead.position.x|float %}
  21. {% set position_y = printer.toolhead.position.y|float %}
  22. {% set position_z = printer.toolhead.position.z|float %}
  23. {% set extruder_temp = printer[printer.toolhead.extruder].target if printer.toolhead.extruder != '' else 0|float %}
  24.  
  25. SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=saved_x VALUE="{position_x}"
  26. SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=saved_y VALUE="{position_y}"
  27. SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=saved_z VALUE={position_z}
  28. SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=saved_extruder_temp VALUE={extruder_temp}
  29.  
  30. PAUSE_BASE
  31. G91
  32.  
  33. {% if printer.extruder.can_extrude|lower == 'true' %}
  34. G1 E-2 F2100
  35. {% else %}
  36. {action_respond_info("Extruder not hot enough")}
  37. {% endif %}
  38.  
  39. M104 S{extruder_temp - 100}
  40.  
  41. {% if "xyz" in printer.toolhead.homed_axes %}
  42. G1 Z{z_safe} F1200
  43. G90
  44. G1 X{x_park} Y{y_park} F6000
  45. {% else %}
  46. {action_respond_info("Printer not homed")}
  47. {% endif %}
  48.  
  49.  
  50. ######################################################################################################################################################
  51. # Resume
  52. ######################################################################################################################################################
  53. [gcode_macro RESUME]
  54. description: Resume the actual running print
  55. rename_existing: RESUME_BASE
  56. variable_saved_extruder_temp: 0
  57. variable_saved_x: 0.0
  58. variable_saved_y: 0.0
  59. variable_saved_z: 0.0
  60. variable_saved_e: 0.0
  61. gcode:
  62. # get VELOCITY parameter if specified
  63. {% if 'VELOCITY' in params|upper %}
  64. {% set get_params = ('VELOCITY=' + params.VELOCITY) %}
  65. {%else %}
  66. {% set get_params = "" %}
  67. {% endif %}
  68.  
  69. # heat extruder
  70. M109 S{saved_extruder_temp}
  71.  
  72. # go back to last position
  73. G90
  74. G0 X{saved_x} Y{saved_y} F6000
  75. G0 Z{saved_z} F1200
  76. G91
  77.  
  78. RESUME_BASE {get_params}
  79.  
  80.  
  81. ######################################################################################################################################################
  82. # Cancel
  83. ######################################################################################################################################################
  84. [gcode_macro CANCEL_PRINT]
  85. description: Cancel the actual running print
  86. rename_existing: CANCEL_PRINT_BASE
  87. gcode:
  88. END_PRINT
  89. CANCEL_PRINT_BASE
  90.  
  91.  
  92.  
  93.  
Tags: Neptune
Advertisement
Add Comment
Please, Sign In to add comment