Skip to content

Commit

Permalink
sample macros
Browse files Browse the repository at this point in the history
  • Loading branch information
rootiest committed May 13, 2023
1 parent 228cfa2 commit 2e193b5
Show file tree
Hide file tree
Showing 2 changed files with 122 additions and 0 deletions.
93 changes: 93 additions & 0 deletions dev/discord_print.cfg
Original file line number Diff line number Diff line change
@@ -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
29 changes: 29 additions & 0 deletions dev/dual_sensors.cfg
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 2e193b5

Please sign in to comment.