diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 79db84c..0000000 --- a/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -*.bkp -*.swp diff --git a/KlipperScreen.conf b/KlipperScreen.conf deleted file mode 100644 index b43f942..0000000 --- a/KlipperScreen.conf +++ /dev/null @@ -1,46 +0,0 @@ -[printer v2.4] -# Define distances and speeds for the extrude panel. CSV list 2 to 4 integers the second -# value is default -extrude_distances: 5, 10, 15, 25 -extrude_speeds: 2, 5, 10, 25 - -[preheat PLA] -bed = 50 -extruder = 200 - -[preheat PETG] -bed = 80 -extruder = 240 - -[preheat ASA] -bed = 100 -extruder = 230 - -[preheat ABS] -bed = 110 -extruder = 255 - -#~# --- Do not edit below this line. This section is auto generated --- #~# -#~# -#~# [main] -#~# move_speed_xy = 100 -#~# print_sort_dir = date_desc -#~# -#~# [displayed_macros Printer] -#~# dump_parameters = False -#~# dump_warnings = False -#~# get_timelapse_setup = False -#~# hyperlapse = False -#~# m601 = False -#~# m900 = False -#~# t6 = False -#~# t7 = False -#~# t8 = False -#~# print_layer_change = False -#~# print_start = False -#~# notify_bed = False -#~# notify_extruder = False -#~# test_stream_delay = False -#~# timelapse_render = False -#~# timelapse_take_frame = False -#~# diff --git a/crowsnest.conf b/crowsnest.conf deleted file mode 100644 index 62c41a5..0000000 --- a/crowsnest.conf +++ /dev/null @@ -1,60 +0,0 @@ -#### crowsnest.conf -#### This is a typical default config. -#### Also used as default in mainsail / MainsailOS -#### See: -#### https://github.com/mainsail-crew/crowsnest/blob/master/README.md -#### for details to configure to your needs. - - -##################################################################### -#### ##### -#### Information about ports and according URL's ##### -#### ##### -##################################################################### -#### ##### -#### Port 8080 equals /webcam/?action=[stream/snapshot] ##### -#### Port 8081 equals /webcam2/?action=[stream/snapshot] ##### -#### Port 8082 equals /webcam3/?action=[stream/snapshot] ##### -#### Port 8083 equals /webcam4/?action=[stream/snapshot] ##### -#### ##### -#### Note: These ports are default for most Mainsail ##### -#### installations. To use any other port would involve ##### -#### changing the proxy configuration or using directly ##### -#### http://:/?action=[stream/snapshot] ##### -#### ##### -##################################################################### -#### RTSP Stream URL: ( if enabled and supported ) ##### -#### rtsp://:/stream.h264 ##### -##################################################################### - - -[crowsnest] -log_path: ~/printer_data/logs/crowsnest.log -log_level: verbose # Valid Options are quiet/verbose/debug -delete_log: false # Deletes log on every restart, if set to true -no_proxy: false - -## LEGACY -[cam 1] -mode: ustreamer # ustreamer - Provides mjpg and snapshots. (All devices) - # camera-streamer - Provides webrtc, mjpg and snapshots. (rpi + Raspi OS based only) -enable_rtsp: false # If camera-streamer is used, this enables also usage of an rtsp server -rtsp_port: 8554 # Set different ports for each device! -port: 8080 # HTTP/MJPG Stream/Snapshot Port -device: /dev/video0 # See Log for available ... -resolution: 640x480 # widthxheight format -max_fps: 15 # If Hardware Supports this it will be forced, otherwise ignored/coerced. -#custom_flags: # You can run the Stream Services with custom flags. -#v4l2ctl: # Add v4l2-ctl parameters to setup your camera, see Log what your cam is capable of. - -# ## LIBCAMERA -# [cam 1] -# mode: camera-streamer # ustreamer - Provides mjpg and snapshots. (All devices) -# # enable_rtsp: false # If camera-streamer is used, this enables also usage of an rtsp server -# # rtsp_port: 8554 # Set different ports for each device! -# # port: 8080 # HTTP/MJPG Stream/Snapshot Port -# device: /dev/v4l/by-path/platform-3f801000.csi-video-index0 # See Log for available ... -# # resolution: 1920x1080 # widthxheight format -# # max_fps: 15 # If Hardware Supports this it will be forced, otherwise ignored/coerced. -# #custom_flags: # You can run the Stream Services with custom flags. -# #v4l2ctl: # Add v4l2-ctl parameters to setup your camera, see Log what your cam is capable of. diff --git a/display_menu.cfg b/display_menu.cfg new file mode 100644 index 0000000..f9b8959 --- /dev/null +++ b/display_menu.cfg @@ -0,0 +1,139 @@ +## +# Display Menu definition # +## + +# Removed items +[menu __main __octoprint] +type: disabled + +## PreHeat +[menu __main __temp __preheat_pla] +type: disabled + +[menu __main __temp __preheat_abs] +type: disabled + +## use own load and unload macro +[menu __main __filament __loadf] +type: disabled + +[menu __main __filament __loads] +type: disabled + +[menu __main __filament __unloadf] +type: disabled + +[menu __main __filament __unloads] +type: disabled + +## Delta Calibration +[menu __main __setup __calib __delta_calib_auto] +type: disabled + +[menu __main __setup __calib __delta_calib_man] +type: disabled + + +# Added Items to the Stock menu # +[menu __main __filament __preheat_pla] +type: command +name: Preheat for PLA +gcode: + PREHEAT EXTRUDER_TEMP=190 + +[menu __main __filament __preheat_abs] +type: command +name: Preheat for ABS +gcode: + PREHEAT EXTRUDER_TEMP=210 + +[menu __main __filament __load] +type: command +name: Load Filament +gcode: + FILAMENT_LOAD + +[menu __main __filament __unload] +type: command +name: Unload Filament +gcode: + FILAMENT_UNLOAD + +## Probe & Endstop Z-Offset calibration +[menu __main __setup __calib __Z_offset] +type: list +enable: {not printer.idle_timeout.state == "Printing"} +name: Z offset + +[menu __main __setup __calib __Z_offset __start] +type: input +enable: {not printer.idle_timeout.state == "Printing"} +name: Do {['None','Probe','Endstop'][menu.input|int]} +input: 0 +input_min: 0 +input_max: 2 +input_step: 1 +gcode: + {%- if menu.event == 'long_click' -%} + {menu.back()} + {%- if menu.input|int == 1 -%} + {action_respond_info("Start Probe calibration")} + PROBE_CALIBRATE + {%- elif menu.input|int == 2 -%} + {action_respond_info(" Start Z-Endstop calibration")} + Z_ENDSTOP_CALIBRATE + {%- endif -%} + {%- endif -%} + +[menu __main __setup __calib __Z_offset __move_z] +type: input +name: Move Z: {'%03.2f' % menu.input} +input: {printer.gcode_move.gcode_position.z} +input_step: 1 +realtime: True +gcode: + {%- if menu.event == 'change' -%} + G1 Z{'%.2f' % menu.input} + {%- elif menu.event == 'long_click' -%} + G1 Z{'%.2f' % menu.input} + SAVE_GCODE_STATE NAME=__move__axis + G91 + G1 Z2 + G1 Z-2 + RESTORE_GCODE_STATE NAME=__move__axis + {%- endif -%} + +[menu __main __setup __calib __Z_offset __test_z] +type: input +name: Test Z: {['++','+','+.01','+.05','+.1','+.5','-.5','-.1','-.05','-.01','-','--'][menu.input|int]} +input: 5 +input_min: 0 +input_max: 11 +input_step: 1 +gcode: + {%- if menu.event == 'long_click' -%} + TESTZ Z={['++','+','+.01','+.05','+.1','+.5','-.5','-.1','-.05','-.01','-','--'][menu.input|int]} + {%- endif -%} + +[menu __main __setup __calib __Z_offset __test_z_live] +type: input +name: Test Z : {'%03.3f' % menu.input} +input: 0 +input_min: -5.0 +input_max: 5.0 +input_step: 0.01 +realtime: True +gcode: + {%- if menu.event == 'long_click' -%} + TESTZ Z={'%.3f' % menu.input} + {%- endif -%} + +[menu __main __setup __calib __Z_offset __accept] +type: command +name: Accept +gcode: ACCEPT + +[menu __main __setup __calib __Z_offset __abort] +type: command +name: Abort +gcode: ABORT diff --git a/ebb36.cfg b/ebb36.cfg deleted file mode 100644 index e6373f9..0000000 --- a/ebb36.cfg +++ /dev/null @@ -1,82 +0,0 @@ -# This file contains common pin mappings for the BIGTREETECH EBBCan -# Canbus board. To use this config, the firmware should be compiled for the -# STM32G0B1 with "8 MHz crystal" and "USB (on PA11/PA12)" or "CAN bus (on PB0/PB1)". -# The "EBB Can" micro-controller will be used to control the components on the nozzle. - -# See docs/Config_Reference.md for a description of parameters. - -[mcu EBBCan] -# serial: /dev/serial/by-id/usb-Klipper_Klipper_firmware_12345-if00 -canbus_uuid: 8192d675a56e - -[adxl345] -cs_pin: EBBCan: PB12 -spi_software_sclk_pin: EBBCan: PB10 -spi_software_mosi_pin: EBBCan: PB11 -spi_software_miso_pin: EBBCan: PB2 -axes_map: x,y,z - -[extruder] -step_pin: EBBCan: PD0 -dir_pin: EBBCan: PD1 -enable_pin: !EBBCan: PD2 -## Update value below when you perform extruder calibration -## If you ask for 100mm of filament, but in reality it is 98mm: -## rotation_distance = * / 100 -## 22.6789511 is a good starting point -rotation_distance: 22.6789511 #Bondtech 5mm Drive Gears -## Update Gear Ratio depending on your Extruder Type -## - 50:17 for Afterburner/Clockwork -## - 50:10 for Stealthburner/Clockwork2 -## - 80:20 for M4, M3.1 -gear_ratio: 50:10 # SB BMG -microsteps: 32 -full_steps_per_rotation: 200 # 1.8 deg stepper: 200, 0.9 deg stepper: 400 -nozzle_diameter: 0.400 -filament_diameter: 1.750 -heater_pin: EBBCan: PB13 -sensor_type: ATC Semitec 104NT-4-R025H42G -sensor_pin: EBBCan: PA3 -max_power: 1.0 -min_extrude_temp: 180 -min_temp: 0 -max_temp: 280 # specified to 300 -## Try to keep pressure_advance below 1.0 -# pressure_advance: 0.05 -## Default is 0.040, leave stock -pressure_advance_smooth_time: 0.040 -# Maximum length (in mm of raw filament) that a retraction or -# extrude-only move may have, default: 50 -max_extrude_only_distance: 200 -# Maximum area (in mm^2) of an extrusion cross section (eg, -# extrusion width multiplied by layer height). This setting prevents -# excessive amounts of extrusion during relatively small XY moves. -# If a move requests an extrusion rate that would exceed this value -# it will cause an error to be returned. The default is: 4.0 * -# nozzle_diameter^2 -max_extrude_cross_section: 50.0 # default 4 * 0.4 = 0.64 -control: pid -pid_Kp: 21.527 -pid_Ki: 1.063 -pid_Kd: 108.982 - -[tmc2209 extruder] -uart_pin: EBBCan: PA15 -run_current: 0.650 -stealthchop_threshold: 999999 - -[fan] -pin: EBBCan: PA0 - -[heater_fan hotend_fan] -pin: EBBCan: PA1 -heater: extruder -heater_temp: 50.0 - -[filament_switch_sensor toolhead_sensor] -pause_on_runout: False -switch_pin: ^EBBCan: PB3 -# runout_gcode: -# M118 toolhead filament removed -# insert_gcode: -# M118 toolhead filament inserted diff --git a/ercf.cfg b/ercf.cfg deleted file mode 100644 index 2d9a09a..0000000 --- a/ercf.cfg +++ /dev/null @@ -1,7 +0,0 @@ -[include ercf/hardware.cfg] -[include ercf/software.cfg] - -[mcu ercf] -# serial: /dev/serial/by-id/usb-Klipper_samd21g18a_D3EB9B384134555020312E30171117FF-if00 -canbus_uuid: 092fcd32b788 - diff --git a/ercf/hardware.cfg b/ercf/hardware.cfg deleted file mode 100644 index 2fdd503..0000000 --- a/ercf/hardware.cfg +++ /dev/null @@ -1,77 +0,0 @@ -## Enraged Rabbit : Carrot Feeder config file for ERCF EASY BRD v1.1 - -# This config sample assume you set the two J6 jumpers on 1-2 and 4-5, i.e. [..].[..] - -# Carrot Feeder 5mm D-cut shaft -[manual_stepper gear_stepper] -step_pin: ercf:gpio7 -dir_pin: !ercf:gpio8 -enable_pin: !ercf:gpio6 -rotation_distance: 22.6789511 # Bondtech 5mm Drive Gears -gear_ratio: 80:20 -microsteps: 16 -full_steps_per_rotation: 200 -velocity: 35 -accel: 100 -endstop_pin: ercf:gpio13 - -[tmc2209 manual_stepper gear_stepper] -# Adapt accordingly to your setup and desires -# The default values are tested with the BOM NEMA14 motor -uart_pin: ercf:gpio9 -interpolate: True -run_current: 0.6 -hold_current: 0.1 -sense_resistor: 0.110 -stealthchop_threshold: 500 -# diag_pin: ercf:gpio23 - -[manual_stepper selector_stepper] -step_pin: ercf:gpio2 -dir_pin: !ercf:gpio1 -enable_pin: !ercf:gpio3 -microsteps: 16 -rotation_distance: 40 -full_steps_per_rotation: 200 -velocity: 200 -homing_speed: 100 -accel: 600 -# Select the endstop you want depending if you are using sensorless homing -# endstop_pin: ^ercf:PB9 -endstop_pin: ercf:gpio20 -#endstop_pin: tmc2209_selector_stepper:virtual_endstop -#endstop_pin: tmc5160_selector_stepper:virtual_endstop - -[tmc2209 manual_stepper selector_stepper] -uart_pin: ercf:gpio0 -run_current: 0.55 -hold_current: 0.4 -interpolate: True -sense_resistor: 0.110 -stealthchop_threshold: 5000 -# Uncomment the lines below if you want to use sensorless homing for the selector -# diag_pin: ^ercf:gpio22 # Set to MCU pin connected to TMC DIAG pin -# driver_SGTHRS: 75 # 255 is most sensitive value, 0 is least sensitive - - -# Values are for the MG90S servo -[servo ercf_servo] -pin: ercf:gpio21 -maximum_servo_angle: 180 -# minimum_pulse_width: 0.00085 -# maximum_pulse_width: 0.00215 -minimum_pulse_width: 0.001 -maximum_pulse_width: 0.002 - -[duplicate_pin_override] -pins: ercf:gpio15 -# Put there the pin used by the encoder and the filament_motion_sensor -# It has to be the same pin for those 3 - -[filament_motion_sensor encoder_sensor] -switch_pin: ^ercf:gpio15 -pause_on_runout: False -detection_length: 10.0 -extruder: extruder -# runout_gcode: _ERCF_ENCODER_MOTION_ISSUE - diff --git a/ercf/software.cfg b/ercf/software.cfg deleted file mode 100644 index 7983ebd..0000000 --- a/ercf/software.cfg +++ /dev/null @@ -1,973 +0,0 @@ -############################### -# ERCF module -############################### - -[ercf] -# Encoder -encoder_pin: ^ercf:gpio15 # easy brd -# encoder_resolution: 1.365188 # in mm -encoder_resolution: 1.349528 # from `ercf_calibrate_encoder` -# Speeds and accels -# Long moves are faster than the small ones -# 100mm/s should be "quiet" with the NEMA14 motor or a NEMA17 pancake, but you can go lower if your really want it to be low noise -# Tested without any issue at 200mm/s, but it's noisy. I'm running mine at 170mm/s for long moves and 50mm/s for short moves. -long_moves_speed: 100 # mm/s. Default value is 100mm/s. -long_moves_accel: 400 # mm/s². Default value is 400mm/s² -short_moves_speed: 25 # mm/s. Default value is 25mm/s. -short_moves_accel: 400 # mm/s². Default value is 400mm/s² - -[gcode_macro _ERCF_VAR] -description: Empty macro to store ERCF variables -# ======================================================= -# ================== VALUES TO ADJUST =================== -# ======================================================= -# -# ==== Toolhead specific values ==== -# -# Distance between the end of the reverse bowden and the toolhead sensor. Value is toolhead specific. -# Tested values : -# Galileo Clockwork with ERCF V1.1 sensor (hall effect) : 27.0 -# LGX on AfterBurner with ERCF V1.1 sensor (hall effect) : 44.0 -# AfterBurner Clockwork with ERCF V1.1 sensor (hall effect) : 36.0 -variable_end_of_bowden_to_sensor: 44 # xk -# Length from the sensor to the nozzle melt pool. -# Reduce this value if there are blobs of filament on each load, before the purge on the tower. -# Increase this value if there are big gaps on the purge tower (i.e. if it takes time for the filament to get pushed out after a swap) -# Tested values : -# Galileo Clockwork with ERCF 1.1 sensor (hall effect) & Dragon Normal Flow : 60.5 -# LGX on AfterBurner with ERCF 1.1 sensor (hall effect) & Dragon Normal Flow : 55.6 -# AfterBurner Clockwork with ERCF 1.1 sensor (hall effect) & Dragon Normal Flow : 54.0 -variable_sensor_to_nozzle: 65 # xk -# -# ==== Values to tune ==== -# -# Tool position for the selector. This has to be tuned manually. Please scale this array to the number of tools you have -variable_colorselector = [2.4, 23.2, 44.0, 70.5, 91.2, 112.8] # 6 tools # xk -# Base value for the loading length used by the auto-calibration macro -# Please use a value SMALLER than the real reverse bowden length (like 50mm less) -variable_min_bowden_length: 730 # xk -# Servo angle for the Up position (i.e. tool disengaged). Refer to the manual to know how to properly tune this value -# Default values: -# MG90S servo : 30 -# SAVOX SH0255MG : 140 -variable_servo_up_angle: 20 -# Servo angle for the Down position (i.e. tool engaged). Refer to the manual to know how to properly tune this value -# Default values: -# MG90S servo : 140 -# SAVOX SH0255MG : 30 -variable_servo_down_angle: 120 # xk -# Threshold for the final load check (i.e. the move from the toolhead sensor to the nozzle) -# Check the _ERCF_GET_LOAD_THRESHOLD command to get the proper value for your setup -variable_final_load_check_threshold: 10.0 -# Options to use or not -# Beware that the clog detection and endless spool mode are in BETA mode for now -# Use at your own risk (beware of the involved macros and the pause(s) and resume ones) -# Put 0 to disable, 1 to enable -variable_clog_detection: 0 -variable_endless_spool_mode: 0 -variable_sensorless_selector: 0 -# ======================================================= -# ============ END OF VALUES TO ADJUST ================== -# ======================================================= -# You shouldn't have to change anything below this point - -# Things that you shouldn't have to change -variable_unload_modifier: 9.0 # Modifier to adjust the ERCF park position (where the filament ends when doing an unload) -variable_min_temp_extruder: 210 # xk # Temp used during the auto-calibration macro, to ensure we can move the extruder (but not really extruding) -variable_extruder_eject_temp: 240 # Temp used during filament ejection (in the ERCF_HOME macro, if a filament is detected in the toolhead) -variable_timeout_pause: 72000 # Time out used by the _ERCF_PAUSE -variable_disable_heater: 600 # Delay after which the hotend heater is disabled in the _ERCF_PAUSE state -variable_gear_stepper_accel: 0 # The acceleration value applied to the gear stepper on moves, standard is to use 0 -variable_extra_servo_dwell_up: 0 # Additional dwell time in ms to apply to dwell prior to turning off the servo -variable_extra_servo_dwell_down: 0 # Additional dwell time in ms to apply to dwell prior to turning off the servo -gcode: - -[save_variables] -filename: /home/pi/printer_data/config/ercf/vars.cfg - -############################### -# ERCF Calibration macros -############################### -[gcode_macro _ERCF_CALIB_SELECTOR] -description: Calibration of the selector position for a defined Tool -gcode: - _ERCF_SERVO_UP - - {% set move_length=(20.0 + (params.TOOL|int + 1)*21.0 + ((params.TOOL|int + 1)/3)*5.0) %} - - M118 Measuring the selector position for tool {params.TOOL} - ERCF_GET_SELECTOR_POS REF={move_length|int} - - _ERCF_MOTORS_OFF - -[gcode_macro _ERCF_CALIBRATE] -description: Complete calibration of all ERCF Tools -gcode: - SET_FILAMENT_SENSOR SENSOR=encoder_sensor ENABLE=0 - M118 Start the complete auto calibration... - M118 First home the ERCF - ERCF_HOME - - {% for chan in range(printer["gcode_macro _ERCF_VAR"].colorselector|length) %} - _ERCF_CALIBRATE_SINGLE TOOL={chan|int} - {% endfor %} - - M118 End of the complete auto calibration! - M118 Please reload the firmware for the calibration to be active! - -[gcode_macro _ERCF_CALIBRATE_SINGLE] -description: Calibration of a single ERCF Tool -gcode: - SET_FILAMENT_SENSOR SENSOR=encoder_sensor ENABLE=0 - {% if params.TOOL|int >= 0 and params.TOOL|int < printer["gcode_macro _ERCF_VAR"].colorselector|length %} - {% if printer["gcode_macro ERCF_HOME"].home == -1 %} - M118 First home the ERCF - ERCF_HOME - {% endif %} - - _ERCF_SELECT_TOOL TOOL={params.TOOL} - ERCF_SET_STEPS RATIO=1.0 - - {% if params.TOOL|int == 0 %} - {% if printer['extruder'].temperature < printer["gcode_macro _ERCF_VAR"].min_temp_extruder %} - M109 S{printer["gcode_macro _ERCF_VAR"].min_temp_extruder|int} - {% endif %} - - M118 Calibrating reference tool {params.TOOL} - ERCF_LOAD LENGTH={printer["gcode_macro _ERCF_VAR"].min_bowden_length} - ERCF_HOME_EXTRUDER TOTAL_LENGTH=400 STEP_LENGTH=0.5 - - _ERCF_CALIB_SAVE_VAR TOOL={params.TOOL} - - G91 - G92 E0 - MANUAL_STEPPER STEPPER=gear_stepper SET_POSITION=0 - MANUAL_STEPPER STEPPER=gear_stepper MOVE=-{printer["gcode_macro _ERCF_VAR"].end_of_bowden_to_sensor|float} SPEED=25 ACCEL={printer["gcode_macro _ERCF_VAR"].gear_stepper_accel|int} SYNC=0 - G1 E-{printer["gcode_macro _ERCF_VAR"].end_of_bowden_to_sensor|float} F1500.0 - - _ERCF_CALIB_UNLOAD - ERCF_BUZZ_GEAR_MOTOR - _ERCF_IS_FILAMENT_STUCK_IN_ERCF - - _ERCF_UNSELECT_TOOL - {% else %} - M118 Calibrating tool {params.TOOL} - - ERCF_LOAD LENGTH={printer["gcode_macro _ERCF_VAR"].min_bowden_length|float - 100.0} - _ERCF_CALIB_SAVE_VAR tool={params.TOOL} - - _ERCF_CALIB_UNLOAD LENGTH={printer["gcode_macro _ERCF_VAR"].min_bowden_length|float - 100.0 + 27.0} - {% endif %} - - {% else %} - M118 Tool out of range - {% endif %} - -[gcode_macro _ERCF_CALIB_SAVE_VAR] -description: Saving ERCF calibration values -gcode: - {% if params.TOOL|int == 0 %} - M118 Tool {params.TOOL} calibration value is {printer['ercf'].encoder_pos|float} - SAVE_VARIABLE VARIABLE=ercf_calib_ref VALUE={printer['ercf'].encoder_pos|float} # this is the reference value - SAVE_VARIABLE VARIABLE=ercf_calib_{params.TOOL|int} VALUE=1.0 - SET_GCODE_VARIABLE MACRO=_ERCF_CALIB_UNLOAD VARIABLE=ref VALUE={printer['ercf'].encoder_pos|float} - SET_GCODE_VARIABLE MACRO=_ERCF_CALIB_UNLOAD VARIABLE=ratio VALUE=1.0 - {% else %} - {% set ratio = (printer["gcode_macro _ERCF_VAR"].min_bowden_length|float - 100.0) / printer['ercf'].encoder_pos|float %} - M118 Tool {params.TOOL} ratio is {ratio|float} - SAVE_VARIABLE VARIABLE=ercf_calib_{params.TOOL|int} VALUE={ratio|float} - SET_GCODE_VARIABLE MACRO=_ERCF_CALIB_UNLOAD VARIABLE=ratio VALUE={ratio|float} - {% endif %} - -[gcode_macro _ERCF_CALIB_UNLOAD] -description: Filament unload during ERCF calibration -variable_ratio: 0.0 -variable_ref: 0.0 -gcode: - {% set unload_length = params.LENGTH|default(0.0)|float %} - {% if unload_length|float == 0.0 %} - ERCF_UNLOAD LENGTH={(ref|float)*(ratio|float) - printer["gcode_macro _ERCF_VAR"].end_of_bowden_to_sensor|float + 27.0} - {% else %} - {% if ratio|float < 1.0 %} # No correction move is done in case of "over targeting", hence the correction ratio is not applied during this unload sequence - ERCF_UNLOAD LENGTH={(unload_length|float)} - {% else %} - ERCF_UNLOAD LENGTH={(unload_length|float)*(ratio|float)} - {% endif %} - {% endif %} - -[gcode_macro _ERCF_GET_LOAD_THRESHOLD] -description: Measure the encoder threshold for the last part of the load -gcode: - _ERCF_CHANGE_TOOL_STANDALONE TOOL=0 TUNE=1 - -[respond] -default_type: command - -############################### -# ERCF servo -############################### -# Push the top hat down (enable the bondtech gears) while "buzzing" the gear motor to ensure proper BMG gear meshing -[gcode_macro _ERCF_SERVO_DOWN] -description: Engage the ERCF gear -gcode: - MANUAL_STEPPER STEPPER=gear_stepper SET_POSITION=0 - MANUAL_STEPPER STEPPER=gear_stepper MOVE=0.5 SPEED=25 ACCEL={printer["gcode_macro _ERCF_VAR"].gear_stepper_accel|int} SYNC=0 - SET_SERVO SERVO=ercf_servo ANGLE={printer["gcode_macro _ERCF_VAR"].servo_down_angle} - G4 P200 - MANUAL_STEPPER STEPPER=gear_stepper MOVE=0.0 SPEED=25 ACCEL={printer["gcode_macro _ERCF_VAR"].gear_stepper_accel|int} SYNC=0 - G4 P100 - MANUAL_STEPPER STEPPER=gear_stepper MOVE=-0.5 SPEED=25 ACCEL={printer["gcode_macro _ERCF_VAR"].gear_stepper_accel|int} SYNC=0 - G4 P{100 + printer["gcode_macro _ERCF_VAR"].extra_servo_dwell_down|int} - MANUAL_STEPPER STEPPER=gear_stepper MOVE=0.0 SPEED=25 ACCEL={printer["gcode_macro _ERCF_VAR"].gear_stepper_accel|int} - SET_SERVO SERVO=ercf_servo WIDTH=0.0 - -# Pull the top hat up (disengage the bondtech gears) -[gcode_macro _ERCF_SERVO_UP] -description: Disengage the ERCF gear -gcode: - SET_SERVO SERVO=ercf_servo ANGLE={printer["gcode_macro _ERCF_VAR"].servo_up_angle} - G4 P{250 + printer["gcode_macro _ERCF_VAR"].extra_servo_dwell_up|int} - SET_SERVO SERVO=ercf_servo WIDTH=0.0 - -############################### -# ERCF motors -############################### -[gcode_macro _ERCF_MOTORS_OFF] -description: Turn off both ERCF motors -gcode: - MANUAL_STEPPER STEPPER=gear_stepper ENABLE=0 - MANUAL_STEPPER STEPPER=selector_stepper ENABLE=0 - -############################### -# PAUSE MACROS -# _ERCF_PAUSE is called when an human intervention is needed -# use ERCF_UNLOCK to start the manual intervention -# and use RESUME when the intervention is over to resume the current print -############################### - -# Stop the delayed stop of the heater -[gcode_macro ERCF_UNLOCK] -description: Unlock ERCF operations -gcode: - M118 Unlock the ERCF - SET_GCODE_VARIABLE MACRO=_ERCF_PAUSE VARIABLE=is_paused VALUE=0 - UPDATE_DELAYED_GCODE ID=disable_heater DURATION=0 - {% if printer['filament_switch_sensor toolhead_sensor'].filament_detected == False %} - _ERCF_UNSELECT_TOOL - {% else %} - _ERCF_UNSELECT_TOOL FORCED=0 - {% endif %} - M104 S{printer["gcode_macro _ERCF_PAUSE"].extruder_temp} - RESTORE_GCODE_STATE NAME=ERCF_state - M118 Refer to the manual before resuming the print - -[delayed_gcode disable_heater] -gcode: - {% if printer["gcode_macro _ERCF_PAUSE"].is_paused|int != 0 %} - M118 Disable extruder heater - M104 S0 - {% endif %} - -# Pause the ERCF, park the extruder at the parking position -# Save the current state and start the delayed stop of the heated -# modify the timeout of the printer accordingly to timeout_pause -[gcode_macro _ERCF_PAUSE] -description: Pause the current print and lock the ERCF operations -variable_is_paused: 0 -variable_extruder_temp: 0 -gcode: - SET_GCODE_VARIABLE MACRO=_ERCF_PAUSE VARIABLE=extruder_temp VALUE={printer.extruder.target} - SET_GCODE_VARIABLE MACRO=_ERCF_PAUSE VARIABLE=is_paused VALUE=1 - SET_IDLE_TIMEOUT TIMEOUT={printer["gcode_macro _ERCF_VAR"].timeout_pause} - UPDATE_DELAYED_GCODE ID=disable_heater DURATION={printer["gcode_macro _ERCF_VAR"].disable_heater} - M118 An issue with the ERCF has been detected and the ERCF has been PAUSED - M118 When you intervene to fix the issue, first call the "ERCF_UNLOCK" Gcode - M118 Refer to the manual before resuming the print - SAVE_GCODE_STATE NAME=ERCF_state - SET_FILAMENT_SENSOR SENSOR=encoder_sensor ENABLE=0 - PAUSE - -############################################ -# Changing tool macros -# _ERCF_CHANGE_TOOL_STANDALONE TOOL=XX to change filament outside of a print -# _ERCF_CHANGE_TOOL_SLICER TOOL=XX will be called automatically (from the ACTIVATE_EXTRUDER gcode from SuperSlicer), don't use that for "manual" filament swap -# if the new extruder is different from the current extruder : -# eject the filament if needed -# load the new one -########################################### -[gcode_macro T0] -gcode: - _ERCF_CHANGE_TOOL TOOL=0 - -[gcode_macro T1] -gcode: - _ERCF_CHANGE_TOOL TOOL=1 - -[gcode_macro T2] -gcode: - _ERCF_CHANGE_TOOL TOOL=2 - -[gcode_macro T3] -gcode: - _ERCF_CHANGE_TOOL TOOL=3 - -[gcode_macro T4] -gcode: - _ERCF_CHANGE_TOOL TOOL=4 - -[gcode_macro T5] -gcode: - _ERCF_CHANGE_TOOL TOOL=5 - -[gcode_macro T6] -gcode: - _ERCF_CHANGE_TOOL TOOL=6 - -[gcode_macro T7] -gcode: - _ERCF_CHANGE_TOOL TOOL=7 - -[gcode_macro T8] -gcode: - _ERCF_CHANGE_TOOL TOOL=8 - -[gcode_macro _ERCF_CHANGE_TOOL] -description: Perform a tool swap -gcode: - {% set initial_tool_string = 'unknown tool' %} - {% if printer["gcode_macro _ERCF_SELECT_TOOL"].color_selected|int != -1 %} - {% set initial_tool_string = 'T' + printer["gcode_macro _ERCF_SELECT_TOOL"].color_selected|string %} - {% endif %} - M118 Tool swap request, from {initial_tool_string} to T{params.TOOL|int} - M117 {initial_tool_string} -> T{params.TOOL|int} - {% if printer.idle_timeout.state == "Printing" %} - _ERCF_CHANGE_TOOL_SLICER TOOL={params.TOOL|int} - {% else %} - _ERCF_CHANGE_TOOL_STANDALONE TOOL={params.TOOL|int} - {% endif %} - -[gcode_macro _ERCF_CHANGE_TOOL_SLICER] -description: Perform a tool swap during a print -gcode: - SET_FILAMENT_SENSOR SENSOR=encoder_sensor ENABLE=0 - {% if printer["gcode_macro _ERCF_SELECT_TOOL"].color_selected|int != params.TOOL|int %} - # Add a variable 'SwapCounter' in your PRINT_START macro to display this info - # {% set newcounter = (printer["gcode_macro PRINT_START"].swapcounter|int + 1) %} - # SET_GCODE_VARIABLE MACRO=PRINT_START VARIABLE=swapcounter VALUE={newcounter} - # M118 Swap {newcounter|int} - _ERCF_UNLOAD_TOOL - _ERCF_LOAD_TOOL TOOL={params.TOOL|int} - _ERCF_CHANGE_TOOL_SLICER_END - {% endif %} - -[gcode_macro _ERCF_CHANGE_TOOL_SLICER_END] -gcode: - {% if printer["gcode_macro _ERCF_PAUSE"].is_paused|int == 0 %} - {% if printer["gcode_macro _ERCF_VAR"].clog_detection|int == 1 %} - SET_FILAMENT_SENSOR SENSOR=encoder_sensor ENABLE=1 - {% endif %} - {% endif %} - -[gcode_macro _ERCF_CHANGE_TOOL_STANDALONE] -description: Perform a tool swap out of a print -gcode: - SET_FILAMENT_SENSOR SENSOR=encoder_sensor ENABLE=0 - {% set tune = params.TUNE|default(0)|int %} - {% if printer["gcode_macro ERCF_HOME"].home == -1 %} - M118 ERCF not homed, homing it... - ERCF_HOME - _ERCF_LOAD_TOOL TOOL={params.TOOL|int} TUNE={tune} - {% elif printer["gcode_macro _ERCF_SELECT_TOOL"].color_selected|int != params.TOOL|int %} - {% if printer['filament_switch_sensor toolhead_sensor'].filament_detected == True %} - M118 Unloading current filament - {% if printer['extruder'].temperature < 178 %} - M118 Preheat Nozzle - M109 S{printer["gcode_macro _ERCF_VAR"].extruder_eject_temp} - {% endif %} - ERCF_EJECT - {% endif %} - - _ERCF_LOAD_TOOL TOOL={params.TOOL|int} TUNE={tune} - {% endif %} - -############################################ -# Unloading/Loading Macros -############################################ - -# Load filament from ERCF to nozzle -[gcode_macro _ERCF_LOAD_TOOL] -description: Load the filament from the ERCF to the toolhead -gcode: - {% if printer["gcode_macro _ERCF_PAUSE"].is_paused|int == 0 %} - {% if printer["gcode_macro ERCF_HOME"].home == -1 %} - M118 ERCF not homed, homing it... - ERCF_HOME - {% endif %} - {% set tune = params.TUNE|default(0)|int %} - M118 Loading tool {params.TOOL|int} ... - _ERCF_SELECT_TOOL TOOL={params.TOOL|int} - {% set ercf_params = printer.save_variables.variables %} - ERCF_SET_STEPS RATIO={ercf_params['ercf_calib_%s' % (params.TOOL|string)]} - M118 Loading filament from ERCF to extruder ... - {% set ercf_params = printer.save_variables.variables %} - ERCF_LOAD LENGTH={ercf_params.ercf_calib_ref|float - printer["gcode_macro _ERCF_VAR"].end_of_bowden_to_sensor|float} - _ERCF_LOAD_FILAMENT_IN_EXTRUDER TUNE={tune} - {% else %} - M118 ERCF is currently paused. Please use ERCF_UNLOCK - {% endif %} - -# Unload filament from nozzle to ERCF, using built-in tip forming macro -[gcode_macro ERCF_EJECT] -description: Eject the filament out of a print and park it into the ERCF -gcode: - {% if printer["gcode_macro _ERCF_PAUSE"].is_paused|int == 0 %} - {% if printer["gcode_macro _ERCF_SELECT_TOOL"].color_selected|int != -1 %} - M118 Unloading tool {printer["gcode_macro _ERCF_SELECT_TOOL"].color_selected|int} ... - {% if printer['filament_switch_sensor toolhead_sensor'].filament_detected == True %} - _ERCF_UNLOAD_FILAMENT_IN_EXTRUDER_WITH_TIP_FORMING - {% set ercf_params = printer.save_variables.variables %} - ERCF_SET_STEPS RATIO={ercf_params['ercf_calib_%s' % (printer["gcode_macro _ERCF_SELECT_TOOL"].color_selected|string)]} - ERCF_UNLOAD LENGTH={ercf_params.ercf_calib_ref|float + printer["gcode_macro _ERCF_VAR"].unload_modifier|float - 60.0} - _ERCF_UNSELECT_TOOL - {% else %} - _ERCF_EJECT_UNKNOW_STATE - {% endif %} - {% else %} - _ERCF_EJECT_UNKNOW_STATE - {% endif %} - {% else %} - M118 ERCF is currently paused. Please use ERCF_UNLOCK - {% endif %} - -# Unload filament from nozzle to ERCF, using SuperSlicer ramming -[gcode_macro _ERCF_UNLOAD_TOOL] -description: Eject the filament during a print and park it into the ERCF -gcode: - {% if printer["gcode_macro _ERCF_PAUSE"].is_paused|int == 0 %} - {% if printer["gcode_macro _ERCF_SELECT_TOOL"].color_selected|int != -1 %} - M118 Unload tool {printer["gcode_macro _ERCF_SELECT_TOOL"].color_selected|int} ... - G1 E-10.00 F1200.0 - G1 E-{printer["gcode_macro _ERCF_VAR"].end_of_bowden_to_sensor|float + 20.0} F2000 - _ERCF_SELECT_TOOL TOOL={printer["gcode_macro _ERCF_SELECT_TOOL"].color_selected|int} - {% set ercf_params = printer.save_variables.variables %} - ERCF_SET_STEPS RATIO={ercf_params['ercf_calib_%s' % (printer["gcode_macro _ERCF_SELECT_TOOL"].color_selected|string)]} - G4 P100 - _ERCF_EXTRACT_FROM_EXTRUDER - {% set ercf_params = printer.save_variables.variables %} - ERCF_UNLOAD LENGTH={ercf_params.ercf_calib_ref|float + printer["gcode_macro _ERCF_VAR"].unload_modifier|float - 60.0} - _ERCF_UNSELECT_TOOL - {% endif %} - {% else %} - M118 ERCF is currently paused. Please use ERCF_UNLOCK - {% endif %} - -# Unload filament from nozzle to ERCF, using SuperSlicer ramming -[gcode_macro _ERCF_EXTRACT_FROM_EXTRUDER] -description: Extract the tip at the parking position from the extruder -gcode: - {% if printer['filament_switch_sensor toolhead_sensor'].filament_detected == True %} - M118 Filament still below the extruder... Trying extraction again... - G1 E-5.00 F1200.0 - G1 E-{printer["gcode_macro _ERCF_VAR"].end_of_bowden_to_sensor|float + 25.0} F2000 - G4 P100 - _ERCF_RETRY_EXTRACT_FROM_EXTRUDER - {% else %} - G91 - G92 E0 - MANUAL_STEPPER STEPPER=gear_stepper SET_POSITION=0 - MANUAL_STEPPER STEPPER=gear_stepper MOVE=-20 SPEED=25 ACCEL=0 - MANUAL_STEPPER STEPPER=gear_stepper SET_POSITION=0 - MANUAL_STEPPER STEPPER=gear_stepper MOVE=-10 SPEED=25 ACCEL=0 SYNC=0 - G1 E10 F2000.0 - {% endif %} - -# Unload filament from nozzle to ERCF, using SuperSlicer ramming -[gcode_macro _ERCF_RETRY_EXTRACT_FROM_EXTRUDER] -description: Check if extraction retry went properly or not -gcode: - {% if printer['filament_switch_sensor toolhead_sensor'].filament_detected == True %} - M118 Filament is stuck below the extruder... - M118 Calling ERCF_PAUSE - _ERCF_PAUSE - {% else %} - G91 - G92 E0 - MANUAL_STEPPER STEPPER=gear_stepper SET_POSITION=0 - MANUAL_STEPPER STEPPER=gear_stepper MOVE=-20 SPEED=25 ACCEL=0 - MANUAL_STEPPER STEPPER=gear_stepper SET_POSITION=0 - MANUAL_STEPPER STEPPER=gear_stepper MOVE=-10 SPEED=25 ACCEL=0 SYNC=0 - G1 E10 F2000.0 - {% endif %} - - -############################################ -# Select/Unselect a tool -# move the selector (if needed) to the requested tool -############################################ - -# Select a tool. move the idler and then move the color selector (if needed) -[gcode_macro _ERCF_SELECT_TOOL] -description: Move the selector to the Tool and select it -variable_tool_selected: -1 -variable_color_selected: -1 -gcode: - {% if printer["gcode_macro _ERCF_PAUSE"].is_paused|int == 0 %} - {% if printer["gcode_macro ERCF_HOME"].home != -1 %} - M118 Select Tool {params.TOOL} ... - _ERCF_SERVO_UP - {% if printer["gcode_macro _ERCF_VAR"].sensorless_selector|int == 1 %} - ERCF_MOVE_SELECTOR TARGET={printer["gcode_macro _ERCF_VAR"].colorselector[params.TOOL|int]} - {% else %} - MANUAL_STEPPER STEPPER=selector_stepper MOVE={printer["gcode_macro _ERCF_VAR"].colorselector[params.TOOL|int]} - {% endif %} - SET_GCODE_VARIABLE MACRO=_ERCF_SELECT_TOOL VARIABLE=tool_selected VALUE={params.TOOL} - SET_GCODE_VARIABLE MACRO=_ERCF_SELECT_TOOL VARIABLE=color_selected VALUE={params.TOOL} - _ERCF_SERVO_DOWN - M118 Tool {params.TOOL} Enabled - {% else %} - M118 Could not select tool, ERCF is not homed - {% endif %} - {% else %} - M118 ERCF is currently paused. Please use ERCF_UNLOCK - {% endif %} - -# Unselect a tool -[gcode_macro _ERCF_UNSELECT_TOOL] -description: Unselect current Tool -gcode: - {% set unselect_color = params.FORCED|default(1)|int %} - {% if printer["gcode_macro _ERCF_PAUSE"].is_paused|int == 0 %} - {% if printer["gcode_macro ERCF_HOME"].home != -1 %} - _ERCF_SERVO_UP - SET_GCODE_VARIABLE MACRO=_ERCF_SELECT_TOOL VARIABLE=tool_selected VALUE=-1 - {% if unselect_color == 1 %} - SET_GCODE_VARIABLE MACRO=_ERCF_SELECT_TOOL VARIABLE=color_selected VALUE=-1 - {% endif %} - ERCF_SET_STEPS RATIO=1.0 - {% else %} - M118 Could not unselect tool, ERCF is not homed - {% endif %} - {% else %} - M118 ERCF is currently paused. Please use ERCF_UNLOCK - {% endif %} - -############################################ -# Loading/Unloading part FROM/TO EXTRUDER TO/FROM NOZZLE -############################################ - -# Load the filament into the extruder -# Call _ERCF_PAUSE if the filament is not detected by the toolhead sensor -[gcode_macro _ERCF_LOAD_FILAMENT_IN_EXTRUDER] -description: Load filament from the toolhead entrance to the nozzle -gcode: - {% if printer["gcode_macro _ERCF_PAUSE"].is_paused|int == 0 %} - {% set tune = params.TUNE|default(0)|int %} - {% if printer.extruder.temperature > printer["gcode_macro _ERCF_VAR"].min_temp_extruder %} - M118 Loading Filament... - G91 - G92 E0 - MANUAL_STEPPER STEPPER=gear_stepper SET_POSITION=0 - MANUAL_STEPPER STEPPER=gear_stepper MOVE={printer["gcode_macro _ERCF_VAR"].end_of_bowden_to_sensor|float - 7} SPEED=25 ACCEL={printer["gcode_macro _ERCF_VAR"].gear_stepper_accel|int} SYNC=0 - G1 E{printer["gcode_macro _ERCF_VAR"].end_of_bowden_to_sensor|float - 7} F1500.0 - G4 P100 - ERCF_HOME_EXTRUDER TOTAL_LENGTH=30.0 STEP_LENGTH=0.5 - _ERCF_UNSELECT_TOOL FORCED=0 - ERCF_FINALIZE_LOAD LENGTH={printer["gcode_macro _ERCF_VAR"].sensor_to_nozzle|float} TUNE={tune} - G92 E0 - G90 - {% else %} - M118 Extruder too cold - _ERCF_PAUSE - {% endif %} - {% else %} - M118 ERCF is currently paused. Please use ERCF_UNLOCK - {% endif %} - -# StandAlone cooling moves to extract proper filament tip -[gcode_macro _ERCF_FORM_TIP_STANDALONE] -description: Generic tip forming macro -gcode: - {% set COOLING_TUBE_LENGTH = params.COOLING_TUBE_LENGTH|default(15) %} # Dragon ST: 15, Dragon HF: 10, Mosquito: 20 - {% set COOLING_TUBE_RETRACTION = params.COOLING_TUBE_RETRACTION|default(35) %} # Dragon ST: 35, Dragon HF: 30, Mosquito: 38 - {% set INITIAL_COOLING_SPEED = params.INITIAL_COOLING_SPEED|default(10) %} - {% set FINAL_COOLING_SPEED = params.FINAL_COOLING_SPEED|default(50) %} - {% set COOLING_MOVES = params.COOLING_MOVES|default(5) %} - {% set TOOLCHANGE_TEMP = params.TOOLCHANGE_TEMP|default(0) %} - {% set USE_SKINNYDIP = params.USE_SKINNYDIP|default(0) %} - {% set USE_FAST_SKINNYDIP = params.USE_FAST_SKINNYDIP|default(1) %} - {% set SKINNYDIP_DISTANCE = params.SKINNYDIP_DISTANCE|default(26) %} - {% set DIP_INSERTION_SPEED = params.DIP_INSERTION_SPEED|default(33) %} - {% set DIP_EXTRACTION_SPEED = params.DIP_EXTRACTION_SPEED|default(70) %} - {% set MELT_ZONE_PAUSE = params.MELT_ZONE_PAUSE|default(0) %} - {% set COOLING_ZONE_PAUSE = params.COOLING_ZONE_PAUSE|default(0) %} - {% set UNLOADING_SPEED_START = params.UNLOADING_SPEED_START|default(199) %} - {% set UNLOADING_SPEED = params.UNLOADING_SPEED|default(20) %} - {% set RAMMING_VOLUME = params.RAMMING_VOLUME|default(0) %} # in mm3 - {% set INITIAL_RETRACT = params.INITIAL_RETRACT|default(0) %} # Use an initial retract or not. Don't use it if you want to ram the filament - {% set FINAL_EJECT = params.FINAL_EJECT|default(0) %} # Fully eject the filament afterwards, default is no - - G91 - G92 E0 - - SET_PRESSURE_ADVANCE ADVANCE=0 - {% set OLD_TEMP = printer.extruder.target %} - - # Ramming with SuperSlicer standard setting - {% if INITIAL_RETRACT|int == 1 %} - G1 E-8.5000 F3000 - {% endif %} - - {% set RATIO = (RAMMING_VOLUME|float) /23.0 %} - - G1 E{0.5784 * RATIO|float} F299 #7 - G1 E{0.5834 * RATIO|float} F302 #3 - G1 E{0.5918 * RATIO|float} F306 #6 - G1 E{0.6169 * RATIO|float} F319 #6 - G1 E{0.3393 * RATIO|float} F350 #0 - G1 E{0.3363 * RATIO|float} F350 #0 - G1 E{0.7577 * RATIO|float} F392 #6 - G1 E{0.8382 * RATIO|float} F434 #3 - G1 E{0.7776 * RATIO|float} F469 #9 - G1 E{0.1293 * RATIO|float} F469 #9 - G1 E{0.9673 * RATIO|float} F501 #2 - G1 E{1.0176 * RATIO|float} F527 #2 - G1 E{0.5956 * RATIO|float} F544 #6 - G1 E{0.4555 * RATIO|float} F544 #6 - G1 E{1.0662 * RATIO|float} F552 #4 - - # set toolchange temperature just prior to filament being extracted from melt zone and wait for set point - # (SKINNYDIP--normal mode only) - {% if TOOLCHANGE_TEMP|float > 0 and USE_FAST_SKINNYDIP|int == 0 %} - M109 S{TOOLCHANGE_TEMP} - {% endif %} - - # Retraction - {% set TOTAL_RETRACTION_DISTANCE = COOLING_TUBE_RETRACTION|float + COOLING_TUBE_LENGTH|float / 2 - 15 %} - G1 E-15 F{1.0 * UNLOADING_SPEED_START|float * 60} - G1 E-{0.7 * TOTAL_RETRACTION_DISTANCE} F{1.0 * UNLOADING_SPEED|float * 60} - G1 E-{0.2 * TOTAL_RETRACTION_DISTANCE} F{0.5 * UNLOADING_SPEED|float * 60} - G1 E-{0.1 * TOTAL_RETRACTION_DISTANCE} F{0.3 * UNLOADING_SPEED|float * 60} - - {% if TOOLCHANGE_TEMP|float > 0 and USE_FAST_SKINNYDIP|int == 1 %} - M104 S{TOOLCHANGE_TEMP} - {% endif %} - - # Generate Cooling Moves - {% set SPEED_INC = (FINAL_COOLING_SPEED|float - INITIAL_COOLING_SPEED|float) / (2 * COOLING_MOVES|float - 1) %} - {% for move in range(COOLING_MOVES|int) %} - G1 E{COOLING_TUBE_LENGTH} F{(INITIAL_COOLING_SPEED|float + SPEED_INC*move*2) * 60} - G1 E-{COOLING_TUBE_LENGTH} F{(INITIAL_COOLING_SPEED|float + SPEED_INC*(move*2+1)) * 60} - {% endfor %} - - # wait for extruder to reach toolchange temperature after cooling moves complete (SKINNYDIP--fast mode only) - {% if TOOLCHANGE_TEMP|float > 0 and USE_FAST_SKINNYDIP|int == 1 %} - M109 S{TOOLCHANGE_TEMP} - {% endif %} - - # Generate a skinnydip move - {% if USE_SKINNYDIP|int == 1 %} - G1 E{SKINNYDIP_DISTANCE} F{DIP_INSERTION_SPEED|float * 60} - G4 P{MELT_ZONE_PAUSE} - G1 E-{SKINNYDIP_DISTANCE} F{DIP_EXTRACTION_SPEED|float * 60} - G4 P{COOLING_ZONE_PAUSE} - {% endif %} - - {% if TOOLCHANGE_TEMP|float > 0 %} - M104 S{OLD_TEMP} - {% endif %} - - {% if FINAL_EJECT|int == 1 %} - G92 E0 - G1 E-80 F3000 - {% endif %} - - G92 E0 - -# Unload from extruder with tip forming sequence -[gcode_macro _ERCF_UNLOAD_FILAMENT_IN_EXTRUDER_WITH_TIP_FORMING] -description: Unload filament from the nozzle to the toolhead entrance using generic tip forming macro -gcode: - {% if printer["gcode_macro _ERCF_PAUSE"].is_paused|int == 0 %} - {% if printer.extruder.temperature > printer["gcode_macro _ERCF_VAR"].min_temp_extruder %} - {% if printer["gcode_macro _ERCF_SELECT_TOOL"].tool_selected|int == -1 %} - M118 Forming filament tip and Unloading Filament... - G91 - _ERCF_FORM_TIP_STANDALONE - G1 E-10.00 F1200.0 - G1 E-{printer["gcode_macro _ERCF_VAR"].sensor_to_nozzle|float - 10.00} F2000 - G1 E-{printer["gcode_macro _ERCF_VAR"].end_of_bowden_to_sensor|float + 20.00} F2000 - _ERCF_SERVO_DOWN - G4 P100 - _ERCF_EXTRACT_FROM_EXTRUDER - M118 Filament removed - {% else %} - M118 Tool selected, UNSELECT it - _ERCF_PAUSE - {% endif %} - {% else %} - M118 Extruder too cold - _ERCF_PAUSE - {% endif %} - {% else %} - M118 ERCF is currently paused. Please use ERCF_UNLOCK - {% endif %} - -############################################ -# Endstop check macros -############################################ -# Call _ERCF_PAUSE if the filament is stuck in the ERCF -[gcode_macro _ERCF_IS_FILAMENT_STUCK_IN_ERCF] -gcode: - {% if printer.ercf.encoder_pos|float != 0 %} - M118 Filament stuck in ERCF - _ERCF_PAUSE - {% else %} - M118 Filament not in ERCF - {% endif %} - -############################################ -# Macros called during homing to try to eject the filament if loaded -############################################ - -# Eject from extruder gear to the ERCF -[gcode_macro _ERCF_EJECT_UNKNOW_STATE] -description: Unload filament from an unknown position -gcode: - M118 Eject Filament if loaded ... - {% if printer['filament_switch_sensor toolhead_sensor'].filament_detected == True %} - M118 Filament in extruder, trying to eject it .. - {% if printer['extruder'].temperature < 178 %} - M118 Preheat Nozzle - M109 S{printer["gcode_macro _ERCF_VAR"].extruder_eject_temp} - {% endif %} - _ERCF_UNLOAD_FILAMENT_IN_EXTRUDER_WITH_TIP_FORMING - ERCF_UNLOAD LENGTH={printer["gcode_macro _ERCF_VAR"].min_bowden_length - 50} UNKNOWN=1 - {% else %} - _ERCF_SERVO_DOWN - ERCF_BUZZ_GEAR_MOTOR - _ERCF_EJECT_FROM_BOWDEN - {% endif %} - -# Eject from the bowden to the ERCF -[gcode_macro _ERCF_EJECT_FROM_BOWDEN] -description: Unload filament from the reverse bowden -gcode: - {% if printer.ercf.encoder_pos|float != 0 %} - ERCF_UNLOAD HOMING=1 - M118 Filament ejected ! - {% else %} - M118 Filament already ejected ! - {% endif %} - _ERCF_SERVO_UP - -############################################ -# Homing macros -# ERCF_HOME must be called before using the ERCF -############################################ - -# Home the ERCF -# eject filament if loaded with _ERCF_EJECT_UNKNOW_STATE -# next home the ERCF with _ERCF_HOME_ONLY -[gcode_macro ERCF_HOME] -description: Home the ERCF -variable_home: -1 -gcode: - SET_FILAMENT_SENSOR SENSOR=encoder_sensor ENABLE=0 - SET_GCODE_VARIABLE MACRO=ERCF_HOME VARIABLE=home VALUE=1 - {% if printer["gcode_macro _ERCF_PAUSE"].is_paused|int == 1 %} - ERCF_UNLOCK - {% endif %} - M118 Homing ERCF ... - QUERY_ENDSTOPS - _ERCF_EJECT_UNKNOW_STATE - _ERCF_HOME_SELECTOR - _ERCF_HOME_ONLY TOOL={params.TOOL|default(0)|int} - -[gcode_macro _ERCF_HOME_SELECTOR] -description: Home the ERCF selector -gcode: - M118 Homing selector - _ERCF_UNSELECT_TOOL - - {% set number_of_chan=printer["gcode_macro _ERCF_VAR"].colorselector|length %} - {% set selector_length=(20.0 + number_of_chan*21.0 + (number_of_chan/3)*5.0) %} - - {% if printer["gcode_macro _ERCF_VAR"].sensorless_selector|int == 1 %} - MANUAL_STEPPER STEPPER=selector_stepper SET_POSITION=0 - MANUAL_STEPPER STEPPER=selector_stepper SPEED=60 MOVE=-{selector_length|float} STOP_ON_ENDSTOP=1 - MANUAL_STEPPER STEPPER=selector_stepper SET_POSITION=0 - {% else %} - MANUAL_STEPPER STEPPER=selector_stepper SET_POSITION=0 - MANUAL_STEPPER STEPPER=selector_stepper SPEED=100 MOVE=-{selector_length|float} STOP_ON_ENDSTOP=1 - MANUAL_STEPPER STEPPER=selector_stepper SET_POSITION=0 - MANUAL_STEPPER STEPPER=selector_stepper SPEED=100 MOVE=5.0 - MANUAL_STEPPER STEPPER=selector_stepper SPEED=10 MOVE=-10.0 STOP_ON_ENDSTOP=1 - MANUAL_STEPPER STEPPER=selector_stepper SET_POSITION=0 - {% endif %} - QUERY_ENDSTOPS - M400 - MANUAL_STEPPER STEPPER=selector_stepper SPEED=50 MOVE=3.0 - M400 - -# Home the ERCF (home the color selector if needed) -# if everything is ok, the ERCF is ready to be used -[gcode_macro _ERCF_HOME_ONLY] -gcode: - {% if printer["gcode_macro _ERCF_PAUSE"].is_paused|int == 0 %} - {% set selector_homed = 0 %} - {% if printer["gcode_macro _ERCF_VAR"].sensorless_selector|int == 1 %} - {% if printer.query_endstops.last_query["manual_stepper gear_stepper"] == 1 %} - {% set selector_homed = 1 %} - {% endif %} - {% else %} - {% if printer.query_endstops.last_query["manual_stepper selector_stepper"] == 1 %} - {% set selector_homed = 1 %} - {% endif %} - {% endif %} - {% if selector_homed != 1 %} - M118 Homing ERCF selector failed, check what is blocking the selector - M118 Pausing the ERCF, run "ERCF_UNLOCK" to unlock it ... - _ERCF_PAUSE - {% else %} - M118 Homing ERCF ended ... - {% endif %} - {% else %} - M118 Homing ERCF failed, ERCF is paused, run "ERCF_UNLOCK" to unlock it ... - {% endif %} - -############################################### -# Test Macros -############################################### -[gcode_macro _ERCF_DISPLAY_ENCODER_POS] -description: Display current value of the ERCF encoder -gcode: - M118 Encoder value is {printer['ercf'].encoder_pos|float} - -[gcode_macro _ERCF_TEST_MOVE_GEAR] -description: Move the ERCF gear -gcode: - {% set move_length = params.LENGTH|default(200.0)|float %} - {% set move_speed = params.SPEED|default(50.0)|float %} - {% set move_accel = params.ACCEL|default(200.0)|float %} - MANUAL_STEPPER STEPPER=gear_stepper SET_POSITION=0 - MANUAL_STEPPER STEPPER=gear_stepper MOVE={move_length|float} SPEED={move_speed|float} ACCEL={move_accel|float} - -[gcode_macro _ERCF_TEST_SERVO] -description: Test the servo angle -gcode: - SET_SERVO SERVO=ercf_servo ANGLE={params.VALUE|float} - G4 P{250 + printer["gcode_macro _ERCF_VAR"].extra_servo_dwell_up|int} - SET_SERVO SERVO=ercf_servo WIDTH=0.0 - -[gcode_macro _ERCF_TEST_GRIP] -description: Test the ERCF grip for a Tool -gcode: - _ERCF_SERVO_DOWN - _ERCF_MOTORS_OFF - -[gcode_macro _ERCF_TEST_LOAD_SEQUENCE] -description: Test sequence -gcode: - {% set loop_number = params.LOOP|default(10)|int %} - {% set use_rand = params.RAND|default(0)|int %} - {% for iteration in range(loop_number|int) %} - {% for load in range((printer["gcode_macro _ERCF_VAR"].colorselector|length)|int) %} - {% if use_rand|int == 1 %} - _ERCF_SELECT_TOOL TOOL={range(0, printer["gcode_macro _ERCF_VAR"].colorselector|length)|random} - {% else %} - _ERCF_SELECT_TOOL TOOL={load|int} - {% endif %} - - ERCF_LOAD LENGTH=100 - G4 P50 - ERCF_UNLOAD LENGTH=100 - _ERCF_UNSELECT_TOOL - G4 P200 - {% endfor %} - {% endfor %} - -############################################### -# Endless spool mode and clog detection -############################################### - -[gcode_macro _ERCF_ENCODER_MOTION_ISSUE] -description: Perform a test when the encoder sense an issue (clog or runout) -gcode: - M118 Issue on tool {printer["gcode_macro _ERCF_SELECT_TOOL"].color_selected|int} - M118 Checking if this is a clog or a runout... - - SET_FILAMENT_SENSOR SENSOR=encoder_sensor ENABLE=0 - - _ERCF_SERVO_DOWN - ERCF_BUZZ_GEAR_MOTOR - _ERCF_SERVO_UP - _ERCF_CLOG_OR_RUNOUT - -[gcode_macro _ERCF_CLOG_OR_RUNOUT] -description: Actions taken if a clog or a runout is detected by the ERCF encoder -gcode: - {% if printer.ercf.encoder_pos|float != 0 %} - M118 Clog detected, please check the ERCF and the printer - {% else %} - M118 Runout detected ! - {% if printer["gcode_macro _ERCF_VAR"].endless_spool_mode|int == 1 %} - {% set pre_change_PA = printer.extruder.pressure_advance %} - M118 EndlessSpool mode is ON! - {% if printer["gcode_macro _ERCF_SELECT_TOOL"].color_selected|int >= (printer["gcode_macro _ERCF_VAR"].colorselector|length -1) %} - {% set nexttool = 0 %} - {% else %} - {% set nexttool = (printer["gcode_macro _ERCF_SELECT_TOOL"].color_selected|int + 1) %} - {% endif %} - - M118 Loading tool {nexttool|int} - SAVE_GCODE_STATE NAME=ERCF_Pre_Brush_init - # Adapt the example below to your own setup - # The goal is just to clean the nozzle after the change - # In my case I have a purge bucket with a brush - # G0 X45 Y300 F18000 - # G0 X45 Y310 Z1 F3000 - - # Custom unload sequence - M118 Unloading Filament... - G91 - _ERCF_FORM_TIP_STANDALONE - ERCF_HOME_EXTRUDER TOTAL_LENGTH={printer["gcode_macro _ERCF_VAR"].sensor_to_nozzle} STEP_LENGTH=2.0 - _ERCF_SERVO_DOWN - - G91 - G92 E0 - MANUAL_STEPPER STEPPER=gear_stepper SET_POSITION=0 - MANUAL_STEPPER STEPPER=gear_stepper MOVE=-{printer["gcode_macro _ERCF_VAR"].end_of_bowden_to_sensor|float} SPEED=25 ACCEL={printer["gcode_macro _ERCF_VAR"].gear_stepper_accel|int} SYNC=0 - G1 E-{printer["gcode_macro _ERCF_VAR"].end_of_bowden_to_sensor|float} F1500.0 - - {% set ercf_params = printer.save_variables.variables %} - ERCF_SET_STEPS RATIO={ercf_params['ercf_calib_%s' % (printer["gcode_macro ERCF_SELECT_TOOL"].color_selected|string)]} - ERCF_UNLOAD LENGTH={ercf_params.ercf_calib_ref|float - printer["gcode_macro ERCF_VAR"].end_of_bowden_to_sensor|float + printer["gcode_macro ERCF_VAR"].unload_modifier|float} - ERCF_UNSELECT_TOOL - - _ERCF_LOAD_TOOL TOOL={nexttool|int} - SET_PRESSURE_ADVANCE ADVANCE={pre_change_PA} - _ERCF_CHECK_IF_RESUME - {% else %} - M118 EndlessSpool mode not enabled, please do something - {% endif %} - {% endif %} - -[gcode_macro _ERCF_CHECK_IF_RESUME] -description: Safety checks before resuming the print after an encoder event -gcode: - {% if printer["gcode_macro _ERCF_PAUSE"].is_paused|int == 0 %} - # Adapt the example below to your own setup - # The goal is just to clean the nozzle after the change - # In my case I have a purge bucket with a brush - # BRUSH_PURGE LENGTH=50 - # BRUSH_CLEAN - RESTORE_GCODE_STATE NAME=ERCF_Pre_Brush_init - RESUME - {% if printer["gcode_macro _ERCF_VAR"].clog_detection|int == 1 %} - SET_FILAMENT_SENSOR SENSOR=encoder_sensor ENABLE=1 - {% endif %} - {% else %} - M118 ERCF is currently paused. Please use ERCF_UNLOCK - {% endif %} - diff --git a/ercf/vars.cfg b/ercf/vars.cfg deleted file mode 100644 index 59a9861..0000000 --- a/ercf/vars.cfg +++ /dev/null @@ -1,15 +0,0 @@ -[Variables] -ercf_calib_0 = 1.0 -ercf_calib_1 = 1.0017808674381732 -ercf_calib_10 = 1.0 -ercf_calib_11 = 1.0 -ercf_calib_2 = 1.0007071473230196 -ercf_calib_3 = 0.9996357263944082 -ercf_calib_4 = 1.0050158971500294 -ercf_calib_5 = 0.999635726394 -ercf_calib_6 = 1.0 -ercf_calib_7 = 1.0 -ercf_calib_8 = 1.0 -ercf_calib_9 = 1.0 -ercf_calib_ref = 782.7262400000001 - diff --git a/fans.cfg b/fans.cfg deleted file mode 100644 index d0cdec8..0000000 --- a/fans.cfg +++ /dev/null @@ -1,36 +0,0 @@ -##################################################################### -# Fan Control -##################################################################### - -# [fan_generic nevermore1] -[heater_fan nevermore1] -pin: PD12 -kick_start_time: 0.5 -heater: heater_bed -heater_temp: 40.0 -fan_speed: 0.80 - -# [fan_generic nevermore2] -[heater_fan nevermore2] -pin: PD13 -kick_start_time: 0.5 -heater: heater_bed -heater_temp: 40.0 -fan_speed: 0.80 - -# [fan_generic side1] -[heater_fan side1] -pin: PD14 -kick_start_time: 0.5 -heater: heater_bed -heater_temp: 40.0 -fan_speed: 0.40 - -# [fan_generic side1] -[heater_fan side2] -pin: PD15 -kick_start_time: 0.5 -heater: heater_bed -heater_temp: 40.0 -fan_speed: 0.40 - diff --git a/macros.cfg b/macros.cfg new file mode 100644 index 0000000..38f3b85 --- /dev/null +++ b/macros.cfg @@ -0,0 +1,211 @@ +[gcode_macro START_PRINT] +description: start printing +gcode: + {% set BED_TEMP = params.BED_TEMP|default(60)|float %} + {% set EXTRUDER_TEMP = params.EXTRUDER_TEMP|default(190)|float %} + M117 start heating + M140 S{BED_TEMP} # start bed heating + M104 S{EXTRUDER_TEMP} # start extruder heating + NEOPIXEL_ON COLOR=green # set neopixel green + G92 E0 # reset extruder + G21 # set units to millimeters + G90 # use absolute coordinates + M83 # use relative distances for extrusion + SET_GCODE_OFFSET Z=0.0 # reset the G-Code Z offset + M117 home + G28 # home the printer + G1 Z5 F3000 # move the nozzle near the bed + G1 Z0.25 F300 # move the nozzle very close to the bed + M117 wait for heating + NEOPIXEL_ON COLOR=red # set neopixel red + G92 E0 # reset extruder + M190 S{BED_TEMP} # set and wait for bed temperature + M109 S{EXTRUDER_TEMP} # set and wait for nozzle temperature + # clean nozzle + NEOPIXEL_ON COLOR=blue # set neopixel blue + M117 clean nozzle + G0 Z5 F300 # move Z to travel height + G0 X40 Y0 F5000 # move to start position + G0 Z0.2 F1500 # lower Z + G0 X150 Y0 Z0.2 E10 # draw line + G0 X150 Y0.8 Z0.2 # move to the side little + G0 X30 Y0.8 Z0.2 E5 # draw fine line + # G0 Z5 F300 # move Z to travel height + NEOPIXEL_ON COLOR=white # set neopixel white + M117 starting + +[gcode_macro END_PRINT] +description: end printing +gcode: + M140 S0 # Turn off bed + M104 S0 # Turn off extruder + M106 S0 # Turn off fan + G91 # Use relativ coordinates + G1 X-2 Y-2 E-3 F300 # Move nozzle away from print while retracting + G1 Z10 F3000 # Raise nozzle by 10mm + G90 # Use absolute coordinates + M84 # Disable steppers + NEOPIXEL_OFF # Turn off NeoPixel + +[gcode_macro PREHEAT] +description: set bed and extruder temperature +gcode: + {% set BED_TEMP = params.BED_TEMP|default(0)|float %} + {% set EXTRUDER_TEMP = params.EXTRUDER_TEMP|default(190)|float %} + M117 start heating + M140 S{BED_TEMP} # start bed heating + M104 S{EXTRUDER_TEMP} # start extruder heating + M109 S{EXTRUDER_TEMP} # set and wait for nozzle temperature + M117 done + +[gcode_macro PAUSE] +description: Pause the actual running print +rename_existing: PAUSE_BASE +gcode: + {% set x = params.X|default(170) %} + {% set y = params.Y|default(170) %} + {% set z = params.Z|default(10)|float %} + {% set e = params.E|default(1) %} + ## calculate save lift position + {% set max_z = printer.toolhead.axis_maximum.z|float %} + {% set act_z = printer.toolhead.position.z|float %} + {% set lift_z = z|abs %} + {% if act_z < (max_z - lift_z) %} + {% set z_safe = lift_z %} + {% else %} + {% set z_safe = max_z - act_z %} + {% endif %} + PAUSE_BASE + G91 + {% if printer.extruder.can_extrude|lower == 'true' %} + G1 E-{e} F2100 + {% else %} + {action_respond_info("Extruder not hot enough")} + {% endif %} + {% if "xyz" in printer.toolhead.homed_axes %} + G1 Z{z_safe} + G90 + G1 X{x} Y{y} F6000 + {% else %} + {action_respond_info("Printer not homed")} + {% endif %} + +[gcode_macro RESUME] +description: Resume the actual running print +rename_existing: RESUME_BASE +gcode: + {% set e = params.E|default(1) %} + {% if 'VELOCITY' in params|upper %} + {% set get_params = ('VELOCITY=' + params.VELOCITY) %} + {%else %} + {% set get_params = "" %} + {% endif %} + G91 + {% if printer.extruder.can_extrude|lower == 'true' %} + G1 E{e} F2100 + {% else %} + {action_respond_info("Extruder not hot enough")} + {% endif %} + RESUME_BASE {get_params} + +[gcode_macro CANCEL_PRINT] +description: Cancel the actual running print +rename_existing: CANCEL_PRINT_BASE +gcode: + TURN_OFF_HEATERS + CANCEL_PRINT_BASE + +[gcode_macro FILAMENT_UNLOAD] +description: unload filament +gcode: + {% if printer.extruder.can_extrude|lower == 'true' %} + M83 # e relative coordinates + G0 E-370 F3000 # unload + M82 # e absolute coordinates + {% else %} + {action_respond_info("extruder not hot enough")} + {% endif %} + +[gcode_macro FILAMENT_LOAD] +description: load filament +gcode: + {% if printer.extruder.can_extrude|lower == 'true' %} + M83 # e relative coordinates + G0 E350 F3000 + G0 E30 F300 + M82 # e absolute coordinates + {% else %} + {action_respond_info("extruder not hot enough")} + {% endif %} + +[gcode_macro PURGE] +description: purge filament +gcode: + {% set e = params.e|default(10)|float %} + {% if printer.extruder.can_extrude|lower == 'true' %} + M83 # e relative coordinates + G1 E-{e} F300 + M82 # e absolute coordinates + {% else %} + {action_respond_info("extruder not hot enough")} + {% endif %} + + +# [gcode_macro POWER_ON] +# description: power on the printer +# gcode: +# {action_call_remote_method("set_device_power", device="prusa", state="on")} + +# [gcode_macro POWER_OFF] +# description: power off the printer +# gcode: +# {action_call_remote_method("set_device_power", device="prusa", state="off")} + +[gcode_macro M600] +description: Change filament +gcode: + SAVE_GCODE_STATE NAME=M600_state + PAUSE + UNLOAD + M117 change filament + RESTORE_GCODE_STATE NAME=M600_state + +[gcode_macro G29] +description: Bed Leveling +gcode: + BED_MESH_CALIBRATE + +[gcode_macro BED_MESH_CALIBRATE] +description: Bed Leveling +rename_existing: BED_MESH_CALIBRATE_BASE +gcode: + {% if "xyz" not in printer.toolhead.homed_axes %} + M117 home + G28 + {% endif %} + M117 calibrate + BED_MESH_CALIBRATE_BASE + M84 # Disable steppers + + + +## Remove unused gcodes +[gcode_macro M201] +description: Set Print Max Acceleration +gcode: + G4 + +[gcode_macro M203] +description: Set Max Feedrate +gcode: + G4 + +[gcode_macro M205] +description: Set Advanced Settings +gcode: + G4 + +[gcode_macro M900] +description: Linear Advance Factor +gcode: + G4 diff --git a/macros/_init.cfg b/macros/_init.cfg deleted file mode 100644 index 5549dce..0000000 --- a/macros/_init.cfg +++ /dev/null @@ -1,9 +0,0 @@ -##################################################################### -# include all the macros -# large parts taken from alexz and others -##################################################################### -[include debug.cfg] -[include helpers.cfg] -[include print.cfg] -[include sensorless.cfg] -[include timelapse.cfg] diff --git a/macros/debug.cfg b/macros/debug.cfg deleted file mode 100644 index 55488c3..0000000 --- a/macros/debug.cfg +++ /dev/null @@ -1,115 +0,0 @@ -##################################################################### -# Macros to debug the printer variable -# - DUMP_PARAMETERS -# - DUMP_CONFIG -# - DUMP_WARNINGS -# - DUMP_SETTINGS -##################################################################### - - -[gcode_macro xk] -gcode: - M117 xk - M118 xk - # M117 {quad_gantry_level.applied} - # M118 {quad_gantry_level.applied} - {% if printer['quad_gantry_level'] is not none %} - M117 not none - M118 not none - {% if printer['quad_gantry_level'].applied %} - M117 not none yes - M118 not none yes - {% endif %} - {% else %} - M117 not not none - M118 not not none - {% endif %} - - {% if printer['quad_gantry_level'] is defined %} - M117 defined - M118 defined - {% if printer['quad_gantry_level'].applied %} - M117 defined yes - M118 defined yes - {% endif %} - {% else %} - M117 not defined - M118 not defined - {% endif %} - -## Use: -## - DUMP_PARAMETERS -## - DUMP_PARAMETERS S='gcode_macro _USER_VARIABLE' -[gcode_macro DUMP_PARAMETERS] -description: Debug: Print all entries of the printer object -gcode: - {% set parameters = [] %} - {% for name1 in printer|sort %} - {% if 'S' in params %} - {% if name1 is in [params.S] %} - {% for name2 in printer[name1]|sort %} - {% set parameters = parameters.append("printer['%s'].%s = %s" % (name1, name2, printer[name1][name2])) %} - {% endfor %} - {% endif %} - {% else %} - {% if name1 is not in ['configfile'] %} - {% for name2 in printer[name1]|sort %} - {% set parameters = parameters.append("printer['%s'].%s = %s" % (name1, name2, printer[name1][name2])) %} - {% endfor %} - {% endif %} - {% endif %} - {% endfor %} - {action_respond_info(parameters|join("\n"))} - -## Use: -## - DUMP_CONFIG S='printer' -[gcode_macro DUMP_CONFIG] -description: Debug: Print the selected entry of the printer config object -gcode: - {% if 'S' in params %} - {% set parameters = [] %} - {% for name1 in printer.configfile.config %} - {% if name1 is in [params.S] %} - {% for name2 in printer.configfile.config[name1]|sort %} - {% set parameters = parameters.append("printer.configfile.config['%s'].%s = %s" % (name1, name2, printer.configfile.config[name1][name2])) %} - {% endfor %} - {% endif %} - {% endfor %} - {action_respond_info(parameters|join("\n"))} - {% else %} - {action_respond_info("WARNING: parameter S needed call e.g. DUMP_CONFIG S='printer'")} - {% endif %} - -## Use: -## - DUMP_WARNINGS -[gcode_macro DUMP_WARNINGS] -description: Debug: Print all warning messages from klipper -gcode: - {% set parameters = ["printer.configfile.warnings:"] %} - {% for name1 in printer.configfile.warnings %} - {% set parameters = parameters.append("%s -> %s -> %s\n%s" % (name1.type, name1.section, name1.option, name1.message)) %} - {% endfor %} - {action_respond_info(parameters|join("\n"))} - -## Use: -## - DUMP_SETTINGS S='printer' -[gcode_macro DUMP_SETTINGS] -description: Debug: Print the selected entry of the printer settings object -gcode: - {% if 'S' in params %} - {% set parameters = [] %} - {% for name1 in printer.configfile.settings %} - {% if name1 is in [params.S] %} - {% for name2 in printer.configfile.settings[name1]|sort %} - {% set parameters = parameters.append("printer.configfile.settings['%s'].%s = %s" % (name1, name2, printer.configfile.settings[name1][name2])) %} - {% endfor %} - {% endif %} - {% endfor %} - {action_respond_info(parameters|join("\n"))} - {% else %} - {action_respond_info("WARNING: parameter S needed call e.g. DUMP_SETTINGS S='printer'")} - {% endif %} - -##################################################################### -# Macros needed for several debug activities -##################################################################### diff --git a/macros/helpers.cfg b/macros/helpers.cfg deleted file mode 100644 index b8e91c8..0000000 --- a/macros/helpers.cfg +++ /dev/null @@ -1,61 +0,0 @@ -#################################################################### -# Helper macros -# - MOVE_SPEED -# - NOTIFY_BED -# - NOTIFY_EXTRUDER -# - ZC - calibrate z and move to front to measure -# - TZC - Test Z Calibration -#################################################################### - -[gcode_macro MOVE_SPEED] -description: move along certain patterns with selected speed -gcode: - {% set F=params.F|default(3000)|int %} - {% set N=params.N|default(1)|int %} - {% if printer.idle_timeout.state != "Printing" %} - {% if "xyz" in printer.toolhead.homed_axes %} - M118 moving N={N} with F={F} - {% set X0=275 %} - {% set X1=25 %} - {% set Y0=275 %} - {% set Y1=25 %} - ; start - G0 X{X0} Y{Y0} F3000 - G0 F{F} - {% for i in range(N) %} - M118 move {(i+1)}/{N} - ; move 1 - G0 X{X1} Y{Y0} - G0 X{X0} Y{Y1} - ; move 2 - G0 X{X0} Y{Y0} - G0 X{X1} Y{Y1} - ; move 3 - G0 X{X0} Y{Y1} - G0 X{X1} Y{Y0} - ; move 4 - G0 X{X1} Y{Y1} - G0 X{X0} Y{Y0} - {% endfor %} - M118 done - {% else %} - M118 Printer not homed - {% endif %} - {% else %} - M118 Already printing - {% endif %} - - -[gcode_macro NOTIFY_BED] -gcode: - {% set BED=params.BED|default(0)|int %} - M117 HEATING BED from {printer.heater_bed.temperature} to {BED} - M118 HEATING BED from {printer.heater_bed.temperature} to {BED} - - -[gcode_macro NOTIFY_EXTRUDER] -gcode: - {% set EXTRUDER=params.EXTRUDER|default(0)|int %} - M117 HEATING EXTRUDER from {printer.extruder.temperature} to {EXTRUDER} - M118 HEATING EXTRUDER from {printer.extruder.temperature} to {EXTRUDER} - diff --git a/macros/print.cfg b/macros/print.cfg deleted file mode 100644 index 98729b0..0000000 --- a/macros/print.cfg +++ /dev/null @@ -1,251 +0,0 @@ -#################################################################### -# Macros used for printing -# - BRUSHIE -# - CANCEL_PRINT -# - LOAD_FILAMENT -# - UNLOAD_FILAMENT -# - M600 -# - M601 -# - M900 -# - PARK -# - PAUSE -# - PRINT_START -# - PRINT_END -# - PRINT_LAYER_CHANGE -# - PURGE_NOZZLE -# - RESUME -#################################################################### - - -# BRUSHIE -[gcode_macro BRUSHIE] -gcode: - {% set x0=250 %} - {% set x1=190 %} - {% set y0=printer.toolhead.axis_maximum.y - 1 %} - {% set z0=2.0 %} - # {% set z_hop = printer['gcode_macro _USER_VARIABLE'].z_hop|int %} - {% set z_hop = 10 %} - {% if "xyz" in printer.toolhead.homed_axes %} - G0 Z{z_hop} F1000 # move Z to travel height - G0 X{x0} Y{y0} F6000 # move to x0/y0 - G0 Z{z0} # lower - G0 X{x1} # 1 - G0 X{x0} # 2 - G0 X{x1} # 3 - G0 Z{z_hop} F300 # move Z to travel height - {% else %} - M118 printer not homed - {% endif %} - - -# CANCEL_PRINT -[gcode_macro CANCEL_PRINT] -description: Cancel the actual running print -rename_existing: _CANCEL_PRINT_BASE -gcode: - CLEAR_PAUSE - SDCARD_RESET_FILE - TURN_OFF_HEATERS - PARK - _CANCEL_PRINT_BASE - -# LOAD_FILAMENT -[gcode_macro LOAD_FILAMENT] -description: extrude 100mm of filament -gcode: - G0 E100 F600 # speed 10*60 - -# UNLOAD_FILAMENT -[gcode_macro UNLOAD_FILAMENT] -description: retract 100mm of filament -gcode: - G0 E-100 F600 # speed 10*60 - - -[gcode_macro M600] -description: Change filament -gcode: - SAVE_GCODE_STATE NAME=M600_state - PAUSE - M118 M600 change filament - RESTORE_GCODE_STATE NAME=M600_state - -[gcode_macro M601] -description: Pause print -gcode: - PAUSE - -[gcode_macro M900] -description: Set pressure advance -gcode: - SET_PRESSURE_ADVANCE ADVANCE={params.K|default(0)} - - -# PARK -[gcode_macro PARK] -gcode: - {% set Y=params.Y|default(295) %} - {% set X=params.X|default(295) %} - {% set Z=params.Z|default(-1) %} - {% if "xyz" in printer.toolhead.homed_axes %} - # calculate save lift position - {% set z_max = printer.toolhead.axis_maximum.z|float %} - {% set z_act = printer.toolhead.position.z|float %} - {% set z_safe = z_act + 5 %} - {% if z_safe > z_max %} - {% set z_safe = z_max %} - {% endif %} - {% if Z != - 1 %} - {% set z_safe = Z %} - {% endif %} - M118 Parking X{X} Y{Y} Z{z_safe} - G0 Z{z_safe} F1200 - G0 X{X} Y{Y} F6000 - {% else %} - M118 printer not homed - {% endif %} - - -# - PAUSE -[gcode_macro PAUSE] -rename_existing: _PAUSE_BASE -gcode: - {% if printer.pause_resume.is_paused|lower == 'false' %} - G92 E0 - {% if printer.extruder.can_extrude %} - G1 E-1.0 F1500.0 - {% endif %} - G90 # use absolute coordinates - SAVE_GCODE_STATE NAME=PAUSE_state - _PAUSE_BASE - PARK Y=5 - {% else %} - M117 already paused - M118 already paused - {% endif %} - -# - PRINT_START -[gcode_macro PRINT_START] -gcode: - {% set BED=params.BED|default(100)|int %} - {% set EXTRUDER=params.EXTRUDER|default(250)|int %} - {% set QGL=params.QGL|default(0)|int %} - {% set BMC=params.BMC|default(0)|int %} - {% set SHEET=params.SHEET|default("default")|string %} - {% set PURGE=params.PURGE|default(0)|int %} - {% set Z_ADJUST=params.Z_ADJUST|default(0.0)|float %} - {action_respond_info("starting print BED=%d, EXTRUDER=%d, SHEET=%s, BMC=%d, PURGE=%d, Z_AJUST=%f" % (BED, EXTRUDER, SHEET, BMC, PURGE, Z_ADJUST))} - {% set EXTRUDER_MIN=120 %} - M117 CONFIGURING - M118 CONFIGURING - SET_GCODE_OFFSET Z=0.0 # reset z offset - M140 S{BED} # start bed heating to bed - G92 E0 # reset extruder - G21 # set units to millimeters - G90 # use absolute coordinates - M83 # use relative distances for extrusion - - BED_MESH_CLEAR - # HOME - M117 HOME - M118 HOME - G28 - BRUSHIE - # QGL - {% if QGL or not printer['quad_gantry_level'].applied %} - M117 QGL - M118 QGL - QUAD_GANTRY_LEVEL - {% else %} - M117 NO QGL - M118 NO QGL - {% endif %} - # BMC - {% if BMC %} - M117 BED MESH CALIBRATE - M118 BED MESH CALIBRATE - BED_MESH_CALIBRATE - {% else %} - M117 BED MESH LOAD {SHEET} - M118 BED MESH LOAD {SHEET} - BED_MESH_PROFILE LOAD={SHEET} - {% endif %} - PARK Z=10 - - G92 E0 # reset extruder - G90 # use absolute coordinates - M104 S{EXTRUDER_MIN} # start extruder heating - NOTIFY_BED BED={BED} - M190 S{BED} # set and wait for actual bed temperature - # final home z - G28 Z - PARK Z=10 - # heat extruder - NOTIFY_EXTRUDER EXTRUDER={EXTRUDER} - M109 S{EXTRUDER} # set and wait for extruder temperature - - SET_GCODE_OFFSET Z_ADJUST={params.Z_ADJUST|default(0.0)|float} MOVE=1 - BRUSHIE - {% if PURGE %} - PURGE_NOZZLE - {% endif %} - M117 STARTING - M118 STARTING - - -# - PRINT_END -[gcode_macro PRINT_END] -gcode: - {% set UNLOAD_AT_END=params.UNLOAD_AT_END|default(0)|int %} - M118 finished - PARK - M400 ; wait for buffer to clear - G92 E0 ; zero the extruder - G1 E-10.0 F3600 ; retract filament - TURN_OFF_HEATERS - M107 ; turn off fan - - -# - PURGE_NOZZLE -[gcode_macro PURGE_NOZZLE] -gcode: - {% set x0=params.x0|default(100) %} - {% set x1=params.x1|default(200) %} - {% set y0=params.y0|default(2) %} - {% set y1=params.y1|default(3) %} - # {% set z_hop = printer['gcode_macro _USER_VARIABLE'].z_hop|int %} - {% set z_hop = 10 %} - M118 purge nozzle - G0 Z{z_hop} F300 # move Z to travel height - G0 X{x0} Y{y0} F5000 # move to x0/y0 - G0 Z0.24 F300 # lower Z to 75% - G0 X{x1} E20 F1500 # draw line - G0 Y{y1} # move to y1 - G0 X{x0} E10 # draw fine line - G0 X{x0-10} # move a little further - # G0 E-5 # retract filament - G0 Z{z_hop} F300 # move Z to travel height - - -# - RESUME -[gcode_macro RESUME] -description: Resume the actual running print -rename_existing: _RESUME_BASE -gcode: - {% if printer.pause_resume.is_paused|lower == 'true' %} - RESTORE_GCODE_STATE NAME=PAUSE_state - G90 - _RESUME_BASE - {% else %} - M117 not paused - M118 not paused - {% endif %} - - -[gcode_macro PRINT_LAYER_CHANGE] -gcode: - {% set layer=params.LAYER|default(0)|int %} - {% set layer_z=params.LAYER_Z|default(0) %} - {% set total_layer_count=params.TOTAL_LAYER_COUNT|default(0) %} - M117 layer {layer+1}/{total_layer_count} {layer_z}mm diff --git a/macros/sensorless.cfg b/macros/sensorless.cfg deleted file mode 100644 index 5854a5d..0000000 --- a/macros/sensorless.cfg +++ /dev/null @@ -1,76 +0,0 @@ -[gcode_macro _HOME_X] -gcode: - # Always use consistent run_current on A/B steppers during sensorless homing - {% set RUN_CURRENT_X = printer.configfile.settings['tmc5160 stepper_x'].run_current|float %} - {% set RUN_CURRENT_Y = printer.configfile.settings['tmc5160 stepper_y'].run_current|float %} - {% set HOME_CURRENT = 0.5 %} - SET_TMC_CURRENT STEPPER=stepper_x CURRENT={HOME_CURRENT} - SET_TMC_CURRENT STEPPER=stepper_y CURRENT={HOME_CURRENT} - - # Home - G28 X - # Move away - G91 - G1 X-10 F1200 - G90 - - # Wait just a moment - G4 P500 - # Set current during print - SET_TMC_CURRENT STEPPER=stepper_x CURRENT={RUN_CURRENT_X} - SET_TMC_CURRENT STEPPER=stepper_y CURRENT={RUN_CURRENT_Y} - -[gcode_macro _HOME_Y] -gcode: - # Set current for sensorless homing - {% set RUN_CURRENT_X = printer.configfile.settings['tmc5160 stepper_x'].run_current|float %} - {% set RUN_CURRENT_Y = printer.configfile.settings['tmc5160 stepper_y'].run_current|float %} - {% set HOME_CURRENT = 0.5 %} - SET_TMC_CURRENT STEPPER=stepper_x CURRENT={HOME_CURRENT} - SET_TMC_CURRENT STEPPER=stepper_y CURRENT={HOME_CURRENT} - - # Home - G28 Y - # Move away - G91 - G1 Y-10 F1200 - G90 - - # Wait just a moment - G4 P500 - # Set current during print - SET_TMC_CURRENT STEPPER=stepper_x CURRENT={RUN_CURRENT_X} - SET_TMC_CURRENT STEPPER=stepper_y CURRENT={RUN_CURRENT_Y} - -[homing_override] -axes: xyz -set_position_z: 0 -gcode: - {% set home_all = 'X' not in params and 'Y' not in params or 'Z' in params %} - - # set_position_z does home z - # but if x and y are not, guess that z is not really either z - {% if not "x" in printer.toolhead.homed_axes and not "y" in printer.toolhead.homed_axes %} - # move up 5 - G91 - G0 Z5 - G90 - {% else %} - # or to 5 - G0 Z5 - {% endif %} - - {% if home_all or 'X' in params %} - _HOME_X - {% endif %} - - {% if home_all or 'Y' in params %} - _HOME_Y - {% endif %} - - {% if home_all or 'Z' in params %} - G0 X150 Y150 F6000 - G28 Z - G1 Z10 - {% endif %} - diff --git a/macros/timelapse.cfg b/macros/timelapse.cfg deleted file mode 100644 index 134243f..0000000 --- a/macros/timelapse.cfg +++ /dev/null @@ -1,424 +0,0 @@ -# Timelapse klipper macro definition -# -# Copyright (C) 2021 Christoph Frei -# Copyright (C) 2021 Alex Zellner -# -# This file may be distributed under the terms of the GNU GPLv3 license -# -# Macro version 1.14 -# - -##### DO NOT CHANGE ANY MACRO!!! ##### - -########################################################################## -# # -# GET_TIMELAPSE_SETUP: Print the Timelapse setup to console # -# # -########################################################################## - -[gcode_macro GET_TIMELAPSE_SETUP] -description: Print the Timelapse setup -gcode: - {% set tl = printer['gcode_macro TIMELAPSE_TAKE_FRAME'] %} - {% set output_txt = ["Timelapse Setup:"] %} - {% set _dummy = output_txt.append("enable: %s" % tl.enable) %} - {% set _dummy = output_txt.append("park: %s" % tl.park.enable) %} - {% if tl.park.enable %} - {% set _dummy = output_txt.append("park position: %s time: %s s" % (tl.park.pos, tl.park.time)) %} - {% set _dummy = output_txt.append("park cord x:%s y:%s dz:%s" % (tl.park.coord.x, tl.park.coord.y, tl.park.coord.dz)) %} - {% set _dummy = output_txt.append("travel speed: %s mm/s" % tl.speed.travel) %} - {% endif %} - {% set _dummy = output_txt.append("fw_retract: %s" % tl.extruder.fw_retract) %} - {% if not tl.extruder.fw_retract %} - {% set _dummy = output_txt.append("retract: %s mm speed: %s mm/s" % (tl.extruder.retract, tl.speed.retract)) %} - {% set _dummy = output_txt.append("extrude: %s mm speed: %s mm/s" % (tl.extruder.extrude, tl.speed.extrude)) %} - {% endif %} - {% set _dummy = output_txt.append("verbose: %s" % tl.verbose) %} - {action_respond_info(output_txt|join("\n"))} - -################################################################################################ -# # -# Use _SET_TIMELAPSE_SETUP [ENABLE=value] [VERBOSE=value] [PARK_ENABLE=value] [PARK_POS=value] # -# [PARK_TIME=value] [CUSTOM_POS_X=value] [CUSTOM_POS_Y=value] # -# [CUSTOM_POS_DZ=value][TRAVEL_SPEED=value] [RETRACT_SPEED=value] # -# [EXTRUDE_SPEED=value] [EXTRUDE_DISTANCE=value] # -# [RETRACT_DISTANCE=value] [FW_RETRACT=value] # -# # -################################################################################################ - -[gcode_macro _SET_TIMELAPSE_SETUP] -description: Set user parameters for timelapse -gcode: - {% set tl = printer['gcode_macro TIMELAPSE_TAKE_FRAME'] %} - ##### get min and max bed size ##### - {% set min = printer.toolhead.axis_minimum %} - {% set max = printer.toolhead.axis_maximum %} - {% set round_bed = True if printer.configfile.settings.printer.kinematics is in ['delta','polar','rotary_delta','winch'] - else False %} - {% set park = {'min' : {'x': (min.x / 1.42)|round(3) if round_bed else min.x|round(3), - 'y': (min.y / 1.42)|round(3) if round_bed else min.y|round(3)}, - 'max' : {'x': (max.x / 1.42)|round(3) if round_bed else max.x|round(3), - 'y': (max.y / 1.42)|round(3) if round_bed else max.y|round(3)}, - 'center': {'x': (max.x-(max.x-min.x)/2)|round(3), - 'y': (max.y-(max.y-min.y)/2)|round(3)}} %} - ##### set new values ##### - {% if params.ENABLE %} - {% if params.ENABLE|lower is in ['true', 'false'] %} - SET_GCODE_VARIABLE MACRO=TIMELAPSE_TAKE_FRAME VARIABLE=enable VALUE={True if params.ENABLE|lower == 'true' else False} - {% else %} - {action_raise_error("ENABLE=%s not supported. Allowed values are [True, False]" % params.ENABLE|capitalize)} - {% endif %} - {% endif %} - {% if params.VERBOSE %} - {% if params.VERBOSE|lower is in ['true', 'false'] %} - SET_GCODE_VARIABLE MACRO=TIMELAPSE_TAKE_FRAME VARIABLE=verbose VALUE={True if params.VERBOSE|lower == 'true' else False} - {% else %} - {action_raise_error("VERBOSE=%s not supported. Allowed values are [True, False]" % params.VERBOSE|capitalize)} - {% endif %} - {% endif %} - {% if params.CUSTOM_POS_X %} - {% if params.CUSTOM_POS_X|float >= min.x and params.CUSTOM_POS_X|float <= max.x %} - {% set _dummy = tl.park.custom.update({'x':params.CUSTOM_POS_X|float|round(3)}) %} - {% else %} - {action_raise_error("CUSTOM_POS_X=%s must be within [%s - %s]" % (params.CUSTOM_POS_X, min.x, max.x))} - {% endif %} - {% endif %} - {% if params.CUSTOM_POS_Y %} - {% if params.CUSTOM_POS_Y|float >= min.y and params.CUSTOM_POS_Y|float <= max.y %} - {% set _dummy = tl.park.custom.update({'y':params.CUSTOM_POS_Y|float|round(3)}) %} - {% else %} - {action_raise_error("CUSTOM_POS_Y=%s must be within [%s - %s]" % (params.CUSTOM_POS_Y, min.y, max.y))} - {% endif %} - {% endif %} - {% if params.CUSTOM_POS_DZ %} - {% if params.CUSTOM_POS_DZ|float >= min.z and params.CUSTOM_POS_DZ|float <= max.z %} - {% set _dummy = tl.park.custom.update({'dz':params.CUSTOM_POS_DZ|float|round(3)}) %} - {% else %} - {action_raise_error("CUSTOM_POS_DZ=%s must be within [%s - %s]" % (params.CUSTOM_POS_DZ, min.z, max.z))} - {% endif %} - {% endif %} - {% if params.PARK_ENABLE %} - {% if params.PARK_ENABLE|lower is in ['true', 'false'] %} - {% set _dummy = tl.park.update({'enable':True if params.PARK_ENABLE|lower == 'true' else False}) %} - {% else %} - {action_raise_error("PARK_ENABLE=%s not supported. Allowed values are [True, False]" % params.PARK_ENABLE|capitalize)} - {% endif %} - {% endif %} - {% if params.PARK_POS %} - {% if params.PARK_POS|lower is in ['center','front_left','front_right','back_left','back_right','custom','x_only','y_only'] %} - {% set dic = {'center' : {'x': park.center.x , 'y': park.center.y , 'dz': 1 }, - 'front_left' : {'x': park.min.x , 'y': park.min.y , 'dz': 0 }, - 'front_right' : {'x': park.max.x , 'y': park.min.y , 'dz': 0 }, - 'back_left' : {'x': park.min.x , 'y': park.max.y , 'dz': 0 }, - 'back_right' : {'x': park.max.x , 'y': park.max.y , 'dz': 0 }, - 'custom' : {'x': tl.park.custom.x, 'y': tl.park.custom.y, 'dz': tl.park.custom.dz}, - 'x_only' : {'x': tl.park.custom.x, 'y': 'none' , 'dz': tl.park.custom.dz}, - 'y_only' : {'x': 'none' , 'y': tl.park.custom.y, 'dz': tl.park.custom.dz}} %} - {% set _dummy = tl.park.update({'pos':params.PARK_POS|lower}) %} - {% set _dummy = tl.park.update({'coord':dic[tl.park.pos]}) %} - {% else %} - {action_raise_error("PARK_POS=%s not supported. Allowed values are [CENTER, FRONT_LEFT, FRONT_RIGHT, BACK_LEFT, BACK_RIGHT, CUSTOM, X_ONLY, Y_ONLY]" - % params.PARK_POS|upper)} - {% endif %} - {% endif %} - {% if params.PARK_TIME %} - {% if params.PARK_TIME|float >= 0.0 %} - {% set _dummy = tl.park.update({'time':params.PARK_TIME|float|round(3)}) %} - {% else %} - {action_raise_error("PARK_TIME=%s must be a positive number" % params.PARK_TIME)} - {% endif %} - {% endif %} - SET_GCODE_VARIABLE MACRO=TIMELAPSE_TAKE_FRAME VARIABLE=park VALUE="{tl.park}" - {% if params.TRAVEL_SPEED %} - {% if params.TRAVEL_SPEED|float > 0.0 %} - {% set _dummy = tl.speed.update({'travel':params.TRAVEL_SPEED|float|round(3)}) %} - {% else %} - {action_raise_error("TRAVEL_SPEED=%s must be larger than 0" % params.TRAVEL_SPEED)} - {% endif %} - {% endif %} - {% if params.RETRACT_SPEED %} - {% if params.RETRACT_SPEED|float > 0.0 %} - {% set _dummy = tl.speed.update({'retract':params.RETRACT_SPEED|float|round(3)}) %} - {% else %} - {action_raise_error("RETRACT_SPEED=%s must be larger than 0" % params.RETRACT_SPEED)} - {% endif %} - {% endif %} - {% if params.EXTRUDE_SPEED %} - {% if params.EXTRUDE_SPEED|float > 0.0 %} - {% set _dummy = tl.speed.update({'extrude':params.EXTRUDE_SPEED|float|round(3)}) %} - {% else %} - {action_raise_error("EXTRUDE_SPEED=%s must be larger than 0" % params.EXTRUDE_SPEED)} - {% endif %} - {% endif %} - SET_GCODE_VARIABLE MACRO=TIMELAPSE_TAKE_FRAME VARIABLE=speed VALUE="{tl.speed}" - {% if params.EXTRUDE_DISTANCE %} - {% if params.EXTRUDE_DISTANCE|float >= 0.0 %} - {% set _dummy = tl.extruder.update({'extrude':params.EXTRUDE_DISTANCE|float|round(3)}) %} - {% else %} - {action_raise_error("EXTRUDE_DISTANCE=%s must be specified as positiv number" % params.EXTRUDE_DISTANCE)} - {% endif %} - {% endif %} - {% if params.RETRACT_DISTANCE %} - {% if params.RETRACT_DISTANCE|float >= 0.0 %} - {% set _dummy = tl.extruder.update({'retract':params.RETRACT_DISTANCE|float|round(3)}) %} - {% else %} - {action_raise_error("RETRACT_DISTANCE=%s must be specified as positiv number" % params.RETRACT_DISTANCE)} - {% endif %} - {% endif %} - {% if params.FW_RETRACT %} - {% if params.FW_RETRACT|lower is in ['true', 'false'] %} - {% if 'firmware_retraction' in printer.configfile.settings %} - {% set _dummy = tl.extruder.update({'fw_retract': True if params.FW_RETRACT|lower == 'true' else False}) %} - {% else %} - {% set _dummy = tl.extruder.update({'fw_retract':False}) %} - {% if params.FW_RETRACT|capitalize == 'True' %} - {action_raise_error("[firmware_retraction] not defined in printer.cfg. Can not enable fw_retract")} - {% endif %} - {% endif %} - {% else %} - {action_raise_error("FW_RETRACT=%s not supported. Allowed values are [True, False]" % params.FW_RETRACT|capitalize)} - {% endif %} - {% endif %} - SET_GCODE_VARIABLE MACRO=TIMELAPSE_TAKE_FRAME VARIABLE=extruder VALUE="{tl.extruder}" - {% if printer.configfile.settings['gcode_macro pause'] is defined %} - {% set _dummy = tl.macro.update({'pause': printer.configfile.settings['gcode_macro pause'].rename_existing}) %} - {% endif %} - {% if printer.configfile.settings['gcode_macro resume'] is defined %} - {% set _dummy = tl.macro.update({'resume': printer.configfile.settings['gcode_macro resume'].rename_existing}) %} - {% endif %} - SET_GCODE_VARIABLE MACRO=TIMELAPSE_TAKE_FRAME VARIABLE=macro VALUE="{tl.macro}" - -########################################################################## -# # -# TIMELAPSE_TAKE_FRAME: take the next picture # -# # -########################################################################## - -######################### definition ######################### -## enable: enable or disable the next frame. Valid inputs: [True, False] -## takingframe: internal use. Valid inputs: [True, False] -## -## park.enable: enable or disable to park the head while taking a picture. Valid inputs: [True, False] -## park.pos : used position for parking. Valid inputs: [center, front_left, front_right, back_left, back_right, custom, x_only, y_only] -## park.time : used for the debug macro. Time in s -## park.custom.x, park.custom.y: coordinates of the custom parkposition. Unit [mm] -## park.custom.dz : custom z hop for the picture. Unit [mm] -## park.coord : internal use -## -## extruder.fw_retract: enable disable fw retraction [True,False] -## extruder.extrude : filament extruded at the end of park. Unit [mm] -## extruder.retract : filament retract at the start of park. Unit [mm] -## -## speed.travel : used speed for travel from and to the park positon. Unit: [mm/min] -## speed.retract: used speed for retract [mm/min] -## speed.extrude: used speed for extrude [mm/min] -## -## verbose: Enable mesage output of TIMELAPSE_TAKE_FRAME -## -## restore.absolute.coordinates: internal use -## restore.absolute.extrude : internal use -## restore.speed : internal use -## restore.e : internal use -## restore.factor.speed : internal use -## restore.factor.extrude : internal use -## -## macro.pause : internal use -## macro.resume : internal use -## -## is_paused: internal use -############################################################### -[gcode_macro TIMELAPSE_TAKE_FRAME] -description: Take Timelapse shoot -variable_enable: False -variable_takingframe: False -variable_park: {'enable': False, - 'pos' : 'center', - 'time' : 0.1, - 'custom': {'x': 0, 'y': 0, 'dz': 0}, - 'coord' : {'x': 0, 'y': 0, 'dz': 0}} -variable_extruder: {'fw_retract': False, - 'retract': 1.0, - 'extrude': 1.0} -variable_speed: {'travel': 100, - 'retract': 15, - 'extrude': 15} -variable_verbose: True -variable_restore: {'absolute': {'coordinates': True, 'extrude': True}, 'speed': 1500, 'e':0, 'factor': {'speed': 1.0, 'extrude': 1.0}} -variable_macro: {'pause': 'PAUSE', 'resume': 'RESUME'} -variable_is_paused: False -gcode: - {% set hyperlapse = True if params.HYPERLAPSE and params.HYPERLAPSE|lower =='true' else False %} - {% if enable %} - {% if (hyperlapse and printer['gcode_macro HYPERLAPSE'].run) or - (not hyperlapse and not printer['gcode_macro HYPERLAPSE'].run) %} - {% if park.enable %} - {% set pos = {'x': 'X' + park.coord.x|string if park.pos != 'y_only' else '', - 'y': 'Y' + park.coord.y|string if park.pos != 'x_only' else '', - 'z': 'Z'+ [printer.gcode_move.gcode_position.z + park.coord.dz, printer.toolhead.axis_maximum.z]|min|string} %} - {% set restore = {'absolute': {'coordinates': printer.gcode_move.absolute_coordinates, - 'extrude' : printer.gcode_move.absolute_extrude}, - 'speed' : printer.gcode_move.speed, - 'e' : printer.gcode_move.gcode_position.e, - 'factor' : {'speed' : printer.gcode_move.speed_factor, - 'extrude': printer.gcode_move.extrude_factor}} %} - SET_GCODE_VARIABLE MACRO=TIMELAPSE_TAKE_FRAME VARIABLE=restore VALUE="{restore}" - {% if not printer[printer.toolhead.extruder].can_extrude %} - {% if verbose %}{action_respond_info("Timelapse: Warning, minimum extruder temperature not reached!")}{% endif %} - {% else %} - {% if extruder.fw_retract %} - G10 - {% else %} - M83 ; insure relative extrusion - G0 E-{extruder.retract} F{speed.retract * 60} - {% endif %} - {% endif %} - SET_GCODE_VARIABLE MACRO=TIMELAPSE_TAKE_FRAME VARIABLE=is_paused VALUE=True - {macro.pause} ; execute the klipper PAUSE command - SET_GCODE_OFFSET X=0 Y=0 ; this will insure that the head parks always at the same position in a multi setup - G90 ; insure absolute move - {% if "xyz" not in printer.toolhead.homed_axes %} - {% if verbose %}{action_respond_info("Timelapse: Warning, axis not homed yet!")}{% endif %} - {% else %} - G0 {pos.x} {pos.y} {pos.z} F{speed.travel * 60} - {% endif %} - SET_GCODE_VARIABLE MACRO=TIMELAPSE_TAKE_FRAME VARIABLE=takingframe VALUE=True - UPDATE_DELAYED_GCODE ID=_WAIT_TIMELAPSE_TAKE_FRAME DURATION=0.5 - M400 - {% endif %} - _TIMELAPSE_NEW_FRAME HYPERLAPSE={hyperlapse} - {% endif %} - {% else %} - {% if verbose %}{action_respond_info("Timelapse: disabled, take frame ignored")}{% endif %} - {% endif %} - -[gcode_macro _TIMELAPSE_NEW_FRAME] -description: action call for timelapse shoot. must be a seperate macro -gcode: - {action_call_remote_method("timelapse_newframe", - macropark=printer['gcode_macro TIMELAPSE_TAKE_FRAME'].park, - hyperlapse=params.HYPERLAPSE)} - -[delayed_gcode _WAIT_TIMELAPSE_TAKE_FRAME] -gcode: - {% set tl = printer['gcode_macro TIMELAPSE_TAKE_FRAME'] %} - {% set factor = {'speed': printer.gcode_move.speed_factor, 'extrude': printer.gcode_move.extrude_factor} %} - {% if tl.takingframe %} - UPDATE_DELAYED_GCODE ID=_WAIT_TIMELAPSE_TAKE_FRAME DURATION=0.5 - {% else %} - {tl.macro.resume} VELOCITY={tl.speed.travel} ; execute the klipper RESUME command - SET_GCODE_VARIABLE MACRO=TIMELAPSE_TAKE_FRAME VARIABLE=is_paused VALUE=False - {% if not printer[printer.toolhead.extruder].can_extrude %} - {action_respond_info("Timelapse: Warning minimum extruder temperature not reached!")} - {% else %} - {% if tl.extruder.fw_retract %} - G11 - {% else %} - G0 E{tl.extruder.extrude} F{tl.speed.extrude * 60} - G0 F{tl.restore.speed} - {% if tl.restore.absolute.extrude %} - M82 - G92 E{tl.restore.e} - {% endif %} - {% endif %} - {% endif %} - {% if tl.restore.factor.speed != factor.speed %} M220 S{(factor.speed*100)|round(0)} {% endif %} - {% if tl.restore.factor.extrude != factor.extrude %} M221 S{(factor.extrude*100)|round(0)} {% endif %} - {% if not tl.restore.absolute.coordinates %} G91 {% endif %} - {% endif %} - -#################################################################################################### -# # -# HYPERLAPSE: Starts or stops a Hyperlapse video # -# Usage: HYPERLAPSE ACTION=START [CYCLE=time] starts a hyperlapse with cycle time (default 30 sec) # -# HYPERLAPSE ACTION=STOP stops the hyperlapse recording # -# # -#################################################################################################### - -######################### definition ######################### -## cycle: cycle time in seconds -## run: internal use [True/False] -############################################################### -[gcode_macro HYPERLAPSE] -description: Start/Stop a hyperlapse recording -variable_cycle: 0 -variable_run: False -gcode: - {% set cycle = params.CYCLE|default(30)|int %} - {% if params.ACTION and params.ACTION|lower == 'start' %} - {action_respond_info("Hyperlapse: frames started (Cycle %d sec)" % cycle)} - SET_GCODE_VARIABLE MACRO=HYPERLAPSE VARIABLE=run VALUE=True - SET_GCODE_VARIABLE MACRO=HYPERLAPSE VARIABLE=cycle VALUE={cycle} - UPDATE_DELAYED_GCODE ID=_HYPERLAPSE_LOOP DURATION={cycle} - TIMELAPSE_TAKE_FRAME HYPERLAPSE=True - {% elif params.ACTION and params.ACTION|lower == 'stop' %} - {% if run %}{action_respond_info("Hyperlapse: frames stopped")}{% endif %} - SET_GCODE_VARIABLE MACRO=HYPERLAPSE VARIABLE=run VALUE=False - UPDATE_DELAYED_GCODE ID=_HYPERLAPSE_LOOP DURATION=0 - {% else %} - {action_raise_error("Hyperlapse: No valid input parameter - Use: - - HYPERLAPSE ACTION=START [CYCLE=time] - - HYPERLAPSE ACTION=STOP")} - {% endif %} - -[delayed_gcode _HYPERLAPSE_LOOP] -gcode: - UPDATE_DELAYED_GCODE ID=_HYPERLAPSE_LOOP DURATION={printer["gcode_macro HYPERLAPSE"].cycle} - TIMELAPSE_TAKE_FRAME HYPERLAPSE=True - -########################################################################## -# # -# TIMELAPSE_RENDER: Render the video at print end # -# # -########################################################################## - -######################### definition ######################### -## render: internal use. Valid inputs: [True, False] -## run_identifier: internal use. Valid input [0 .. 3] -############################################################### -[gcode_macro TIMELAPSE_RENDER] -description: Render Timelapse video and wait for the result -variable_render: False -variable_run_identifier: 0 -gcode: - {action_respond_info("Timelapse: Rendering started")} - {action_call_remote_method("timelapse_render", byrendermacro="True")} - SET_GCODE_VARIABLE MACRO=TIMELAPSE_RENDER VARIABLE=render VALUE=True - {printer.configfile.settings['gcode_macro pause'].rename_existing} ; execute the klipper PAUSE command - UPDATE_DELAYED_GCODE ID=_WAIT_TIMELAPSE_RENDER DURATION=0.5 - -[delayed_gcode _WAIT_TIMELAPSE_RENDER] -gcode: - {% set ri = printer['gcode_macro TIMELAPSE_RENDER'].run_identifier % 4 %} - SET_GCODE_VARIABLE MACRO=TIMELAPSE_RENDER VARIABLE=run_identifier VALUE={ri + 1} - {% if printer['gcode_macro TIMELAPSE_RENDER'].render %} - M117 Rendering {['-','\\','|','/'][ri]} - UPDATE_DELAYED_GCODE ID=_WAIT_TIMELAPSE_RENDER DURATION=0.5 - {% else %} - {action_respond_info("Timelapse: Rendering finished")} - M117 - {printer.configfile.settings['gcode_macro resume'].rename_existing} ; execute the klipper RESUME command - {% endif %} - -########################################################################## -# # -# TEST_STREAM_DELAY: Helper macro to find stream and park delay # -# # -########################################################################## - -[gcode_macro TEST_STREAM_DELAY] -description: Helper macro to find stream and park delay -gcode: - {% set min = printer.toolhead.axis_minimum %} - {% set max = printer.toolhead.axis_maximum %} - {% set act = printer.toolhead.position %} - {% set tl = printer['gcode_macro TIMELAPSE_TAKE_FRAME'] %} - {% if act.z > 5.0 %} - G0 X{min.x + 5.0} F{tl.speed.travel|int * 60} - G0 X{(max.x-min.x)/2} - G4 P{tl.park.time|float * 1000} - _TIMELAPSE_NEW_FRAME HYPERLAPSE=FALSE - G0 X{max.x - 5.0} - {% else %} - {action_raise_error("Toolhead z %.3f to low. Please place head above z = 5.0" % act.z)} - {% endif %} diff --git a/moonraker.conf b/moonraker.conf index 5db2bd0..3c20322 100644 --- a/moonraker.conf +++ b/moonraker.conf @@ -1,32 +1,26 @@ +# vim: ft=cfg [server] host: 0.0.0.0 port: 7125 -klippy_uds_address: /home/pi/printer_data/comms/klippy.sock +enable_debug_logging: False +config_path: ~/klipper_config [authorization] -force_logins: True cors_domains: - *.local - *.lan - *.nom - *://app.fluidd.xyz - *://my.mainsail.xyz - + https://my.mainsail.xyz + http://my.mainsail.xyz + https://app.fluidd.xyz + http://app.fluidd.xyz + http://*.local + http://*.lan trusted_clients: - 10.0.0.0/8 - 127.0.0.0/8 - 169.254.0.0/16 - 172.16.0.0/12 - 192.168.0.0/16 - FE80::/10 - ::1/128 - -[file_manager] -enable_object_processing: True - -[data_store] -temperature_store_size: 600 -gcode_store_size: 1000 + 10.0.0.0/8 + 127.0.0.0/8 + 169.254.0.0/16 + 172.16.0.0/12 + 192.168.0.0/16 + FE80::/10 + ::1/128 # enables partial support of Octoprint API [octoprint_compat] @@ -36,71 +30,51 @@ gcode_store_size: 1000 # this enables moonraker's update manager [update_manager] -enable_auto_refresh: True +enable_repo_debug: True +# When set to True moonraker will bypass repo validation and allow +# updates from unofficial remotes and/or branches. Updates on +# detached repos are also allowed. This option is intended for +# developers and should not be used on production machines. The +# default is False. +enable_auto_refresh: False +# When set to True Moonraker will attempt to fetch status about +# available updates roughly every 24 hours, between 12am-4am. +# When set to False Moonraker will only fetch update state on startup +# and clients will need to request that Moonraker updates state. The +# default is False. +enable_system_updates: True +# A boolean value that can be used to toggle system package updates. +# Currently Moonraker only supports updating packages via APT, so +# this option is useful for users that wish to experiment with linux +# distros that use other package management applications, or users +# that prefer to manage their packages directly. Note that if this +# is set to False users will be need to make sure that all system +# dependencies are up to date. The default is True. +channel: dev +# The update channel applied to Klipper and Moonraker. May be 'dev' +# which will fetch updates using git, or 'beta' which will fetch +# zipped beta releases. Note that this channel does not apply to +# client updates, a client's update channel is determined by its +# 'type' option. When this option is changed the next "update" will +# swap channels, any untracked files in the application's path will be +# removed during this process. The default is dev. -[update_manager client fluidd] +[update_manager client mainsail] type: web -repo: fluidd-core/fluidd -path: ~/fluidd - -# [update_manager client mainsail] -# type: web -# channel: beta -# repo: mainsail-crew/mainsail -# path: ~/mainsail +repo: meteyou/mainsail +path: ~/mainsail # [update_manager klipper] # type: git_repo -# origin: https://github.com/Klipper3d/klipper.git +# # venv_args: -p python2 # path: ~/klipper +# is_system_service: True +# origin: https://github.com/matthewlloyd/klipper +# primary_branch: prusamini +# enable_node_updates: false +# requirements: scripts/klippy-requirements.txt +# install_script: scripts/install-octopi.sh -[update_manager KlipperScreen] -type: git_repo -path: ~/KlipperScreen -origin: https://github.com/jordanruthe/KlipperScreen.git -env: ~/.KlipperScreen-env/bin/python -requirements: scripts/KlipperScreen-requirements.txt -install_script: scripts/KlipperScreen-install.sh - -# [update_manager timelapse] -# type: git_repo -# primary_branch: main -# is_system_service: false -# path: ~/moonraker-timelapse -# origin: https://github.com/mainsail-crew/moonraker-timelapse.git - -# [update_manager ercf] -# type: git_repo -# primary_branch: main -# is_system_service: false -# path: ~/EnragedRabbitProject -# origin: https://github.com/EtteGit/EnragedRabbitProject.git - -[power voron-v2.4] -# type: tplink_smartplug -# address: 192.168.11.91 -type: tasmota -address: pcu-eg-office-voronberry.nom -# password: mypassword - -# [timelapse] -## Following basic configuration is default to most images and don't need -## to be changed in most scenarios. Only uncomment and change it if your -## Image differ from standard installations. In most common scenarios -## a User only need [timelapse] in there configuration. -## -## Directory where the generated video will be saved -# output_path: ~/timelapse/ -## Directory where the temporary frames are saved -# frame_path: /tmp/timelapse/ -## Directory where ffmpeg is installed -#ffmpeg_binary_path: /usr/bin/ffmpeg - -# Crowsnest update_manager entry -[update_manager crowsnest] -type: git_repo -path: ~/crowsnest -origin: https://github.com/mainsail-crew/crowsnest.git -primary_branch: legacy/v3 -managed_services: crowsnest -install_script: tools/install.sh +[power prusa] +type: tplink_smartplug +address: 192.168.11.91 diff --git a/neopixel.cfg b/neopixel.cfg index 29ba872..e15b6f6 100644 --- a/neopixel.cfg +++ b/neopixel.cfg @@ -1,27 +1,62 @@ -##################################################################### -# LED Control -##################################################################### +## direct control of neopixel is not working on RPI +# [neopixel pixel] +# pin: rpi:gpio18 +# chain_count: 4 +# color_order: GRB +# initial_RED: 0.0 +# initial_GREEN: 0.0 +# initial_BLUE: 0.0 +# # initial_WHITE: 0.0 -[neopixel caselight] -pin: PB6 # Octopus BL_Touch -chain_count: 44 -initial_RED: 0.6 -initial_GREEN: 0.5 -initial_BLUE: 0.4 +# [gcode_macro NEOPIXEL] +# description: control neopixel +# gcode: +# {% set R = params.R|default(0) %} +# {% set G = params.G|default(0) %} +# {% set B = params.B|default(0) %} +# SET_LED LED=pixel RED={R} GREEN={G} BLUE={B} -[neopixel toolhead] -# pin: PB6 # Octopus BL_Touch -# pin: PB0 # Octopus LED -pin: EBBCan: PD3 -chain_count: 3 -color_order: GRBW -initial_RED: 0.3 -initial_GREEN: 0.3 -initial_BLUE: 0.3 -initial_WHITE: 0.2 - -[delayed_gcode toolhead_leds] +## run script instead +[gcode_macro NEOPIXEL_ON] +description: turn neopixel on gcode: - SET_LED LED=toolhead INDEX=1 RED=0.0 BLUE=0.5 GREEN=0.0 WHITE=0.0 -initial_duration: 3 + {% set COLOR = params.COLOR|default("white") %} + {% if COLOR == "white" %} + RUN_SHELL_COMMAND CMD=neopixel_white + {% elif COLOR == "red" %} + RUN_SHELL_COMMAND CMD=neopixel_red + {% elif COLOR == "green" %} + RUN_SHELL_COMMAND CMD=neopixel_green + {% elif COLOR == "blue" %} + RUN_SHELL_COMMAND CMD=neopixel_blue + {% endif %} +[gcode_macro NEOPIXEL_OFF] +description: turn neopixel off +gcode: + RUN_SHELL_COMMAND CMD=neopixel_off + +[gcode_shell_command neopixel_white] +command: sudo /home/pi/klipper_config/scripts/pixel.py 255 +timeout: 3 +verbose: False + +[gcode_shell_command neopixel_red] +command: sudo /home/pi/klipper_config/scripts/pixel.py 255 0 0 +timeout: 3 +verbose: False + +[gcode_shell_command neopixel_green] +command: sudo /home/pi/klipper_config/scripts/pixel.py 0 255 0 +timeout: 3 +verbose: False + +[gcode_shell_command neopixel_blue] +command: sudo /home/pi/klipper_config/scripts/pixel.py 0 0 255 +timeout: 3 +verbose: False + +[gcode_shell_command neopixel_off] +command: sudo /home/pi/klipper_config/scripts/pixel.py 0 +timeout: 3 +verbose: False diff --git a/printer.cfg b/printer.cfg index 14dfd8b..2cbbfa2 100644 --- a/printer.cfg +++ b/printer.cfg @@ -1,398 +1,259 @@ -# This file contains common pin mappings for the BigTreeTech OctoPus V1. -# To use this config, the firmware should be compiled for the STM32F446 with a "32KiB bootloader" -# Enable "extra low-level configuration options" and select the "12MHz crystal" as clock reference - -# after running "make", copy the generated "klipper/out/klipper.bin" file to a -# file named "firmware.bin" on an SD card and then restart the OctoPus with that SD card. - -# See docs/Config_Reference.md for a description of parameters. - -## Voron Design VORON2 250/300/350mm BigTreeTech OctoPus V1 TMC2209 UART config - -## *** THINGS TO CHANGE/CHECK: *** -## MCU paths [mcu] section -## Thermistor types [extruder] and [heater_bed] sections - See 'sensor types' list at end of file -## Z Endstop Switch location [safe_z_home] section -## Homing end position [gcode_macro G32] section -## Z Endstop Switch offset for Z0 [stepper_z] section -## Probe points [quad_gantry_level] section -## Min & Max gantry corner postions [quad_gantry_level] section -## PID tune [extruder] and [heater_bed] sections -## Fine tune E steps [extruder] section +## +# Prusa Mini+ +## +## general configuration [mcu] -## [X in MOTOR0] - B Motor -## [Y in MOTOR1] - A Motor -## [E in MOTOR6] - Extruder -## Obtain definition by "ls -l /dev/serial/by-id/" then unplug to verify -##-------------------------------------------------------------------- -# serial: /dev/serial/by-id/usb-Klipper_stm32f446xx_1E0030000E5053424E363620-if00 # octopus -serial: /dev/serial/by-id/usb-Klipper_stm32f446xx_410015000250534E4E313120-if00 # octopus pro -# serial: /dev/serial0 -# restart_method: command -##-------------------------------------------------------------------- - +serial: /dev/serial/by-id/usb-Klipper_stm32f407xx_2B0024001547393432343038-if00 +restart_method: command [printer] -kinematics: corexy -max_velocity: 600 -## regular -max_accel: 4000 -max_accel_to_decel: 2000 -## resonance testing -# max_accel: 10000 -# max_accel_to_decel: 5000 -## -max_z_velocity: 30 # Max 15 for 12V TMC Drivers, can increase for 24V -max_z_accel: 500 -square_corner_velocity: 5.0 +kinematics: cartesian +# Prusa firmware defaults. +max_velocity: 180 +max_accel: 1250 +max_z_velocity: 12 +max_z_accel: 400 [virtual_sdcard] -path: /home/pi/printer_data/gcodes +path: ~/gcode_files +[save_variables] +filename: ~/klipper_config/variables.cfg + +## neopixel +[include neopixel.cfg] + +## macros +[include macros.cfg] + +## display menu +[include display_menu.cfg] + +## web [pause_resume] [display_status] -[exclude_object] - -# enable M118 and RESPOND [respond] -# default_type: echo -# default_type: echo +default_type: echo # Sets the default prefix of the "M118" and "RESPOND" output to one # of the following: # echo: "echo: " (This is the default) # command: "// " # error: "!! " -default_prefix: >> -# Directly sets the default prefix. If present, this value will -# override the "default_type". -# -##################################################################### -# includes -##################################################################### +# default_prefix: echo: +# Directly sets the default prefix. If present, this value will +# override the "default_type". -[include ebb36.cfg] -[include macros/_init.cfg] -[include neopixel.cfg] -[include fans.cfg] -[include resonance_test.cfg] - - -##################################################################### -# X/Y Stepper Settings -##################################################################### - -## X Stepper on MOTOR0(B Motor) +## stepper [stepper_x] -step_pin: PF13 -dir_pin: !PF12 -enable_pin: !PF14 -rotation_distance: 40 -homing_speed: 20 -microsteps: 32 -full_steps_per_rotation: 400 # 200: 1.8 deg stepper, 400: 0.9 deg stepper -# endstop_pin: PG6 # octopus -endstop_pin: tmc5160_stepper_x:virtual_endstop -position_min: 0 -position_endstop: 300 -position_max: 300 -# homing_retract_dist: 5 +step_pin: PD1 +dir_pin: PD0 +enable_pin: !PD3 +microsteps: 16 +rotation_distance: 32 # 200 * 16 / 100 +endstop_pin: tmc2209_stepper_x:virtual_endstop +position_endstop: 180.4 +position_min: -2 +position_max: 180.4 +homing_speed: 50 homing_retract_dist: 0 -homing_positive_dir: true -[tmc5160 stepper_x] -cs_pin: PC4 -spi_software_miso_pin: PA6 -spi_software_mosi_pin: PA7 -spi_software_sclk_pin: PA5 -interpolate: False -run_current: 1.0 -sense_resistor: 0.110 -stealthchop_threshold: 0 -diag0_pin: ^!PG6 -driver_SGT: 1 # -64 most sensitive, 63 least sensitive - -## Y Stepper on MOTOR1 (A Motor) [stepper_y] -step_pin: PG0 -dir_pin: !PG1 -enable_pin: !PF15 -rotation_distance: 40 -homing_speed: 20 -microsteps: 32 -full_steps_per_rotation: 400 # 200: 1.8 deg stepper, 400: 0.9 deg stepper -# endstop_pin: PG9 # octopus -endstop_pin: tmc5160_stepper_y:virtual_endstop -position_min: 0 -position_endstop: 303 -position_max: 303 -# homing_retract_dist: 5 -homing_retract_dist: 0 -homing_positive_dir: true - -[tmc5160 stepper_y] -cs_pin: PD11 -spi_software_miso_pin: PA6 -spi_software_mosi_pin: PA7 -spi_software_sclk_pin: PA5 -interpolate: False -run_current: 1.0 -sense_resistor: 0.110 -stealthchop_threshold: 0 -diag0_pin: ^!PG9 -driver_SGT: 1 # -64 most sensitive, 63 least sensitive - - -##################################################################### -# Z Stepper Settings -##################################################################### - -## Z0 Stepper - Front Left on MOTOR2_1 -[stepper_z] -step_pin: PF11 -dir_pin: PG3 -enable_pin: !PG5 -rotation_distance: 40 -gear_ratio: 80:16 -microsteps: 32 -endstop_pin: probe:z_virtual_endstop -position_max: 240 +step_pin: PD13 +dir_pin: PD12 +enable_pin: !PD14 +microsteps: 16 +rotation_distance: 32 # 200 * 16 / 100 +endstop_pin: tmc2209_stepper_y:virtual_endstop +position_endstop: -3 position_min: -3 -homing_speed: 5.0 # speed: mm/sec, feedrate: mm/min -homing_retract_speed: 10 -second_homing_speed: 2 -homing_retract_dist: 5 +position_max: 180 +homing_speed: 50 +homing_retract_dist: 0 + +[stepper_z] +step_pin: PD4 +dir_pin: !PD15 +enable_pin: !PD2 +microsteps: 16 +rotation_distance: 4 +endstop_pin: probe:z_virtual_endstop +position_min: -3 +position_max: 185 + +## tmc +[tmc2209 stepper_x] +uart_pin: PD5 +uart_address: 1 +diag_pin: ^PE2 +driver_SGTHRS: 130 +run_current: 0.35 +sense_resistor: 0.22 +stealthchop_threshold: 999999 + +[tmc2209 stepper_y] +uart_pin: PD5 +uart_address: 3 +diag_pin: ^PE1 +driver_SGTHRS: 130 +run_current: 0.35 +sense_resistor: 0.22 +stealthchop_threshold: 999999 [tmc2209 stepper_z] -uart_pin: PC6 -interpolate: False -run_current: 0.8 -sense_resistor: 0.110 -stealthchop_threshold: 0 +uart_pin: PD5 +uart_address: 0 +diag_pin: ^PE3 +driver_SGTHRS: 100 +run_current: 0.35 +sense_resistor: 0.22 +stealthchop_threshold: 999999 -## Z1 Stepper - Rear Left on MOTOR3 -[stepper_z1] -step_pin: PG4 -dir_pin: !PC1 -enable_pin: !PA0 -rotation_distance: 40 -gear_ratio: 80:16 -microsteps: 32 +[tmc2209 extruder] +uart_pin: PD5 +uart_address: 2 +diag_pin: ^PA15 +driver_SGTHRS: 100 +run_current: 0.4 +sense_resistor: 0.22 -[tmc2209 stepper_z1] -uart_pin: PC7 -interpolate: False -run_current: 0.8 -sense_resistor: 0.110 -stealthchop_threshold: 0 +## display +[display] +lcd_type: st7789v +spi_bus: spi2a +rst_pin: PC8 +cs_pin: PC9 +rs_pin: PD11 +encoder_pins: ^PE13, ^PE15 +click_pin: ^!PE12 -## Z2 Stepper - Rear Right on MOTOR4 -[stepper_z2] -step_pin: PF9 -dir_pin: PF10 -enable_pin: !PG2 -rotation_distance: 40 -gear_ratio: 80:16 -microsteps: 32 - -[tmc2209 stepper_z2] -uart_pin: PF2 -interpolate: False -run_current: 0.8 -sense_resistor: 0.110 -stealthchop_threshold: 0 - -## Z3 Stepper - Front Right on MOTOR5 -[stepper_z3] -step_pin: PC13 -dir_pin: !PF0 -enable_pin: !PF1 -rotation_distance: 40 -gear_ratio: 80:16 -microsteps: 32 - -[tmc2209 stepper_z3] -uart_pin: PE4 -interpolate: False -run_current: 0.8 -sense_resistor: 0.110 -stealthchop_threshold: 0 - - -##################################################################### -# Bed Heater -##################################################################### +[extruder] +step_pin: PD9 +dir_pin: !PD8 +enable_pin: !PD10 +microsteps: 16 +rotation_distance: 26.2564 # (200 * 16 * 48/18) / 325 +gear_ratio: 48:18 +nozzle_diameter: 0.400 +filament_diameter: 1.750 +heater_pin: PB1 +sensor_type: ATC Semitec 104GT-2 +sensor_pin: PC0 +# Prusa's firmware defaults. +#control: pid +#pid_Kp: 7 +#pid_Ki: 0.5 +#pid_Kd: 45 +min_temp: 10 +max_temp: 305 +max_extrude_only_distance: 800.0 +# max_extrude_cross_section: 10.0 [heater_bed] -## SSR Pin - BED_OUT -heater_pin: PA1 -sensor_type: Generic 3950 -sensor_pin: PF3 -## Adjust Max Power so your heater doesn't warp your bed -max_power: 0.8 # 0.4W per cm2, 360W for 300 build -min_temp: 0 -max_temp: 120 +heater_pin: PB0 +sensor_type: EPCOS 100K B57560G104F +sensor_pin: PA4 +# Prusa's firmware defaults. #control: pid -#pid_kp: 58.437 -#pid_ki: 2.347 -#pid_kd: 363.769 +#pid_Kp: 120 +#pid_Ki: 1.5 +#pid_Kd: 600 +min_temp: 10 +max_temp: 110 +# Hotend fan. +# The stock firmware uses control ranges of PWM 0-50%, RPM 1000-8000. +# Change fan_speed below to match your preference. Measured speeds: +# fan_speed 0.5: 50% PWM = 4000RPM (Prusa stock default speed) +# fan_speed 1.0: 100% PWM = 8000RPM (safe but loud) +[heater_fan hotend_fan] +pin: PE9 +tachometer_pin: PE14 +fan_speed: 0.5 -##################################################################### -# Enclosure Temp Sensor Section -##################################################################### -[thermistor chamber] -temperature1: 25 -resistance1: 10000 -beta: 3950 - -[temperature_sensor MCU] -sensor_type: temperature_mcu -sensor_mcu: mcu -min_temp: 0 -max_temp: 100 -# gcode_id: C - - -## replaced, there is no thermistor on the stealthburner pcb -# [temperature_sensor chamber] -# sensor_type: chamber -# sensor_pin: PF5 -# min_temp: 0 -# max_temp: 100 -# gcode_id: C - -[temperature_sensor RPI] -sensor_type: temperature_host -min_temp: 0 -max_temp: 100 - -[idle_timeout] -timeout: 1800 - -# [safe_z_home] -# home_xy_position: 150, 150 -# z_hop: 5 - - -##################################################################### -# Probe -##################################################################### +# Part cooling fan. +# The stock firmware uses control ranges of PWM 10-50%, RPM 500-5000. +# To match stock firmware, set the Klipper fan speed to 50%. This speed +# can be safely increased to 100% for better part cooling. Measured speeds: +# 50% PWM = 2500RPM (Prusa stock default speed) +# 100% PWM = 5000RPM (better cooling, still quiet) +[fan] +pin: PE11 +tachometer_pin: PE10 +# The SuperPINDA has built-in temperature compensation and no thermistor output, +# so no compensation table is needed here. [probe] -## Voron-Tap -# pin: ^PG11 -pin: EBBCan: PB9 -x_offset: 0 -y_offset: 0 -#z_offset: 0 -speed: 5.0 -lift_speed: 10 -samples: 3 -samples_result: median -sample_retract_dist: 3 -samples_tolerance: 0.01 -samples_tolerance_retries: 5 - -activate_gcode: - # impatient - {% set PROBE_TEMP = 120 %} - # {% set PROBE_TEMP = 250 %} - {% set MAX_TEMP = PROBE_TEMP + 5 %} - {% set ACTUAL_TEMP = printer.extruder.temperature %} - {% set TARGET_TEMP = printer.extruder.target %} - - {% if TARGET_TEMP > PROBE_TEMP %} - { action_respond_info('Extruder temperature target of %.1fC is too high, lowering to %.1fC' % (TARGET_TEMP, PROBE_TEMP)) } - M109 S{ PROBE_TEMP } - {% else %} - # Temperature target is already low enough, but nozzle may still be too hot. - {% if ACTUAL_TEMP > MAX_TEMP %} - { action_respond_info('Extruder temperature %.1fC is still too high, waiting until below %.1fC' % (ACTUAL_TEMP, MAX_TEMP)) } - TEMPERATURE_WAIT SENSOR=extruder MAXIMUM={ MAX_TEMP } - {% endif %} - {% endif %} +pin: PA8 +x_offset: -29 +y_offset: -3 +#z_offset: 0 # set this to your Live Z Offset, but negated (invert the sign) +speed: 6.0 +[safe_z_home] +home_xy_position: 160,20 +z_hop: 4 [bed_mesh] -speed: 500 -horizontal_move_z: 10 -# x, y --> x + probe.x_offset, y + probe.y_offset -mesh_min: 35, 35 -# x, y --> x + probe.x_offset, y + probe.y_offset -mesh_max: 265, 265 -# fade_start: 1 -# fade_end: 10 -# fade_target: 0 +speed: 1000 +horizontal_move_z: 5 +mesh_min: 10,10 +mesh_max: 141,167 +probe_count: 5,5 algorithm: bicubic -# relative_reference_index = ((x points * y points) - 1) / 2 -# 3x3: 4, 5x5: 12, 7x7: 24, 9x9: 40 -# probe_count: 3,3 -# relative_reference_index: 4 -# probe_count: 5,5 -# relative_reference_index: 12 -# probe_count: 7,7 -# relative_reference_index: 24 -probe_count: 9,9 -# relative_reference_index: 40 -zero_reference_position: 145.00, 145.00 -[quad_gantry_level] -speed: 500 -horizontal_move_z: 10 -gantry_corners: - -60,-10 - 360,370 -points: - 40,40 - 40,260 - 260,260 - 260,40 -retries: 5 -retry_tolerance: 0.0075 -max_adjust: 10 +[filament_switch_sensor filament_sensor] +switch_pin: ^PB4 +pause_on_runout: True +event_delay: 3.0 +pause_delay: 0.5 +runout_gcode: + M117 filament removed +insert_gcode: + M117 filament inserted + G4 P3000 + {% for i in range(10) %} + M117 loading in {10-i} + G4 P1000 + {% endfor %} + M117 loading now + FILAMENT_LOAD #*# <---------------------- SAVE_CONFIG ----------------------> #*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated. #*# +#*# [extruder] +#*# control = pid +#*# pid_kp = 21.307 +#*# pid_ki = 0.911 +#*# pid_kd = 124.644 +#*# #*# [heater_bed] #*# control = pid -#*# pid_kp = 37.870 -#*# pid_ki = 1.244 -#*# pid_kd = 288.283 -#*# -#*# [extruder] +#*# pid_kp = 57.528 +#*# pid_ki = 1.059 +#*# pid_kd = 780.942 #*# #*# [probe] -#*# z_offset = -0.880 -#*# -#*# [input_shaper] -#*# shaper_type_x = 3hump_ei -#*# shaper_freq_x = 89.2 -#*# shaper_type_y = mzv -#*# shaper_freq_y = 30.6 +#*# z_offset = 1.435 #*# #*# [bed_mesh default] #*# version = 1 #*# points = -#*# -0.000973, 0.016527, 0.007777, 0.001527, 0.016527, -0.005973, 0.014027, 0.015277, 0.007777 -#*# -0.003473, 0.012777, 0.009027, -0.005973, 0.011527, 0.000277, 0.021527, 0.002777, 0.012777 -#*# 0.004027, 0.007777, 0.012777, 0.020277, 0.024027, 0.024027, 0.020277, 0.017777, 0.014027 -#*# -0.005973, -0.008473, -0.002223, -0.003473, 0.019027, -0.003473, -0.003473, -0.002223, -0.003473 -#*# -0.000973, -0.007223, -0.004723, 0.011527, -0.004723, -0.000973, 0.022777, 0.009027, -0.005973 -#*# 0.001527, 0.015277, 0.036527, 0.015277, 0.014027, 0.012777, 0.021527, 0.016527, 0.019027 -#*# -0.010973, 0.012777, -0.005973, -0.000973, 0.000277, -0.007223, 0.000277, -0.002223, -0.012223 -#*# -0.007223, 0.005277, 0.006527, 0.015277, 0.011527, 0.024027, 0.011527, -0.012223, 0.001527 -#*# -0.003473, -0.003473, 0.009027, -0.008473, 0.009027, 0.007777, 0.009027, -0.007223, -0.009723 -#*# x_count = 9 -#*# y_count = 9 -#*# mesh_x_pps = 2 -#*# mesh_y_pps = 2 -#*# algo = bicubic +#*# 0.017500, -0.083750, 0.061250, 0.045000, 0.018750 +#*# -0.133750, -0.042500, -0.002500, 0.005000, -0.008750 +#*# 0.011250, -0.013750, 0.057500, 0.052500, 0.016250 +#*# -0.038750, -0.023750, -0.037500, 0.007500, 0.037500 +#*# -0.011250, -0.097500, 0.021250, 0.041250, 0.035000 #*# tension = 0.2 -#*# min_x = 35.0 -#*# max_x = 265.0 -#*# min_y = 35.0 -#*# max_y = 265.0 +#*# min_x = 10.0 +#*# algo = bicubic +#*# y_count = 5 +#*# mesh_y_pps = 2 +#*# min_y = 10.0 +#*# x_count = 5 +#*# max_y = 167.0 +#*# mesh_x_pps = 2 +#*# max_x = 141.0 diff --git a/resonance_test.cfg b/resonance_test.cfg deleted file mode 100644 index e4e8b5c..0000000 --- a/resonance_test.cfg +++ /dev/null @@ -1,20 +0,0 @@ -## EBB36 -[adxl345] -cs_pin: EBBCan:PB12 -spi_software_sclk_pin: EBBCan:PB10 -spi_software_mosi_pin: EBBCan:PB11 -spi_software_miso_pin: EBBCan:PB2 -axes_map: x,y,z - -[resonance_tester] -accel_chip: adxl345 -probe_points: - 150,150,20 # an example - -[gcode_macro TR] -gcode: - {% if not "xyz" in printer.toolhead.homed_axes %} - G28 - {% endif %} - TEST_RESONANCES AXIS=X - TEST_RESONANCES AXIS=Y diff --git a/scripts/gcode_shell_command.py b/scripts/gcode_shell_command.py new file mode 100755 index 0000000..4138172 --- /dev/null +++ b/scripts/gcode_shell_command.py @@ -0,0 +1,83 @@ +# Run a shell command via gcode +# +# Copyright (C) 2019 Eric Callahan +# +# This file may be distributed under the terms of the GNU GPLv3 license. +import os +import shlex +import subprocess +import logging + +class ShellCommand: + def __init__(self, config): + self.name = config.get_name().split()[-1] + self.printer = config.get_printer() + self.gcode = self.printer.lookup_object('gcode') + cmd = config.get('command') + cmd = os.path.expanduser(cmd) + self.command = shlex.split(cmd) + self.timeout = config.getfloat('timeout', 2., above=0.) + self.verbose = config.getboolean('verbose', True) + self.proc_fd = None + self.partial_output = "" + self.gcode.register_mux_command( + "RUN_SHELL_COMMAND", "CMD", self.name, + self.cmd_RUN_SHELL_COMMAND, + desc=self.cmd_RUN_SHELL_COMMAND_help) + + def _process_output(self, eventime): + if self.proc_fd is None: + return + try: + data = os.read(self.proc_fd, 4096) + except Exception: + pass + data = self.partial_output + data + if '\n' not in data: + self.partial_output = data + return + elif data[-1] != '\n': + split = data.rfind('\n') + 1 + self.partial_output = data[split:] + data = data[:split] + self.gcode.respond_info(data) + + cmd_RUN_SHELL_COMMAND_help = "Run a linux shell command" + def cmd_RUN_SHELL_COMMAND(self, params): + reactor = self.printer.get_reactor() + try: + proc = subprocess.Popen( + self.command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + except Exception: + logging.exception( + "shell_command: Command {%s} failed" % (self.name)) + raise self.gcode.error("Error running command {%s}" % (self.name)) + if self.verbose: + self.proc_fd = proc.stdout.fileno() + self.gcode.respond_info("Running Command {%s}...:" % (self.name)) + hdl = reactor.register_fd(self.proc_fd, self._process_output) + eventtime = reactor.monotonic() + endtime = eventtime + self.timeout + complete = False + while eventtime < endtime: + eventtime = reactor.pause(eventtime + .05) + if proc.poll() is not None: + complete = True + break + if not complete: + proc.terminate() + if self.verbose: + if self.partial_output: + self.gcode.respond_info(self.partial_output) + self.partial_output = "" + if complete: + msg = "Command {%s} finished\n" % (self.name) + else: + msg = "Command {%s} timed out" % (self.name) + self.gcode.respond_info(msg) + reactor.unregister_fd(hdl) + self.proc_fd = None + + +def load_config_prefix(config): + return ShellCommand(config) diff --git a/scripts/pixel.py b/scripts/pixel.py new file mode 100755 index 0000000..ef2ceb5 --- /dev/null +++ b/scripts/pixel.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python3 + +import board +import neopixel +import sys + +np_pin = board.D18 +np_num = 16 +np_order = neopixel.GRB + +fname = "/tmp/pixel" +np = neopixel.NeoPixel(np_pin, np_num, auto_write=False, pixel_order=np_order) + +c = (0,0,0) +try: + if len(sys.argv) == 4: + c = (int(sys.argv[1]), int(sys.argv[2]), int(sys.argv[3])) + elif len(sys.argv) == 2: + c = (int(sys.argv[1]), int(sys.argv[1]), int(sys.argv[1])) + + print(f"setting color to {c}") + np.fill(c) + np.show() +except Exception as ex: + print(f"ERROR: {ex}")