Guest User

Untitled

a guest
Jun 29th, 2025
10
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 40.66 KB | None | 0 0
  1. # QIDI Plus4 V1.0.0
  2.  
  3. [gcode_macro _CG28]
  4. description: Home all if not already homed
  5. gcode:
  6. {% if "xyz" not in printer.toolhead.homed_axes %}
  7. G28
  8. {% endif %}
  9.  
  10. [gcode_macro MOVE_HEAD]
  11. description: Move Head Around After Lubricating Rods
  12. gcode:
  13. {% set speed = params.SPEED|default(10000)|float %}
  14. _CG28
  15. G1 Z10 F600 # Move bed 10mm away from nozzle
  16. {% for i in range(10) %}
  17. G1 X0 Y0 F{speed}
  18. G1 X305 Y305 F{speed}
  19. G1 X0 Y305 F{speed}
  20. G1 X305 Y305 F{speed}
  21. {% endfor %}
  22. G1 X152.5 Y152.5 F{speed}
  23.  
  24. # The following 2 macros intent is to provide for a clear way to separate the
  25. # nozzle z offset from a filament specific z offset adjustment
  26. [gcode_macro _APPLY_NOZZLE_OFFSET]
  27. description: Determine the global nozzle offset and apply
  28. variable_hotend_temp: 250 # Target hotend temp (typically set by PRINT_START)
  29. variable_probe_temp_delta: 70 # We probe at this amount less than the hotend temp
  30. variable_reference_position: 5.0 # A safe Z position at which we'll apply the offset change
  31. variable_offset_correction: 0.07 # Static Offset Correction
  32. gcode:
  33. # Set our local working variables. We treat everything as floats for these calculations
  34. {% set reference_position = reference_position|float %}
  35. {% set offset_correction = offset_correction|float %}
  36.  
  37. # Determine the rest of our working variables
  38. {% set z_home_x = printer.configfile.settings.beacon.home_xy_position[0] %}
  39. {% set z_home_y = printer.configfile.settings.beacon.home_xy_position[1] %}
  40. {% set z_speed = printer.configfile.settings['stepper_z'].homing_speed|float * 60 %}
  41.  
  42. {% set target_position = (reference_position + offset_correction)|float %}
  43.  
  44. # Report to the console what we've determined
  45. { action_respond_info("Applying Z offset adjustment for hotend temperature of %.1f°C" % hotend_temp|float) }
  46. { action_respond_info(" Offset Correction = %.3f" % (offset_correction)|float) }
  47. { action_respond_info(" Reference Position = %.1f" % (reference_position)|float) }
  48. { action_respond_info(" Target Position = %.6f" % (target_position)|float) }
  49.  
  50. SET_GCODE_OFFSET Z=0 # Clear any pre-existing Gcode offsets
  51. G1 Z{target_position} F{z_speed} # Move Z to determined target position
  52. G1 X{z_home_x} Y{z_home_y} F7200 # Move X/Y to Z homing position
  53. M400 # Wait for prior gcode-commands to finish
  54. SET_KINEMATIC_POSITION Z={reference_position} # Set target position to be the reference position
  55. G1 Z{reference_position} F{z_speed} # Move Z to reference position. Ideally the bed should not move
  56. M400
  57.  
  58. [gcode_macro _SETTLE_PRINT_BED]
  59. description: Vibrate bed up and down to try to settle any movement in the springs
  60. gcode:
  61. G1 Z4 F600 # Move to Z=4
  62. G91 # Enter relative positioning mode
  63. M400 # Wait for all prior commands to finish
  64. {% for z in range(50) %} # Loop 50 times
  65. G1 Z1 F5000 # Move bed down by 1mm
  66. G1 Z-1 F5000 # Move bed up by 1mm
  67. {% endfor %}
  68. G90 # Go back to absolute positioning mode
  69. M400 # Wait for all prior commands to finish
  70. G1 Z4 F600 # Make sure Z=4mm before we leave the macro
  71.  
  72. [gcode_macro _FIND_Z_EQUALS_ZERO]
  73. description: Find where Z equals zero and apply nozzle offset
  74. gcode:
  75. {% set hotend_temp = (printer["gcode_macro _APPLY_NOZZLE_OFFSET"].hotend_temp)|float %}
  76. {% set probe_temp_delta = (printer["gcode_macro _APPLY_NOZZLE_OFFSET"].probe_temp_delta)|float %}
  77.  
  78. {% set z_home_temp = hotend_temp - probe_temp_delta %}
  79. {% set z_home_x = printer.configfile.settings.beacon.home_xy_position[0] %}
  80. {% set z_home_y = printer.configfile.settings.beacon.home_xy_position[1] %}
  81. {% set k = printer["gcode_macro G29"].k|int %}
  82.  
  83. M104 S{z_home_temp} # Commence nozzle warmup for z homing
  84. BED_MESH_CLEAR # Clear out any existing bed meshing context
  85. SET_KINEMATIC_POSITION Z=0 # Force firmware to believe Z is homed at 0
  86. G1 Z3 F600 # Move bed away from the nozzle by 3mm from where it was
  87. SET_KINEMATIC_POSITION CLEAR=XYZ # Ensure all kinematic repositionings are cleared
  88. SET_GCODE_OFFSET Z=0 # Comnpletely reset all prior notions of Z offset
  89. G28 X Y # Home X and Y Axes
  90. {% if (k == 1) and (printer.configfile.settings['beacon model default'] is defined) %}
  91. G28 Z METHOD=proximity # Do a rapid proximity based Z home if possible
  92. {% else %}
  93. M109 S{z_home_temp} # Wait for nozzle to fully heat up
  94. G28 Z METHOD=CONTACT CALIBRATE=0 # Home Z axis without calibration
  95. {% endif %}
  96. _SETTLE_PRINT_BED # Try to settle the build plate
  97. M109 S{z_home_temp} # Wait for nozzle to fully reach Z probing temperature
  98. G28 Z METHOD=CONTACT CALIBRATE=1 # Home Z axis, and calibrate beacon
  99. Z_TILT_ADJUST # Ensure bed is level
  100. G1 X{z_home_x} Y{z_home_y} F7200 # Move to Z home position
  101. G4 P15000 # Heatsoak hotend for 15s more
  102. G28 Z METHOD=CONTACT CALIBRATE=1 # Establish Z=0
  103. G1 Z3 F600 # Move bed away from the nozzle by 3mm from where it was
  104. _APPLY_NOZZLE_OFFSET
  105.  
  106. [gcode_macro APPLY_FILAMENT_OFFSET]
  107. description: Apply a Z offset adjustment for a specific filament
  108. gcode:
  109. {% set filament_z = params.Z|default(0)|float %}
  110. { action_respond_info("Setting Filament Offset to %.3fmm" % (filament_z)) }
  111. SET_GCODE_OFFSET Z_ADJUST={filament_z}
  112.  
  113. [gcode_macro APPLY_BED_TYPE_OFFSET]
  114. description: Apply a Z offset adjustment for a specific bed type
  115. gcode:
  116. {% set bed_type = params.BED_TYPE|default("default")|string|lower %}
  117. { action_respond_info("Bed Type Is: %s" % bed_type) }
  118. {% if "textured" in bed_type %}
  119. {% set offset = 0.0|float %}
  120. {% elif "cool plate" in bed_type %}
  121. {% set offset = 0.025|float %}
  122. {% else %}
  123. {% set offset = 0.0|float %}
  124. {% endif %}
  125. { action_respond_info("Bed Offset Is: %.3f" % offset) }
  126. SET_GCODE_OFFSET Z_ADJUST={offset}
  127.  
  128. # All the following zoffset calls only exist to keep Qidi's xindi happy
  129. [gcode_macro zoffset]
  130. description: Apply baseline Z offset which is always zero for Beacon Contact
  131. gcode:
  132. SET_GCODE_OFFSET Z=0 # Apply a zero gcode_offset
  133.  
  134. # Development test
  135. [gcode_macro test_zoffset]
  136. description: Debugging test to compare the probe contact and proximity Z Offset values
  137. gcode:
  138. G28 X Y
  139. get_zoffset
  140. M400
  141. BEACON_OFFSET_COMPARE
  142. G4 P5000
  143. G1 Z10 F600
  144.  
  145. [gcode_macro get_zoffset]
  146. description: Homes nozzle against build plate and applies global z offset
  147. gcode:
  148. _FIND_Z_EQUALS_ZERO
  149.  
  150. [gcode_macro save_zoffset]
  151. description: Use APPLY_FILAMENT_OFFSET instead
  152. gcode:
  153. { action_respond_info("Use APPLY_FILAMENT_OFFSET instead") }
  154.  
  155. [gcode_macro set_zoffset]
  156. description: Apply baseline Z offset which is always zero for Beacon Contact
  157. gcode:
  158. SET_GCODE_OFFSET Z=0 # Apply a zero gcode_offset
  159.  
  160. [gcode_macro _MOVE_TO_CHUTE]
  161. description: Safely move nozzle over the purge chute if not already there
  162. gcode:
  163. M400
  164. {% if (printer.gcode_move.position.x) != 95 %}
  165. {% if (printer.gcode_move.position.y) != 324 %}
  166. {% if (printer.gcode_move.position.x) < 56 %}
  167. G1 X56 F12000 # Move to avoid collision with stepper motor
  168. M400
  169. {% endif %}
  170. {% if (printer.gcode_move.position.y) != 300 %}
  171. G1 Y300 F12000 # Move to avoid collision with purge activation arm
  172. M400
  173. {% endif %}
  174. {% if (printer.gcode_move.position.x) > 56 %}
  175. G1 X56 F12000 # Move in line with silicon scrubbing brush
  176. M400
  177. {% endif %}
  178. G1 Y324 F600 # Slowly move back in line with purge chute
  179. G1 X95 F600 # Move directly over the purge chute
  180. M400 # Wait for all operations to complete
  181. {% endif %}
  182. {% else %}
  183. {% if (printer.gcode_move.position.y) != 324 %}
  184. G1 Y300 F12000
  185. G1 Y324 F600
  186. M400
  187. {% endif %}
  188. {% endif %}
  189.  
  190. [gcode_macro _ACTIVATE_PURGE_EJECTION]
  191. description: Activate purge arm to drop purged filament down chute
  192. gcode:
  193. {% set hotendtemp = params.HOTEND|default(250)|int %}
  194. _MOVE_TO_CHUTE
  195. M106 S255
  196. G4 P5000
  197. M104 S{hotendtemp - 80}
  198. G1 Y318 F9000
  199. G1 Y322 F600
  200. G1 Y318 F9000
  201. G1 Y322 F600
  202. G1 Y308 F30000
  203. G1 Y324 F600
  204.  
  205. [gcode_macro _PURGE_INTO_CHUTE]
  206. description: Purge Filament into purge chute
  207. gcode:
  208. {% set hotendtemp = params.HOTEND|default(250)|int %}
  209. _MOVE_TO_CHUTE
  210. G92 E0 # Set extruder position to 0
  211. G1 E5 F50 # Purge 5mm of filament slowly
  212. G92 E0 # Set extruder position to 0
  213. G1 E80 F200 # Purge 80mm of filament at 2mm/s
  214. G92 E0 # Set extruder position to 0
  215. G1 E-2 F200 # Perform a 2mm retraction
  216. _ACTIVATE_PURGE_EJECTION HOTEND={hotendtemp} # Eject the purged filament
  217. G1 E-1 # Perform a 1mm retraction
  218.  
  219. [gcode_macro _PEI_WIPE]
  220. description: Wipe nozzle over PEI Plate
  221. gcode:
  222. _MOVE_TO_CHUTE
  223. G1 X124
  224. G1 X133 F200
  225. G1 Y321 F200
  226. G2 I0.5 J0.5 F600
  227. G2 I0.5 J0.5 F600
  228. G2 I0.5 J0.5 F600
  229.  
  230. G1 Y319 F150
  231. G1 X132
  232. G1 Y324
  233. G1 X131
  234. G1 Y319
  235. G1 X130
  236. G1 Y324
  237. G1 X129
  238. G1 Y319
  239.  
  240. G1 X113 F200
  241. G1 Y320
  242. G1 X125
  243. G1 X113
  244. G1 X125
  245. G2 I0.5 J0.5 F200
  246. G2 I0.5 J0.5 F200
  247. G2 I0.5 J0.5 F200
  248.  
  249. M400
  250. G1 Y320 F600
  251. G1 X95 F600
  252. M400
  253.  
  254. [gcode_macro _BRUSH_WIPE]
  255. description: Wipe nozzle over Silicone Brush area
  256. gcode:
  257. _MOVE_TO_CHUTE
  258. G1 Y300 F600
  259. G1 X95 F12000
  260. G1 Y314 F9000
  261. G1 Y324 F600
  262.  
  263. G1 X58 F12000
  264. G1 X78 F12000
  265. G1 Y324
  266. G1 X58 F12000
  267. G1 X78 F12000
  268. G1 Y323.5
  269. G1 X58 F12000
  270. G1 X78 F12000
  271. G1 Y323
  272. G1 X58 F12000
  273. G1 X78 F12000
  274. G1 Y322.5
  275. G1 X58 F12000
  276. G1 X78 F12000
  277. G1 Y322
  278. G1 X58 F12000
  279. G1 X75 F12000
  280. G1 Y321.5
  281. G2 I0.8 J0.8 F600
  282. G2 I0.8 J0.8 F600
  283. G2 I0.8 J0.8 F600
  284. G1 Y324 F600
  285.  
  286. M106 S0
  287.  
  288. G1 X95 F12000
  289. G1 Y316 F9000
  290. G1 Y312 F600
  291. M400
  292.  
  293. # Specialized for power lose recovery
  294. [gcode_macro CLEAR_NOZZLE_PLR]
  295. description: Specialised Nozzle Clean after power loss
  296. gcode:
  297. {% set hotendtemp = params.HOTEND|default(250)|int %}
  298. {% if (printer.gcode_move.position.z ) < 35 %}
  299. G1 Z35 F900
  300. {% else %}
  301. G91
  302. G1 Z{5} F900
  303. G90
  304. {% endif %}
  305.  
  306. _MOVE_TO_CHUTE
  307.  
  308. M106 S0
  309. M109 S{hotendtemp}
  310.  
  311. G92 E0
  312. G1 E5 F50
  313. G92 E0
  314. G1 E80 F200
  315. G92 E0
  316. G1 E-2 F200
  317. G4 P300
  318.  
  319. M106 S255
  320. G1 Y316 F30000
  321. G1 Y320 F3000
  322. G1 Y316 F30000
  323. G1 Y320 F3000
  324. G1 Y316 F30000
  325. G1 Y320 F3000
  326. G1 Y316 F12000
  327. G1 Y312 F600
  328.  
  329. [gcode_macro CLEAR_NOZZLE]
  330. description: Clear Nozzle of any stuck filament
  331. gcode:
  332. {% set hotendtemp = params.HOTEND|default(250)|int %}
  333. {% set purge = params.PURGE|default(0)|int %}
  334. {% set pei_wipe = params.PEI_WIPE|default(0)|int %}
  335.  
  336. {% if (printer.gcode_move.position.z ) < 35 %}
  337. G1 Z35 F900
  338. {% else %}
  339. G91
  340. G1 Z{5} F900
  341. G90
  342. {% endif %}
  343.  
  344. _MOVE_TO_CHUTE
  345.  
  346. M106 S0 # Turn off part cooling fan
  347. M109 S{hotendtemp} # Wait for nozzle to reach full temperature
  348. {% if purge == 1 %}
  349. _PURGE_INTO_CHUTE HOTEND={hotendtemp} # Hotend temp is set to 80C less than hotendtemp after this call
  350. {% else %}
  351. _ACTIVATE_PURGE_EJECTION HOTEND={hotendtemp} # Hotend temp is set to 80C less than hotendtemp after this call
  352. {% endif %}
  353. TEMPERATURE_WAIT SENSOR=extruder MAXIMUM={hotendtemp - 70}
  354.  
  355. # Wipe Nozzle over the PEI plate
  356. {% if pei_wipe == 1 %}
  357. _PEI_WIPE
  358. {% endif %}
  359.  
  360. # Wipe Nozzle using silicon brush
  361. _BRUSH_WIPE
  362. M118 Nozzle cleared
  363.  
  364. # Safely move nozzle to park position at back left
  365. G1 Y300 F12000
  366. M400
  367. G1 X10 F12000
  368.  
  369. # Cool hotend down
  370. M106 S255
  371. M104 S{hotendtemp - 80}
  372. TEMPERATURE_WAIT SENSOR=extruder MAXIMUM={hotendtemp - 70}
  373. M106 S0
  374. M400
  375. M118 Nozzle cooled
  376.  
  377. # Excute when start printing, prior to gcode file
  378. [gcode_macro PRINT_START]
  379. description: Start Printing
  380. gcode:
  381. {% set bedtemp = params.BED|int %}
  382. {% set hotendtemp = params.HOTEND|int %}
  383. {% set chambertemp = params.CHAMBER|default(0)|int %}
  384.  
  385. # Inform nozzle offset mechanism of our target hotend temperature
  386. SET_GCODE_VARIABLE MACRO=_APPLY_NOZZLE_OFFSET VARIABLE=hotend_temp VALUE={hotendtemp}
  387.  
  388. M140 S{bedtemp} # Initiate Print Bed Warmup as early as possible
  389. M104 S0 # Make sure hotend is off
  390. M106 P3 S0 # Turn off chamber circulation/exhaust fan
  391.  
  392. {% if chambertemp > 0 %}
  393. M141 S{chambertemp} # Initiate Chamber Warmup as early as possible
  394. M106 P2 S255 # Set AUX to full to help mix chamber air fully
  395. M106 S255 # Turn on part cooling fan to full speed for better air-temp sensing
  396. {% else %}
  397. M141 S0 # Ensure Chamber heater is off
  398. M106 P2 S0 # Turn off auxiliary part cooling fan
  399. M106 S0 # Turn off part cooling fan
  400. {% endif %}
  401.  
  402. M400 # Wait for all prior G-code commands to be processed before G28
  403. SET_GCODE_OFFSET Z=0 # Reset any applied Z_offset
  404. G28 # Home all axes
  405. CLEAR_NOZZLE HOTEND={hotendtemp} PEI_WIPE=1 # Do nozzle purge and wipe
  406.  
  407. {% if chambertemp > 0 %} # Special chamber handling for fastest thorough warmup times
  408. M106 P0 S255 # Ensure part cooling fan is full speed for better air mixing
  409. M106 P2 S255 # Ensure AUX is at 100% after CLEAR_NOZZLE was called
  410. G0 Z5 F600 # Bring print bed to Z=5mm. This helps with chamber heating
  411. G0 X152 Y152 F6000 # Bring print head to middle of print bed
  412. M191 S{chambertemp-5} # Wait for chamber to reach 5C less than desired target
  413. M141 S{chambertemp} # Reset chamber temp target back to full target again
  414. M106 P2 S0 # Turn off AUX Fan
  415. M106 P0 S0 # Turn off part cooling fan
  416. {% endif %}
  417.  
  418. M190 S{bedtemp} # Wait for print bed to reach target temperature
  419. G4 P60000 # Wait 60 seconds for bed temps to stabilise
  420. G29 # Perform Z-tilt, Z-offset, and bed meshing measurements
  421. M104 S0 # Ensure hotend is fully off to minimise any oozing
  422.  
  423. {% if chambertemp == 0 %} # No chamber temp set. This means we're likely printing PLA/PETG.
  424. M106 P3 S255 # Set the chamber circulation fan to 100% to minimise heat creep
  425. {% else %}
  426. M141 S{chambertemp} # Ensure chamber is set back to on after G29 was called earlier
  427. {% endif %}
  428.  
  429. G0 X5 Y5 F6000 # Move print head to front-left
  430. G0 Z5 F600 # Move print bed to Z=5mm
  431.  
  432. M109 S{hotendtemp} # Commence hotend warmup
  433. M204 S10000 # Set velocity limits
  434. M83 # Set E-axis to relative mode
  435. SET_PRINT_STATS_INFO CURRENT_LAYER=1 # Set current layer to 1
  436. ENABLE_ALL_SENSOR # Turn on filament runout detection
  437. save_last_file
  438. G4 P2000
  439.  
  440. [gcode_macro ENABLE_ALL_SENSOR]
  441. description: Enable Filament Width/Runout Sensors
  442. gcode:
  443. ENABLE_FILAMENT_WIDTH_SENSOR
  444. RESET_FILAMENT_WIDTH_SENSOR
  445. query_filament_width
  446. SET_FILAMENT_SENSOR SENSOR=fila ENABLE=1
  447.  
  448. [gcode_macro DISABLE_ALL_SENSOR]
  449. description: Disable Filament Width/Runout Sensors
  450. gcode:
  451. SET_FILAMENT_SENSOR SENSOR=fila ENABLE=0
  452. DISABLE_FILAMENT_WIDTH_SENSOR
  453.  
  454. [gcode_macro AUTOTUNE_SHAPERS]
  455. variable_autotune_shapers: 'ei'
  456. gcode:
  457.  
  458. [gcode_macro M84]
  459. description: Disable steppers but hold Z
  460. rename_existing:M84.1
  461. gcode:
  462. M84.1
  463. SET_STEPPER_ENABLE STEPPER=stepper_x enable=0
  464. SET_STEPPER_ENABLE STEPPER=stepper_y enable=0
  465. SET_STEPPER_ENABLE STEPPER=stepper_z enable=1
  466. SET_STEPPER_ENABLE STEPPER=stepper_z1 enable=1
  467. SET_STEPPER_ENABLE STEPPER=extruder enable=0
  468.  
  469. # Used for power lose recovery detection
  470. [gcode_macro DETECT_INTERRUPTION]
  471. gcode:
  472. {% set was_interrupted = printer.save_variables.variables.was_interrupted %}
  473. {% if was_interrupted %}
  474. M118 Detected unexpected interruption during the last print. Do you want to resume printing? (Do not move the extruder before resuming.)
  475. M118 Yes: RESUME_INTERRUPTED
  476. M118 No: CLEAR_LAST_FILE
  477. {% endif %}
  478.  
  479. # Excute when klipper init
  480. [delayed_gcode PRINTER_INIT]
  481. initial_duration:0.2
  482. gcode:
  483. SET_STEPPER_ENABLE STEPPER=stepper_z enable=1
  484. SET_STEPPER_ENABLE STEPPER=stepper_z1 enable=1
  485. BED_MESH_CLEAR
  486. SET_FILAMENT_SENSOR SENSOR=fila ENABLE=0
  487.  
  488. [gcode_macro SHAPER_CALIBRATE]
  489. rename_existing: RESHAPER_CALIBRATE
  490. gcode:
  491. RESHAPER_CALIBRATE FREQ_START=20 FREQ_END=150
  492.  
  493. # Excute when print end, after gcode file
  494. [gcode_macro PRINT_END]
  495. description: End current print
  496. gcode:
  497. # {% if printer.gcode_move.homing_origin.z < 0.5 %}
  498. # SAVE_VARIABLE VARIABLE=z_offset VALUE={printer.gcode_move.homing_origin.z}
  499. # {% endif %}
  500. SET_IDLE_TIMEOUT TIMEOUT={printer.configfile.settings.idle_timeout.timeout}
  501. CLEAR_PAUSE
  502. M400
  503. G4 P5000
  504. M106 P2 S0
  505. M106 P0 S0
  506. M106 P3 S0
  507.  
  508. M104 S0
  509. M140 S0
  510. M141 S0
  511.  
  512. M220 S100
  513. M221 S100
  514. SET_STEPPER_ENABLE STEPPER=stepper_x enable=0
  515. SET_STEPPER_ENABLE STEPPER=stepper_y enable=0
  516. SET_STEPPER_ENABLE STEPPER=stepper_z enable=1
  517. SET_STEPPER_ENABLE STEPPER=stepper_z1 enable=1
  518. SET_STEPPER_ENABLE STEPPER=extruder enable=0
  519.  
  520. DISABLE_ALL_SENSOR
  521. SET_GCODE_OFFSET Z=0
  522. BED_MESH_CLEAR
  523. G31
  524. CLEAR_LAST_FILE
  525. M84
  526. BEEP I=2 DUR=500
  527. G4 P5000
  528. M84
  529.  
  530. [gcode_macro CANCEL_PRINT]
  531. description: Cancel Print
  532. rename_existing: BASE_CANCEL_PRINT
  533. gcode:
  534. {% if (printer.gcode_move.position.z) < 200 %}
  535. G1 Z200 F600
  536. {% endif %}
  537.  
  538. G1 X56 F6000
  539. M400
  540. G4 P500
  541. G1 Y290 F6000
  542. M400
  543. G4 P500
  544. G1 X15 F6000
  545.  
  546. SET_IDLE_TIMEOUT TIMEOUT={printer.configfile.settings.idle_timeout.timeout}
  547. CLEAR_PAUSE
  548.  
  549. M106 P2 S0
  550. M106 P0 S0
  551. M106 P3 S0
  552.  
  553. M104 S0
  554. M140 S0
  555. M141 S0
  556.  
  557. M220 S100
  558. M221 S100
  559. SET_STEPPER_ENABLE STEPPER=stepper_x enable=0
  560. SET_STEPPER_ENABLE STEPPER=stepper_y enable=0
  561. SET_STEPPER_ENABLE STEPPER=stepper_z enable=1
  562. SET_STEPPER_ENABLE STEPPER=stepper_z1 enable=1
  563. SET_STEPPER_ENABLE STEPPER=extruder enable=0
  564.  
  565. DISABLE_ALL_SENSOR
  566. SET_GCODE_OFFSET Z=0
  567. BED_MESH_CLEAR
  568. G31
  569. BEEP I=2 DUR=500
  570.  
  571. M84
  572. SDCARD_RESET_FILE
  573. BASE_CANCEL_PRINT
  574. CLEAR_LAST_FILE
  575. G4 P1000
  576.  
  577. [gcode_macro PAUSE]
  578. description: Pause printing
  579. rename_existing: BASE_PAUSE
  580. gcode:
  581. {% set z = params.Z|default(35)|int %}
  582.  
  583. {% if printer['pause_resume'].is_paused|int == 0 %}
  584. SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=zhop VALUE={z}
  585. SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=etemp VALUE={printer['extruder'].target}
  586. SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=efan VALUE={printer["fan_generic cooling_fan"].speed *255}
  587.  
  588. DISABLE_FILAMENT_WIDTH_SENSOR
  589. SET_FILAMENT_SENSOR SENSOR=fila ENABLE=0
  590. SAVE_GCODE_STATE NAME=PAUSE
  591. BASE_PAUSE
  592. G92 E0
  593. G1 E-5 F1800
  594. {% if (printer.gcode_move.position.z ) < z %}
  595. G91
  596. G1 Z{z} F900
  597. {% else %}
  598. G91
  599. G1 Z{5} F900
  600. SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=zhop VALUE=0
  601. {% endif %}
  602. SAVE_GCODE_STATE NAME=PAUSEPARK2
  603. G90
  604. G1 X95 F12000
  605. G1 Y312 F12000
  606. G1 Y316 F600
  607. G1 Y320 F9000
  608. G1 Y324 F600
  609. SAVE_GCODE_STATE NAME=PAUSEPARK
  610. M104 S0
  611. SET_IDLE_TIMEOUT TIMEOUT=86400
  612. SET_STEPPER_ENABLE STEPPER=extruder enable=0
  613. {% endif %}
  614.  
  615. [gcode_macro RESUME]
  616. description: Resume printing
  617. rename_existing: BASE_RESUME
  618. variable_zhop: 0
  619. variable_etemp: 0
  620. variable_efan: 0
  621. gcode:
  622. {% set e = params.E|default(5)|int %}
  623.  
  624. {% if printer['pause_resume'].is_paused|int == 1 %}
  625. SET_IDLE_TIMEOUT TIMEOUT={printer.configfile.settings.idle_timeout.timeout}
  626. {% if etemp > 0 %}
  627. M109 S{etemp|int}
  628. {% endif %}
  629. M83
  630. M106 S0
  631. G1 X95 F12000
  632. G1 Y324 F12000
  633. G92 E0
  634. G1 E5 F50
  635. G92 E0
  636. G1 E50 F200
  637. G92 E0
  638. G1 E-0.8 F200
  639. G4 P300
  640.  
  641. M106 S{efan}
  642.  
  643. G1 Y318 F30000
  644. G1 Y322 F3000
  645. G1 Y318 F30000
  646. G1 Y322 F3000
  647. G1 Y318 F30000
  648. G1 Y322 F3000
  649. G1 Y324 F600
  650.  
  651. G1 X58 F12000
  652. G1 X78 F12000
  653. G1 X58 F12000
  654. G1 X78 F12000
  655. G1 X58 F12000
  656. G1 X78 F12000
  657. G1 X58 F12000
  658. G1 X78 F12000
  659. G1 X58 F12000
  660. G1 X78 F12000
  661. G1 X58 F12000
  662. G1 X78 F12000
  663. G1 X95 F12000
  664.  
  665. G1 Y316 F9000
  666. G1 Y312 F600
  667. G1 Y260 F12000
  668. RESTORE_GCODE_STATE NAME=PAUSEPARK2 MOVE=1 MOVE_SPEED=200
  669. RESTORE_GCODE_STATE NAME=PAUSE MOVE=1 MOVE_SPEED=15
  670. BASE_RESUME
  671. ENABLE_FILAMENT_WIDTH_SENSOR
  672. RESET_FILAMENT_WIDTH_SENSOR
  673. query_filament_width
  674. SET_FILAMENT_SENSOR SENSOR=fila ENABLE=1
  675. {% endif %}
  676.  
  677. [gcode_macro BEEP]
  678. gcode:
  679. {% set i = params.I|default(1)|int %}
  680. {% set dur = params.DUR|default(100)|int %}
  681.  
  682. {% if printer["output_pin sound"].value|int == 1 %}
  683. {% for iteration in range(i|int) %}
  684. SET_PIN PIN=beeper VALUE=1
  685. G4 P{dur}
  686. SET_PIN PIN=beeper VALUE=0
  687. G4 P{dur}
  688. {% endfor %}
  689. {% endif %}
  690.  
  691. [gcode_macro M141]
  692. description: Set chamber temperature
  693. gcode:
  694. {% if printer["heater_generic chamber"] is defined %}
  695. {% set s = params.S|float %}
  696. SET_HEATER_TEMPERATURE HEATER=chamber TARGET={([s, 65]|min)}
  697. {% endif %}
  698.  
  699. [gcode_macro M191]
  700. description: Wait for chamber temperature
  701. gcode:
  702. {% if printer["heater_generic chamber"] is defined %}
  703. {% set s = params.S|float %}
  704.  
  705. M141 {% for p in params %}{'%s%s' % (p, params[p])}{% endfor %}
  706. {% if s != 0 %}
  707. TEMPERATURE_WAIT SENSOR="heater_generic chamber" MINIMUM={([s, 65]|min)-2}
  708. {% endif %}
  709. {% endif %}
  710.  
  711. [gcode_macro M106]
  712. description: Control Fan Speeds
  713. gcode:
  714. {% set p = params.P|default(0)|int %}
  715.  
  716. {% if p == 2 %}
  717. {% if params.S is defined %}
  718. SET_FAN_SPEED FAN=auxiliary_cooling_fan SPEED={(params.S|float / 255.0)}
  719. {% else %}
  720. SET_FAN_SPEED FAN=auxiliary_cooling_fan SPEED=1
  721. {% endif %}
  722. {% endif %}
  723.  
  724. {% if p == 0 %}
  725. {% if params.S is defined %}
  726. SET_FAN_SPEED FAN=cooling_fan SPEED={(params.S|float / 255.0)}
  727. {% else %}
  728. SET_FAN_SPEED FAN=cooling_fan SPEED=1
  729. {% endif %}
  730. {% endif %}
  731.  
  732. {% if p == 3 %}
  733. {% if params.S is defined %}
  734. SET_FAN_SPEED FAN=chamber_circulation_fan SPEED={(params.S|float / 255.0)}
  735. {% else %}
  736. SET_FAN_SPEED FAN=chamber_circulation_fan SPEED=1
  737. {% endif %}
  738. {% endif %}
  739.  
  740. [gcode_macro M107]
  741. description: Turn Off Part Cooling Fan
  742. gcode:
  743. SET_FAN_SPEED FAN=cooling_fan SPEED=0
  744.  
  745. [gcode_macro M303]
  746. description: Heater Bed PID Calibration
  747. gcode:
  748. {% if params.E is defined %}
  749. {% if params.S is defined %}
  750. {% if (params.E|int)==-1 %}
  751. PID_CALIBRATE HEATER=heater_bed TARGET={params.S|int}
  752. {% endif %}
  753. {% if (params.E|int)==0 %}
  754. PID_CALIBRATE HEATER=extruder TARGET={params.S|int}
  755. {% endif %}
  756. {% endif %}
  757. {% endif %}
  758.  
  759. [gcode_macro M8029]
  760. description: Activate/De-activate filament width sensor
  761. gcode:
  762. {% if params.D is defined %}
  763. {% if (params.D|int)==1 %}
  764. ENABLE_FILAMENT_WIDTH_SENSOR
  765. {% endif %}
  766. {% if (params.D|int)==0 %}
  767. DISABLE_FILAMENT_WIDTH_SENSOR
  768. {% endif %}
  769. {% endif %}
  770.  
  771. [gcode_macro M900]
  772. description: Adjust Pressure Advance
  773. gcode:
  774. {% if params.K is defined %}
  775. SET_PRESSURE_ADVANCE ADVANCE={params.K}
  776. {% endif %}
  777. {% if params.T is defined %}
  778. SET_PRESSURE_ADVANCE SMOOTH_TIME={params.T}
  779. {% endif %}
  780.  
  781. [gcode_macro M290]
  782. description: Adjust Z Offset
  783. gcode:
  784. { action_respond_info("Adjusting Z offset by %.3fmm" % (params.Z)) }
  785. SET_GCODE_OFFSET Z_ADJUST={params.Z}
  786.  
  787. [gcode_macro M901]
  788. description: Input Shaper Calibration
  789. gcode:
  790. G28
  791. SHAPER_CALIBRATE
  792. M118 Input shaping complete
  793. SAVE_CONFIG
  794.  
  795. [gcode_macro M0]
  796. description: Gcode PAUSE
  797. gcode:
  798. PAUSE
  799.  
  800. [gcode_macro M25]
  801. rename_existing: M9925
  802. description: Gcode PAUSE
  803. gcode:
  804. PAUSE
  805.  
  806. [gcode_macro RESPOND_INFO]
  807. variable_S:0
  808. description: Report if nozzle has cooled down
  809. gcode:
  810. {% if params.S is defined %}
  811. {% set s = params.S|int %}
  812. {% if s == 0 %}
  813. { action_respond_info("Nozzle cooled") }
  814. {% endif %}
  815. {% endif %}
  816.  
  817. [gcode_macro M4027]
  818. gcode:
  819. { action_respond_info("M4027 called") }
  820. G32 # Set bed meshing to default profile
  821. G29 # Do full homing, z-tilt, and bed meshing
  822. G31 # Set bed meshing back to kamp profile
  823. M400 # Wait for all outstanding G-code moves to finish
  824. M118 Bed mesh calibrate complete # Tell xindi we're done
  825. SAVE_CONFIG # Save configuration
  826.  
  827. [gcode_macro M4028]
  828. description: Home all axis and re-establish baseline Z offset without clearing bed mesh
  829. gcode:
  830. { action_respond_info("M4028 called") }
  831. G28 X Y
  832. get_zoffset
  833. M400
  834. M118 Position init complete
  835.  
  836. [gcode_macro M4029]
  837. description: Clear any saved Z offset, clean nozzle, and re-establish baseline Z offset
  838. gcode:
  839. { action_respond_info("M4029 called") }
  840. M141 S0
  841. SAVE_VARIABLE VARIABLE=z_offset VALUE=0
  842. G28
  843. M400
  844. M118 Position init complete
  845. CLEAR_NOZZLE HOTEND=280
  846. G28 X Y
  847. get_zoffset
  848.  
  849. [gcode_macro M4030]
  850. description: Home all axis and re-establish baseline Z offset
  851. gcode:
  852. { action_respond_info("M4030 called") }
  853. BED_MESH_CLEAR
  854. SET_GCODE_OFFSET Z=0 MOVE=0
  855. G28 X Y
  856. get_zoffset
  857. G1 X152 Y152 F9000
  858. G1 Z0 F600
  859.  
  860. [gcode_macro M4031]
  861. description: Reset platform against base of build chamber
  862. gcode:
  863. { action_respond_info("M4031 called") }
  864. SET_KINEMATIC_POSITION Z=20
  865. G1 Z30 F300
  866. SET_TMC_CURRENT STEPPER=stepper_z CURRENT={printer.configfile.settings['tmc2209 stepper_z'].run_current * 0.7 }
  867. SET_TMC_CURRENT STEPPER=stepper_z1 CURRENT={printer.configfile.settings['tmc2209 stepper_z1'].run_current * 0.7 }
  868. REVERSE_HOMING
  869. SET_TMC_CURRENT STEPPER=stepper_z CURRENT={printer.configfile.settings['tmc2209 stepper_z'].run_current}
  870. SET_TMC_CURRENT STEPPER=stepper_z1 CURRENT={printer.configfile.settings['tmc2209 stepper_z1'].run_current}
  871. G91
  872. G1 Z-30 F600
  873. G90
  874.  
  875. SET_TMC_CURRENT STEPPER=stepper_z CURRENT={printer.configfile.settings['tmc2209 stepper_z'].run_current * 0.7 }
  876. SET_TMC_CURRENT STEPPER=stepper_z1 CURRENT={printer.configfile.settings['tmc2209 stepper_z1'].run_current * 0.7 }
  877. REVERSE_HOMING
  878. SET_TMC_CURRENT STEPPER=stepper_z CURRENT={printer.configfile.settings['tmc2209 stepper_z'].run_current}
  879. SET_TMC_CURRENT STEPPER=stepper_z1 CURRENT={printer.configfile.settings['tmc2209 stepper_z1'].run_current}
  880. G91
  881. G1 Z-30 F600
  882. G90
  883.  
  884. [gcode_macro M603]
  885. description: Unload filament
  886. gcode:
  887. {% set hotendtemp = params.S|default(250)|int %}
  888. {% set accel = printer.toolhead.max_accel|int %}
  889. _CG28
  890. M204 S10000
  891. G1 Y150 F9000
  892. G1 X305 F9000
  893. G1 Y20 F9000
  894. G1 Y5 F3000
  895. G4 P500
  896. G1 Y20 F9000
  897. G1 Y5 F3000
  898. G4 P500
  899. G1 Y20 F9000
  900.  
  901. G1 X56 F12000
  902. G1 Y310 F12000
  903. G1 Y324 F600
  904. G1 X95 F600
  905.  
  906. M106 S0
  907. M109 S{hotendtemp}
  908. M118 Heat up complete
  909.  
  910. G92 E0
  911. G1 E5 F50
  912. G1 E50 F200
  913. G92 E0
  914. G1 E-0.8 F200
  915. G4 P300
  916.  
  917. M106 S255
  918. M104 S{hotendtemp-100}
  919. G4 P5000
  920.  
  921.  
  922. G1 Y318 F9000
  923. G1 Y322 F600
  924. G1 Y318 F9000
  925. G1 Y322 F600
  926. G1 Y308 F30000
  927. G1 Y324 F600
  928.  
  929. M106 S0
  930. M400
  931. M204 S{accel}
  932. M118 Unload finish
  933.  
  934. [gcode_macro M604]
  935. description: Load filament
  936. gcode:
  937. {% set hotendtemp = params.S|default(250)|int %}
  938. {% set current_state = params.F|default(1)|int %}
  939. {% set accel = printer.toolhead.max_accel|int %}
  940. M204 S10000
  941. M104 S{hotendtemp}
  942. _CG28
  943. {% if current_state == 1 %}
  944. {% if (printer.gcode_move.position.y) > 300 %}
  945. G91
  946. G1 Y-20 F9000
  947. G90
  948. {% endif %}
  949. G1 X95 F12000
  950. G1 Y312 F12000
  951. G1 Y316 F600
  952. G1 Y320 F9000
  953. G1 Y324 F600
  954. {% endif %}
  955. M109 S{hotendtemp}
  956. M118 Heat up complete
  957.  
  958. G1 X95 F600
  959. G1 Y324 F600
  960. G92 E0
  961. G1 E5 F50
  962. G92 E0
  963. G1 E120 F300
  964. G92 E0
  965. G1 E-0.8 F200
  966. G4 P300
  967.  
  968. M106 S255
  969. M104 S{hotendtemp-100}
  970. G4 P5000
  971.  
  972. G1 Y318 F9000
  973. G1 Y322 F600
  974. G1 Y318 F9000
  975. G1 Y322 F600
  976. G1 Y308 F30000
  977. G1 Y324 F600
  978.  
  979. M106 S0
  980.  
  981. M400
  982. M204 S{accel}
  983. M118 Load finish
  984.  
  985. [gcode_macro beep_on]
  986. gcode:
  987. SET_PIN PIN=sound VALUE=1
  988.  
  989. [gcode_macro beep_off]
  990. gcode:
  991. SET_PIN PIN=sound VALUE=0
  992.  
  993. [gcode_macro M109]
  994. description: Wait for extruder temperature
  995. rename_existing: M99109
  996. gcode:
  997. {% set s = params.S|float %}
  998.  
  999. M104 {% for p in params %}{'%s%s' % (p, params[p])}{% endfor %}
  1000. {% if s != 0 %}
  1001. TEMPERATURE_WAIT SENSOR=extruder MINIMUM={s} MAXIMUM={s+1}
  1002. {% endif %}
  1003.  
  1004. [gcode_macro G31]
  1005. description: Enable kamp bed meshing profile
  1006. gcode:
  1007. SET_GCODE_VARIABLE MACRO=G29 VARIABLE=k VALUE=1
  1008.  
  1009. [gcode_macro G32]
  1010. description: Enable default bed meshing profile
  1011. gcode:
  1012. SET_GCODE_VARIABLE MACRO=G29 VARIABLE=k VALUE=0
  1013.  
  1014. [gcode_macro G29]
  1015. variable_k:1
  1016. variable_bed_meshing_offset: -0.4 # Generate bed with this amount applied
  1017. # to the default meshing height of 2.0mm
  1018. # negative = closer, positive = further
  1019. # Acceptable range is [-1.0, 1.0]
  1020. description: Prepare print bed, generate a bed mesh, and apply global Z nozzle offset
  1021. gcode:
  1022. {% set z_home_x = printer.configfile.settings.beacon.home_xy_position[0] %}
  1023. {% set z_home_y = printer.configfile.settings.beacon.home_xy_position[1] %}
  1024. # Read bed meshing offset value. Cap value to within the [-1.0, 1.0] range
  1025. {% set bmo = [([(printer["gcode_macro G29"].bed_meshing_offset)|float, -1.0]|max), 1.0]|min %}
  1026. {% set mesh_closer = (2.0 + bmo)|float %}
  1027. {% set mesh_return = (2.0 - bmo)|float %}
  1028. { action_respond_info(" Mesh Closer = %.2f" % (mesh_closer)|float) }
  1029. { action_respond_info(" Mesh Return = %.2f" % (mesh_return)|float) }
  1030.  
  1031. _FIND_Z_EQUALS_ZERO
  1032.  
  1033. G1 X{z_home_x} Y{z_home_y} F7200
  1034. G1 Z{mesh_closer} F600
  1035. SET_KINEMATIC_POSITION Z=2.0
  1036.  
  1037. {% if k|int==1 %}
  1038. BED_MESH_CALIBRATE RUNS=2 PROFILE=kamp
  1039. BED_MESH_PROFILE LOAD=kamp
  1040. SAVE_VARIABLE VARIABLE=profile_name VALUE='"kamp"'
  1041. {% else %}
  1042. BED_MESH_CALIBRATE RUNS=2 PROFILE=default
  1043. BED_MESH_PROFILE LOAD=default
  1044. SAVE_VARIABLE VARIABLE=profile_name VALUE='"default"'
  1045. SET_GCODE_VARIABLE MACRO=G29 VARIABLE=k VALUE=1
  1046. {% endif %}
  1047.  
  1048. G1 X{z_home_x} Y{z_home_y} F7200
  1049. G1 Z{mesh_return} F600
  1050. SET_KINEMATIC_POSITION Z=2.0
  1051.  
  1052.  
  1053. [gcode_macro M204]
  1054. rename_existing: M99204
  1055. description: Set acceleration limits
  1056. gcode:
  1057. {% if params.S is defined %}
  1058. {% set s = params.S|float %}
  1059. {% endif %}
  1060. {% if params.P is defined %}
  1061. {% if params.T is defined %}
  1062. {% set s = [params.P|float ,params.T|float] | min %}
  1063. {% endif %}
  1064. {% endif %}
  1065.  
  1066. SET_VELOCITY_LIMIT ACCEL={s}
  1067. SET_VELOCITY_LIMIT ACCEL_TO_DECEL={s/2}
  1068.  
  1069. [gcode_macro CHECK_CHAMBER_HEATER_Z]
  1070. description: Disable chamber heater if Z height >= 270mm
  1071. gcode:
  1072. {% if (printer.gcode_move.position.z) >= 270 %}
  1073. # Don't turn heater off entirely as we still want the fan to circulate any air
  1074. # it can underneath the build plate to pick up heat to keep the chamber warm
  1075. M141 S10
  1076. {% endif %}
  1077.  
  1078. [gcode_macro SEARCH_VARS]
  1079. # Call with:
  1080. # $ SEARCH_VARS s="profile"
  1081. # // printer.bed_mesh.profile_name : default
  1082. description: Search Klipper Configuration and variables
  1083. gcode:
  1084. {% set search = params.S|lower %}
  1085. {% set ns = namespace() %}
  1086. {% for item in printer %}
  1087. {% if ' ' in item %}
  1088. {% set ns.path = ['printer', "['%s']" % (item), ''] %}
  1089. {% else %}
  1090. {% set ns.path = ['printer.', item, ''] %}
  1091. {% endif %}
  1092.  
  1093. {% if search in ns.path|lower %}
  1094. { action_respond_info(ns.path|join) }
  1095. {% endif %}
  1096.  
  1097. {% if printer[item].items() %}
  1098. {% for childkey, child in printer[item].items() recursive %}
  1099. {% set ns.path = ns.path[:loop.depth|int + 1] %}
  1100.  
  1101. {% if ' ' in childkey %}
  1102. {% set null = ns.path.append("['%s']" % (childkey)) %}
  1103. {% else %}
  1104. {% set null = ns.path.append(".%s" % (childkey)) %}
  1105. {% endif %}
  1106.  
  1107. {% if child is mapping %}
  1108. { loop(child.items()) }
  1109. {% else %}
  1110. {% if search in ns.path|lower %}
  1111. { action_respond_info("%s : %s" % (ns.path|join, child)) }
  1112. {% endif %}
  1113. {% endif %}
  1114.  
  1115. {% endfor %}
  1116. {% endif %}
  1117. {% endfor %}
  1118.  
  1119. [gcode_macro MANAGE_CHAMBER_TEMP]
  1120. description: Dynamically adjust exhaust fan speed
  1121. gcode:
  1122. {% set target = printer['heater_generic chamber'].target %}
  1123. {% set temperature = printer['heater_generic chamber'].temperature %}
  1124. {% if temperature > 70 %}
  1125. M106 P3 S255 # Too hot! Set the exhaust fan to 100%
  1126. {% else %}
  1127. # Allow for 3C of "grace" before we start ramping the exhaust fan speed
  1128. # This prevents the macro from fighting with the chamber heater PID algorithm
  1129. {% set diff = temperature - (target + 3) %}
  1130. {% if diff < 0 %}
  1131. M106 P3 S0 # Disable Exhaust Fan
  1132. {% else %}
  1133. {% set speed = ([(diff * 50), 255] | min) | int %}
  1134. M106 P3 S{speed}
  1135. {% endif %}
  1136. {% endif %}
  1137.  
  1138. [gcode_macro _BEACON_HOME_PRE_X]
  1139. gcode:
  1140. {% set RUN_CURRENT = printer.configfile.settings['tmc2240 stepper_x'].run_current|float %}
  1141. SET_TMC_CURRENT STEPPER=stepper_x CURRENT={RUN_CURRENT * 0.6}
  1142.  
  1143. [gcode_macro _BEACON_HOME_POST_X]
  1144. gcode:
  1145. {% set RUN_CURRENT = printer.configfile.settings['tmc2240 stepper_x'].run_current|float %}
  1146. # Move away
  1147. G1 X20 F9000
  1148. M400
  1149. SET_TMC_CURRENT STEPPER=stepper_x CURRENT={RUN_CURRENT}
  1150.  
  1151. [gcode_macro _BEACON_HOME_PRE_Y]
  1152. gcode:
  1153. {% set RUN_CURRENT = printer.configfile.settings['tmc2240 stepper_y'].run_current|float %}
  1154. SET_TMC_CURRENT STEPPER=stepper_y CURRENT={RUN_CURRENT * 0.8}
  1155.  
  1156. [gcode_macro _BEACON_HOME_POST_Y]
  1157. gcode:
  1158. {% set RUN_CURRENT = printer.configfile.settings['tmc2240 stepper_y'].run_current|float %}
  1159. # Move away
  1160. G1 Y20 F9000
  1161. M400
  1162. SET_TMC_CURRENT STEPPER=stepper_y CURRENT={RUN_CURRENT}
  1163.  
  1164. [gcode_macro _BEACON_CONTACT_PRE_Z]
  1165. gcode:
  1166.  
  1167. [gcode_macro _BEACON_CONTACT_POST_Z]
  1168. gcode:
  1169. G1 Z3 F600 # Ensure the bed is moved away from the nozzle
  1170. M400
  1171.  
  1172. [gcode_macro SCREW_ADJUST_START]
  1173. gcode:
  1174. { action_respond_info("Re-calibrating where Z=0 is") }
  1175. _FIND_Z_EQUALS_ZERO
  1176. M104 S0 # Turn off hotend
  1177.  
  1178. [gcode_macro SFL]
  1179. description: Get zoffset at front-left bed adjustment screw position
  1180. gcode:
  1181. {% set screw_pos_x = printer.configfile.settings.bed_screws.screw1[0] %}
  1182. {% set screw_pos_y = printer.configfile.settings.bed_screws.screw1[1] %}
  1183. {% set beacon_off_x = printer.configfile.settings.beacon.x_offset %}
  1184. {% set beacon_off_y = printer.configfile.settings.beacon.y_offset %}
  1185. G1 Z3 F600 # Ensure the bed is moved away from the nozzle
  1186. G1 X{screw_pos_x - beacon_off_x + 20} Y{screw_pos_y - beacon_off_y + 20} F6000
  1187. PROBE PROBE_METHOD=proximity
  1188. G1 Z3 F600 # Ensure the bed is moved away from the nozzle
  1189.  
  1190. [gcode_macro SFR]
  1191. description: Get zoffset at front-right bed adjustment screw position
  1192. gcode:
  1193. {% set screw_pos_x = printer.configfile.settings.bed_screws.screw2[0] %}
  1194. {% set screw_pos_y = printer.configfile.settings.bed_screws.screw2[1] %}
  1195. {% set beacon_off_x = printer.configfile.settings.beacon.x_offset %}
  1196. {% set beacon_off_y = printer.configfile.settings.beacon.y_offset %}
  1197. G1 Z3 F600 # Ensure the bed is moved away from the nozzle
  1198. G1 X{screw_pos_x - beacon_off_x - 20} Y{screw_pos_y - beacon_off_y + 20} F6000
  1199. PROBE PROBE_METHOD=proximity
  1200. G1 Z3 F600 # Ensure the bed is moved away from the nozzle
  1201.  
  1202. [gcode_macro SBR]
  1203. description: Get zoffset at back-right bed adjustment screw position
  1204. gcode:
  1205. {% set screw_pos_x = printer.configfile.settings.bed_screws.screw3[0] %}
  1206. {% set screw_pos_y = printer.configfile.settings.bed_screws.screw3[1] %}
  1207. {% set beacon_off_x = printer.configfile.settings.beacon.x_offset %}
  1208. {% set beacon_off_y = printer.configfile.settings.beacon.y_offset %}
  1209. G1 Z3 F600 # Ensure the bed is moved away from the nozzle
  1210. G1 X{screw_pos_x - beacon_off_x - 20} Y{screw_pos_y - beacon_off_y - 20} F6000
  1211. PROBE PROBE_METHOD=proximity
  1212. G1 Z3 F600 # Ensure the bed is moved away from the nozzle
  1213.  
  1214. [gcode_macro SBL]
  1215. description: Get zoffset at back-left bed adjustment screw position
  1216. gcode:
  1217. {% set screw_pos_x = printer.configfile.settings.bed_screws.screw4[0] %}
  1218. {% set screw_pos_y = printer.configfile.settings.bed_screws.screw4[1] %}
  1219. {% set beacon_off_x = printer.configfile.settings.beacon.x_offset %}
  1220. {% set beacon_off_y = printer.configfile.settings.beacon.y_offset %}
  1221. G1 Z3 F600 # Ensure the bed is moved away from the nozzle
  1222. G1 X{screw_pos_x - beacon_off_x + 20} Y{screw_pos_y - beacon_off_y - 20} F6000
  1223. PROBE PROBE_METHOD=proximity
  1224. G1 Z3 F600 # Ensure the bed is moved away from the nozzle
Add Comment
Please, Sign In to add comment