Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # QIDI Plus4 V1.0.0
- [gcode_macro _CG28]
- description: Home all if not already homed
- gcode:
- {% if "xyz" not in printer.toolhead.homed_axes %}
- G28
- {% endif %}
- [gcode_macro MOVE_HEAD]
- description: Move Head Around After Lubricating Rods
- gcode:
- {% set speed = params.SPEED|default(10000)|float %}
- _CG28
- G1 Z10 F600 # Move bed 10mm away from nozzle
- {% for i in range(10) %}
- G1 X0 Y0 F{speed}
- G1 X305 Y305 F{speed}
- G1 X0 Y305 F{speed}
- G1 X305 Y305 F{speed}
- {% endfor %}
- G1 X152.5 Y152.5 F{speed}
- # The following 2 macros intent is to provide for a clear way to separate the
- # nozzle z offset from a filament specific z offset adjustment
- [gcode_macro _APPLY_NOZZLE_OFFSET]
- description: Determine the global nozzle offset and apply
- variable_hotend_temp: 250 # Target hotend temp (typically set by PRINT_START)
- variable_probe_temp_delta: 70 # We probe at this amount less than the hotend temp
- variable_reference_position: 5.0 # A safe Z position at which we'll apply the offset change
- variable_offset_correction: 0.07 # Static Offset Correction
- gcode:
- # Set our local working variables. We treat everything as floats for these calculations
- {% set reference_position = reference_position|float %}
- {% set offset_correction = offset_correction|float %}
- # Determine the rest of our working variables
- {% set z_home_x = printer.configfile.settings.beacon.home_xy_position[0] %}
- {% set z_home_y = printer.configfile.settings.beacon.home_xy_position[1] %}
- {% set z_speed = printer.configfile.settings['stepper_z'].homing_speed|float * 60 %}
- {% set target_position = (reference_position + offset_correction)|float %}
- # Report to the console what we've determined
- { action_respond_info("Applying Z offset adjustment for hotend temperature of %.1f°C" % hotend_temp|float) }
- { action_respond_info(" Offset Correction = %.3f" % (offset_correction)|float) }
- { action_respond_info(" Reference Position = %.1f" % (reference_position)|float) }
- { action_respond_info(" Target Position = %.6f" % (target_position)|float) }
- SET_GCODE_OFFSET Z=0 # Clear any pre-existing Gcode offsets
- G1 Z{target_position} F{z_speed} # Move Z to determined target position
- G1 X{z_home_x} Y{z_home_y} F7200 # Move X/Y to Z homing position
- M400 # Wait for prior gcode-commands to finish
- SET_KINEMATIC_POSITION Z={reference_position} # Set target position to be the reference position
- G1 Z{reference_position} F{z_speed} # Move Z to reference position. Ideally the bed should not move
- M400
- [gcode_macro _SETTLE_PRINT_BED]
- description: Vibrate bed up and down to try to settle any movement in the springs
- gcode:
- G1 Z4 F600 # Move to Z=4
- G91 # Enter relative positioning mode
- M400 # Wait for all prior commands to finish
- {% for z in range(50) %} # Loop 50 times
- G1 Z1 F5000 # Move bed down by 1mm
- G1 Z-1 F5000 # Move bed up by 1mm
- {% endfor %}
- G90 # Go back to absolute positioning mode
- M400 # Wait for all prior commands to finish
- G1 Z4 F600 # Make sure Z=4mm before we leave the macro
- [gcode_macro _FIND_Z_EQUALS_ZERO]
- description: Find where Z equals zero and apply nozzle offset
- gcode:
- {% set hotend_temp = (printer["gcode_macro _APPLY_NOZZLE_OFFSET"].hotend_temp)|float %}
- {% set probe_temp_delta = (printer["gcode_macro _APPLY_NOZZLE_OFFSET"].probe_temp_delta)|float %}
- {% set z_home_temp = hotend_temp - probe_temp_delta %}
- {% set z_home_x = printer.configfile.settings.beacon.home_xy_position[0] %}
- {% set z_home_y = printer.configfile.settings.beacon.home_xy_position[1] %}
- {% set k = printer["gcode_macro G29"].k|int %}
- M104 S{z_home_temp} # Commence nozzle warmup for z homing
- BED_MESH_CLEAR # Clear out any existing bed meshing context
- SET_KINEMATIC_POSITION Z=0 # Force firmware to believe Z is homed at 0
- G1 Z3 F600 # Move bed away from the nozzle by 3mm from where it was
- SET_KINEMATIC_POSITION CLEAR=XYZ # Ensure all kinematic repositionings are cleared
- SET_GCODE_OFFSET Z=0 # Comnpletely reset all prior notions of Z offset
- G28 X Y # Home X and Y Axes
- {% if (k == 1) and (printer.configfile.settings['beacon model default'] is defined) %}
- G28 Z METHOD=proximity # Do a rapid proximity based Z home if possible
- {% else %}
- M109 S{z_home_temp} # Wait for nozzle to fully heat up
- G28 Z METHOD=CONTACT CALIBRATE=0 # Home Z axis without calibration
- {% endif %}
- _SETTLE_PRINT_BED # Try to settle the build plate
- M109 S{z_home_temp} # Wait for nozzle to fully reach Z probing temperature
- G28 Z METHOD=CONTACT CALIBRATE=1 # Home Z axis, and calibrate beacon
- Z_TILT_ADJUST # Ensure bed is level
- G1 X{z_home_x} Y{z_home_y} F7200 # Move to Z home position
- G4 P15000 # Heatsoak hotend for 15s more
- G28 Z METHOD=CONTACT CALIBRATE=1 # Establish Z=0
- G1 Z3 F600 # Move bed away from the nozzle by 3mm from where it was
- _APPLY_NOZZLE_OFFSET
- [gcode_macro APPLY_FILAMENT_OFFSET]
- description: Apply a Z offset adjustment for a specific filament
- gcode:
- {% set filament_z = params.Z|default(0)|float %}
- { action_respond_info("Setting Filament Offset to %.3fmm" % (filament_z)) }
- SET_GCODE_OFFSET Z_ADJUST={filament_z}
- [gcode_macro APPLY_BED_TYPE_OFFSET]
- description: Apply a Z offset adjustment for a specific bed type
- gcode:
- {% set bed_type = params.BED_TYPE|default("default")|string|lower %}
- { action_respond_info("Bed Type Is: %s" % bed_type) }
- {% if "textured" in bed_type %}
- {% set offset = 0.0|float %}
- {% elif "cool plate" in bed_type %}
- {% set offset = 0.025|float %}
- {% else %}
- {% set offset = 0.0|float %}
- {% endif %}
- { action_respond_info("Bed Offset Is: %.3f" % offset) }
- SET_GCODE_OFFSET Z_ADJUST={offset}
- # All the following zoffset calls only exist to keep Qidi's xindi happy
- [gcode_macro zoffset]
- description: Apply baseline Z offset which is always zero for Beacon Contact
- gcode:
- SET_GCODE_OFFSET Z=0 # Apply a zero gcode_offset
- # Development test
- [gcode_macro test_zoffset]
- description: Debugging test to compare the probe contact and proximity Z Offset values
- gcode:
- G28 X Y
- get_zoffset
- M400
- BEACON_OFFSET_COMPARE
- G4 P5000
- G1 Z10 F600
- [gcode_macro get_zoffset]
- description: Homes nozzle against build plate and applies global z offset
- gcode:
- _FIND_Z_EQUALS_ZERO
- [gcode_macro save_zoffset]
- description: Use APPLY_FILAMENT_OFFSET instead
- gcode:
- { action_respond_info("Use APPLY_FILAMENT_OFFSET instead") }
- [gcode_macro set_zoffset]
- description: Apply baseline Z offset which is always zero for Beacon Contact
- gcode:
- SET_GCODE_OFFSET Z=0 # Apply a zero gcode_offset
- [gcode_macro _MOVE_TO_CHUTE]
- description: Safely move nozzle over the purge chute if not already there
- gcode:
- M400
- {% if (printer.gcode_move.position.x) != 95 %}
- {% if (printer.gcode_move.position.y) != 324 %}
- {% if (printer.gcode_move.position.x) < 56 %}
- G1 X56 F12000 # Move to avoid collision with stepper motor
- M400
- {% endif %}
- {% if (printer.gcode_move.position.y) != 300 %}
- G1 Y300 F12000 # Move to avoid collision with purge activation arm
- M400
- {% endif %}
- {% if (printer.gcode_move.position.x) > 56 %}
- G1 X56 F12000 # Move in line with silicon scrubbing brush
- M400
- {% endif %}
- G1 Y324 F600 # Slowly move back in line with purge chute
- G1 X95 F600 # Move directly over the purge chute
- M400 # Wait for all operations to complete
- {% endif %}
- {% else %}
- {% if (printer.gcode_move.position.y) != 324 %}
- G1 Y300 F12000
- G1 Y324 F600
- M400
- {% endif %}
- {% endif %}
- [gcode_macro _ACTIVATE_PURGE_EJECTION]
- description: Activate purge arm to drop purged filament down chute
- gcode:
- {% set hotendtemp = params.HOTEND|default(250)|int %}
- _MOVE_TO_CHUTE
- M106 S255
- G4 P5000
- M104 S{hotendtemp - 80}
- G1 Y318 F9000
- G1 Y322 F600
- G1 Y318 F9000
- G1 Y322 F600
- G1 Y308 F30000
- G1 Y324 F600
- [gcode_macro _PURGE_INTO_CHUTE]
- description: Purge Filament into purge chute
- gcode:
- {% set hotendtemp = params.HOTEND|default(250)|int %}
- _MOVE_TO_CHUTE
- G92 E0 # Set extruder position to 0
- G1 E5 F50 # Purge 5mm of filament slowly
- G92 E0 # Set extruder position to 0
- G1 E80 F200 # Purge 80mm of filament at 2mm/s
- G92 E0 # Set extruder position to 0
- G1 E-2 F200 # Perform a 2mm retraction
- _ACTIVATE_PURGE_EJECTION HOTEND={hotendtemp} # Eject the purged filament
- G1 E-1 # Perform a 1mm retraction
- [gcode_macro _PEI_WIPE]
- description: Wipe nozzle over PEI Plate
- gcode:
- _MOVE_TO_CHUTE
- G1 X124
- G1 X133 F200
- G1 Y321 F200
- G2 I0.5 J0.5 F600
- G2 I0.5 J0.5 F600
- G2 I0.5 J0.5 F600
- G1 Y319 F150
- G1 X132
- G1 Y324
- G1 X131
- G1 Y319
- G1 X130
- G1 Y324
- G1 X129
- G1 Y319
- G1 X113 F200
- G1 Y320
- G1 X125
- G1 X113
- G1 X125
- G2 I0.5 J0.5 F200
- G2 I0.5 J0.5 F200
- G2 I0.5 J0.5 F200
- M400
- G1 Y320 F600
- G1 X95 F600
- M400
- [gcode_macro _BRUSH_WIPE]
- description: Wipe nozzle over Silicone Brush area
- gcode:
- _MOVE_TO_CHUTE
- G1 Y300 F600
- G1 X95 F12000
- G1 Y314 F9000
- G1 Y324 F600
- G1 X58 F12000
- G1 X78 F12000
- G1 Y324
- G1 X58 F12000
- G1 X78 F12000
- G1 Y323.5
- G1 X58 F12000
- G1 X78 F12000
- G1 Y323
- G1 X58 F12000
- G1 X78 F12000
- G1 Y322.5
- G1 X58 F12000
- G1 X78 F12000
- G1 Y322
- G1 X58 F12000
- G1 X75 F12000
- G1 Y321.5
- G2 I0.8 J0.8 F600
- G2 I0.8 J0.8 F600
- G2 I0.8 J0.8 F600
- G1 Y324 F600
- M106 S0
- G1 X95 F12000
- G1 Y316 F9000
- G1 Y312 F600
- M400
- # Specialized for power lose recovery
- [gcode_macro CLEAR_NOZZLE_PLR]
- description: Specialised Nozzle Clean after power loss
- gcode:
- {% set hotendtemp = params.HOTEND|default(250)|int %}
- {% if (printer.gcode_move.position.z ) < 35 %}
- G1 Z35 F900
- {% else %}
- G91
- G1 Z{5} F900
- G90
- {% endif %}
- _MOVE_TO_CHUTE
- M106 S0
- M109 S{hotendtemp}
- G92 E0
- G1 E5 F50
- G92 E0
- G1 E80 F200
- G92 E0
- G1 E-2 F200
- G4 P300
- M106 S255
- G1 Y316 F30000
- G1 Y320 F3000
- G1 Y316 F30000
- G1 Y320 F3000
- G1 Y316 F30000
- G1 Y320 F3000
- G1 Y316 F12000
- G1 Y312 F600
- [gcode_macro CLEAR_NOZZLE]
- description: Clear Nozzle of any stuck filament
- gcode:
- {% set hotendtemp = params.HOTEND|default(250)|int %}
- {% set purge = params.PURGE|default(0)|int %}
- {% set pei_wipe = params.PEI_WIPE|default(0)|int %}
- {% if (printer.gcode_move.position.z ) < 35 %}
- G1 Z35 F900
- {% else %}
- G91
- G1 Z{5} F900
- G90
- {% endif %}
- _MOVE_TO_CHUTE
- M106 S0 # Turn off part cooling fan
- M109 S{hotendtemp} # Wait for nozzle to reach full temperature
- {% if purge == 1 %}
- _PURGE_INTO_CHUTE HOTEND={hotendtemp} # Hotend temp is set to 80C less than hotendtemp after this call
- {% else %}
- _ACTIVATE_PURGE_EJECTION HOTEND={hotendtemp} # Hotend temp is set to 80C less than hotendtemp after this call
- {% endif %}
- TEMPERATURE_WAIT SENSOR=extruder MAXIMUM={hotendtemp - 70}
- # Wipe Nozzle over the PEI plate
- {% if pei_wipe == 1 %}
- _PEI_WIPE
- {% endif %}
- # Wipe Nozzle using silicon brush
- _BRUSH_WIPE
- M118 Nozzle cleared
- # Safely move nozzle to park position at back left
- G1 Y300 F12000
- M400
- G1 X10 F12000
- # Cool hotend down
- M106 S255
- M104 S{hotendtemp - 80}
- TEMPERATURE_WAIT SENSOR=extruder MAXIMUM={hotendtemp - 70}
- M106 S0
- M400
- M118 Nozzle cooled
- # Excute when start printing, prior to gcode file
- [gcode_macro PRINT_START]
- description: Start Printing
- gcode:
- {% set bedtemp = params.BED|int %}
- {% set hotendtemp = params.HOTEND|int %}
- {% set chambertemp = params.CHAMBER|default(0)|int %}
- # Inform nozzle offset mechanism of our target hotend temperature
- SET_GCODE_VARIABLE MACRO=_APPLY_NOZZLE_OFFSET VARIABLE=hotend_temp VALUE={hotendtemp}
- M140 S{bedtemp} # Initiate Print Bed Warmup as early as possible
- M104 S0 # Make sure hotend is off
- M106 P3 S0 # Turn off chamber circulation/exhaust fan
- {% if chambertemp > 0 %}
- M141 S{chambertemp} # Initiate Chamber Warmup as early as possible
- M106 P2 S255 # Set AUX to full to help mix chamber air fully
- M106 S255 # Turn on part cooling fan to full speed for better air-temp sensing
- {% else %}
- M141 S0 # Ensure Chamber heater is off
- M106 P2 S0 # Turn off auxiliary part cooling fan
- M106 S0 # Turn off part cooling fan
- {% endif %}
- M400 # Wait for all prior G-code commands to be processed before G28
- SET_GCODE_OFFSET Z=0 # Reset any applied Z_offset
- G28 # Home all axes
- CLEAR_NOZZLE HOTEND={hotendtemp} PEI_WIPE=1 # Do nozzle purge and wipe
- {% if chambertemp > 0 %} # Special chamber handling for fastest thorough warmup times
- M106 P0 S255 # Ensure part cooling fan is full speed for better air mixing
- M106 P2 S255 # Ensure AUX is at 100% after CLEAR_NOZZLE was called
- G0 Z5 F600 # Bring print bed to Z=5mm. This helps with chamber heating
- G0 X152 Y152 F6000 # Bring print head to middle of print bed
- M191 S{chambertemp-5} # Wait for chamber to reach 5C less than desired target
- M141 S{chambertemp} # Reset chamber temp target back to full target again
- M106 P2 S0 # Turn off AUX Fan
- M106 P0 S0 # Turn off part cooling fan
- {% endif %}
- M190 S{bedtemp} # Wait for print bed to reach target temperature
- G4 P60000 # Wait 60 seconds for bed temps to stabilise
- G29 # Perform Z-tilt, Z-offset, and bed meshing measurements
- M104 S0 # Ensure hotend is fully off to minimise any oozing
- {% if chambertemp == 0 %} # No chamber temp set. This means we're likely printing PLA/PETG.
- M106 P3 S255 # Set the chamber circulation fan to 100% to minimise heat creep
- {% else %}
- M141 S{chambertemp} # Ensure chamber is set back to on after G29 was called earlier
- {% endif %}
- G0 X5 Y5 F6000 # Move print head to front-left
- G0 Z5 F600 # Move print bed to Z=5mm
- M109 S{hotendtemp} # Commence hotend warmup
- M204 S10000 # Set velocity limits
- M83 # Set E-axis to relative mode
- SET_PRINT_STATS_INFO CURRENT_LAYER=1 # Set current layer to 1
- ENABLE_ALL_SENSOR # Turn on filament runout detection
- save_last_file
- G4 P2000
- [gcode_macro ENABLE_ALL_SENSOR]
- description: Enable Filament Width/Runout Sensors
- gcode:
- ENABLE_FILAMENT_WIDTH_SENSOR
- RESET_FILAMENT_WIDTH_SENSOR
- query_filament_width
- SET_FILAMENT_SENSOR SENSOR=fila ENABLE=1
- [gcode_macro DISABLE_ALL_SENSOR]
- description: Disable Filament Width/Runout Sensors
- gcode:
- SET_FILAMENT_SENSOR SENSOR=fila ENABLE=0
- DISABLE_FILAMENT_WIDTH_SENSOR
- [gcode_macro AUTOTUNE_SHAPERS]
- variable_autotune_shapers: 'ei'
- gcode:
- [gcode_macro M84]
- description: Disable steppers but hold Z
- rename_existing:M84.1
- gcode:
- M84.1
- SET_STEPPER_ENABLE STEPPER=stepper_x enable=0
- SET_STEPPER_ENABLE STEPPER=stepper_y enable=0
- SET_STEPPER_ENABLE STEPPER=stepper_z enable=1
- SET_STEPPER_ENABLE STEPPER=stepper_z1 enable=1
- SET_STEPPER_ENABLE STEPPER=extruder enable=0
- # Used for power lose recovery detection
- [gcode_macro DETECT_INTERRUPTION]
- gcode:
- {% set was_interrupted = printer.save_variables.variables.was_interrupted %}
- {% if was_interrupted %}
- M118 Detected unexpected interruption during the last print. Do you want to resume printing? (Do not move the extruder before resuming.)
- M118 Yes: RESUME_INTERRUPTED
- M118 No: CLEAR_LAST_FILE
- {% endif %}
- # Excute when klipper init
- [delayed_gcode PRINTER_INIT]
- initial_duration:0.2
- gcode:
- SET_STEPPER_ENABLE STEPPER=stepper_z enable=1
- SET_STEPPER_ENABLE STEPPER=stepper_z1 enable=1
- BED_MESH_CLEAR
- SET_FILAMENT_SENSOR SENSOR=fila ENABLE=0
- [gcode_macro SHAPER_CALIBRATE]
- rename_existing: RESHAPER_CALIBRATE
- gcode:
- RESHAPER_CALIBRATE FREQ_START=20 FREQ_END=150
- # Excute when print end, after gcode file
- [gcode_macro PRINT_END]
- description: End current print
- gcode:
- # {% if printer.gcode_move.homing_origin.z < 0.5 %}
- # SAVE_VARIABLE VARIABLE=z_offset VALUE={printer.gcode_move.homing_origin.z}
- # {% endif %}
- SET_IDLE_TIMEOUT TIMEOUT={printer.configfile.settings.idle_timeout.timeout}
- CLEAR_PAUSE
- M400
- G4 P5000
- M106 P2 S0
- M106 P0 S0
- M106 P3 S0
- M104 S0
- M140 S0
- M141 S0
- M220 S100
- M221 S100
- SET_STEPPER_ENABLE STEPPER=stepper_x enable=0
- SET_STEPPER_ENABLE STEPPER=stepper_y enable=0
- SET_STEPPER_ENABLE STEPPER=stepper_z enable=1
- SET_STEPPER_ENABLE STEPPER=stepper_z1 enable=1
- SET_STEPPER_ENABLE STEPPER=extruder enable=0
- DISABLE_ALL_SENSOR
- SET_GCODE_OFFSET Z=0
- BED_MESH_CLEAR
- G31
- CLEAR_LAST_FILE
- M84
- BEEP I=2 DUR=500
- G4 P5000
- M84
- [gcode_macro CANCEL_PRINT]
- description: Cancel Print
- rename_existing: BASE_CANCEL_PRINT
- gcode:
- {% if (printer.gcode_move.position.z) < 200 %}
- G1 Z200 F600
- {% endif %}
- G1 X56 F6000
- M400
- G4 P500
- G1 Y290 F6000
- M400
- G4 P500
- G1 X15 F6000
- SET_IDLE_TIMEOUT TIMEOUT={printer.configfile.settings.idle_timeout.timeout}
- CLEAR_PAUSE
- M106 P2 S0
- M106 P0 S0
- M106 P3 S0
- M104 S0
- M140 S0
- M141 S0
- M220 S100
- M221 S100
- SET_STEPPER_ENABLE STEPPER=stepper_x enable=0
- SET_STEPPER_ENABLE STEPPER=stepper_y enable=0
- SET_STEPPER_ENABLE STEPPER=stepper_z enable=1
- SET_STEPPER_ENABLE STEPPER=stepper_z1 enable=1
- SET_STEPPER_ENABLE STEPPER=extruder enable=0
- DISABLE_ALL_SENSOR
- SET_GCODE_OFFSET Z=0
- BED_MESH_CLEAR
- G31
- BEEP I=2 DUR=500
- M84
- SDCARD_RESET_FILE
- BASE_CANCEL_PRINT
- CLEAR_LAST_FILE
- G4 P1000
- [gcode_macro PAUSE]
- description: Pause printing
- rename_existing: BASE_PAUSE
- gcode:
- {% set z = params.Z|default(35)|int %}
- {% if printer['pause_resume'].is_paused|int == 0 %}
- SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=zhop VALUE={z}
- SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=etemp VALUE={printer['extruder'].target}
- SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=efan VALUE={printer["fan_generic cooling_fan"].speed *255}
- DISABLE_FILAMENT_WIDTH_SENSOR
- SET_FILAMENT_SENSOR SENSOR=fila ENABLE=0
- SAVE_GCODE_STATE NAME=PAUSE
- BASE_PAUSE
- G92 E0
- G1 E-5 F1800
- {% if (printer.gcode_move.position.z ) < z %}
- G91
- G1 Z{z} F900
- {% else %}
- G91
- G1 Z{5} F900
- SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=zhop VALUE=0
- {% endif %}
- SAVE_GCODE_STATE NAME=PAUSEPARK2
- G90
- G1 X95 F12000
- G1 Y312 F12000
- G1 Y316 F600
- G1 Y320 F9000
- G1 Y324 F600
- SAVE_GCODE_STATE NAME=PAUSEPARK
- M104 S0
- SET_IDLE_TIMEOUT TIMEOUT=86400
- SET_STEPPER_ENABLE STEPPER=extruder enable=0
- {% endif %}
- [gcode_macro RESUME]
- description: Resume printing
- rename_existing: BASE_RESUME
- variable_zhop: 0
- variable_etemp: 0
- variable_efan: 0
- gcode:
- {% set e = params.E|default(5)|int %}
- {% if printer['pause_resume'].is_paused|int == 1 %}
- SET_IDLE_TIMEOUT TIMEOUT={printer.configfile.settings.idle_timeout.timeout}
- {% if etemp > 0 %}
- M109 S{etemp|int}
- {% endif %}
- M83
- M106 S0
- G1 X95 F12000
- G1 Y324 F12000
- G92 E0
- G1 E5 F50
- G92 E0
- G1 E50 F200
- G92 E0
- G1 E-0.8 F200
- G4 P300
- M106 S{efan}
- G1 Y318 F30000
- G1 Y322 F3000
- G1 Y318 F30000
- G1 Y322 F3000
- G1 Y318 F30000
- G1 Y322 F3000
- G1 Y324 F600
- G1 X58 F12000
- G1 X78 F12000
- G1 X58 F12000
- G1 X78 F12000
- G1 X58 F12000
- G1 X78 F12000
- G1 X58 F12000
- G1 X78 F12000
- G1 X58 F12000
- G1 X78 F12000
- G1 X58 F12000
- G1 X78 F12000
- G1 X95 F12000
- G1 Y316 F9000
- G1 Y312 F600
- G1 Y260 F12000
- RESTORE_GCODE_STATE NAME=PAUSEPARK2 MOVE=1 MOVE_SPEED=200
- RESTORE_GCODE_STATE NAME=PAUSE MOVE=1 MOVE_SPEED=15
- BASE_RESUME
- ENABLE_FILAMENT_WIDTH_SENSOR
- RESET_FILAMENT_WIDTH_SENSOR
- query_filament_width
- SET_FILAMENT_SENSOR SENSOR=fila ENABLE=1
- {% endif %}
- [gcode_macro BEEP]
- gcode:
- {% set i = params.I|default(1)|int %}
- {% set dur = params.DUR|default(100)|int %}
- {% if printer["output_pin sound"].value|int == 1 %}
- {% for iteration in range(i|int) %}
- SET_PIN PIN=beeper VALUE=1
- G4 P{dur}
- SET_PIN PIN=beeper VALUE=0
- G4 P{dur}
- {% endfor %}
- {% endif %}
- [gcode_macro M141]
- description: Set chamber temperature
- gcode:
- {% if printer["heater_generic chamber"] is defined %}
- {% set s = params.S|float %}
- SET_HEATER_TEMPERATURE HEATER=chamber TARGET={([s, 65]|min)}
- {% endif %}
- [gcode_macro M191]
- description: Wait for chamber temperature
- gcode:
- {% if printer["heater_generic chamber"] is defined %}
- {% set s = params.S|float %}
- M141 {% for p in params %}{'%s%s' % (p, params[p])}{% endfor %}
- {% if s != 0 %}
- TEMPERATURE_WAIT SENSOR="heater_generic chamber" MINIMUM={([s, 65]|min)-2}
- {% endif %}
- {% endif %}
- [gcode_macro M106]
- description: Control Fan Speeds
- gcode:
- {% set p = params.P|default(0)|int %}
- {% if p == 2 %}
- {% if params.S is defined %}
- SET_FAN_SPEED FAN=auxiliary_cooling_fan SPEED={(params.S|float / 255.0)}
- {% else %}
- SET_FAN_SPEED FAN=auxiliary_cooling_fan SPEED=1
- {% endif %}
- {% endif %}
- {% if p == 0 %}
- {% if params.S is defined %}
- SET_FAN_SPEED FAN=cooling_fan SPEED={(params.S|float / 255.0)}
- {% else %}
- SET_FAN_SPEED FAN=cooling_fan SPEED=1
- {% endif %}
- {% endif %}
- {% if p == 3 %}
- {% if params.S is defined %}
- SET_FAN_SPEED FAN=chamber_circulation_fan SPEED={(params.S|float / 255.0)}
- {% else %}
- SET_FAN_SPEED FAN=chamber_circulation_fan SPEED=1
- {% endif %}
- {% endif %}
- [gcode_macro M107]
- description: Turn Off Part Cooling Fan
- gcode:
- SET_FAN_SPEED FAN=cooling_fan SPEED=0
- [gcode_macro M303]
- description: Heater Bed PID Calibration
- gcode:
- {% if params.E is defined %}
- {% if params.S is defined %}
- {% if (params.E|int)==-1 %}
- PID_CALIBRATE HEATER=heater_bed TARGET={params.S|int}
- {% endif %}
- {% if (params.E|int)==0 %}
- PID_CALIBRATE HEATER=extruder TARGET={params.S|int}
- {% endif %}
- {% endif %}
- {% endif %}
- [gcode_macro M8029]
- description: Activate/De-activate filament width sensor
- gcode:
- {% if params.D is defined %}
- {% if (params.D|int)==1 %}
- ENABLE_FILAMENT_WIDTH_SENSOR
- {% endif %}
- {% if (params.D|int)==0 %}
- DISABLE_FILAMENT_WIDTH_SENSOR
- {% endif %}
- {% endif %}
- [gcode_macro M900]
- description: Adjust Pressure Advance
- gcode:
- {% if params.K is defined %}
- SET_PRESSURE_ADVANCE ADVANCE={params.K}
- {% endif %}
- {% if params.T is defined %}
- SET_PRESSURE_ADVANCE SMOOTH_TIME={params.T}
- {% endif %}
- [gcode_macro M290]
- description: Adjust Z Offset
- gcode:
- { action_respond_info("Adjusting Z offset by %.3fmm" % (params.Z)) }
- SET_GCODE_OFFSET Z_ADJUST={params.Z}
- [gcode_macro M901]
- description: Input Shaper Calibration
- gcode:
- G28
- SHAPER_CALIBRATE
- M118 Input shaping complete
- SAVE_CONFIG
- [gcode_macro M0]
- description: Gcode PAUSE
- gcode:
- PAUSE
- [gcode_macro M25]
- rename_existing: M9925
- description: Gcode PAUSE
- gcode:
- PAUSE
- [gcode_macro RESPOND_INFO]
- variable_S:0
- description: Report if nozzle has cooled down
- gcode:
- {% if params.S is defined %}
- {% set s = params.S|int %}
- {% if s == 0 %}
- { action_respond_info("Nozzle cooled") }
- {% endif %}
- {% endif %}
- [gcode_macro M4027]
- gcode:
- { action_respond_info("M4027 called") }
- G32 # Set bed meshing to default profile
- G29 # Do full homing, z-tilt, and bed meshing
- G31 # Set bed meshing back to kamp profile
- M400 # Wait for all outstanding G-code moves to finish
- M118 Bed mesh calibrate complete # Tell xindi we're done
- SAVE_CONFIG # Save configuration
- [gcode_macro M4028]
- description: Home all axis and re-establish baseline Z offset without clearing bed mesh
- gcode:
- { action_respond_info("M4028 called") }
- G28 X Y
- get_zoffset
- M400
- M118 Position init complete
- [gcode_macro M4029]
- description: Clear any saved Z offset, clean nozzle, and re-establish baseline Z offset
- gcode:
- { action_respond_info("M4029 called") }
- M141 S0
- SAVE_VARIABLE VARIABLE=z_offset VALUE=0
- G28
- M400
- M118 Position init complete
- CLEAR_NOZZLE HOTEND=280
- G28 X Y
- get_zoffset
- [gcode_macro M4030]
- description: Home all axis and re-establish baseline Z offset
- gcode:
- { action_respond_info("M4030 called") }
- BED_MESH_CLEAR
- SET_GCODE_OFFSET Z=0 MOVE=0
- G28 X Y
- get_zoffset
- G1 X152 Y152 F9000
- G1 Z0 F600
- [gcode_macro M4031]
- description: Reset platform against base of build chamber
- gcode:
- { action_respond_info("M4031 called") }
- SET_KINEMATIC_POSITION Z=20
- G1 Z30 F300
- SET_TMC_CURRENT STEPPER=stepper_z CURRENT={printer.configfile.settings['tmc2209 stepper_z'].run_current * 0.7 }
- SET_TMC_CURRENT STEPPER=stepper_z1 CURRENT={printer.configfile.settings['tmc2209 stepper_z1'].run_current * 0.7 }
- REVERSE_HOMING
- SET_TMC_CURRENT STEPPER=stepper_z CURRENT={printer.configfile.settings['tmc2209 stepper_z'].run_current}
- SET_TMC_CURRENT STEPPER=stepper_z1 CURRENT={printer.configfile.settings['tmc2209 stepper_z1'].run_current}
- G91
- G1 Z-30 F600
- G90
- SET_TMC_CURRENT STEPPER=stepper_z CURRENT={printer.configfile.settings['tmc2209 stepper_z'].run_current * 0.7 }
- SET_TMC_CURRENT STEPPER=stepper_z1 CURRENT={printer.configfile.settings['tmc2209 stepper_z1'].run_current * 0.7 }
- REVERSE_HOMING
- SET_TMC_CURRENT STEPPER=stepper_z CURRENT={printer.configfile.settings['tmc2209 stepper_z'].run_current}
- SET_TMC_CURRENT STEPPER=stepper_z1 CURRENT={printer.configfile.settings['tmc2209 stepper_z1'].run_current}
- G91
- G1 Z-30 F600
- G90
- [gcode_macro M603]
- description: Unload filament
- gcode:
- {% set hotendtemp = params.S|default(250)|int %}
- {% set accel = printer.toolhead.max_accel|int %}
- _CG28
- M204 S10000
- G1 Y150 F9000
- G1 X305 F9000
- G1 Y20 F9000
- G1 Y5 F3000
- G4 P500
- G1 Y20 F9000
- G1 Y5 F3000
- G4 P500
- G1 Y20 F9000
- G1 X56 F12000
- G1 Y310 F12000
- G1 Y324 F600
- G1 X95 F600
- M106 S0
- M109 S{hotendtemp}
- M118 Heat up complete
- G92 E0
- G1 E5 F50
- G1 E50 F200
- G92 E0
- G1 E-0.8 F200
- G4 P300
- M106 S255
- M104 S{hotendtemp-100}
- G4 P5000
- G1 Y318 F9000
- G1 Y322 F600
- G1 Y318 F9000
- G1 Y322 F600
- G1 Y308 F30000
- G1 Y324 F600
- M106 S0
- M400
- M204 S{accel}
- M118 Unload finish
- [gcode_macro M604]
- description: Load filament
- gcode:
- {% set hotendtemp = params.S|default(250)|int %}
- {% set current_state = params.F|default(1)|int %}
- {% set accel = printer.toolhead.max_accel|int %}
- M204 S10000
- M104 S{hotendtemp}
- _CG28
- {% if current_state == 1 %}
- {% if (printer.gcode_move.position.y) > 300 %}
- G91
- G1 Y-20 F9000
- G90
- {% endif %}
- G1 X95 F12000
- G1 Y312 F12000
- G1 Y316 F600
- G1 Y320 F9000
- G1 Y324 F600
- {% endif %}
- M109 S{hotendtemp}
- M118 Heat up complete
- G1 X95 F600
- G1 Y324 F600
- G92 E0
- G1 E5 F50
- G92 E0
- G1 E120 F300
- G92 E0
- G1 E-0.8 F200
- G4 P300
- M106 S255
- M104 S{hotendtemp-100}
- G4 P5000
- G1 Y318 F9000
- G1 Y322 F600
- G1 Y318 F9000
- G1 Y322 F600
- G1 Y308 F30000
- G1 Y324 F600
- M106 S0
- M400
- M204 S{accel}
- M118 Load finish
- [gcode_macro beep_on]
- gcode:
- SET_PIN PIN=sound VALUE=1
- [gcode_macro beep_off]
- gcode:
- SET_PIN PIN=sound VALUE=0
- [gcode_macro M109]
- description: Wait for extruder temperature
- rename_existing: M99109
- gcode:
- {% set s = params.S|float %}
- M104 {% for p in params %}{'%s%s' % (p, params[p])}{% endfor %}
- {% if s != 0 %}
- TEMPERATURE_WAIT SENSOR=extruder MINIMUM={s} MAXIMUM={s+1}
- {% endif %}
- [gcode_macro G31]
- description: Enable kamp bed meshing profile
- gcode:
- SET_GCODE_VARIABLE MACRO=G29 VARIABLE=k VALUE=1
- [gcode_macro G32]
- description: Enable default bed meshing profile
- gcode:
- SET_GCODE_VARIABLE MACRO=G29 VARIABLE=k VALUE=0
- [gcode_macro G29]
- variable_k:1
- variable_bed_meshing_offset: -0.4 # Generate bed with this amount applied
- # to the default meshing height of 2.0mm
- # negative = closer, positive = further
- # Acceptable range is [-1.0, 1.0]
- description: Prepare print bed, generate a bed mesh, and apply global Z nozzle offset
- gcode:
- {% set z_home_x = printer.configfile.settings.beacon.home_xy_position[0] %}
- {% set z_home_y = printer.configfile.settings.beacon.home_xy_position[1] %}
- # Read bed meshing offset value. Cap value to within the [-1.0, 1.0] range
- {% set bmo = [([(printer["gcode_macro G29"].bed_meshing_offset)|float, -1.0]|max), 1.0]|min %}
- {% set mesh_closer = (2.0 + bmo)|float %}
- {% set mesh_return = (2.0 - bmo)|float %}
- { action_respond_info(" Mesh Closer = %.2f" % (mesh_closer)|float) }
- { action_respond_info(" Mesh Return = %.2f" % (mesh_return)|float) }
- _FIND_Z_EQUALS_ZERO
- G1 X{z_home_x} Y{z_home_y} F7200
- G1 Z{mesh_closer} F600
- SET_KINEMATIC_POSITION Z=2.0
- {% if k|int==1 %}
- BED_MESH_CALIBRATE RUNS=2 PROFILE=kamp
- BED_MESH_PROFILE LOAD=kamp
- SAVE_VARIABLE VARIABLE=profile_name VALUE='"kamp"'
- {% else %}
- BED_MESH_CALIBRATE RUNS=2 PROFILE=default
- BED_MESH_PROFILE LOAD=default
- SAVE_VARIABLE VARIABLE=profile_name VALUE='"default"'
- SET_GCODE_VARIABLE MACRO=G29 VARIABLE=k VALUE=1
- {% endif %}
- G1 X{z_home_x} Y{z_home_y} F7200
- G1 Z{mesh_return} F600
- SET_KINEMATIC_POSITION Z=2.0
- [gcode_macro M204]
- rename_existing: M99204
- description: Set acceleration limits
- gcode:
- {% if params.S is defined %}
- {% set s = params.S|float %}
- {% endif %}
- {% if params.P is defined %}
- {% if params.T is defined %}
- {% set s = [params.P|float ,params.T|float] | min %}
- {% endif %}
- {% endif %}
- SET_VELOCITY_LIMIT ACCEL={s}
- SET_VELOCITY_LIMIT ACCEL_TO_DECEL={s/2}
- [gcode_macro CHECK_CHAMBER_HEATER_Z]
- description: Disable chamber heater if Z height >= 270mm
- gcode:
- {% if (printer.gcode_move.position.z) >= 270 %}
- # Don't turn heater off entirely as we still want the fan to circulate any air
- # it can underneath the build plate to pick up heat to keep the chamber warm
- M141 S10
- {% endif %}
- [gcode_macro SEARCH_VARS]
- # Call with:
- # $ SEARCH_VARS s="profile"
- # // printer.bed_mesh.profile_name : default
- description: Search Klipper Configuration and variables
- gcode:
- {% set search = params.S|lower %}
- {% set ns = namespace() %}
- {% for item in printer %}
- {% if ' ' in item %}
- {% set ns.path = ['printer', "['%s']" % (item), ''] %}
- {% else %}
- {% set ns.path = ['printer.', item, ''] %}
- {% endif %}
- {% if search in ns.path|lower %}
- { action_respond_info(ns.path|join) }
- {% endif %}
- {% if printer[item].items() %}
- {% for childkey, child in printer[item].items() recursive %}
- {% set ns.path = ns.path[:loop.depth|int + 1] %}
- {% if ' ' in childkey %}
- {% set null = ns.path.append("['%s']" % (childkey)) %}
- {% else %}
- {% set null = ns.path.append(".%s" % (childkey)) %}
- {% endif %}
- {% if child is mapping %}
- { loop(child.items()) }
- {% else %}
- {% if search in ns.path|lower %}
- { action_respond_info("%s : %s" % (ns.path|join, child)) }
- {% endif %}
- {% endif %}
- {% endfor %}
- {% endif %}
- {% endfor %}
- [gcode_macro MANAGE_CHAMBER_TEMP]
- description: Dynamically adjust exhaust fan speed
- gcode:
- {% set target = printer['heater_generic chamber'].target %}
- {% set temperature = printer['heater_generic chamber'].temperature %}
- {% if temperature > 70 %}
- M106 P3 S255 # Too hot! Set the exhaust fan to 100%
- {% else %}
- # Allow for 3C of "grace" before we start ramping the exhaust fan speed
- # This prevents the macro from fighting with the chamber heater PID algorithm
- {% set diff = temperature - (target + 3) %}
- {% if diff < 0 %}
- M106 P3 S0 # Disable Exhaust Fan
- {% else %}
- {% set speed = ([(diff * 50), 255] | min) | int %}
- M106 P3 S{speed}
- {% endif %}
- {% endif %}
- [gcode_macro _BEACON_HOME_PRE_X]
- gcode:
- {% set RUN_CURRENT = printer.configfile.settings['tmc2240 stepper_x'].run_current|float %}
- SET_TMC_CURRENT STEPPER=stepper_x CURRENT={RUN_CURRENT * 0.6}
- [gcode_macro _BEACON_HOME_POST_X]
- gcode:
- {% set RUN_CURRENT = printer.configfile.settings['tmc2240 stepper_x'].run_current|float %}
- # Move away
- G1 X20 F9000
- M400
- SET_TMC_CURRENT STEPPER=stepper_x CURRENT={RUN_CURRENT}
- [gcode_macro _BEACON_HOME_PRE_Y]
- gcode:
- {% set RUN_CURRENT = printer.configfile.settings['tmc2240 stepper_y'].run_current|float %}
- SET_TMC_CURRENT STEPPER=stepper_y CURRENT={RUN_CURRENT * 0.8}
- [gcode_macro _BEACON_HOME_POST_Y]
- gcode:
- {% set RUN_CURRENT = printer.configfile.settings['tmc2240 stepper_y'].run_current|float %}
- # Move away
- G1 Y20 F9000
- M400
- SET_TMC_CURRENT STEPPER=stepper_y CURRENT={RUN_CURRENT}
- [gcode_macro _BEACON_CONTACT_PRE_Z]
- gcode:
- [gcode_macro _BEACON_CONTACT_POST_Z]
- gcode:
- G1 Z3 F600 # Ensure the bed is moved away from the nozzle
- M400
- [gcode_macro SCREW_ADJUST_START]
- gcode:
- { action_respond_info("Re-calibrating where Z=0 is") }
- _FIND_Z_EQUALS_ZERO
- M104 S0 # Turn off hotend
- [gcode_macro SFL]
- description: Get zoffset at front-left bed adjustment screw position
- gcode:
- {% set screw_pos_x = printer.configfile.settings.bed_screws.screw1[0] %}
- {% set screw_pos_y = printer.configfile.settings.bed_screws.screw1[1] %}
- {% set beacon_off_x = printer.configfile.settings.beacon.x_offset %}
- {% set beacon_off_y = printer.configfile.settings.beacon.y_offset %}
- G1 Z3 F600 # Ensure the bed is moved away from the nozzle
- G1 X{screw_pos_x - beacon_off_x + 20} Y{screw_pos_y - beacon_off_y + 20} F6000
- PROBE PROBE_METHOD=proximity
- G1 Z3 F600 # Ensure the bed is moved away from the nozzle
- [gcode_macro SFR]
- description: Get zoffset at front-right bed adjustment screw position
- gcode:
- {% set screw_pos_x = printer.configfile.settings.bed_screws.screw2[0] %}
- {% set screw_pos_y = printer.configfile.settings.bed_screws.screw2[1] %}
- {% set beacon_off_x = printer.configfile.settings.beacon.x_offset %}
- {% set beacon_off_y = printer.configfile.settings.beacon.y_offset %}
- G1 Z3 F600 # Ensure the bed is moved away from the nozzle
- G1 X{screw_pos_x - beacon_off_x - 20} Y{screw_pos_y - beacon_off_y + 20} F6000
- PROBE PROBE_METHOD=proximity
- G1 Z3 F600 # Ensure the bed is moved away from the nozzle
- [gcode_macro SBR]
- description: Get zoffset at back-right bed adjustment screw position
- gcode:
- {% set screw_pos_x = printer.configfile.settings.bed_screws.screw3[0] %}
- {% set screw_pos_y = printer.configfile.settings.bed_screws.screw3[1] %}
- {% set beacon_off_x = printer.configfile.settings.beacon.x_offset %}
- {% set beacon_off_y = printer.configfile.settings.beacon.y_offset %}
- G1 Z3 F600 # Ensure the bed is moved away from the nozzle
- G1 X{screw_pos_x - beacon_off_x - 20} Y{screw_pos_y - beacon_off_y - 20} F6000
- PROBE PROBE_METHOD=proximity
- G1 Z3 F600 # Ensure the bed is moved away from the nozzle
- [gcode_macro SBL]
- description: Get zoffset at back-left bed adjustment screw position
- gcode:
- {% set screw_pos_x = printer.configfile.settings.bed_screws.screw4[0] %}
- {% set screw_pos_y = printer.configfile.settings.bed_screws.screw4[1] %}
- {% set beacon_off_x = printer.configfile.settings.beacon.x_offset %}
- {% set beacon_off_y = printer.configfile.settings.beacon.y_offset %}
- G1 Z3 F600 # Ensure the bed is moved away from the nozzle
- G1 X{screw_pos_x - beacon_off_x + 20} Y{screw_pos_y - beacon_off_y - 20} F6000
- PROBE PROBE_METHOD=proximity
- G1 Z3 F600 # Ensure the bed is moved away from the nozzle
Add Comment
Please, Sign In to add comment