Skip to content

Commit

Permalink
globals: Use _KM_OPTIONS for end-user startup gcode
Browse files Browse the repository at this point in the history
Allows end-user startup customization by running _KM_OPTIONS gcode
at startup, immediately after our macros initialize.
  • Loading branch information
jschuh committed Oct 28, 2022
1 parent 576def9 commit a1f8a34
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,12 @@ overridden by creating a corresponding variable with a new value in your
# {'name' : 'PLA', 'extruder' : 200.0, 'bed' : 60.0},
# {'name' : 'PETG', 'extruder' : 230.0, 'bed' : 85.0},
# {'name' : 'ABS', 'extruder' : 245.0, 'bed' : 110.0, 'chamber' : 60}]
gcode: # This line required by Klipper.
gcode:
# Any code you put here will run at klipper startup, after the initialization
# for these macros. For example, you could uncomment the following line to
# automatically adjust your bed surface offsets to account for any changes made
# to your Z endstop or probe offset.
# ADJUST_SURFACE_OFFSETS
# This line includes all the standard macros.
[include klipper-macros/*.cfg]
Expand Down
2 changes: 2 additions & 0 deletions globals.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ gcode:
# This needs to be its own macro so it gets evaluated after _KM_GLOBALS runs.
_CHECK_GLOBALS
_INIT_SURFACES
# This is any end-user gcode that need to run after macro initialization.
_KM_OPTIONS

[gcode_macro _check_globals]
description: Checks global variables and stops printer on an invalid value.
Expand Down

0 comments on commit a1f8a34

Please sign in to comment.