From 2e193b596dc7a31551200d2853801c65af70b37a Mon Sep 17 00:00:00 2001 From: Chris Date: Sat, 13 May 2023 06:49:38 -0400 Subject: [PATCH] sample macros --- dev/discord_print.cfg | 93 +++++++++++++++++++++++++++++++++++++++++++ dev/dual_sensors.cfg | 29 ++++++++++++++ 2 files changed, 122 insertions(+) create mode 100644 dev/discord_print.cfg create mode 100644 dev/dual_sensors.cfg diff --git a/dev/discord_print.cfg b/dev/discord_print.cfg new file mode 100644 index 0000000..5aca704 --- /dev/null +++ b/dev/discord_print.cfg @@ -0,0 +1,93 @@ +# Start G-Code: +# +# START_PRINT BED_TEMP_0={first_layer_bed_temperature[0]} BED_TEMP1={first_layer_bed_temperature[1]} EXTRUDER_TEMP_0={first_layer_temperature[0]} EXTRUDER_TEMP_1={first_layer_temperature[1]} INITIAL_EXTRUDER={initial_extruder} INITIAL_EXTRUDER_TEMP={first_layer_temperature[initial_extruder]} INITIAL_BED_TEMP={first_layer_bed_temperature[initial_extruder]} START_X_MIN={first_layer_print_min[0]} START_Y_MIN={first_layer_print_min[1]} START_X_MAX={first_layer_print_max[0]} START_Y_MAX={first_layer_print_max[1]} +# +# + + +[gcode_macro START_PRINT] +gcode: + {% set bed_temp_0 = params.BED_TEMP_0|default(60)|float %} + {% set bed_temp_1 = params.BED_TEMP_1|default(60)|float %} + {% set extruder_temp_0 = params.EXTRUDER_TEMP_0|default(200)|float %} + {% set extruder_temp_1 = params.EXTRUDER_TEMP_1|default(200)|float %} + {% set initial_extruder = params.INITIAL_EXTRUDER|default(0)|int %} + {% set initial_extruder_temp = params.INITIAL_EXTRUDER_TEMP|default(200)|int %} + {% set initial_bed_temp = params.INITIAL_BED_TEMP|default(60)|int %} + {% set first_layer_print_min_x = params.START_X_MIN %} + {% set first_layer_print_min_y = params.START_Y_MIN %} + {% set first_layer_print_max_x = params.START_X_MAX %} + {% set first_layer_print_max_y = params.START_Y_MAX %} + ; set rpi fan to full + SET_FAN_SPEED FAN=rpi SPEED=1 + ; set bed temperature + M118{"Bed Set to Temp "}{max(bed_temp_0, bed_temp_1)} + M140 S{max(bed_temp_0, bed_temp_1)} + ; set standby temp, extruder 0 + {% if extruder_temp_0 > 50 %} + M118{"T0 Set to Standby Temp "}{round(extruder_temp_0*.85)} + M104 S{round(extruder_temp_0*.85)} T0 + {% else %} + M118{"T0 Set to Temp Off"} + M104 S0 T0 + {% endif %} + ; set standby temp, extruder 1 + {% if extruder_temp_1 > 50 %} + M118{"T1 Set to Standby Temp "}{round(extruder_temp_1*.85)} + M104 S{round(extruder_temp_1*.85)} T1 + {% else %} + M118{"T1 Set to Temp Off "} + M104 S0 T1 + {% endif %} + ; set initial temp, initial extruder + M118{"T"}[initial_extruder]{" Initial Extruder Set to Temp "}{initial_extruder_temp} + M104 S{initial_extruder_temp} T[initial_extruder] + ; heat to temp, bed temperature + M118{"Bed Heating to Temp "}{max(bed_temp_0, bed_temp_1)} + M190 S{max(bed_temp_0, bed_temp_1)} + ; heat to temp, initial extruder + M118{"T"}[initial_extruder]{" Initial Extruder Heating to Temp "}{initial_extruder_temp} + M109 S{initial_extruder_temp} T[initial_extruder] + ; heat soak, bed temperature + M118{"Bed Heat Soaking to Temp "}{max(bed_temp_0, bed_temp_1)} + G4 P60000 + ; home, tram gantry, and home + G34 + ; auto bed leveling + ;G29 + ; auto bed leveling, only active print area + BED_MESH_CALIBRATE PRINT_MIN={first_layer_print_min_x},{first_layer_print_min_y} PRINT_MAX={first_layer_print_max_x},{first_layer_print_max_y} FORCE_NEW_MESH=True + ; park extruders + _PARK_extruder1 + _PARK_extruder + ; initiate extruder + T[initial_extruder] + + + +# End G-Code: +# +# END_PRINT +# +# + +[gcode_macro END_PRINT] +gcode: + ; zero rpi fan + SET_FAN_SPEED FAN=rpi SPEED=0 + ; turn off heaters + TURN_OFF_HEATERS + ; raise z + G91 + G0 Z5 F500 + G90 + ; kill fan + M107 + ; park extruders + _PARK_extruder1 + _PARK_extruder + T0 + ; present print + BED_PRESENT + ; disable steppers + M18 \ No newline at end of file diff --git a/dev/dual_sensors.cfg b/dev/dual_sensors.cfg new file mode 100644 index 0000000..d5f9475 --- /dev/null +++ b/dev/dual_sensors.cfg @@ -0,0 +1,29 @@ +[filament_motion_sensor extruder0] +pause_on_runout: False ; pause handled by macro +runout_gcode: + FILAMENT_RUNOUT EXTRUDER=0 ; trigger filament runout + +[filament_motion_sensor extruder1] +pause_on_runout: False ; pause handled by macro +runout_gcode: + FILAMENT_RUNOUT EXTRUDER=1 ; trigger filament runout + +[gcode_macro filament_runout] +variable_extruder: 0 +gcode: + {% set runout = params.extruder|int|default(0) %} + {% if extruder == 0 and runout == 0 %} + M600 + {% elif extruder == 1 and runout == 1 %} + M600 + {% endif %} + +[gcode_macro T0] +gcode: + SET_GCODE_VARIABLE MACRO=filament_runout VARIABLE=extruder VALUE=0 + # etc + +[gcode_macro T1] +gcode: + SET_GCODE_VARIABLE MACRO=filament_runout VARIABLE=extruder VALUE=1 + # etc \ No newline at end of file