Newer
Older
jeltz-klipper-config / config / variable_macros.cfg
[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 %}