Advertisement
shawnp123

euclidprobe.cfg

Jan 21st, 2023
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.21 KB | None | 0 0
  1.  
  2. [probe]
  3. pin:^PG10
  4. x_offset: 6 # offset for microswitch x direction off nozzle
  5. y_offset: 66 # offset for microswitch y direction off nozzle
  6. #z_offset: 0 # offset for microswitch in z height
  7. samples: 2
  8. sample_retract_dist: 3 # this is so the machine has time for the switch to reset properly, especially with a higher retract speed
  9. samples_result: average
  10. samples_tolerance: 0.04
  11. samples_tolerance_retries: 2
  12. speed: 7 # do not go higher than 10mm/s, you will destroy the switch
  13. lift_speed: 35
  14.  
  15. #########################################################
  16.  
  17. #[homing_override]
  18. #gcode: SET_KINEMATIC_POSITION X=0 Y=0 Z=0
  19.  
  20. #G0 Z8 F500 ; raise bed to 8
  21. #G28 X Y ; home X & Y
  22. #M401 ; deploy Euclid Probe
  23. #G0 X244 Y185 F6000 ; move to X200 Y250
  24. #G28 Z ; home Z
  25. #M402 ; retract Euclid Probe
  26. #axes: z
  27. #set_position_z:-5
  28.  
  29.  
  30. ###########################################################
  31. [bed_mesh]
  32. speed = 200
  33. horizontal_move_z = 10
  34. mesh_min = 30,100
  35. mesh_max = 460,434
  36. probe_count = 7,7
  37. mesh_pps: 3, 3
  38. fade_start: 1
  39. fade_end: 10
  40. algorithm: bicubic
  41. bicubic_tension: 0.4
  42. #relative_reference_index: 24
  43. ###########################################################
  44.  
  45. [z_tilt]
  46. z_positions:
  47. 0,200
  48. 493,6
  49. 493,385
  50. points:
  51. 50,215
  52. 470,7
  53. 470,380
  54. speed: 180
  55. horizontal_move_z: 10
  56. retries: 10
  57. retry_tolerance: 0.0075
  58.  
  59. ## The following is EXAMPLE configuration; it is intended to guide you in the
  60. ## configuration of the Euclid probe for YOUR printer.
  61. ##
  62. ## When incorporating this config into your own, make sure you address all
  63. ## comment markers starting with "@TODO". Failure to do so could result in
  64. ## damage to your probe, your printer, or your pride.
  65. ##
  66. ##
  67. ## This example is for a fixed dock, fixed gantry/carriage and moving bed motion
  68. ## system like RailCore, Ender5, V-Core3, etc. Delta printes will be similar.
  69. ##
  70. ## Moving gantry printers like Voron need a few tweaks to ensure proper
  71. ## clearances and leveling procedures; some hints are provided inline below.
  72. ##
  73. ## Array variables implementation and macro setups credited to Brian Lalor,
  74. ## yolo-dubstep#8033 on Discord. See https://github.com/blalor/vcore3-ratos-config
  75. ## for updates and details.
  76. ##
  77.  
  78. ## @TODO the following is a hardware probe config for the hardware configuration.
  79. ## it can appear in either the printer.cfg OR in the euclid.cfg, not both.
  80. ## see https://euclidprobe.github.io/05_klipper.html for more details.
  81.  
  82. # Below is an example bed diagram to correlate with macros and movements below.
  83. # __________________________________________________________________________
  84. # | |
  85. # | |
  86. # | |
  87. # | |
  88. # | |
  89. # | |
  90. # | |
  91. # | |
  92. # | |
  93. # | |
  94. # | |
  95. # | |
  96. # | |
  97. # | |
  98. # | |
  99. # | |
  100. # | |
  101. # | |
  102. # | * Dock Exit Position |
  103. # | X0,Y40 |
  104. # | |
  105. # | |
  106. # | |
  107. # | |
  108. # | |
  109. # | X0,Y-4 X30,Y-4 X100,Y-4 |
  110. # | * Dock * Dock Side * Dock Preflight |
  111. # |________________________________________________________________________|
  112. #
  113.  
  114. [gcode_macro EuclidProbe]
  115. description: config vars for Euclid probe deploy/stow
  116.  
  117. ## @TODO Replace the coordinates to suit your printer
  118. variable_position_preflight: [ 250, 465 ] # position for probe to have clear path to dock
  119. variable_position_side: [ 220, 504 ] # position for probe near dock to swipe on/off
  120. variable_position_dock: [ 250, 504 ] # dock position
  121. variable_position_fail_dock: [ 220, 504 ] # if mesh fails before print
  122. ## @TODO if your printer has a fixed Z-Endstop that you will use define it here
  123. ## @TODO for example Voron Trident
  124. variable_position_zstop: [ 150,250 ] # zstop position
  125.  
  126. ## exit/re-entry staging
  127. variable_position_exit: [ 250, 460 ] # exit position
  128.  
  129. ## clearance between the toolhead and bed when traveling to pick up the probe
  130. variable_bed_clearance: 8
  131.  
  132. ## probe dock height
  133. ## @TODO If the toolhead can move vertically in relation to the probe dock
  134. ## @TODO height(such as attached to the be on a moving-gantry printer like a
  135. ## @TODO Voron 2.4), set this to the Z position of the probe dock.
  136. # variable_dock_height: 15
  137.  
  138. ## move speeds in mm/min
  139. variable_move_speeds: 10000
  140.  
  141. ## internal state variables; not for configuration!
  142. variable_batch_mode_enabled: False
  143. variable_probe_state: None
  144.  
  145. gcode:
  146. RESPOND TYPE=command MSG="{ printer['gcode_macro EuclidProbe'] }"
  147.  
  148.  
  149. # @TODO The homing override is machine specific. This example is for a
  150. # @TODO fixed-gantry/moving-bed printer such as the Rat Rig V-Core 3. Ensure you
  151. # @TODO only have [homing_override] defined in one place in your Klipper config
  152. # @TODO (typically here or in printer.cfg). It's particularly important to make
  153. # @TODO sure the probe is picked up before attempting to home the Z axis.
  154. [homing_override]
  155. axes: z
  156. set_position_z: -5
  157. gcode:
  158. {% set euclid_probe = printer["gcode_macro EuclidProbe"] %}
  159.  
  160.  
  161.  
  162. G90
  163.  
  164. # force the bed and toolhead apart
  165. SET_KINEMATIC_POSITION Z=0
  166. G0 Z{ euclid_probe.bed_clearance } F800
  167.  
  168. # home Y and X, Y first to avoid running into the dock
  169. {% if "y" not in (printer.toolhead.homed_axes | lower) %}
  170. G28 X
  171. {% endif %}
  172.  
  173. {% if "x" not in (printer.toolhead.homed_axes | lower) %}
  174. G28 Y
  175. {% endif %}
  176.  
  177. ## @TODO If you are using Euclid to function as a Z-Endstop, then you need to deploy it.
  178. ## @TODO If you are using a fixed Z-stop, then comment out the next line
  179. DEPLOY_PROBE
  180.  
  181. # @ TODO home Z at bed center with Euclid Probe
  182. G0 X{ printer.toolhead.axis_maximum.x/2 } Y{ printer.toolhead.axis_maximum.y/2 } F{ euclid_probe.move_speeds }
  183. G28 Z
  184.  
  185.  
  186.  
  187. # after 'G28 Z' the probe stays in contact with the bed; move it away bed_clearance height.
  188. G0 Z{euclid_probe.bed_clearance} F800
  189.  
  190. ## @TODO If you are using Euclid to function as a Z-Endstop, then you need to stow it.
  191. ## @TODO If you are using a fixed Z-stop, then comment out the next line
  192. STOW_PROBE
  193.  
  194.  
  195. [gcode_macro _ASSERT_PROBE_STATE]
  196. description: ensures probe is in a known state; QUERY_PROBE must have been called before this macro!
  197. gcode:
  198. ## QUERY_PROBE manually-verified results, when microswitch not depressed
  199. ## "TRIGGERED" -> 1 :: probe stowed
  200. ## "open" -> 0 :: probe deployed
  201. {% set last_query_state = "deployed" if printer.probe.last_query == 0 else "deployed" %}
  202.  
  203. {% if params.MUST_BE != last_query_state %}
  204. { action_raise_error("expected probe state to be {} but is {} ({})".format(params.MUST_BE, last_query_state, printer.probe.last_query)) }
  205. {% else %}
  206. ## all good; update state
  207. SET_GCODE_VARIABLE MACRO=EuclidProbe VARIABLE=probe_state VALUE="'{ last_query_state }'"
  208. {% endif %}
  209.  
  210.  
  211. [gcode_macro ASSERT_PROBE_DEPLOYED]
  212. description: error if probe not deployed
  213. gcode:
  214. # wait for moves to finish, then pause 0.25s for detection
  215. M400
  216. G4 P250
  217.  
  218. QUERY_PROBE
  219. _ASSERT_PROBE_STATE MUST_BE=deployed
  220.  
  221.  
  222. [gcode_macro ASSERT_PROBE_STOWED]
  223. description: error if probe not stowed
  224. gcode:
  225. # wait for moves to finish, then pause 0.25s for detection
  226. M400
  227. G4 P250
  228.  
  229. QUERY_PROBE
  230. _ASSERT_PROBE_STATE MUST_BE=deployed
  231.  
  232.  
  233. [gcode_macro EUCLID_PROBE_BEGIN_BATCH]
  234. description: begin euclid probe batch mode
  235. gcode:
  236. SET_GCODE_VARIABLE MACRO=EuclidProbe VARIABLE=batch_mode_enabled VALUE=True
  237. RESPOND TYPE=command MSG="Probe batch mode enabled"
  238.  
  239.  
  240. [gcode_macro EUCLID_PROBE_END_BATCH]
  241. description: end euclid probe batch mode and stow probe
  242. gcode:
  243. SET_GCODE_VARIABLE MACRO=EuclidProbe VARIABLE=batch_mode_enabled VALUE=False
  244. RESPOND TYPE=command MSG="Probe batch mode disabled"
  245. STOW_PROBE
  246.  
  247.  
  248. [gcode_macro DEPLOY_PROBE]
  249. description: deploy Euclid probe
  250. gcode:
  251. {% set euclid_probe = printer["gcode_macro EuclidProbe"] %}
  252.  
  253. {% if euclid_probe.batch_mode_enabled and euclid_probe.probe_state == "deployed" %}
  254. RESPOND TYPE=command MSG="Probe batch mode enabled: already deployed"
  255. {% else %}
  256. RESPOND TYPE=command MSG="Deploying probe"
  257.  
  258. # ensure the probe is currently stowed; can't deploy what isn't stowed.
  259. ASSERT_PROBE_STOWED
  260.  
  261. G90
  262.  
  263. # set approach elevation to clear probe over bed on fixed gantry machine
  264. G0 Z{ euclid_probe.bed_clearance } F800
  265.  
  266. # move the toolhead to safe position to start probe pickup
  267. G0 X{ euclid_probe.position_preflight[0] } Y{ euclid_probe.position_preflight[1] } F{ euclid_probe.move_speeds }
  268.  
  269. # move to the side of the dock
  270. G0 X{ euclid_probe.position_side[0] } Y{ euclid_probe.position_side[1] } F{ euclid_probe.move_speeds }
  271.  
  272.  
  273.  
  274. # wait 1/4 second
  275. M400
  276. G4 P250
  277.  
  278. # move sideways over the dock to pick up probe
  279. G0 X{ euclid_probe.position_dock[0] } Y{ euclid_probe.position_dock[1] } F2500
  280.  
  281. # wait 1/4 second
  282. M400
  283. G4 P250
  284.  
  285. # confirm deploy was successful
  286. ASSERT_PROBE_DEPLOYED
  287.  
  288. # move out of the dock in a straight line
  289. G0 X{ euclid_probe.position_exit[0] } Y{ euclid_probe.position_exit[1] } F{ euclid_probe.move_speeds }
  290. {% endif %}
  291.  
  292.  
  293. [gcode_macro STOW_PROBE]
  294. description: stow Euclid probe
  295. gcode:
  296. {% set euclid_probe = printer["gcode_macro EuclidProbe"] %}
  297.  
  298. {% if euclid_probe.batch_mode_enabled %}
  299. RESPOND TYPE=command MSG="Probe batch mode enabled: not stowing"
  300. {% else %}
  301. RESPOND TYPE=command MSG="Stowing probe"
  302.  
  303. # ensure the probe is currently deployed; can't stow what isn't deployed.
  304. ASSERT_PROBE_DEPLOYED
  305.  
  306. G90
  307.  
  308. # set approach elevation for fixed gantry system to clear probe over bed
  309. G0 Z{ euclid_probe.bed_clearance } F800
  310.  
  311. # move the toolhead to safe position to start probe pickup
  312. G0 X{ euclid_probe.position_preflight[0] } Y{ euclid_probe.position_preflight[1] } F{ euclid_probe.move_speeds }
  313.  
  314. # move to the exit/re-entry staging position
  315. G0 X{ euclid_probe.position_exit[0] } Y{ euclid_probe.position_exit[1] } F{ euclid_probe.move_speeds }
  316.  
  317. # slowly move into dock
  318. G0 X{ euclid_probe.position_dock[0] } Y{ euclid_probe.position_dock[1] } F5000
  319.  
  320. # wait for moves to finish, pause to force 90deg travel swipe
  321. M400
  322. G4 P250
  323.  
  324. # quick swipe off
  325. G0 X{ euclid_probe.position_side[0] } Y{ euclid_probe.position_side[1] } F{ euclid_probe.move_speeds }
  326.  
  327. # confirm stowing was successful
  328. ASSERT_PROBE_STOWED
  329. {% endif %}
  330.  
  331.  
  332. ## Simple example macro to perform a bed mesh calibration by wrapping it in
  333. ## DEPLOY_PROBE/STOW_PROBE macros.
  334. ## For a more complex example that probes the area that will be printed, see
  335. ## https://github.com/blalor/vcore3-ratos-config/blob/50e757ec32e085bedb3b9fa317581f9aa1913dd2/euclid.cfg#L230-L305
  336.  
  337.  
  338. ## @TODO uncomment one of the following macros if necessary for your printer:
  339. ## * Z_TILT_ADJUST is for [z_tilt] config
  340. ## * QUAD_GANTRY_LEVEL is for [quad_gantry_level] config
  341.  
  342.  
  343.  
  344.  
  345.  
  346. [gcode_macro PROBE_CALIBRATE]
  347. rename_existing: PROBE_CALIBRATE_ORIG
  348. gcode:
  349. {% set euclid_probe = printer["gcode_macro EuclidProbe"] %}
  350. DEPLOY_PROBE
  351.  
  352. G90
  353. G0 X{ printer.toolhead.axis_maximum.x/2 } Y{ printer.toolhead.axis_maximum.y/2 } F{ euclid_probe.move_speeds }
  354.  
  355. M117 Beginning probe calibration; remove probe before measuring nozzle height!
  356. PROBE_CALIBRATE_ORIG
  357.  
  358.  
  359.  
  360.  
  361.  
  362.  
  363.  
  364.  
  365. [gcode_macro START_PRINT]
  366. ## support PRINT_MIN={first_layer_print_min[0]},{first_layer_print_min[1]} PRINT_MAX={first_layer_print_max[0]},{first_layer_print_max[1]}
  367. variable_first_layer_min_xy: None
  368. variable_first_layer_max_xy: None
  369.  
  370. gcode:
  371.  
  372. {% set euclid = printer["gcode_macro EuclidProbe"] %}
  373.  
  374. {% set extruder_temp = params.EXTRUDER_TEMP | default(printer.extruder.target, true) %}
  375. {% set EXTRUDER_TEMP = params.EXTRUDER_TEMP|default(0)|float %}
  376.  
  377.  
  378. ; {% endif %}
  379.  
  380. # Metric values
  381. G21
  382.  
  383. # Absolute positioning
  384. G90
  385.  
  386. # Set extruder to absolute mode
  387. M82
  388.  
  389. EUCLID_PROBE_BEGIN_BATCH
  390.  
  391. # Home
  392. G28
  393.  
  394. # Adjust bed tilt
  395. M117 Adjusting for tilt...
  396. Z_TILT_ADJUST
  397.  
  398. # Home again as Z will have changed after tilt adjustment and bed heating.
  399. M117 Rehoming after tilt adjustment...
  400. G28 Z
  401.  
  402. M117 Bed mesh calibration...
  403.  
  404. SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=first_layer_min_xy VALUE="{ params.PRINT_MIN | default(None, true) }"
  405. SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=first_layer_max_xy VALUE="{ params.PRINT_MAX | default(None, true) }"
  406.  
  407. BED_MESH_CALIBRATE PRINT_MIN={params.PRINT_MIN} PRINT_MAX={params.PRINT_MAX}
  408. ;BED_MESH_PROFILE LOAD="default"
  409.  
  410. SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=first_layer_min_xy VALUE=None
  411. SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=first_layer_max_xy VALUE=None
  412. M104 S{EXTRUDER_TEMP} ; set extruder temp
  413. M109 S{EXTRUDER_TEMP} ; wait for extruder temp
  414.  
  415. EUCLID_PROBE_END_BATCH
  416.  
  417. M104 S{EXTRUDER_TEMP} ; set extruder temp
  418. M109 S{EXTRUDER_TEMP} ; wait for extruder temp
  419.  
  420. G1 X10 Y10 Z5 F9000 ; Move safe Z height to shear strings
  421.  
  422. G0 X10 Y20 Z0.0 F9000 ; Move in 1mm from edge and up [z] 0.2mm
  423.  
  424. G92 E0 ; Set extruder to [0] zero
  425.  
  426. G1 X200 E50 F500 ; Extrude 30mm filiment along X axis 100mm long to prime and clean the nozzle
  427.  
  428. G92 E0 ; Reset extruder to [0] zero end of cleaning run
  429.  
  430. G1 X205 F15000 ; quick wipe away from the filament line
  431.  
  432. [gcode_macro PRINT_START]
  433. ## support PRINT_MIN={first_layer_print_min[0]},{first_layer_print_min[1]} PRINT_MAX={first_layer_print_max[0]},{first_layer_print_max[1]}
  434. variable_first_layer_min_xy: None
  435. variable_first_layer_max_xy: None
  436.  
  437. gcode:
  438.  
  439. {% set euclid = printer["gcode_macro EuclidProbe"] %}
  440.  
  441. {% set extruder_temp = params.EXTRUDER_TEMP | default(printer.extruder.target, true) %}
  442. {% set hotendtemp = params.HOTEND|int %}
  443.  
  444. ; {% endif %}
  445.  
  446. #M109 S{hotendtemp}
  447. # Metric values
  448. G21
  449.  
  450. # Absolute positioning
  451. G90
  452.  
  453. # Set extruder to absolute mode
  454. M82
  455.  
  456. EUCLID_PROBE_BEGIN_BATCH
  457.  
  458. # Home
  459. G28
  460.  
  461. # Adjust bed tilt
  462. M117 Adjusting for tilt...
  463. Z_TILT_ADJUST
  464.  
  465. # Home again as Z will have changed after tilt adjustment and bed heating.
  466. M117 Rehoming after tilt adjustment...
  467. G28 Z
  468.  
  469. M117 Bed mesh calibration...
  470.  
  471. SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=first_layer_min_xy VALUE="{ params.PRINT_MIN | default(None, true) }"
  472. SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=first_layer_max_xy VALUE="{ params.PRINT_MAX | default(None, true) }"
  473.  
  474. BED_MESH_CALIBRATE PRINT_MIN={params.PRINT_MIN} PRINT_MAX={params.PRINT_MAX}
  475. ;BED_MESH_PROFILE LOAD="default"
  476.  
  477. SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=first_layer_min_xy VALUE=None
  478. SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=first_layer_max_xy VALUE=None
  479.  
  480. EUCLID_PROBE_END_BATCH
  481.  
  482. M109 S{hotendtemp}
  483.  
  484. G1 X10 Y10 Z5 F9000 ; Move safe Z height to shear strings
  485.  
  486. G0 X10 Y20 Z0.0 F9000 ; Move in 1mm from edge and up [z] 0.2mm
  487.  
  488. G92 E0 ; Set extruder to [0] zero
  489.  
  490. G1 X200 E50 F500 ; Extrude 30mm filiment along X axis 100mm long to prime and clean the nozzle
  491.  
  492. G92 E0 ; Reset extruder to [0] zero end of cleaning run
  493.  
  494. G1 X205 F15000 ; quick wipe away from the filament line
  495.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement