diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1be3892 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +printer-*.cfg +printer.*.cfg +.moonraker.conf.bkp +storage/* diff --git a/KlipperScreen.conf b/KlipperScreen.conf new file mode 100644 index 0000000..5b2468d --- /dev/null +++ b/KlipperScreen.conf @@ -0,0 +1,36 @@ + +#~# --- Do not edit below this line. This section is auto generated --- #~# +#~# +#~# [main] +#~# font_size = small +#~# +#~# [displayed_macros Printer] +#~# calibrate_override = False +#~# clean_nozzle = False +#~# calibrate_query = False +#~# dump_variables = False +#~# end_load_filament = False +#~# end_unprime_filament = False +#~# fan_control = False +#~# set_heater_state = False +#~# m600 = False +#~# probe_eddy_current_calibrate_auto = False +#~# hello_world = False +#~# set_z_params = False +#~# set_heater_temperature1 = False +#~# set_heater_temperature_and_wait = False +#~# set_heater_temperature_and_wait1 = False +#~# set_z_from_probe = False +#~# set_extruder_filament = False +#~# set_heaters_to_filament = False +#~# set_filament_load_state = False +#~# start_print = False +#~# stop_print = False +#~# set_hotend_filament = False +#~# test = False +#~# variables = False +#~# +#~# [graph Printer] +#~# extruder = False +#~# heater_bed = False +#~# diff --git a/config/bash.cfg b/config/bash.cfg new file mode 100644 index 0000000..7bde515 --- /dev/null +++ b/config/bash.cfg @@ -0,0 +1,20 @@ +[gcode_shell_command aplay] +command: aplay +timeout: 5. +verbose: True + +[gcode_shell_command ls] +command: ls +timeout: 3. +verbose: True + +[gcode_macro metal_pipe] +gcode: + g0 z150 f12000 + g4 1 + g0 z1 f12000 + UPDATE_DELAYED_GCODE ID=metal_pipe1 DURATION=3.5 + +[delayed_gcode metal_pipe1] +gcode: + RUN_SHELL_COMMAND CMD=aplay PARAMS=--device\ default:CARD=HDMI\ ../printer_data/sounds/metal-pipe-falling-sound-effect.wav diff --git a/config/cooling.cfg b/config/cooling.cfg new file mode 100644 index 0000000..9e7e931 --- /dev/null +++ b/config/cooling.cfg @@ -0,0 +1,94 @@ +[delayed_gcode FAN_CONTROL_LOOP] +gcode: + FAN_CONTROL + UPDATE_DELAYED_GCODE ID=FAN_CONTROL_LOOP DURATION=2 + +[gcode_macro FAN_CONTROL] +gcode: + # # TMC cooler + # # This defaults to 100% if either x or y steppers are enabled and 0% otherwise. + # {% if printer['stepper_enable'].steppers.stepper_x or printer['stepper_enable'].steppers.stepper_y %} + # SET_FAN_SPEED FAN=tmcCooler SPEED=1 + # {% else %} + # SET_FAN_SPEED FAN=tmcCooler SPEED=0 + # {% endif %} + + + # idle m8p temp - 52 + {% set mantaMinTemp = 55 %} + {% set mantaMaxTemp = 80 %} + + # idle rpi temp - 54 + {% set rpiMinTemp = 58 %} + {% set rpiMaxTemp = 85 %} + + # idle printhead temp - 39 + + # base fans depend on the current microcontroller temperature, following a fan curve from a 'base' to 'max' temperature. + # they are fixed at 20% or above when stepperx or y are enabled. + + # magic equation here: + {% set baseFanSpeed = (printer['temperature_sensor Manta'].temperature-mantaMinTemp)/(mantaMaxTemp-mantaMinTemp) %} + + {% set baseFanSpeed = [(printer['temperature_sensor Rpi'].temperature-rpiMinTemp)/(rpiMaxTemp-rpiMinTemp),baseFanSpeed]|max %} + + {% if printer['print_stats'].state == "printing" %} + {% set baseFanSpeed = [0.6, baseFanSpeed]|max %} + {% endif %} + + {% set baseFanSpeed = [[baseFanSpeed, 1]|min, 0]|max %} # fix the value somewhere between zero and one + SET_FAN_SPEED FAN=base_1 SPEED={baseFanSpeed} + SET_FAN_SPEED FAN=base_2 SPEED={baseFanSpeed} + + + # for now both exhaust and filter go to 60% when printing + {% if printer['print_stats'].state == "printing" %} + SET_FAN_SPEED FAN=filter SPEED=.5 + SET_FAN_SPEED FAN=exhaust SPEED=.5 + {% endif %} + +## Fans + +[fan] +# Print cooling fan +pin: printHead:PA1 + +kick_start_time: 0.500 + +[heater_fan hotend_fan] +# Hotend fan +pin: printHead:PA0 + +kick_start_time: 0.500 +heater: extruder +heater_temp: 50.0 + +[fan_generic filter] +pin: PF8 + +[fan_generic exhaust] +pin: PF6 + +[fan_generic base_1] +pin: PF9 + +[fan_generic base_2] +pin: PF7 +#fan_speed: .4 + +[controller_fan tmcCooler] +pin: PA4 +stepper: stepper_x, stepper_y + +## Temperatures +[temperature_sensor Manta] +sensor_type: temperature_mcu +sensor_mcu: mcu + +[temperature_sensor printHead] +sensor_type: temperature_mcu +sensor_mcu: printHead + +[temperature_sensor Rpi] +sensor_type: temperature_host +sensor_path: /sys/class/thermal/thermal_zone0/temp \ No newline at end of file diff --git a/config/eddy.cfg b/config/eddy.cfg new file mode 100644 index 0000000..717435c --- /dev/null +++ b/config/eddy.cfg @@ -0,0 +1,159 @@ +# The MCU section only applies to the Eddy USB. For Eddy Coil you will use the MCU name of the toolboard that you connected the Eddy Coil to. +[mcu eddy] +canbus_uuid: c544ec61c167 +#Did you read all of the comments before the macros? Make sure that you do and then uncomment the ones that you need. Remove this line when you are done. + +[temperature_sensor btt_eddy_mcu] +sensor_type: temperature_mcu # Sets the type of sensor for Klipper to read +sensor_mcu: eddy # Sets the MCU of the eddy probe tempereature sensor +min_temp: 10 # Sets the minimum tempereature for eddys tempereature sensor to operate +max_temp: 100 # Sets the maximum tempereature for eddys tempereature sensor to operate + +[probe_eddy_current btt_eddy] +sensor_type: ldc1612 +z_offset: 2.5 +#i2c_address: +i2c_mcu: eddy # This value is good for the Eddy USB but would need to be adjusted for the Eddy Coil according to the MCU you have used. +i2c_bus: i2c0f # This value is good for the Eddy USB but would need to be adjusted for the Eddy Coil according to the I2C bus you have used. +# Measure the offsets below using the method described here: https://www.klipper3d.org/Probe_Calibrate.html#calibrating-probe-x-and-y-offsets +# For a standard Voron stealthburner X carriage mount there should be no need to change the defaults below. +x_offset: 0 +y_offset: 21.42 +sensor_type: ldc1612 + +# This section is only relevant for Eddy USB. Comment it out for Eddy Coil. +[temperature_probe btt_eddy] +sensor_type: Generic 3950 +sensor_pin: eddy:gpio26 +horizontal_move_z: 2 + +[quad_gantry_level] +# Use QUAD_GANTRY_LEVEL to level a gantry. +gantry_corners: + -59, 0 + 310, 320 +# Min & Max gantry corners - measure from nozzle at MIN (0,0) and MAX (250,250) to respective belt positions +points: + # 239, 210 + # 15, 210 + # 15, 0 + # 239, 0 + 15, 0 + 15, 210 + 239, 210 + 239, 0 + +# Probe points +speed: 600 +horizontal_move_z: 6 +max_adjust: 10 + +[bed_mesh] +horizontal_move_z: 3 +speed: 300 +# For the mesh dimensions below, the coordinates need to be reachable by the center of the probe. To calculate coordinates that will work, use the formula below: +# mesh x min = position_min_x + greater_of (15mm or x_offset) <--- in this term, only consider the x offset if it is positive, ignore if negative. +# mesh y min = position_min_y + greater_of (15mm or y_offset) <--- in this term, only consider the y offset if it is positive, ignore if negative. +# mesh x max = position_max_x - greater_of (15mm or |x_offset|) <--- in this term, only consider the x offset if it is negative, ignore if positive. +# mesh y max = position_max_y - greater_of (15mm or |y_offset|) <--- in this term, only consider the y offset if it is negative, ignore if positive. +# Example: Consider that you have a 300 x 300 bed with the max x and y positions being 300 and the min being 0. Your probe offsets are -20 for X and 10 for Y +# For mesh x min we ignore the x offset term because it is negative. Therefore mesh x min = 15 +# For mesh y min we do not ignore the y offset term because it is positive but it is less than 15 so we use 15. Therefore mesh y min = 15 +# For mesh x max we do not ignore the x offset term because it is negative. It is also greater than 15. Therefore mesh x max = 280 +# For mesh y max we ignore the y offset term because it is positive but it is less than 15 so we use 15. Therefore mesh y max = 285 +# The final result would be mesh_min: 15, 15 mesh_max: 280, 285 +mesh_min: 15, 22 # modify these according to the above guide. If the probe cannot reach then you will get a klipper error when trying to scan a bed mesh. +mesh_max: 239, 239 # modify these according to the above guide. If the probe cannot reach then you will get a klipper error when trying to scan a bed mesh. +probe_count: 40, 12 +algorithm: bicubic +scan_overshoot: 5 #uncomment this section if you still have room left over on the X axis for some scan overshoot to product smoother movements and more accurate scanning. Uncommenting this should be fine if you are using a standard voron mount. + +# Uncomment this if you are using Eddy as the probe AND the homing endstop +[safe_z_home] +home_xy_position: 239, 210 # Choose an X,Y position that is in the center of your bed. For a 300x300 machine that will be 150, 150. Use the same principle to calculate your bed center. +z_hop: 10 +z_hop_speed: 25 +speed: 600 + +###############################Macros and related################################ +#This secton contains macros and related config sections. Some should be used, others are optional. Read the comment above each one to find out whether or not to uncomment it for your installation. + + +# Uncomment this if you are using Eddy as the probe AND the homing endstop AND would like to use the beta z-offset control +#[save_variables] +#filename: ~/printer_data/config/variables.cfg + + +# Uncomment this if you are using Eddy as the probe AND the homing endstop AND would like to use the beta z-offset control +#[delayed_gcode RESTORE_PROBE_OFFSET] +#initial_duration: 1. +#gcode: +# {% set svv = printer.save_variables.variables %} +# {% if not printer["gcode_macro SET_GCODE_OFFSET"].restored %} +# SET_GCODE_VARIABLE MACRO=SET_GCODE_OFFSET VARIABLE=runtime_offset VALUE={ svv.nvm_offset|default(0) } +# SET_GCODE_VARIABLE MACRO=SET_GCODE_OFFSET VARIABLE=restored VALUE=True +# {% endif %} + +# Uncomment this if you are using Eddy as the probe AND the homing endstop +[gcode_macro SET_Z_FROM_PROBE] +gcode: + {% set cf = printer.configfile.settings %} + SET_GCODE_OFFSET_ORIG Z={printer.probe.last_z_result - cf['probe_eddy_current btt_eddy'].z_offset + printer["gcode_macro SET_GCODE_OFFSET"].runtime_offset} + G90 + G1 Z{cf.safe_z_home.z_hop} + + +# Uncomment this if you are using Eddy as the probe AND the homing endstop AND would like to use the beta z-offset control +#[gcode_macro Z_OFFSET_APPLY_PROBE] +#rename_existing: Z_OFFSET_APPLY_PROBE_ORIG +#gcode: +# SAVE_VARIABLE VARIABLE=nvm_offset VALUE={ printer["gcode_macro SET_GCODE_OFFSET"].runtime_offset } + + + +# Uncomment the lines in this macro if you are using Eddy as the probe AND the homing endstop AND would like to use the beta z-offset control +[gcode_macro SET_GCODE_OFFSET] +rename_existing: SET_GCODE_OFFSET_ORIG +variable_restored: False # Mark whether the var has been restored from NVM +variable_runtime_offset: 0 +gcode: +# {% if params.Z_ADJUST %} +# SET_GCODE_VARIABLE MACRO=SET_GCODE_OFFSET VARIABLE=runtime_offset VALUE={ printer["gcode_macro SET_GCODE_OFFSET"].runtime_offset + params.Z_ADJUST|float } +# {% endif %} +# {% if params.Z %} +# {% set paramList = rawparams.split() %} +# {% for i in range(paramList|length) %} +# {% if paramList[i]=="Z=0" %} +# {% set temp=paramList.pop(i) %} +# {% set temp="Z_ADJUST=" + (-printer["gcode_macro SET_GCODE_OFFSET"].runtime_offset)|string %} +# {% if paramList.append(temp) %}{% endif %} +# {% endif %} +# {% endfor %} +# {% set rawparams=paramList|join(' ') %} +# SET_GCODE_VARIABLE MACRO=SET_GCODE_OFFSET VARIABLE=runtime_offset VALUE=0 +# {% endif %} + SET_GCODE_OFFSET_ORIG { rawparams } + + + +# This macro automates a lot of the frequency mapping process and simplifies the steps significantly. +[gcode_macro PROBE_EDDY_CURRENT_CALIBRATE_AUTO] +gcode: + BED_MESH_CLEAR + G28 X Y + G90 # Abs positioning + G1 X{ printer.toolhead.axis_maximum.x/2 } Y{ printer.toolhead.axis_maximum.y/2 } F6000 + {% if 'z' not in printer.toolhead.homed_axes %} + SET_KINEMATIC_POSITION Z={ printer.toolhead.axis_maximum.z-1 } # Allows the user to work it down until it touches. + {% endif %} + PROBE_EDDY_CURRENT_CALIBRATE {rawparams} + + + +#This macro is optional but useful if you want to run a rapid scan before each print. Simply uncomment it and add BED_MESH_SCAN to your print start code. +#[gcode_macro BED_MESH_CALIBRATE] +#rename_existing: BTT_BED_MESH_CALIBRATE +#gcode: +# SET_GCODE_VARIABLE MACRO=_KNOMI_STATUS VARIABLE=probing VALUE=True #Only uncomment this line if using a KNOMI and then remove the BED_MESH_CALIBRATE macro from KNOMI.cfg +# BTT_BED_MESH_CALIBRATE METHOD=rapid_scan +# SET_GCODE_VARIABLE MACRO=_KNOMI_STATUS VARIABLE=probing VALUE=False #Only uncomment this line if using a KNOMI and then remove the BED_MESH_CALIBRATE macro from KNOMI.cfg \ No newline at end of file diff --git a/config/filament_sensors.cfg b/config/filament_sensors.cfg new file mode 100644 index 0000000..245fcd9 --- /dev/null +++ b/config/filament_sensors.cfg @@ -0,0 +1,263 @@ +# filament states: +# is_ready_to_print - +# load_state +# hotend_filament - the filament currently in the hotend. Set to the current loaded filament +# loaded_filament - the filament spool which is currently connected to the extruder. Modifiable when filament is +# heater_state - cold, heating, heated +# if the heater state is 'heated' on printer boot, +# and the current hotend and bed temperature is within 15c of the set temperature, then turn the heaters back on. + +[filaments] +on_set_filament_gcode: +# A list of G-Code commands to execute after the SET_FILAMENT macro runs. See +# docs/Command_Templates.md for G-Code format. These parameters are passed +# to the gcode: +# * 'EXTRUDER' - the name of the extruder. 'extruder', 'extruder1' etc. +# * 'T' - the integer index of the extruder +# * 'PRESET' - the filament preset that was just assigned to th extruder +# * 'LAST_PRESET' - the filament preset that was previously assigned to the extruder, if any +on_clear_filament_gcode: +# A list of G-Code commands to execute after the CLEAR_FILAMENT macro runs. See +# docs/Command_Templates.md for G-Code format. These parameters are pass to the gcode: +# * 'EXTRUDER' - the name of the extruder. 'extruder', 'extruder1' etc. +# * 'T' - the integer index of the extruder +# * 'LAST_PRESET' - the filament preset that was previously assigned to the extruder, if any + +[gcode_macro UNPRIME_FILAMENT] +description: Unprimes the filament, leaving it in a state where it can be unloaded without changing temperatures +gcode: + {% set svv = printer.save_variables.variables %} + {% set unload = params.UNLOAD|default(False) %} + + {% if svv.filament_load_state == "primed" %} + SET_FILAMENT_LOAD_STATE STATE="processing" + + # tell the end macro wether to call the unload macro after this + SET_GCODE_VARIABLE MACRO=END_UNPRIME_FILAMENT VARIABLE=unload VALUE={unload} + # If the extruder was cold, keep it cold after finishing. + SET_GCODE_VARIABLE MACRO=END_UNPRIME_FILAMENT VARIABLE=etemp VALUE={printer['extruder'].target} + + # set temperature of extruder + # if in auto mode, set temperature and wait. Otherwise wait for the set temperature if it it's above 25c. + {% if svv.heater_mode == "auto" %} + SET_TEMPERATURE_AND_WAIT HEATER=extruder TARGET={printer['extruder'].filament.extruder} MODE=auto + {% elif printer['extruder'].target > 25 %} + TEMPERATURE_WAIT SENSOR=extruder MINIMUM={printer['extruder'].target|float - 1} MAXIMUM={printer['extruder'].target|float + 2} + {% endif %} + + # run the loop to retract until the switch is no longer pressed + M83 # relative extruder moves + UPDATE_DELAYED_GCODE ID=LOOP_UNPRIME_FILAMENT DURATION=0.15 + # retract filament until the button is no longer pressed + + {% else %} + {action_respond_info("unable to unprime filament. Current filament state: %s " %(svv.filament_load_state))} + {% endif %} + +[delayed_gcode LOOP_UNPRIME_FILAMENT] +# Retracts filament until the extruder_exit button is no longer pressed +gcode: + {% if printer["gcode_button extruder_exit"].state == "PRESSED" %} + G0 E-2 F{20*60} + # retract by -2mm at 20mm/s (0.1s) + UPDATE_DELAYED_GCODE ID=LOOP_UNPRIME_FILAMENT DURATION=0.15 + # really long wait here. Otherwise klipper gets angry and queues up moves or something. + {% else %} + END_UNPRIME_FILAMENT + {% endif %} + +[gcode_macro END_UNPRIME_FILAMENT] +description: Called by LOOP_UNPRIME_FILAMENT, finishes up unpriming the filament. +variable_etemp = 0 +variable_unload = False +gcode: + # reload filament by an extra 10mm to press the button again + G0 E10 F{40*60} + + M82 # absolute extruder moves + + # set temperature to what it was before + SET_HEATER_TEMPERATURE HEATER='extruder' TARGET={etemp} MODE=auto + + # set filament state + SET_FILAMENT_LOAD_STATE STATE="loaded" + + # if we want to unload after this, do so + {% if unload %} + UNLOAD_FILAMENT + {% endif %} + +[gcode_macro UNLOAD_FILAMENT] +description: Unloads the current filament +gcode: + {% set svv = printer.save_variables.variables %} + + # check against current filament state + {% if svv.filament_load_state == "loaded" %} + + # retract filament by 30mm + M83 # relative extruder moves + G0 E-30 F{40*60} + M82 # absolute extruder moves + M84 E # disable extruder motor + SET_FILAMENT_LOAD_STATE STATE="unloaded_waiting" + SET_EXTRUDER_FILAMENT NAME="None" + + {% elif svv.filament_load_state == "primed" %} + UNPRIME_FILAMENT UNLOAD=True + {% else %} + {action_respond_info("unable to unload filament. Current filament state: %s " %(svv.filament_load_state))} + {% endif %} + +[gcode_macro LOAD_FILAMENT] +# loads filament after it has been detected in the entry sensor or manually triggered +gcode: + {% set prompt = params.PROMPT|default(False) %}M84 E + {% set prime = params.PRIME|default(False) %} + + # tell the end macro wether to call the unload macro after this + SET_GCODE_VARIABLE MACRO=END_LOAD_FILAMENT VARIABLE=prime VALUE={prime} + + # prompt user for filament types: + {% if prompt %} + RESPOND TYPE=command MSG="action:prompt_end" + {% endif %} + # check if the given thing matches the other thing + {% if not params.NAME in printer.filaments.presets|map(attribute='name',default='None') %} + # if the thing doesnt match the thing then prompt the user and call the macro again + RESPOND TYPE=command MSG="action:prompt_begin Load Filament" + RESPOND TYPE=command MSG="action:prompt_text Select filament" + {% for filament_name in printer.filaments.presets|map(attribute='name',default='None') %} + RESPOND TYPE=command MSG="action:prompt_button {filament_name}|LOAD_FILAMENT NAME={filament_name} PROMPT=True|primary" + {% endfor %} + RESPOND TYPE=command MSG="action:prompt_show" + {% else %} + # forward the filament name to the next macro + SET_GCODE_VARIABLE MACRO=END_LOAD_FILAMENT VARIABLE=name VALUE="'{params.NAME}'" + # we could set it here, but it avoids weird states if the macro fails for some reason. + + SET_FILAMENT_LOAD_STATE STATE="processing" + M83 # relative extruder moves + # load filament into extruder gear + UPDATE_DELAYED_GCODE ID=LOOP_LOAD_FILAMENT DURATION=0.15 + {% endif %} + + +[delayed_gcode LOOP_LOAD_FILAMENT] +gcode: + {% if printer["gcode_button extruder_exit"].state == "RELEASED" %} + G0 E2 F{20*60} + # Extrude by 2mm at 20mm/s (0.1s) + UPDATE_DELAYED_GCODE ID=LOOP_LOAD_FILAMENT DURATION=0.15 + # really long wait here. Otherwise klipper gets angry and queues up moves or something. + {% else %} + END_LOAD_FILAMENT + {% endif %} + + +[gcode_macro END_LOAD_FILAMENT] +variable_prime = False +variable_name = None +gcode: + M82 # absolute extruder moves + # set loaded filament + SET_EXTRUDER_FILAMENT NAME={name} + SET_FILAMENT_LOAD_STATE STATE="loaded" + + {% if prime %} + PRIME_FILAMENT + {% endif %} + + + +[gcode_macro PRIME_FILAMENT] +gcode: + + +[gcode_macro PURGE_FILAMENT] +gcode: + {% if filament_load_state in ["loaded", "primed"] %} + # if the filament is loaded or primed, then continue + ##SET_HEATER_TEMPERATURE HEATER=extruder TARGET={svv.filaments|selectattr("name", "in", [svv.filament_hotend, + ## svv.filament_extruder])|map(attribute="extruder",default='None')|max|string)} MODE=auto; set extruder temp + #set extruder temp to max of the filament temperatures in the hotend or extruder to purge correctly + # todo + # move to / extend purge bucket + ; TODO + {% else %} + {action_respond_info("unable to purge filament. Current filament state: %s " %(svv.filament_load_state))} + {% endif %} + + +[gcode_macro CLEAN_NOZZLE] +gcode: + +[gcode_button bowden_sensor] +pin: PF2 +press_gcode: + {% set svv = printer.save_variables.variables %} + { action_respond_info("bowden_load") } #DEBUG + SET_FILAMENT_SENSOR SENSOR=bowden_encoder_sensor ENABLE=0 + # TODO - USER LOAD FILAMENT. Setup some sort of response? Maybe wake printer from sleep mode and turn on lights? + # can't switch back frgom near runout as the extruder can't grab further filament + +release_gcode: + {% set svv = printer.save_variables.variables %} + {% if svv.filament_load_state == 'loaded_ready'%} + {action_raise_error("Warning: bowden sensor released, nearing filament runout")} + # disable the encoder sensor + SET_FILAMENT_SENSOR SENSOR=filament_sensor ENABLE=0 + + # TODO IMPLEMENT MORE WARNINGS. + {% elif svv.filament_load_state != 'unloaded' %} + {action_raise_error("Warning: bowden sensor released during nonsensical filament state.")} + {% endif %} + + +[filament_motion_sensor bowden_encoder_sensor] +detection_length: 10 +extruder: extruder +switch_pin: ^PF3 +pause_on_runout: True +insert_gcode: +runout_gcode: + +[gcode_button extruder_entry] +pin: printHead:PB7 +press_gcode: + {% set svv = printer.save_variables.variables %} + + { action_respond_info("extruder_entry_insert") } + + {% if svv.filament_load_state == 'unloaded' %} + LOAD_FILAMENT + {% endif %} + +release_gcode: + { action_respond_info("extruder_entry_release") } + {% set svv = printer.save_variables.variables %} + {% if svv.filament_load_state == 'loaded' %} + {action_raise_error("Warning: extruder entry sensor released, filament runout")} + SET_FILAMENT_LOAD_STATE STATE="runout" + {% if svv.printer_state == 'printing'%} + PAUSE + {% endif %} + # TODO IMPLEMENT MORE WARNINGS. + {% elif svv.filament_load_state == 'unloaded_waiting' %} + SET_FILAMENT_LOAD_STATE STATE="unloaded" + {% elif svv.filament_load_state != 'unloaded' %} + {action_raise_error("Warning: bowden sensor released during nonsensical filament state.")} + {% endif %} + +[gcode_button extruder_exit] +pin: printHead:PB5 + +press_gcode: + {% set svv = printer.save_variables.variables %} +# not much here, this is handled by repeatedly checking the state in the filamet unload macro + { action_respond_info("extruder_exit_insert") } + +release_gcode: + {% set svv = printer.save_variables.variables %} + { action_respond_info("extruder_exit_runout") } + { action_respond_info(svv.filament_load_state|string) } diff --git a/config/interface_macros.cfg b/config/interface_macros.cfg new file mode 100644 index 0000000..c936ede --- /dev/null +++ b/config/interface_macros.cfg @@ -0,0 +1,4 @@ +[gcode_macro set_heater_state] +gcode: + {% set state = params.state|default("auto") %} + SAVE_VARIABLE VARIABLE=filament_load_state VALUE=params diff --git a/config/leds.cfg b/config/leds.cfg new file mode 100644 index 0000000..92628f1 --- /dev/null +++ b/config/leds.cfg @@ -0,0 +1,36 @@ +[neopixel printhead] +pin: printHead:PD3 +# The pin connected to the neopixel. This parameter must be +# provided. +chain_count: 3 +# The number of Neopixel chips that are "daisy chained" to the +# provided pin. The default is 1 (which indicates only a single +# Neopixel is connected to the pin). +color_order: GRBW +# Set the pixel order required by the LED hardware (using a string +# containing the letters R, G, B, W with W optional). Alternatively, +# this may be a comma separated list of pixel orders - one for each +# LED in the chain. The default is GRB. +initial_RED: 1 +initial_GREEN: 1 +initial_BLUE: 1 +initial_WHITE: 1 +# See the "led" section for information on these parameters. + +[led chamber] +white_pin: PA0 +cycle_time: 0.010 +#hardware_pwm: False +# Enable this to use hardware PWM instead of software PWM. When +# using hardware PWM the actual cycle time is constrained by the +# implementation and may be significantly different than the +# requested cycle_time. The default is False. +initial_WHITE: 1 + +[led_effect rainbow] +leds: + neopixel:printhead +layers: + static 10 1 top (1,1,1) +autostart: true +frame_rate:20 \ No newline at end of file diff --git a/config/macros.cfg b/config/macros.cfg new file mode 100644 index 0000000..32f3152 --- /dev/null +++ b/config/macros.cfg @@ -0,0 +1,485 @@ +# gcode to run on printer start +[delayed_gcode STARTUP] +gcode: + # grab saved variables + {% set svv = printer.save_variables.variables %} + {% set bed_leeway_temp = 10 %} + {% set extruder_leeway_temp = 20 %} + {% set hotend_filament = svv.hotend_filament %} + + # check if stored variables make sense, and set them to default values if not + {% if not(svv.heater_mode == "auto" or svv.heater_mode == "manual" or svv.heater_mode == "slicer")%} + { action_respond_info("setting heater_mode to AUTO, before: %s" % (svv.heater_mode)) } + SAVE_VARIABLE VARIABLE=heater_mode VALUE='"auto"' + + {% endif %} + + # set temp variables - call variables macro + VARIABLES + + # kickstart fan control macro + UPDATE_DELAYED_GCODE ID=FAN_CONTROL_LOOP DURATION=2 + + + # check the current heater states and re enable heaters if able + {% if svv.extruder_state == 'hot' %} + {% if printer.extruder.temperature - extruder_leeway_temp <= svv.extruder_temperature %} + { action_respond_info("re-enabling extruder after printer shutoff") } + {% else %} + { action_respond_info("extruder was enabled before last shutoff. State updated to cold.") } + SAVE_VARIABLE VARIABLE=extruder_state VALUE='"cold"' + {% endif %} + {% endif %} + + {% if svv.bed_state == 'hot' %} + {action_respond_info(printer.heater_bed.temperature|string)} + {action_respond_info(bed_leeway_temp|string)} + {action_respond_info(svv.bed_temperature|string)} + + {% if printer.heater_bed.temperature - bed_leeway_temp <= svv.bed_temperature %} + { action_respond_info("re-enabling bed after printer shutoff") } + {% else %} + { action_respond_info("bed was enabled before last shutoff. State updated to cold.") } + SAVE_VARIABLE VARIABLE=bed_state VALUE='"cold"' + {% endif %} + {% endif %} + + # check the filament load state: + # exit-entry-bowden + # 000 unloaded + # 001 unloaded + # 010 invalid + # 011 unloaded + # 100 runout + # 101 invalid + # 110 near_runout + # 111 loaded + + # store button vals + {% set exit_sense = (printer["gcode_button extruder_exit"].state == "PRESSED") %} + {% set entry_sense = (printer["gcode_button extruder_entry"].state == "PRESSED") %} + {% set bowden_sense = (printer["gcode_button bowden_sensor"].state == "PRESSED") %} + + # detect unloaded + {% if not(entry_sense and exit_sense) or (not(entry_sense) and bowden_sense) %} + {% if svv.filament_load_state != "unloaded" %} + { action_respond_info("Current filament state does not match filament state on last boot. Was " ~ (svv.filament_load_state|string) ~ ", currently unloaded.") } + {% endif %} + SET_FILAMENT_LOAD_STATE STATE="unloaded" + SET_FILAMENT_SENSOR SENSOR=bowden_encoder_sensor ENABLE=0 + + # loaded + {% elif entry_sense and exit_sense and bowden_sense %} + {% if svv.filament_load_state != "loaded" %} + { action_respond_info("Current filament state does not match filament state on last boot. Was " ~ (svv.filament_load_state|string) ~ ", currently loaded. Double check filament path.") } + {% endif %} + # SAVE_VARIABLE VARIABLE=loaded_filament VALUE=none + SET_FILAMENT_LOAD_STATE STATE="loaded" + SET_FILAMENT_SENSOR SENSOR=bowden_encoder_sensor ENABLE=1 + + # runout + {% elif entry_sense and not(exit_sense) and not(bowden_sense) %} + { action_respond_info("Current filament state is runout. Unable to print.") } + SET_FILAMENT_LOAD_STATE STATE="runout" + SET_FILAMENT_SENSOR SENSOR=bowden_encoder_sensor ENABLE=0 + + # near_runout + {% elif entry_sense and exit_sense and not(bowden_sense) %} + { action_respond_info("Current filament state is runout. Unable to print.") } + SET_FILAMENT_LOAD_STATE STATE="near_runout" + SET_FILAMENT_SENSOR SENSOR=bowden_encoder_sensor ENABLE=0 + + {% endif %} + + # set the currently loaded filament + SET_FILAMENT NAME={loaded_filament['name']} + +initial_duration: 2 + +[gcode_macro TEST] +gcode: + {% set svv = printer.save_variables.variables %} + {break} + {action_respond_info(svv.filaments|selectattr("name", "in", [svv.filament_hotend, + svv.filament_extruder])|map(attribute="extruder",default='None')|max|string)} + +####### Calibration +[gcode_macro calibrate_full] +gcode: + G28 + QUAD_GANTRY_LEVEL + BED_MESH_CALIBRATE METHOD=rapid_scan + G0 X239 Y210 F{700*60} + SET_GCODE_VARIABLE MACRO=VARIABLES VARIABLE=calibrate VALUE='"full"' + +[gcode_macro calibrate] +gcode: + {% set calibrate = printer["gcode_macro VARIABLES"].calibrate %} + + {% if calibrate == "none" %} + G28 + QUAD_GANTRY_LEVEL + BED_MESH_CALIBRATE METHOD=rapid_scan + + {% elif calibrate == "home" %} + QUAD_GANTRY_LEVEL + BED_MESH_CALIBRATE METHOD=rapid_scan + + {% elif calibrate == "QGL" %} + G0 X15 Y22 F{700*60} + BED_MESH_CALIBRATE METHOD=rapid_scan + {% endif %} + + G0 X239 Y210 F{700*60} + SET_GCODE_VARIABLE MACRO=VARIABLES VARIABLE=calibrate VALUE='"full"' + +[gcode_macro calibrate_override] +gcode: + SET_GCODE_VARIABLE MACRO=VARIABLES VARIABLE=calibrate VALUE='"full"' + +[gcode_macro calibrate_query] +gcode: + {% set val = printer["gcode_macro VARIABLES"].calibrate %} + { action_respond_info("a" + val|string) } + +####### PRINT START AND STOP ETC +[gcode_macro START_PRINT] +description: Runs before the start of a print. Checks print readyness, corrects if nessesary, and primes the nozzle. +gcode: + {% set svv = printer.save_variables.variables %} + # first, check calibration + CALIBRATE + + # enable the encoder filament sensor + SET_FILAMENT_SENSOR SENSOR=bowden_encoder_sensor ENABLE=1 + + # check the state of the loaded filament + {% if svv.filament_state in ["loaded", "primed"] and svv.filament_runout_state != "runout" %} + # if in auto, only bother to set bed to loaded filament parameters. The others will be set when we purge/prime. + {% if svv.heater_mode == "auto" %} + #SET_HEATER_TEMPERATURE HEATER=heater_bed TARGET={svv.filaments|selectattr("name", "equalto", svv.filament_extruder)|map(attribute="bed",default='None')|first|string} MODE=auto; set extruder temp + # if in slicer or manual mode, quickly sanity check the set temperatures: + {% else %} + {% if printer['extruder'].target != 0 %} + {action_raise_error("Extruder temperature is set to at or below zero")} + {% endif %} + {% endif %} + + {% if svv.filament_extruder == svv.filament_hotend %} + PRIME_FILAMENT + {% else %} + PURGE_FILAMENT + {% endif %} + + {% elif svv.filament_runout_state == "runout" %} + {action_raise_error("Error, filament in runout state")} + + {% else %} + {action_raise_error("Error, filament not loaded. Filament is %s" %(svv.filament_state))} + {% endif %} + + # final enable of heaters and wait for temperature to be reached + SET_HEATERS_TO_FILAMENT_AND_WAIT + + +[gcode_macro stop_print] +gcode: + {% set z = params.Z|default(50)|int %} ; z hop amount + + SET_FILAMENT_SENSOR SENSOR=bowden_encoder_sensor ENABLE=0 + + # reduce temperature of extruder by 10c to reduce oozing + SET_HEATER_TEMPERATURE HEATER=extruder TARGET={printer['extruder'].target - 10} MODE=auto + + {% if (printer.gcode_move.position.z + z) < printer.toolhead.axis_maximum.z %} ; check that zhop doesn't exceed z max + G91 ; relative positioning + G1 Z{z} F900 ; raise Z up by z hop amount + {% else %} + G0 Z{printer.toolhead.axis_maximum.z} + { action_respond_info("Pause zhop exceeds maximum Z height.") } + {% endif %} + G90 ; absolute positioning + G1 Y{258} F6000 ; park toolhead + + +[gcode_macro PAUSE] +description: Pause the actual running print +rename_existing: PAUSE_MAINSAIL +gcode: +# Parameters + {% set z = params.Z|default(10)|int %} ; z hop amount + #{% set idle_timeout = client.idle_timeout|default({60*5}) %} + {% set idle_timeout = 60*5 %} + + # if printer is not already paused... + {% if printer['pause_resume'].is_paused|int == 0 %} + # set variables for reference in resume macro + SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=posx VALUE={printer['gcode_move'].gcode_position.x} + SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=posy VALUE={printer['gcode_move'].gcode_position.y} + SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=posz VALUE={printer['gcode_move'].gcode_position.z} + + SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=etemp VALUE={printer['extruder'].target} + SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=btemp VALUE={printer['heater_bed'].target} + SAVE_GCODE_STATE NAME=PAUSE + + # set a new idle_timeout value + SET_IDLE_TIMEOUT TIMEOUT={idle_timeout} + + # {client.user_pause_macro|default("")} + + # reduce temperature of extruder by 10c to reduce oozing + SET_HEATER_TEMPERATURE HEATER=extruder TARGET={printer['extruder'].target - 10} MODE=auto + + {% if (printer.gcode_move.position.z + z) < printer.toolhead.axis_maximum.z %} ; check that zhop doesn't exceed z max + G91 ; relative positioning + G1 Z{z} F900 ; raise Z up by z hop amount + {% else %} + G0 Z{printer.toolhead.axis_maximum.z} + { action_respond_info("Pause zhop exceeds maximum Z height.") } + {% endif %} + G90 ; absolute positioning + G1 Y{258} F6000 ; park toolhead + SAVE_GCODE_STATE NAME=PAUSEPARK ; save parked position in case toolhead is moved during the pause (otherwise the return zhop can error) + {% endif %} + +[gcode_macro RESUME] +description: Resume the actual running print +rename_existing: RESUME_MAINSAIL +variable_posx: 0 +variable_posy: 0 +variable_posz: 0 +variable_zhop: 0 +variable_etemp: 0 +variable_btemp: 0 +gcode: + # Parameters + {% set e = params.E|default(2.5)|int %} ; hotend prime amount (in mm) + {% set client = printer['gcode_macro _CLIENT_VARIABLE']|default({}) %} + {% set velocity = printer.configfile.settings.pause_resume.recover_velocity %} + {% set sp_move = client.speed_move|default(velocity) %} + {% set runout_resume = True if client.runout_sensor|default("") == "" # no runout + else True if not printer[client.runout_sensor].enabled # sensor is disabled + else printer[client.runout_sensor].filament_detected %} # sensor status + {% set can_extrude = True if printer.toolhead.extruder == '' # no extruder defined in config + else printer[printer.toolhead.extruder].can_extrude %} # status of active extruder + {% set do_resume = False %} + {% set prompt_txt = [] %} + + # if printer is paused... + {% if printer['pause_resume'].is_paused|int == 1 %} + SET_IDLE_TIMEOUT TIMEOUT={printer.configfile.settings.idle_timeout.timeout} ; set timeout back to configured value + + RESTORE_GCODE_STATE NAME=PAUSEPARK MOVE=1 MOVE_SPEED=200 ; go back to parked position in case toolhead was moved during pause (otherwise the return zhop can error) + + # reset temperatures + {% if etemp > 0 %} + SET_HEATER_TEMPERATURE HEATER=extruder TARGET={etemp} MODE=auto + {% endif %} + {% if btemp > 0 %} + SET_HEATER_TEMPERATURE_AND_WAIT HEATER=heater_bed TARGET={btemp} MODE=auto + {% endif %} + {% if etemp > 0 %} + SET_HEATER_TEMPERATURE_AND_WAIT HEATER=extruder TARGET={etemp} MODE=auto ; Wait for hotend temp + {% endif %} + + G91 ; relative positioning + M83 ; relative extruder positioning + {% if printer[printer.toolhead.extruder].temperature >= printer.configfile.settings.extruder.min_extrude_temp %} + G1 Z{zhop * -1} E{e} F900 ; prime nozzle by E, lower Z back down + {% else %} + G1 Z{zhop * -1} F900 ; lower Z back down without priming (just in case we are testing the macro with cold hotend) + {% endif %} + RESTORE_GCODE_STATE NAME=PAUSE MOVE=1 MOVE_SPEED=60 ; restore position + {% endif %} + +[gcode_macro CANCEL_PRINT] +rename_existing: CANCEL_PRINT_MAINSAIL +gcode: + {% set z = params.Z|default(10)|int %} ; z hop amount + + SET_IDLE_TIMEOUT TIMEOUT={printer.configfile.settings.idle_timeout.timeout} ; set timeout back to configured value + CLEAR_PAUSE + PRINT_END + + # reduce temperature of extruder by 10c to reduce oozing + SET_HEATER_TEMPERATURE HEATER=extruder TARGET={printer['extruder'].target - 10} MODE=auto + + {% if (printer.gcode_move.position.z + z) < printer.toolhead.axis_maximum.z %} ; check that zhop doesn't exceed z max + G91 ; relative positioning + G1 Z{z} F900 ; raise Z up by z hop amount + {% else %} + G0 Z{printer.toolhead.axis_maximum.z} + { action_respond_info("Pause zhop exceeds maximum Z height.") } + {% endif %} + + G90 ; absolute positioning + G1 Y{258} F6000 ; park toolhead + # clear pause_next_layer and pause_at_layer as preparation for next print + SET_PAUSE_NEXT_LAYER ENABLE=0 + SET_PAUSE_AT_LAYER ENABLE=0 LAYER=0 + +###### HEATER AUTO HANDLING +[gcode_macro SET_HEATERS_TO_FILAMENT_AND_WAIT] +gcode: + SET_HEATER_TEMPERATURE HEATER=extruder TARGET={svv.filaments|selectattr("name", "equalto", svv.filament_hotend)|map(attribute="extruder",default='None')|first|string} MODE=auto + SET_HEATER_TEMPERATURE_AND_WAIT HEATER=heater_bed TARGET={svv.filaments|selectattr("name", "equalto", svv.filament_hotend)|map(attribute="bed",default='None')|first|string} MODE=auto + SET_HEATER_TEMPERATURE_AND_WAIT HEATER=extruder TARGET={svv.filaments|selectattr("name", "equalto", svv.filament_hotend)|map(attribute="extruder",default='None')|first|string} MODE=auto + + +## MISC MACROS + +[gcode_macro DUMP_VARIABLES] +gcode: + {% set filter_name = params.NAME|default('')|string|lower %} + {% set filter_value = params.VALUE|default('')|string|lower %} + {% set show_cfg = params.SHOW_CFG|default(0)|int %} + + {% set out = [] %} + + {% for key1 in printer %} + {% for key2 in printer[key1] %} + {% if (show_cfg or not (key1|lower == 'configfile' and key2|lower in ['config', 'settings'])) and (filter_name in key1|lower or filter_name in key2|lower) and filter_value in printer[key1][key2]|string|lower %} + {% set dummy = out.append("printer['%s'].%s = %s" % (key1, key2, printer[key1][key2])) %} + {% endif %} + {% else %} + {% if filter_name in key1|lower and filter_value in printer[key1]|string|lower %} + {% set dummy = out.append("printer['%s'] = %s" % (key1, printer[key1])) %} + {% endif %} + {% endfor %} + {% endfor %} + + {action_respond_info(out|join("\n"))} + +[gcode_macro TEST_SPEED] +# Home, get position, throw around toolhead, home again. +# If MCU stepper positions (first line in GET_POSITION) are greater than a full step different (your number of microsteps), then skipping occured. +# We only measure to a full step to accomodate for endstop variance. +# Example: TEST_SPEED SPEED=300 ACCEL=5000 ITERATIONS=10 + +description: Test for max speed and acceleration parameters for the printer. Procedure: Home -> ReadPositionFromMCU -> MovesToolhead@Vel&Accel -> Home -> ReadPositionfromMCU + +gcode: + # Speed + {% set speed = params.SPEED|default(printer.configfile.settings.printer.max_velocity)|int %} + # Iterations + {% set iterations = params.ITERATIONS|default(5)|int %} + # Acceleration + {% set accel = params.ACCEL|default(printer.configfile.settings.printer.max_accel)|int %} + # Minimum Cruise Ratio + {% set min_cruise_ratio = params.MIN_CRUISE_RATIO|default(0.5)|float %} + # Bounding inset for large pattern (helps prevent slamming the toolhead into the sides after small skips, and helps to account for machines with imperfectly set dimensions) + {% set bound = params.BOUND|default(20)|int %} + # Size for small pattern box + {% set smallpatternsize = SMALLPATTERNSIZE|default(20)|int %} + + # Large pattern + # Max positions, inset by BOUND + {% set x_min = printer.toolhead.axis_minimum.x %} + {% if x_min < 0 %} + {% set x_min = 0 %} + {% endif %} + + {% set y_min = printer.toolhead.axis_minimum.y %} + {% if y_min < 0 %} + {% set y_min = 0 %} + {% endif %} + + {% set x_min = x_min + bound %} + {% set x_max = printer.toolhead.axis_maximum.x - bound %} + {% set y_min = y_min + bound %} + {% set y_max = printer.toolhead.axis_maximum.y - bound %} + + # Small pattern at center + # Find X/Y center point + {% set x_center = (printer.toolhead.axis_minimum.x|float + printer.toolhead.axis_maximum.x|float ) / 2 %} + {% set y_center = (printer.toolhead.axis_minimum.y|float + printer.toolhead.axis_maximum.y|float ) / 2 %} + + # Set small pattern box around center point + {% set x_center_min = x_center - (smallpatternsize/2) %} + {% set x_center_max = x_center + (smallpatternsize/2) %} + {% set y_center_min = y_center - (smallpatternsize/2) %} + {% set y_center_max = y_center + (smallpatternsize/2) %} + + # Save current gcode state (absolute/relative, etc) + SAVE_GCODE_STATE NAME=TEST_SPEED + + # Output parameters to g-code terminal + { action_respond_info("TEST_SPEED: starting %d iterations at speed %d, accel %d" % (iterations, speed, accel)) } + + # Home and get position for comparison later: + M400 # Finish moves - https://github.com/AndrewEllis93/Print-Tuning-Guide/issues/66 + # QGL if not already QGLd (only if QGL section exists in config) + {% if printer.configfile.settings.quad_gantry_level %} + {% if printer.quad_gantry_level.applied == False %} + G28 + QUAD_GANTRY_LEVEL + G28 Z + {% endif %} + {% endif %} + # Move 50mm away from max position and home again (to help with hall effect endstop accuracy - https://github.com/AndrewEllis93/Print-Tuning-Guide/issues/24) + G90 + G1 X{printer.toolhead.axis_maximum.x-50} Y{printer.toolhead.axis_maximum.y-50} F{100*60} + M400 # Finish moves - https://github.com/AndrewEllis93/Print-Tuning-Guide/issues/66 + G28 X Y + G0 X{printer.toolhead.axis_maximum.x-1} Y{printer.toolhead.axis_maximum.y-1} F{100*60} + G4 P1000 + GET_POSITION + + # Go to starting position + G0 X{x_min} Y{y_min} Z{bound + 10} F{speed*60} + + # Set new limits + {% if printer.configfile.settings.printer.minimum_cruise_ratio is defined %} + SET_VELOCITY_LIMIT VELOCITY={speed} ACCEL={accel} MINIMUM_CRUISE_RATIO={min_cruise_ratio} + {% else %} + SET_VELOCITY_LIMIT VELOCITY={speed} ACCEL={accel} ACCEL_TO_DECEL={accel / 2} + {% endif %} + + {% for i in range(iterations) %} + # Large pattern diagonals + G0 X{x_min} Y{y_min} F{speed*60} + G0 X{x_max} Y{y_max} F{speed*60} + G0 X{x_min} Y{y_min} F{speed*60} + G0 X{x_max} Y{y_min} F{speed*60} + G0 X{x_min} Y{y_max} F{speed*60} + G0 X{x_max} Y{y_min} F{speed*60} + + # Large pattern box + G0 X{x_min} Y{y_min} F{speed*60} + G0 X{x_min} Y{y_max} F{speed*60} + G0 X{x_max} Y{y_max} F{speed*60} + G0 X{x_max} Y{y_min} F{speed*60} + + # Small pattern diagonals + G0 X{x_center_min} Y{y_center_min} F{speed*60} + G0 X{x_center_max} Y{y_center_max} F{speed*60} + G0 X{x_center_min} Y{y_center_min} F{speed*60} + G0 X{x_center_max} Y{y_center_min} F{speed*60} + G0 X{x_center_min} Y{y_center_max} F{speed*60} + G0 X{x_center_max} Y{y_center_min} F{speed*60} + + # Small pattern box + G0 X{x_center_min} Y{y_center_min} F{speed*60} + G0 X{x_center_min} Y{y_center_max} F{speed*60} + G0 X{x_center_max} Y{y_center_max} F{speed*60} + G0 X{x_center_max} Y{y_center_min} F{speed*60} + {% endfor %} + + # Restore max speed/accel/accel_to_decel to their configured values + {% if printer.configfile.settings.printer.minimum_cruise_ratio is defined %} + SET_VELOCITY_LIMIT VELOCITY={printer.configfile.settings.printer.max_velocity} ACCEL={printer.configfile.settings.printer.max_accel} MINIMUM_CRUISE_RATIO={printer.configfile.settings.printer.minimum_cruise_ratio} + {% else %} + SET_VELOCITY_LIMIT VELOCITY={printer.configfile.settings.printer.max_velocity} ACCEL={printer.configfile.settings.printer.max_accel} ACCEL_TO_DECEL={printer.configfile.settings.printer.max_accel_to_decel} + {% endif %} + + # Re-home and get position again for comparison: + M400 # Finish moves - https://github.com/AndrewEllis93/Print-Tuning-Guide/issues/66 + # G28 # This is a full G28 to fix an issue with CoreXZ - https://github.com/AndrewEllis93/Print-Tuning-Guide/issues/12 + # Go to XY home positions (in case your homing override leaves it elsewhere) + G90motors + G0 X{printer.toolhead.axis_maximum.x-1} Y{printer.toolhead.axis_maximum.y-1} F{100*60} + G4 P1000 + GET_POSITION + + # Restore previous gcode state (absolute/relative, etc) + RESTORE_GCODE_STATE NAME=TEST_SPEED \ No newline at end of file diff --git a/config/overrides.cfg b/config/overrides.cfg new file mode 100644 index 0000000..7805b2c --- /dev/null +++ b/config/overrides.cfg @@ -0,0 +1,236 @@ +[force_move] +enable_force_move: True + +[exclude_object] + +# [idle_timeout] +# gcode: +# ACTION_RESPON +# SAVE_VARIABLE VARIABLE=heater_state VALUE='"Cold"' +# TURN_OFF_HEATERS +# UPDATE_DELAYED_GCODE ID=FULL_IDLE DURATION=3600 +# timeout: 600 +# # Idle time (in seconds) to wait before running the above G-Code +# # commands. The default is 600 seconds. + +# [delayed_gcode FULL_IDLE] +# gcode: +# {% if printer.idle_timeout.state == "Idle" %} +# TURN_OFF_HEATERS +# M84 +# SAVE_VARIABLE VARIABLE=heater_state VALUE='"Cold"' +# SET_GCODE_VARIABLE MACRO=VARIABLES VARIABLE=calibrate VALUE='"none"' +# {% endif %} + +# replace homing +[gcode_macro G28] +rename_existing: G9928 +gcode: + {% set calibrate = printer["gcode_macro VARIABLES"].calibrate %} + + G9928 {rawparams} + {% if not rawparams or (rawparams and 'Z' in rawparams) %} + PROBE + SET_Z_FROM_PROBE + {% endif %} + + {% if calibrate == "none" %} + SET_GCODE_VARIABLE MACRO=VARIABLES VARIABLE=calibrate VALUE='"home"' + {% endif %} + +[gcode_macro QUAD_GANTRY_LEVEL] +rename_existing: QUAD_GANTRY_LEVEL1 +gcode: + {% set calibrate = printer["gcode_macro VARIABLES"].calibrate %} + + {% if calibrate == "none" %} + G28 + {% endif %} + + QUAD_GANTRY_LEVEL1 {rawparams} + + {% if calibrate == "home" or calibrate == "none" %} + SET_GCODE_VARIABLE MACRO=VARIABLES VARIABLE=calibrate VALUE='"QGL"' + {% endif %} + +[gcode_macro BED_MESH_CALIBRATE] +rename_existing: BED_MESH_CALIBRATE1 +gcode: + {% set calibrate = printer["gcode_macro VARIABLES"].calibrate %} + + {% if calibrate == "none" %} + G28 + QUAD_GANTRY_LEVEL + {% elif calibrate == "home" %} + QUAD_GANTRY_LEVEL + {% endif %} + + BED_MESH_CALIBRATE1 {rawparams} + + SET_GCODE_VARIABLE MACRO=VARIABLES VARIABLE=calibrate VALUE='"full"' + +# replace pause +[gcode_macro M600] +gcode: + PAUSE + +# replace extruder with temperature wait +[gcode_macro M109] +rename_existing: M99109 +gcode: + {% set svv = printer.save_variables.variables %} + + # only execute if slicer mode + {% if svv.heater_mode == "slicer" %} + + #Parameters + {% set s = params.S|float %} + + M104 {% for p in params %}{'%s%s' % (p, params[p])}{% endfor %} ; Set hotend temp + {% if s != 0 %} + TEMPERATURE_WAIT SENSOR=extruder MINIMUM={s} MAXIMUM={s+1} ; Wait for hotend temp (within 1 degree) + {% endif %} + {% endif %} + +# replace bed with temperature wait +[gcode_macro M190] +rename_existing: M99190 +gcode: + {% set svv = printer.save_variables.variables %} + + # only execute if slicer mode + {% if svv.heater_mode == "slicer" %} + #Parameters + {% set s = params.S|float %} + + M140 {% for p in params %}{'%s%s' % (p, params[p])}{% endfor %} ; Set bed temp + {% if s != 0 %} + TEMPERATURE_WAIT SENSOR=heater_bed MINIMUM={s} MAXIMUM={s+1} ; Wait for bed temp (within 1 degree) + {% endif %} + {% endif %} + +# append extruder temperature with extra logic +[gcode_macro M104] +rename_existing: M99104 +gcode: + {% set svv = printer.save_variables.variables %} + + {% if svv.heater_mode == "slicer" %} + # if printer in slicer mode, run command + {% if params.TARGET != 0 %} + SAVE_VARIABLE VARIABLE=extruder_state VALUE='"hot"' + {% else %} + SAVE_VARIABLE VARIABLE=extruder_state VALUE='"cold"' + {% endif %} + SAVE_VARIABLE VARIABLE=extruder_temperature VALUE={params.TARGET|string} + M99104 {rawparams} + # else silently drop the command + {% endif %} + +# append bed temperature with extra logic +[gcode_macro M140] +rename_existing: M99140 +gcode: + {% set svv = printer.save_variables.variables %} + + {% if svv.heater_mode == "slicer" %} + # if printer in slicer mode, run command + {% if params.TARGET != 0 %} + SAVE_VARIABLE VARIABLE=bed_state VALUE='"hot"' + {% else %} + SAVE_VARIABLE VARIABLE=bed_state VALUE='"cold"' + {% endif %} + SAVE_VARIABLE VARIABLE=bed_temperature VALUE={params.TARGET|string} + M99140 {rawparams} + # else silently drop the command + {% endif %} + +# append set_heater_temperature with extra logic +[gcode_macro SET_HEATER_TEMPERATURE] +rename_existing: SET_HEATER_TEMPERATURE2 +gcode: + {% set svv = printer.save_variables.variables %} + + {% if params.MODE == "auto" %} + # auto meaning it has been called by some variation of the auto filament changer macro + # sanity check this against the printer state + {% if svv.heater_mode == "auto" %} + # if heater mode matches run the command + SET_HEATER_TEMPERATURE1 {rawparams} + # else silently block the command + {% endif %} + + {% elif params.MODE == "override" %} + # just do the thing + SET_HEATER_TEMPERATURE1 {rawparams} + + {% else %} + # no mode param -> called from mainsail, is a MANUAL command. + {% if svv.heater_mode == "manual" %} + SET_HEATER_TEMPERATURE1 {rawparams} + {% else %} + # else complain and tell the user they're and idiot + {action_respond_info("Manual control locked. Printer in: %s" %(svv.heater_state))} + {% endif %} + {% endif %} + +[gcode_macro SET_HEATER_TEMPERATURE1] +gcode: + SET_HEATER_TEMPERATURE2 {rawparams} + # UPDATE SAVED VALUES + # why is this in caps + # i don't know + {% if params.HEATER == "heater_bed" %} + {% if params.TARGET != 0 %} + SAVE_VARIABLE VARIABLE=bed_state VALUE='"hot"' + {% else %} + SAVE_VARIABLE VARIABLE=bed_state VALUE='"cold"' + {% endif %} + SAVE_VARIABLE VARIABLE=bed_temperature VALUE={params.TARGET|float} + + {% elif params.HEATER == "extruder"%} + {% if params.TARGET != 0 %} + SAVE_VARIABLE VARIABLE=extruder_state VALUE='"hot"' + {% else %} + SAVE_VARIABLE VARIABLE=extruder_state VALUE='"cold"' + {% endif %} + SAVE_VARIABLE VARIABLE=extruder_temperature VALUE={params.TARGET|float} + + {% else %} + {action_raise_error("This isn't supposed to happen")} + {% endif %} + +[gcode_macro SET_HEATER_TEMPERATURE_AND_WAIT] +gcode: + {% set svv = printer.save_variables.variables %} + + {% if params.MODE == "auto" %} + # auto meaning it has been called by some variation of the auto filament changer macro + # sanity check this against the printer state + {% if svv.heater_mode == "auto" %} + # if heater mode matches run the command + SET_HEATER_TEMPERATURE_AND_WAIT1 {rawparams} + # else silently block the command + {% endif %} + + {% elif params.MODE == "override" %} + # just do the thing + SET_HEATER_TEMPERATURE_AND_WAIT1 {rawparams} + + {% else %} + # no mode param -> called from mainsail, is a MANUAL command. + {% if svv.heater_mode == "manual" %} + SET_HEATER_TEMPERATURE_AND_WAIT1 {rawparams} + {% else %} + # else complain and tell the user they're and idiot + {action_respond_info("Manual control locked. Printer in: %s" %(svv.heater_state))} + {% endif %} + {% endif %} + +[gcode_macro SET_HEATER_TEMPERATURE_AND_WAIT1] +gcode: + SET_HEATER_TEMPERATURE1 HEATER={params.HEATER} TARGET={params.TARGET|float} + + {% if (params.TARGET|int != 0) %} + TEMPERATURE_WAIT SENSOR={params.HEATER} MINIMUM={params.TARGET|float - 1} MAXIMUM={params.TARGET|float + 2} + {% endif %} \ No newline at end of file diff --git a/config/unused b/config/unused new file mode 100644 index 0000000..666f966 --- /dev/null +++ b/config/unused @@ -0,0 +1,88 @@ +[gcode_macro start_print] +gcode: + # todo check if printer is able to print + {% set calibrate = printer["gcode_macro VARIABLES"].caliabrate %} + + CALIBRATE + + SET_FILAMENT_SENSOR SENSOR=filament_sensor ENABLE=1 + G90 # absolute positioningofnon + G92 E0 # reset extruder origin + G1 Z5 F5000 #lift nozzle + G1 y240 X240 F5000 #move to edge + + M104 S{params.EXTRUDER_TEMP}; set extruder temp + M140 S{params.BED_TEMP} ; set bed temp + M109 S{params.EXTRUDER_TEMP}; Wait for extruder temp + M190S{params.BED_TEMP}; Wait for bed temp + +[gcode_macro stop_print] +gcode: + SET_FILAMENT_SENSOR SENSOR=filament_sensor ENABLE=0 + G1 Z80 + # M84 ; disable motors + #M104 S0 ; turn off temperature + + +[gcode_macro PAUSE] +rename_existing: BASE_PAUSE +gcode: + # Parameters + {% set z = params.Z|default(10)|int %} ; z hop amount + + {% if printer['pause_resume'].is_paused|int == 0 %} + SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=zhop VALUE={z} ; set z hop variable for reference in resume macro + SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=etemp VALUE={printer['extruder'].target} ; set hotend temp variable for reference in resume macro + + SET_FILAMENT_SENSOR SENSOR=filament_sensor ENABLE=0 ; disable filament sensor + SAVE_GCODE_STATE NAME=PAUSE ; save current print position for resume + BASE_PAUSE ; pause print + {% if (printer.gcode_move.position.z + z) < printer.toolhead.axis_maximum.z %} ; check that zhop doesn't exceed z max + G91 ; relative positioning + G1 Z{z} F900 ; raise Z up by z hop amount + {% else %} + { action_respond_info("Pause zhop exceeds maximum Z height.") } ; if z max is exceeded, show message and set zhop value for resume to 0 + SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=zhop VALUE=0 + {% endif %} + G90 ; absolute positioning + G1 X{printer.toolhead.axis_maximum.x/2} Y{printer.toolhead.axis_maximum.y-5} F6000 ; park toolhead at rear center + SAVE_GCODE_STATE NAME=PAUSEPARK ; save parked position in case toolhead is moved during the pause (otherwise the return zhop can error) + # M104 S0 ; turn off hotend + SET_IDLE_TIMEOUT TIMEOUT=43200 ; set timeout to 12 hours + {% endif %} + +[gcode_macro RESUME] +rename_existing: BASE_RESUME +variable_zhop: 0 +variable_etemp: 0 +gcode: + # Parameters + {% set e = params.E|default(2.5)|int %} ; hotend prime amount (in mm) + + {% if printer['pause_resume'].is_paused|int == 1 %} + SET_FILAMENT_SENSOR SENSOR=filament_sensor ENABLE=1 ; enable filament sensor + #INITIAL_RGB ; reset LCD color + SET_IDLE_TIMEOUT TIMEOUT={printer.configfile.settings.idle_timeout.timeout} ; set timeout back to configured value + {% if etemp > 0 %} + M109 S{etemp|int} ; wait for hotend to heat back up + {% endif %} + RESTORE_GCODE_STATE NAME=PAUSEPARK MOVE=1 MOVE_SPEED=100 ; go back to parked position in case toolhead was moved during pause (otherwise the return zhop can error) + G91 ; relative positioning + M83 ; relative extruder positioning + {% if printer[printer.toolhead.extruder].temperature >= printer.configfile.settings.extruder.min_extrude_temp %} + G1 Z{zhop * -1} E{e} F900 ; prime nozzle by E, lower Z back down + {% else %} + G1 Z{zhop * -1} F900 ; lower Z back down without priming (just in case we are testing the macro with cold hotend) + {% endif %} + RESTORE_GCODE_STATE NAME=PAUSE MOVE=1 MOVE_SPEED=60 ; restore position + BASE_RESUME ; resume print + {% endif %} + +[gcode_macro CANCEL_PRINT] +rename_existing: BASE_CANCEL_PRINT +gcode: + SET_IDLE_TIMEOUT TIMEOUT={printer.configfile.settings.idle_timeout.timeout} ; set timeout back to configured value + CLEAR_PAUSE + SDCARD_RESET_FILE + PRINT_END + BASE_CANCEL_PRINT \ No newline at end of file diff --git a/config/variable_macros.cfg b/config/variable_macros.cfg new file mode 100644 index 0000000..91b6297 --- /dev/null +++ b/config/variable_macros.cfg @@ -0,0 +1,35 @@ +[save_variables] +filename: ~/printer_data/config/storage/variables.cfg + +[gcode_macro VARIABLES] +variable_calibrate: "none" +gcode: + +[gcode_macro SET_FILAMENT_LOAD_STATE] +description: Sets the load state of the filament and saves it. +gcode: + {% if params.STATE in ['primed', 'loaded', 'unloaded', 'unloaded_waiting', 'processing'] %} + SAVE_VARIABLE VARIABLE=filament_load_state VALUE="'{params.STATE}'" + {action_respond_info("Filament state set to: %s " %(params.STATE) )} + {% else %} + {action_respond_info("filament state : %s : nope" %(params.STATE))} + {% endif %} + +[gcode_macro SET_HOTEND_FILAMENT] +gcode: + {% if params.NAME in printer.filaments.presets|map(attribute='name',default='None')%} + SAVE_VARIABLE VARIABLE=filament_hotend VALUE="'{params.NAME}'" + {action_respond_info("Hotend filament set to: %s " %(params.NAME) )} + {% else %} + {action_respond_info("invalid hotend filament name : %s : nope" %(params.NAME))} + {% endif %} + +[gcode_macro SET_EXTRUDER_FILAMENT] +gcode: + {action_respond_info("%s " %(params.NAME) )} + {% if (params.NAME in printer.filaments.presets|map(attribute='name',default='None')) or (params.NAME|string == "None") %} + SAVE_VARIABLE VARIABLE=filament_extruder VALUE="'{params.NAME}'" + {action_respond_info("Extruder filament set to: %s " %(params.NAME) )} + {% else %} + {action_respond_info("invalid extruder filament name : %s : nope" %(params.NAME))} + {% endif %} \ No newline at end of file diff --git a/mainsail.cfg b/mainsail.cfg new file mode 120000 index 0000000..9da96c7 --- /dev/null +++ b/mainsail.cfg @@ -0,0 +1 @@ +/home/cory/mainsail-config/client.cfg \ No newline at end of file diff --git a/moonraker.conf b/moonraker.conf new file mode 100644 index 0000000..e5d44cb --- /dev/null +++ b/moonraker.conf @@ -0,0 +1,60 @@ +[server] +host: 0.0.0.0 +port: 7125 +klippy_uds_address: /home/cory/printer_data/comms/klippy.sock + +[authorization] +trusted_clients: + 10.42.0.0/16 + 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 +cors_domains: + *.lan + *.local + *.internal + *://localhost + *://localhost:* + *://my.mainsail.xyz + *://app.fluidd.xyz + +[octoprint_compat] + +[history] + +[update_manager] +channel: dev +refresh_interval: 168 + +[update_manager mainsail-config] +type: git_repo +primary_branch: master +path: ~/mainsail-config +origin: https://github.com/mainsail-crew/mainsail-config.git +managed_services: klipper + +[update_manager mainsail] +type: web +channel: stable +repo: mainsail-crew/mainsail +path: ~/mainsail + + +[update_manager led_effect] +type: git_repo +path: ~/klipper-led_effect +origin: https://github.com/julianschill/klipper-led_effect.git +is_system_service: False + + +[update_manager client Filaments] +type: git_repo +path: ~/filaments-klipper-extra +primary_branch: mainline +origin: https://github.com/garethky/filaments-klipper-extra.git +install_script: install.sh +managed_services: klipper diff --git a/printer.cfg b/printer.cfg new file mode 100644 index 0000000..cf27d64 --- /dev/null +++ b/printer.cfg @@ -0,0 +1,425 @@ +[include shell_command.cfg] +# VORON2 250mm config + +# For other build sizes, controllers, or non-standard pin connections, please see +# https://github.com/mzbotreprap/VORON/tree/master/Firmware/Klipper/Voron_2.1/Klipper/Configurations +# for other example Klipper configs created by the VORON community. +## <---------------------- Main ----------------------> + +[include mainsail.cfg] +[include config/variable_macros.cfg] +[include config/macros.cfg] +[include config/overrides.cfg] +[include config/cooling.cfg] +[include config/leds.cfg] +[include config/eddy.cfg] +[include config/filament_sensors.cfg] +[include config/bash.cfg] +[include config/interface_macros.cfg] + +[virtual_sdcard] +path: /home/cory/printer_data/gcodes +on_error_gcode: CANCEL_PRINT + +[mcu] +##serial: /dev/serial/by-id/usb-Klipper_stm32h723xx_1E003E000D51313339373836-if00 +canbus_uuid: 21641089de00 + +[mcu printHead] +canbus_uuid: b8ebea905eb6 + +[printer] +kinematics: corexy +max_velocity: 700 +max_accel: 18000 +max_z_velocity: 80 +max_z_accel: 800 + +## <---------------------- Motors ----------------------> + +# Motor8 +# A motor +[tmc2209 stepper_y] +uart_pin: PC6 +diag_pin: +run_current: 2 +#stealthchop_threshold: 999999 +[stepper_y] +# A Stepper +step_pin: PC7 +dir_pin: PC8 +enable_pin: !PD2 +microsteps: 16 +rotation_distance: 40 +# 80 steps per mm - 1.8 deg - 1/16 microstepping +endstop_pin: ^PF4 +position_min: 0 +position_endstop: 258.2 +position_max: 258.2 +homing_speed: 100 +homing_retract_dist: 5 + +# Motor7 +# B motor +[tmc2209 stepper_x] +uart_pin: PD5 +run_current: 2 +#stealthchop_threshold: 999999 +[stepper_x] +step_pin: PD4 +dir_pin: PD3 +enable_pin: !PD6 +microsteps: 16 +rotation_distance: 40 +# 80 steps per mm - 1.8 deg - 1/16 microstepping +endstop_pin: printHead:PB6 +position_min: -0.4 +position_endstop: 253 +position_max: 254.4 +homing_speed: 100 +homing_retract_dist: 5 + +## <---------------------- Z STEPPERS ----------------------> + +[gcode_macro SET_Z_PARAMS] +gcode: +variable_run_current: 0.8 +variable_microsteps: 16 +variable_rotation_distance: 8 + +# Motor 1 +# Z0 Stepper - Front Left +[tmc2209 stepper_z] +uart_pin: PC13 +#diag_pin: PF3 +run_current: 0.4 +#stealthchop_threshold: 999999 +[stepper_z] +step_pin: PE6 +dir_pin: PE5 +enable_pin: !PC14 +microsteps: 16 +rotation_distance: 8 +# 400 steps per mm - 1.8 deg - 1/16 microstepping +endstop_pin: probe:z_virtual_endstop +# Offset (in mm) for nozzle to bed off z switch +position_max: 250 +position_min: -2 +# Set to -2 to allow room for squaring gantry with quad_gantry_level +homing_speed: 15.0 +second_homing_speed: 3.0 +homing_retract_dist: 3.0 + +# Motor 3 +# Z1 Stepper - Rear Left +[tmc2209 stepper_z1] +uart_pin: PB9 +#diag_pin: PF5 +run_current: 0.4 +#run_current: {printer.SET_Z_PARAMS.variable_run_current} +#stealthchop_threshold: 999999 +[stepper_z1] +step_pin: PB8 +dir_pin: !PB7 +enable_pin: !PE0 +microsteps: 16 +rotation_distance: 8 +# 400 steps per mm - 1.8 deg - 1/16 microstepping + +# Motor 4 +# Z2 Stepper - Rear Right +[tmc2209 stepper_z2] +uart_pin: PB5 +#diag_pin: PC0 +run_current: 0.4 +#stealthchop_threshold: 999999 +[stepper_z2] +step_pin: PB4 +dir_pin: PB3 +enable_pin: !PB6 + +microsteps: 16 +rotation_distance: 8 +# 400 steps per mm - 1.8 deg - 1/16 microstepping + +# Motor 2 +# Z3 Stepper - Front Right +[tmc2209 stepper_z3] +uart_pin: PE3 +#diag_pin: PF4 +run_current: 0.4 +#stealthchop_threshold: 999999 +[stepper_z3] + +step_pin: PE2 +dir_pin: !PE1 +enable_pin: !PE4 + +microsteps: 16 +rotation_distance: 8 +# 400 steps per mm - 1.8 deg - 1/16 microstepping + + +## <---------------------- HEATERS ----------------------> + +[tmc2209 extruder] +uart_pin: printHead:PA15 +#diag_pin: PF4 +run_current: 0.4 +#stealthchop_threshold: 999999 +[extruder] +step_pin: printHead:PD0 +dir_pin: printHead:PD1 +enable_pin: !printHead:PD2 + +microsteps: 16 +rotation_distance: 8.964 +# 555 steps per mm - 1.8 deg - 1/16 microstepping (Mobius2) +nozzle_diameter: 0.400 +filament_diameter: 1.750 +max_extrude_cross_section: 99 +max_extrude_only_distance: 780.0 +# This is set high to allow the load/unload filament macros to run +heater_pin: printHead:PB13 +# D10 on mcu_xye +max_power: 1.0 +sensor_type: PT1000 +#sensor_pin: printHead:PA3 +sensor_pin: PB0 + +smooth_time: 3.0 +control: pid +pid_Kp: 17.819 +pid_Ki: 0.935 +pid_Kd: 84.861 +min_extrude_temp: -10 +min_temp: -40 +max_temp: 320 +pressure_advance: 0.03 + +[heater_bed] +heater_pin: PA1 +# D11 (servo) on mcu_z +sensor_type: Generic 3950 +sensor_pin: PB1 + +smooth_time: 3.0 +max_power: 0.75 +control: pid +pid_Kp: 47.690 +pid_Ki: 1.556 +pid_Kd: 365.338 +min_temp: -100 +max_temp: 130 + +[adxl345] +cs_pin: printHead:PB12 +spi_software_sclk_pin: printHead:PB10 +spi_software_mosi_pin: printHead:PB11 +spi_software_miso_pin: printHead:PB2 +axes_map: z,-y,x + +# [resonance_tester] +# probe_points:125, 125, 20 +# # A list of X, Y, Z coordinates of points (one point per line) to test +# # resonances at. At least one point is required. Make sure that all +# # points with some safety margin in XY plane (~a few centimeters) +# # are reachable by the toolhead. +# accel_chip:adxl345 +# # A name of the accelerometer chip to use for measurements. If +# # adxl345 chip was defined without an explicit name, this parameter +# # can simply reference it as "accel_chip: adxl345", otherwise an +# # explicit name must be supplied as well, e.g. "accel_chip: adxl345 +# # my_chip_name". Either this, or the next two parameters must be +# # set. +# #max_smoothing: +# # Maximum input shaper smoothing to allow for each axis during shaper +# # auto-calibration (with 'SHAPER_CALIBRATE' command). By default no +# # maximum smoothing is specified. Refer to Measuring_Resonances guide +# # for more details on using this feature. +# move_speed: 50 +# # The speed (in mm/s) to move the toolhead to and between test points +# # during the calibration. The default is 50. +# min_freq: 5 +# # Minimum frequency to test for resonances. The default is 5 Hz. +# max_freq: 200 +# # Maximum frequency to test for resonances. The default is 133.33 Hz. +# accel_per_hz: 180 +# # This parameter is used to determine which acceleration to use to +# # test a specific frequency: accel = accel_per_hz * freq. Higher the +# # value, the higher is the energy of the oscillations. Can be set to +# # a lower than the default value if the resonances get too strong on +# # the printer. However, lower values make measurements of +# # high-frequency resonances less precise. The default value is 75 +# # (mm/sec). +# hz_per_sec: 1 +# # Determines the speed of the test. When testing all frequencies in +# # range [min_freq, max_freq], each second the frequency increases by +# # hz_per_sec. Small values make the test slow, and the large values +# # will decrease the precision of the test. The default value is 1.0 +# # (Hz/sec == sec^-2). +# #sweeping_accel: 400 +# # An acceleration of slow sweeping moves. The default is 400 mm/sec^2. +# sweeping_period: 1.2 +# # A period of slow sweeping moves. Setting this parameter to 0 +# # disables slow sweeping moves. Avoid setting it to a too small +# # non-zero value in order to not poison the measurements. +# # The default is 1.2 sec which is a good all-round choice. + +[resonance_tester] +probe_points:125, 125, 20 +# A list of X, Y, Z coordinates of points (one point per line) to test +# resonances at. At least one point is required. Make sure that all +# points with some safety margin in XY plane (~a few centimeters) +# are reachable by the toolhead. +accel_chip:adxl345 +# A name of the accelerometer chip to use for measurements. If +# adxl345 chip was defined without an explicit name, this parameter +# can simply reference it as "accel_chip: adxl345", otherwise an +# explicit name must be supplied as well, e.g. "accel_chip: adxl345 +# my_chip_name". Either this, or the next two parameters must be +# set. +#max_smoothing: +# Maximum input shaper smoothing to allow for each axis during shaper +# auto-calibration (with 'SHAPER_CALIBRATE' command). By default no +# maximum smoothing is specified. Refer to Measuring_Resonances guide +# for more details on using this feature. +move_speed: 100 +# The speed (in mm/s) to move the toolhead to and between test points +# during the calibration. The default is 50. +min_freq: 160 +# Minimum frequency to test for resonances. The default is 5 Hz. +max_freq: 200 +# Maximum frequency to test for resonances. The default is 133.33 Hz. +accel_per_hz: 300 +# This parameter is used to determine which acceleration to use to +# test a specific frequency: accel = accel_per_hz * freq. Higher the +# value, the higher is the energy of the oscillations. Can be set to +# a lower than the default value if the resonances get too strong on +# the printer. However, lower values make measurements of +# high-frequency resonances less precise. The default value is 75 +# (mm/sec). +hz_per_sec: 2 +# Determines the speed of the test. When testing all frequencies in +# range [min_freq, max_freq], each second the frequency increases by +# hz_per_sec. Small values make the test slow, and the large values +# will decrease the precision of the test. The default value is 1.0 +# (Hz/sec == sec^-2). +#sweeping_accel: 400 +# An acceleration of slow sweeping moves. The default is 400 mm/sec^2. +sweeping_period: 1.2 +# A period of slow sweeping moves. Setting this parameter to 0 +# disables slow sweeping moves. Avoid setting it to a too small +# non-zero value in order to not poison the measurements. +# The default is 1.2 sec which is a good all-round choice. +# [input_shaper] +# shaper_freq_x: 47 +# # A frequency (in Hz) of the input shaper for X axis. This is +# # usually a resonance frequency of X axis that the input shaper +# # should suppress. For more complex shapers, like 2- and 3-hump EI +# # input shapers, this parameter can be set from different +# # considerations. The default value is 0, which disables input +# # shaping for X axis. +# shaper_freq_y: 51.8 +# # A frequency (in Hz) of the input shaper for Y axis. This is +# # usually a resonance frequency of Y axis that the input shaper +# # should suppress. For more complex shapers, like 2- and 3-hump EI +# # input shapers, this parameter can be set from different +# # considerations. The default value is 0, which disables input +# # shaping for Y axis. +# shaper_type: ei +# # A type of the input shaper to use for both X and Y axes. Supported +# # shapers are zv, mzv, zvd, ei, 2hump_ei, and 3hump_ei. The default +# # is mzv input shaper. +# #shaper_type_x: +# #shaper_type_y: +# # If shaper_type is not set, these two parameters can be used to +# # configure different input shapers for X and Y axes. The same +# # values are supported as for shaper_type parameter. +# #damping_ratio_x: 0.1 +# #damping_ratio_y: 0.1 +# # Damping ratios of vibrations of X and Y axes used by input shapers +# # to improve vibration suppression. Default value is 0.1 which is a +# # good all-round value for most printers. In most circumstances this +# # parameter requires no tuning and should not be changed. + +#*# <---------------------- SAVE_CONFIG ----------------------> +#*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated. +#*# +#*# [probe_eddy_current btt_eddy] +#*# reg_drive_current = 15 +#*# calibrate = +#*# 0.050000:3255467.111,0.090000:3254656.814,0.130000:3253788.008, +#*# 0.170000:3252990.251,0.210000:3252128.782,0.250000:3251356.895, +#*# 0.290000:3250508.063,0.330000:3249757.454,0.370000:3248887.928, +#*# 0.410000:3248135.471,0.450000:3247342.440,0.490000:3246606.470, +#*# 0.530000:3245821.355,0.570000:3245111.913,0.610000:3244344.145, +#*# 0.650000:3243649.260,0.690000:3242897.605,0.730000:3242229.037, +#*# 0.770000:3241471.787,0.810000:3240807.107,0.850000:3240093.794, +#*# 0.890000:3239469.697,0.930000:3238746.314,0.970000:3238134.699, +#*# 1.010000:3237447.197,1.050000:3236852.176,1.090000:3236180.000, +#*# 1.130000:3235583.458,1.170000:3234964.113,1.210000:3234377.235, +#*# 1.250000:3233763.043,1.290000:3233187.214,1.330000:3232594.823, +#*# 1.370000:3232051.830,1.410000:3231445.633,1.450000:3230954.755, +#*# 1.490000:3230393.180,1.530000:3229876.514,1.570000:3229326.537, +#*# 1.610000:3228821.007,1.650000:3228294.514,1.690000:3227849.153, +#*# 1.730000:3227302.108,1.770000:3226857.668,1.810000:3226337.031, +#*# 1.850000:3225893.968,1.890000:3225433.311,1.930000:3224969.831, +#*# 1.970000:3224508.982,2.010000:3224116.310,2.050000:3223676.950, +#*# 2.090000:3223240.900,2.130000:3222819.040,2.170000:3222414.028, +#*# 2.210000:3222026.540,2.250000:3221631.561,2.290000:3221220.395, +#*# 2.330000:3220878.385,2.370000:3220500.836,2.410000:3220133.289, +#*# 2.450000:3219712.852,2.490000:3219384.426,2.530000:3219020.614, +#*# 2.570000:3218700.648,2.610000:3218328.645,2.650000:3218005.363, +#*# 2.690000:3217675.452,2.730000:3217356.936,2.770000:3217022.363, +#*# 2.810000:3216715.926,2.850000:3216411.896,2.890000:3216124.629, +#*# 2.930000:3215806.315,2.970000:3215517.625,3.010000:3215223.021, +#*# 3.050000:3214948.252,3.090000:3214666.294,3.130000:3214412.867, +#*# 3.170000:3214128.343,3.210000:3213859.368,3.250000:3213586.975, +#*# 3.290000:3213343.926,3.330000:3213117.185,3.370000:3212836.145, +#*# 3.410000:3212602.835,3.450000:3212373.308,3.490000:3212102.939, +#*# 3.530000:3211895.758,3.570000:3211654.635,3.610000:3211432.972, +#*# 3.650000:3211201.284,3.690000:3210989.952,3.730000:3210775.334, +#*# 3.770000:3210556.110,3.810000:3210360.495,3.850000:3210160.520, +#*# 3.890000:3209951.581,3.930000:3209748.502,3.970000:3209535.904, +#*# 4.010000:3209340.125,4.050000:3209153.735 +#*# +#*# [temperature_probe btt_eddy] +#*# calibration_temp = 34.741757 +#*# drift_calibration = +#*# 3272333.682265, -526.989413, 2.607138 +#*# 3258251.109151, -387.159505, 1.632471 +#*# 3244617.878134, -215.564759, 0.452720 +#*# 3233871.493027, -96.278221, -0.324104 +#*# 3225894.041120, -30.996016, -0.674966 +#*# 3219244.051778, 28.071158, -1.026192 +#*# 3214408.266035, 57.370842, -1.164652 +#*# 3210042.647922, 96.846177, -1.427595 +#*# 3207049.634270, 106.935506, -1.439385 +#*# drift_calibration_min_temp = 40.822170811255326 +#*# +#*# [bed_mesh default] +#*# version = 1 +#*# points = +#*# 0.137485, 0.147651, 0.147765, 0.144464, 0.140674, 0.133303, 0.141993, 0.143746, 0.142624, 0.147563, 0.141592, 0.131627, 0.137083, 0.131629, 0.126803, 0.121864, 0.115289, 0.110268, 0.106071, 0.098738, 0.094542, 0.091574, 0.094923, 0.081787, 0.080043, 0.069332, 0.065545, 0.060891, 0.057940, 0.049297, 0.041405, 0.034115, 0.035432, 0.032680, 0.025104, 0.017528, 0.014022, 0.005916, -0.006553, -0.030834 +#*# 0.099253, 0.119941, 0.119308, 0.122697, 0.120227, 0.121462, 0.115001, 0.123932, 0.118524, 0.120344, 0.123731, 0.123818, 0.121263, 0.123013, 0.117557, 0.105358, 0.099253, 0.103732, 0.091804, 0.089150, 0.086181, 0.078617, 0.077388, 0.072711, 0.066348, 0.060848, 0.059574, 0.053517, 0.046310, 0.037184, 0.033397, 0.029590, 0.026181, 0.030763, 0.020426, 0.017057, 0.009718, 0.000882, 0.001116, -0.013491 +#*# 0.103134, 0.115604, 0.116522, 0.113652, 0.115489, 0.113050, 0.113567, 0.115920, 0.108327, 0.116437, 0.115920, 0.114684, 0.117643, 0.111096, 0.110352, 0.102820, 0.095571, 0.088122, 0.084953, 0.083528, 0.077305, 0.072197, 0.074452, 0.066664, 0.059056, 0.063160, 0.061008, 0.053039, 0.046226, 0.039455, 0.037701, 0.034514, 0.031246, 0.022717, 0.021034, 0.012336, 0.013413, 0.011635, -0.001036, -0.019843 +#*# 0.063678, 0.082099, 0.083412, 0.077820, 0.078733, 0.081387, 0.079445, 0.082415, 0.089548, 0.084754, 0.089465, 0.086695, 0.090776, 0.083610, 0.080501, 0.073424, 0.068099, 0.067065, 0.063762, 0.060692, 0.063878, 0.054235, 0.055752, 0.049414, 0.052799, 0.050448, 0.048979, 0.044994, 0.033398, 0.032880, 0.030155, 0.028110, 0.023747, 0.019957, 0.012712, 0.012105, 0.005605, 0.001628, -0.002580, -0.015872 +#*# 0.045192, 0.059574, 0.061925, 0.061925, 0.058022, 0.060159, 0.065429, 0.066146, 0.059174, 0.059890, 0.058139, 0.060174, 0.060607, 0.062244, 0.054953, 0.050730, 0.051765, 0.048061, 0.042123, 0.042840, 0.043875, 0.034287, 0.041805, 0.039853, 0.036267, 0.031527, 0.030196, 0.023325, 0.021737, 0.016685, 0.016314, 0.019679, 0.013553, 0.003311, 0.004763, -0.000662, -0.004262, -0.010022, -0.013323, -0.031099 +#*# 0.019818, 0.048063, 0.057505, 0.054236, 0.060607, 0.059736, 0.065113, 0.058655, 0.059773, 0.062960, 0.058539, 0.062760, 0.067382, 0.065630, 0.059257, 0.059773, 0.050731, 0.056504, 0.063995, 0.065831, 0.064512, 0.062072, 0.058338, 0.043758, 0.041924, 0.040771, 0.039136, 0.042523, 0.036984, 0.036066, 0.029452, 0.029729, 0.027022, 0.023325, 0.026084, 0.023698, 0.020659, 0.010046, 0.001239, -0.009186 +#*# 0.033398, 0.044793, 0.049413, 0.052084, 0.053917, 0.050331, 0.055670, 0.053001, 0.057422, 0.056904, 0.060090, 0.059974, 0.055470, 0.058512, 0.049095, 0.045192, 0.047262, 0.056186, 0.060091, 0.062244, 0.065230, 0.056069, 0.055152, 0.049214, 0.045828, 0.042123, 0.039454, 0.042006, 0.035232, 0.034287, 0.034833, 0.033280, 0.027534, 0.027160, 0.017761, 0.018231, 0.017995, 0.018273, 0.002098, -0.011234 +#*# 0.010421, 0.028609, 0.037185, 0.035351, 0.036984, 0.045910, 0.046944, 0.050131, 0.046827, 0.052084, 0.052883, 0.055470, 0.055218, 0.049813, 0.042006, 0.049214, 0.043557, 0.041407, 0.042841, 0.039018, 0.041606, 0.042005, 0.039136, 0.041605, 0.035115, 0.042323, 0.041006, 0.037102, 0.030666, 0.039069, 0.028421, 0.032163, 0.026691, 0.030058, 0.027769, 0.028376, 0.020053, 0.026691, 0.016077, 0.004154 +#*# 0.022344, 0.029963, 0.035150, 0.042723, 0.036584, 0.038737, 0.043558, 0.046188, 0.043959, 0.046944, 0.042405, 0.048580, 0.047663, 0.051884, 0.045910, 0.043157, 0.048062, 0.043875, 0.043758, 0.041206, 0.042841, 0.042123, 0.036984, 0.044541, 0.039654, 0.033915, 0.036585, 0.029313, 0.030665, 0.027769, 0.029452, 0.014862, 0.022204, 0.015001, 0.018231, 0.014160, 0.014160, 0.012103, 0.003547, -0.006428 +#*# -0.000053, 0.018977, 0.027300, 0.033398, 0.034289, 0.041488, 0.038737, 0.038736, 0.037501, 0.036784, 0.044075, 0.044156, 0.041405, 0.043675, 0.039854, 0.041605, 0.045392, 0.044792, 0.038619, 0.043958, 0.040570, 0.040983, 0.040488, 0.035750, 0.037820, 0.031127, 0.033480, 0.034633, 0.033597, 0.028845, 0.026927, 0.018507, 0.017154, 0.016077, 0.016452, 0.017762, 0.018602, 0.017011, 0.011262, -0.003933 +#*# 0.010419, 0.010047, 0.000787, 0.000648, 0.006818, 0.007756, 0.008502, 0.007288, 0.014159, 0.009813, 0.010656, 0.009204, 0.013042, 0.011400, 0.001257, 0.010406, 0.007052, 0.000179, 0.001021, 0.003313, 0.006915, 0.006073, 0.005838, 0.009438, -0.002112, 0.000787, -0.000803, -0.005618, -0.011443, -0.009605, -0.002484, -0.007206, -0.014772, -0.013491, -0.016500, -0.012947, -0.016165, -0.021138, -0.025651, -0.042994 +#*# 0.071484, 0.059774, 0.044075, 0.032763, 0.020053, 0.019957, 0.024635, 0.013882, 0.019915, 0.018135, 0.010717, 0.006914, 0.005604, 0.006211, -0.002112, 0.000788, -0.008611, -0.004402, -0.008611, -0.011109, -0.008515, -0.003186, -0.006554, -0.011652, -0.009394, -0.014369, -0.005712, -0.014883, -0.011568, -0.009729, -0.006458, -0.006459, -0.004308, -0.006319, -0.006086, -0.009938, -0.008143, -0.008976, -0.014242, -0.018882 +#*# x_count = 40 +#*# y_count = 12 +#*# mesh_x_pps = 2 +#*# mesh_y_pps = 2 +#*# algo = bicubic +#*# tension = 0.2 +#*# min_x = 15.0 +#*# max_x = 238.86 +#*# min_y = 22.0 +#*# max_y = 238.92 diff --git a/shell_command.cfg b/shell_command.cfg new file mode 100644 index 0000000..34e7581 --- /dev/null +++ b/shell_command.cfg @@ -0,0 +1,7 @@ +[gcode_shell_command hello_world] +command: echo hello world +timeout: 2. +verbose: True +[gcode_macro HELLO_WORLD] +gcode: + RUN_SHELL_COMMAND CMD=hello_world \ No newline at end of file