Newer
Older
jeltz-klipper-config / config / eddy.cfg
  1. ###############################Macros and related################################
  2. #This secton contains macros and related config sections. Some should be used, others are optional. Read the comment above each one to find out whether or not to uncomment it for your installation.
  3.  
  4.  
  5. # Uncomment this if you are using Eddy as the probe AND the homing endstop AND would like to use the beta z-offset control
  6. [delayed_gcode RESTORE_PROBE_OFFSET]
  7. initial_duration: 1.
  8. gcode:
  9. {% set svv = printer.save_variables.variables %}
  10. {% if not printer["gcode_macro SET_GCODE_OFFSET"].restored %}
  11. SET_GCODE_VARIABLE MACRO=SET_GCODE_OFFSET VARIABLE=runtime_offset VALUE={ svv.nvm_offset|default(0) }
  12. SET_GCODE_VARIABLE MACRO=SET_GCODE_OFFSET VARIABLE=restored VALUE=True
  13. {% endif %}
  14.  
  15. # Uncomment this if you are using Eddy as the probe AND the homing endstop
  16. [gcode_macro SET_Z_FROM_PROBE]
  17. gcode:
  18. {% set cf = printer.configfile.settings %}
  19. SET_GCODE_OFFSET_ORIG Z={printer.probe.last_z_result - cf['probe_eddy_current btt_eddy'].z_offset + printer["gcode_macro SET_GCODE_OFFSET"].runtime_offset}
  20. G90
  21. G1 Z{cf.safe_z_home.z_hop}
  22.  
  23.  
  24. # Uncomment this if you are using Eddy as the probe AND the homing endstop AND would like to use the beta z-offset control
  25. [gcode_macro Z_OFFSET_APPLY_PROBE]
  26. rename_existing: Z_OFFSET_APPLY_PROBE_ORIG
  27. gcode:
  28. SAVE_VARIABLE VARIABLE=nvm_offset VALUE={ printer["gcode_macro SET_GCODE_OFFSET"].runtime_offset }
  29.  
  30.  
  31.  
  32. # Uncomment the lines in this macro if you are using Eddy as the probe AND the homing endstop AND would like to use the beta z-offset control
  33. [gcode_macro SET_GCODE_OFFSET]
  34. rename_existing: SET_GCODE_OFFSET_ORIG
  35. variable_restored: False # Mark whether the var has been restored from NVM
  36. variable_runtime_offset: 0
  37. gcode:
  38. {% if params.Z_ADJUST %}
  39. SET_GCODE_VARIABLE MACRO=SET_GCODE_OFFSET VARIABLE=runtime_offset VALUE={ printer["gcode_macro SET_GCODE_OFFSET"].runtime_offset + params.Z_ADJUST|float }
  40. {% endif %}
  41. {% if params.Z %}
  42. {% set paramList = rawparams.split() %}
  43. {% for i in range(paramList|length) %}
  44. {% if paramList[i]=="Z=0" %}
  45. {% set temp=paramList.pop(i) %}
  46. {% set temp="Z_ADJUST=" + (-printer["gcode_macro SET_GCODE_OFFSET"].runtime_offset)|string %}
  47. {% if paramList.append(temp) %}{% endif %}
  48. {% endif %}
  49. {% endfor %}
  50. {% set rawparams=paramList|join(' ') %}
  51. SET_GCODE_VARIABLE MACRO=SET_GCODE_OFFSET VARIABLE=runtime_offset VALUE=0
  52. {% endif %}
  53. SET_GCODE_OFFSET_ORIG { rawparams }
  54.  
  55.  
  56.  
  57. # This macro automates a lot of the frequency mapping process and simplifies the steps significantly.
  58. [gcode_macro PROBE_EDDY_CURRENT_CALIBRATE_AUTO]
  59. gcode:
  60. BED_MESH_CLEAR
  61. G28 X Y
  62. G90 # Abs positioning
  63. G1 X{ printer.toolhead.axis_maximum.x/2 } Y{ printer.toolhead.axis_maximum.y/2 } F6000
  64. {% if 'z' not in printer.toolhead.homed_axes %}
  65. SET_KINEMATIC_POSITION Z={ printer.toolhead.axis_maximum.z-1 } # Allows the user to work it down until it touches.
  66. {% endif %}
  67. PROBE_EDDY_CURRENT_CALIBRATE {rawparams}
  68.  
  69.  
  70. #This macro is optional but useful if you want to run a rapid scan before each print. Simply uncomment it and add BED_MESH_SCAN to your print start code.