===== Config file ===== [gcode_macro ECHO_T_VARS] description = Echo Toolhead variables to the console. gcode = {% set t = params.T|default(0) %} RATOS_ECHO MSG="T{t} Variables" {% for var, value in printer["gcode_macro T%s" % t].items() %} {action_respond_info(var ~ ": " ~ value)} {% endfor %} [gcode_macro ECHO_RATOS_VARS] description = Echo RatOS variables to the console. gcode = {% for var, value in printer["gcode_macro RatOS"].items() %} {action_respond_info(var ~ ": " ~ value)} {% endfor %} [gcode_macro RatOS] description = RatOS variable storage macro, will echo variables to the console when run. variable_relative_extrusion = False variable_force_absolute_position = False variable_preheat_extruder = True variable_preheat_extruder_temp = 150 variable_macro_travel_speed = 150 variable_macro_travel_accel = 2000 variable_macro_z_speed = 15 variable_bed_margin_x = [0, 0] variable_bed_margin_y = [0, 0] variable_printable_x_min = 0 variable_printable_x_max = 0 variable_printable_y_min = 0 variable_printable_y_max = 0 variable_end_print_motors_off = True variable_status_color_ok = "00FF00" variable_status_color_error = "FF0000" variable_status_color_unknown = "FFFF00" variable_end_print_retract_filament = 10 gcode = ECHO_RATOS_VARS [delayed_gcode RATOS_INIT] initial_duration = 0.1 gcode = RATOS_ECHO MSG="Welcome to RatOS!" RATOS_ECHO MSG="Please setup your printer through the RatOS configurator. Use the link in the sidebar to proceed with the setup." [delayed_gcode RATOS_LOGO] initial_duration = 2 gcode = HELLO_RATOS [gcode_macro INITIAL_FRONTEND_UPDATE] gcode = {% set color_ok = printer["gcode_macro RatOS"].status_color_ok|string %} {% set color_error = printer["gcode_macro RatOS"].status_color_error|string %} {% set color_unknown = printer["gcode_macro RatOS"].status_color_unknown|string %} SET_GCODE_VARIABLE MACRO=T0 VARIABLE=color VALUE='"{color_unknown}"' {% if printer["dual_carriage"] is defined %} SET_GCODE_VARIABLE MACRO=T1 VARIABLE=color VALUE='"{color_unknown}"' {% endif %} {% set t0_sensor = "undefined" %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t0"] is defined %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t0"].enabled|lower == "true" %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t0"].filament_detected|lower == "true" %} {% set t0_sensor = "detected" %} {% else %} {% set t0_sensor = "empty" %} {% endif %} {% else %} {% set t0_sensor = "disabled" %} {% endif %} {% endif %} {% set t1_sensor = "undefined" %} {% if printer["dual_carriage"] is defined and printer["filament_switch_sensor toolhead_filament_sensor_t1"] is defined %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t1"].enabled|lower == "true" %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t1"].filament_detected|lower == "true" %} {% set t1_sensor = "detected" %} {% else %} {% set t1_sensor = "empty" %} {% endif %} {% else %} {% set t1_sensor = "disabled" %} {% endif %} {% endif %} {% set svv = printer.save_variables.variables %} {% if svv.t0_filament is defined and printer["gcode_macro T0"] is defined %} {% if printer["gcode_macro T0"].filament_name is defined and printer["gcode_macro T0"].filament_type is defined and printer["gcode_macro T0"].filament_temp is defined %} {% if t0_sensor != "empty" %} {% set t0_filament_type = svv.t0_filament[0]|default('')|string %} {% set t0_filament_name = svv.t0_filament[1]|default('')|string %} {% set t0_filament_temp = svv.t0_filament[2]|default(0)|float %} {% if t0_filament_name != '' and t0_filament_type != '' and t0_filament_temp > 0 %} SET_GCODE_VARIABLE MACRO=T0 VARIABLE=color VALUE='"{color_ok}"' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_name VALUE='"{t0_filament_name}"' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_type VALUE='"{t0_filament_type}"' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_temp VALUE={t0_filament_temp} {% endif %} {% else %} SAVE_VARIABLE VARIABLE=t0_filament VALUE="('""', '""', 0)" SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_name VALUE='""' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_type VALUE='""' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_temp VALUE=0 {% endif %} {% endif %} {% endif %} {% if svv.t1_filament is defined and printer["gcode_macro T1"] is defined %} {% if printer["gcode_macro T1"].filament_name is defined and printer["gcode_macro T1"].filament_type is defined and printer["gcode_macro T1"].filament_temp is defined %} {% if t1_sensor != "empty" %} {% set t1_filament_type = svv.t1_filament[0]|default('')|string %} {% set t1_filament_name = svv.t1_filament[1]|default('')|string %} {% set t1_filament_temp = svv.t1_filament[2]|default(0)|float %} {% if t1_filament_name != '' and t1_filament_type != '' and t1_filament_temp > 0 %} SET_GCODE_VARIABLE MACRO=T1 VARIABLE=color VALUE='"{color_ok}"' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_name VALUE='"{t1_filament_name}"' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_type VALUE='"{t1_filament_type}"' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_temp VALUE={t1_filament_temp} {% endif %} {% else %} SAVE_VARIABLE VARIABLE=t1_filament VALUE="('""', '""', 0)" SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_name VALUE='""' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_type VALUE='""' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_temp VALUE=0 {% endif %} {% endif %} {% endif %} [gcode_macro CALCULATE_PRINTABLE_AREA] gcode = {% set bed_margin_x = printer["gcode_macro RatOS"].bed_margin_x %} {% set bed_margin_y = printer["gcode_macro RatOS"].bed_margin_y %} {% set tool = 0 if printer["gcode_macro T0"] is not defined or printer["gcode_macro T0"].active else 1 %} {% set max_x = printer.toolhead.axis_maximum.x if printer["dual_carriage"] is defined and tool == 0 else printer.toolhead.axis_maximum.x - bed_margin_x[1] %} {% if printer["dual_carriage"] is defined %} {% set max_x = printer.toolhead.axis_maximum.x %} {% endif %} DEBUG_ECHO PREFIX="CALCULATE_PRINTABLE_AREA" MSG="printer.toolhead.axis_maximum.x {printer.toolhead.axis_maximum.x}" {% set max_y = printer.toolhead.axis_maximum.y - bed_margin_y[1]%} SET_GCODE_VARIABLE MACRO=RatOS VARIABLE=printable_x_max VALUE={max_x} SET_GCODE_VARIABLE MACRO=RatOS VARIABLE=printable_y_max VALUE={max_y} DEBUG_ECHO PREFIX="CALCULATE_PRINTABLE_AREA" MSG="Printable area calculated: X: 0,{max_x} Y: 0,{max_y}" [gcode_macro CACHE_TOOLHEAD_SETTINGS] variable_cache = {"global": {"accel": 1000, "ratio": 0.5, "speed": 50, "scv": 5}} gcode = {% set key = "global" %} {% if params.KEY is defined %} {% set key = params.KEY %} {% endif %} {% set dummy = cache.__setitem__(key, {"accel": printer.toolhead.max_accel, "ratio": printer.toolhead.minimum_cruise_ratio, "speed": printer.toolhead.max_velocity, "scv": printer.toolhead.square_corner_velocity}) %} SET_GCODE_VARIABLE MACRO=CACHE_TOOLHEAD_SETTINGS VARIABLE=cache VALUE="{cache | pprint | replace("\n", "") | replace("\"", "\\\"")}" DEBUG_ECHO PREFIX="CACHE_TOOLHEAD_SETTINGS" MSG="Toolhead settings cached for {key}. {printer.toolhead.max_accel} accel, {printer.toolhead.minimum_cruise_ratio} ratio, {printer.toolhead.max_velocity} velocity, {printer.toolhead.square_corner_velocity} scv." [gcode_macro RESTORE_TOOLHEAD_SETTINGS] gcode = {% set key = "global" %} {% if params.KEY is defined %} {% set key = params.KEY %} {% endif %} {% set values = printer["gcode_macro CACHE_TOOLHEAD_SETTINGS"].cache.__getitem__(key) %} {% if values is not defined or values == 'None' %} { action_raise_error("RESTORE_TOOLHEAD_SETTINGS: Toolhead settings not cached for key '" ~ key ~ "'.") } {% endif %} SET_VELOCITY_LIMIT ACCEL={values.accel} MINIMUM_CRUISE_RATIO={values.ratio} VELOCITY={values.speed} SQUARE_CORNER_VELOCITY={values.scv} DEBUG_ECHO PREFIX="RESTORE_TOOLHEAD_SETTINGS" MSG="Toolhead settings restored. {values.accel} accel, {values.ratio} ratio, {values.speed} velocity, {values.scv} scv." [gcode_macro SET_MACRO_TRAVEL_SETTINGS] gcode = {% set speed = printer["gcode_macro RatOS"].macro_travel_speed|float * 60 %} {% set accel = printer["gcode_macro RatOS"].macro_travel_accel %} SET_VELOCITY_LIMIT ACCEL={accel} MINIMUM_CRUISE_RATIO=0.5 VELOCITY={speed} SQUARE_CORNER_VELOCITY={5} DEBUG_ECHO PREFIX="SET_MACRO_TRAVEL_SETTINGS" MSG="Macro travel settings set. {accel} accel, {speed} velocity" [gcode_macro SET_CENTER_KINEMATIC_POSITION] description = FOR DEBUGGING PURPOSES ONLY. Sets the internal printer kinematic state to the center of all axes regardless of actual physical position. gcode = {% set printable_x_max = printer["gcode_macro RatOS"].printable_x_max|float %} {% set printable_y_max = printer["gcode_macro RatOS"].printable_y_max|float %} RATOS_ECHO MSG="WARNING: ONLY USE SET_CENTER_KINEMATIC_POSITION FOR DEBUGGING PURPOSES. YOU'RE OVERRIDING THE INTERNAL POSITIONING STATE OF THE PRINTER. PROCEED WITH CAUTION AND DO A PROPER G28 WHEN DONE." SET_GCODE_VARIABLE MACRO=MAYBE_HOME VARIABLE=is_kinematic_position_overriden VALUE=True {% if printer["dual_carriage"] is not defined %} SET_KINEMATIC_POSITION X={printable_x_max / 2} Y={printable_y_max / 2} Z={printer.toolhead.axis_maximum.z / 2} {% else %} IDEX_SET_CENTER_KINEMATIC_POSITION {% endif %} [gcode_macro IDEX_SET_CENTER_KINEMATIC_POSITION] description = FOR DEBUGGING PURPOSES ONLY. Sets the internal printer kinematic state to the center of all axes regardless of actual physical position. gcode = {% set printable_x_max = printer["gcode_macro RatOS"].printable_x_max|float %} {% set printable_y_max = printer["gcode_macro RatOS"].printable_y_max|float %} RATOS_ECHO MSG="WARNING: ONLY USE SET_CENTER_KINEMATIC_POSITION FOR DEBUGGING PURPOSES. YOU'RE OVERRIDING THE INTERNAL POSITIONING STATE OF THE PRINTER. PROCEED WITH CAUTION AND DO A PROPER G28 WHEN DONE." SET_GCODE_VARIABLE MACRO=MAYBE_HOME VARIABLE=is_kinematic_position_overriden VALUE=True {% set printable_x_max = printer["gcode_macro RatOS"].printable_x_max|float %} {% set center_x = printable_x_max / 2 %} SET_DUAL_CARRIAGE CARRIAGE=0 MODE=PRIMARY SET_KINEMATIC_POSITION X={center_x - (center_x / 2)} Y={printable_y_max / 2} Z={printer.toolhead.axis_maximum.z / 2} SET_DUAL_CARRIAGE CARRIAGE=1 MODE=PRIMARY SET_KINEMATIC_POSITION X={center_x + (center_x / 2)} Y={printable_y_max / 2} Z={printer.toolhead.axis_maximum.z / 2} SET_DUAL_CARRIAGE CARRIAGE=0 MODE=PRIMARY [gcode_macro VERIFY_HYBRID_INVERTED] gcode = {% set inverted = False %} {% if printer.configfile.settings.ratos_hybrid_corexy is defined and printer.configfile.settings.ratos_hybrid_corexy.inverted is defined %} {% if printer.configfile.settings.ratos_hybrid_corexy.inverted|lower == 'true' %} {% set inverted = True %} {% endif %} {% endif %} {% if inverted == False %} { action_emergency_stop("ratos_hybrid_corexy NOT INVERTED! Inverted hybrid core-xy bugfix not detected.") } {% endif %} [gcode_macro RATOS_ECHO] gcode = {% set prefix = "RatOS" %} {% set debug = params.DEBUG|default(0)|int %} {% if params.PREFIX is defined %} {% set prefix = prefix ~ " | " ~ params.PREFIX %} {% endif %} {% set prefix = prefix ~ ":" %} {% set msg = "" %} {% if params.MSG is defined %} {% set msg = params.MSG %} {% else %} {% set msg = "No msg parameter provided (this is a bug or unintended use)." %} {% endif %} {% if not debug %} M117 {prefix} {msg} {% endif %} RATOS_LOG PREFIX="{prefix}" MSG="{msg}" {% if not debug %} RESPOND PREFIX="{prefix}" MSG="{msg}" {% else %} CONSOLE_ECHO TITLE="{prefix}" TYPE="debug" MSG="{msg}" {% endif %} [gcode_macro ENABLE_DEBUG] gcode = SET_GCODE_VARIABLE MACRO=DEBUG_ECHO VARIABLE=enabled VALUE=True SET_GCODE_VARIABLE MACRO=DEBUG_ECHO VARIABLE=prefix_filter VALUE="'{params.FILTER|default('')|lower}'" RATOS_ECHO PREFIX="DEBUG" MSG="Debugging enabled." [gcode_macro DISABLE_DEBUG] gcode = SET_GCODE_VARIABLE MACRO=DEBUG_ECHO VARIABLE=enabled VALUE=False RATOS_ECHO PREFIX="DEBUG" MSG="Debugging disabled." [gcode_macro DEBUG_ECHO] variable_enabled = False variable_prefix_filter = '' gcode = {% set prefix = "DEBUG" %} {% if params.PREFIX is defined %} {% set prefix = prefix ~ " - " ~ params.PREFIX %} {% endif %} {% if enabled and (prefix_filter|lower == '' or prefix_filter|lower in params.PREFIX|lower) %} RATOS_ECHO PREFIX="{prefix}" MSG="{params.MSG}" DEBUG=1 {% endif %} [gcode_macro START_FEATURE] gcode = DEBUG_ECHO PREFIX="G-Code" MSG="Start {params.FEATURE} feature gcode" {% set scv = printer.toolhead.square_corner_velocity|int|default(5) %} {% set accel = printer.toolhead.max_accel|int|default(10000) %} {% set ratio = printer.toolhead.minimum_cruise_ratio|float|default(0.5) %} SET_GCODE_VARIABLE MACRO="END_FEATURE" VARIABLE="scv" VALUE={scv} SET_GCODE_VARIABLE MACRO="END_FEATURE" VARIABLE="accel" VALUE={accel} SET_GCODE_VARIABLE MACRO="END_FEATURE" VARIABLE="ratio" VALUE={ratio} _USER_START_FEATURE FEATURE="{params.FEATURE}" [gcode_macro END_FEATURE] variable_scv = 5 variable_accel = 10000 variable_ratio = 0.5 gcode = DEBUG_ECHO PREFIX="G-Code" MSG="End {params.FEATURE} feature gcode" SET_VELOCITY_LIMIT SQUARE_CORNER_VELOCITY={scv} ACCEL={accel} MINIMUM_CRUISE_RATIO={ratio} _USER_END_FEATURE FEATURE="{params.FEATURE}" SCV={scv} ACCEL={accel} RATIO={ratio} [gcode_macro _ON_LAYER_CHANGE] variable_layer_number = 0 description = INTERNAL USE ONLY. Call it from the slicers after layer change custom gcode gcode = {% set layer = params.LAYER|int %} SET_GCODE_VARIABLE MACRO=_ON_LAYER_CHANGE VARIABLE=layer_number VALUE={layer} SET_PRINT_STATS_INFO CURRENT_LAYER={layer} [gcode_macro _LEARN_MORE_CALIBRATION] gcode = {% set link_url = "https://os.ratrig.com/docs/configuration/calibration" %} {% set link_text = "RatOS Calibration Macros" %} {% set line_1 = '"Learn more about the %s"' % (link_url, link_text) %} CONSOLE_ECHO TITLE="INFO" MSG={line_1} [gcode_macro _LEARN_MORE_CHAMBER_FILTER] gcode = {% set link_url = "https://os.ratrig.com/docs/configuration/chamber_filter" %} {% set link_text = "RatOS Chamber Filter Control" %} {% set line_1 = '"Learn more about the %s"' % (link_url, link_text) %} CONSOLE_ECHO TITLE="INFO" MSG={line_1} [gcode_macro _LEARN_MORE_FILAMENT] gcode = {% set link_url = "https://os.ratrig.com/docs/configuration/filaments" %} {% set link_text = "RatOS Filament Macros" %} {% set line_1 = '"Learn more about the %s"' % (link_url, link_text) %} CONSOLE_ECHO TITLE="INFO" MSG={line_1} [gcode_macro _CONSOLE_SAVE_CONFIG] gcode = M118 Click SAVE_CONFIG to save the settings to your printer.cfg. [gcode_macro SAVE_Z_OFFSET] gcode = {% if printer.configfile.settings.beacon is defined %} _BEACON_SAVE_MULTIPLIER {% else %} Z_OFFSET_APPLY_PROBE {% endif %} [gcode_macro _LOAD_RATOS_SKEW_PROFILE] gcode = {% set ratos_skew_profile = printer["gcode_macro RatOS"].skew_profile|default("") %} {% if ratos_skew_profile != "" %} {% if printer.configfile.config["skew_correction %s" % ratos_skew_profile] is defined %} SKEW_PROFILE LOAD={ratos_skew_profile} GET_CURRENT_SKEW {% else %} {% set line_1 = '"Could not find skew profile %s!_N_Clearing skew correction."' % ratos_skew_profile %} CONSOLE_ECHO TITLE="Missing skew profile!" TYPE="warning" MSG={line_1} SET_SKEW CLEAR=1 {% endif %} {% endif %} [gcode_macro M601] gcode = PAUSE [idle_timeout] gcode = {% if printer.webhooks.state|lower == 'ready' %} {% if printer.pause_resume.is_paused|lower == 'false' %} RATOS_ECHO PREFIX="IDLE" MSG="2 hours since last activity. Powering off heaters and motors.." TURN_OFF_HEATERS M84 {% endif %} {% endif %} timeout = 7200 [temperature_sensor raspberry_pi] sensor_type = temperature_host [virtual_sdcard] path = ~/printer_data/gcodes [display_status] [pause_resume] [respond] [ratos] [mcu] serial = /tmp/klipper_host_mcu [printer] kinematics = none max_velocity = 1 max_accel = 1 [gcode_macro PAUSE] rename_existing = PAUSE_BASE gcode = RATOS_ECHO MSG="Please setup your printer through the RatOS configurator at /configure" [gcode_macro RESUME] rename_existing = RESUME_BASE gcode = RATOS_ECHO MSG="Please setup your printer through the RatOS configurator at /configure" [gcode_macro CANCEL_PRINT] rename_existing = CANCEL_BASE gcode = RATOS_ECHO MSG="Please setup your printer through the RatOS configurator at /configure" ======================= Loaded MCU 'mcu' 119 commands (?-20240727_132503-fv-az659-741 / gcc: (Raspbian 10.2.1-6+rpi1) 10.2.1 20210110 binutils: (GNU Binutils for Raspbian) 2.35.2) MCU 'mcu' config: ADC_MAX=4095 CLOCK_FREQ=50000000 MCU=linux PCA9685_MAX=4096 PWM_MAX=32768 STATS_SUMSQ_BASE=256 Configured MCU 'mcu' (1024 moves) Args: ['/home/pi/klipper/klippy/klippy.py', '/home/pi/printer_data/config/printer.cfg', '-l', '/home/pi/printer_data/logs/klippy.log', '-I', '/home/pi/printer_data/comms/klippy.serial', '-a', '/home/pi/printer_data/comms/klippy.sock'] Git version: 'v0.12.0-316-g96cceed23-dirty' Untracked files: klippy/extras/beacon.py, klippy/extras/gcode_shell_command.py, klippy/extras/linear_movement_vibrations.py, klippy/extras/ratos.py, klippy/extras/ratos_homing.py, klippy/extras/resonance_generator.py, klippy/extras/z_offset_probe.py, klippy/kinematics/ratos_hybrid_corexy.py Branch: master Remote: origin Tracked URL: https://github.com/Klipper3d/klipper.git CPU: 4 core ? Python: '3.9.2 (default, Mar 20 2025, 22:21:41) \n[GCC 10.2.1 20210110]' =============== Log rollover at Wed Oct 22 06:14:46 2025 =============== webhooks client 4123445280: Disconnected Starting Klippy... Args: ['/home/pi/klipper/klippy/klippy.py', '/home/pi/printer_data/config/printer.cfg', '-l', '/home/pi/printer_data/logs/klippy.log', '-I', '/home/pi/printer_data/comms/klippy.serial', '-a', '/home/pi/printer_data/comms/klippy.sock'] Git version: 'v0.12.0-316-g96cceed23-dirty' Untracked files: klippy/extras/beacon.py, klippy/extras/gcode_shell_command.py, klippy/extras/linear_movement_vibrations.py, klippy/extras/ratos.py, klippy/extras/ratos_homing.py, klippy/extras/resonance_generator.py, klippy/extras/z_offset_probe.py, klippy/kinematics/ratos_hybrid_corexy.py Branch: master Remote: origin Tracked URL: https://github.com/Klipper3d/klipper.git CPU: 4 core ? Python: '3.9.2 (default, Mar 20 2025, 22:21:41) \n[GCC 10.2.1 20210110]' Start printer at Wed Oct 22 06:15:04 2025 (1761110104.3 20.9) ===== Config file ===== [gcode_macro ECHO_T_VARS] description = Echo Toolhead variables to the console. gcode = {% set t = params.T|default(0) %} RATOS_ECHO MSG="T{t} Variables" {% for var, value in printer["gcode_macro T%s" % t].items() %} {action_respond_info(var ~ ": " ~ value)} {% endfor %} [gcode_macro ECHO_RATOS_VARS] description = Echo RatOS variables to the console. gcode = {% for var, value in printer["gcode_macro RatOS"].items() %} {action_respond_info(var ~ ": " ~ value)} {% endfor %} [gcode_macro RatOS] description = RatOS variable storage macro, will echo variables to the console when run. variable_relative_extrusion = False variable_force_absolute_position = False variable_preheat_extruder = True variable_preheat_extruder_temp = 150 variable_macro_travel_speed = 150 variable_macro_travel_accel = 2000 variable_macro_z_speed = 15 variable_bed_margin_x = [0, 0] variable_bed_margin_y = [0, 0] variable_printable_x_min = 0 variable_printable_x_max = 0 variable_printable_y_min = 0 variable_printable_y_max = 0 variable_end_print_motors_off = True variable_status_color_ok = "00FF00" variable_status_color_error = "FF0000" variable_status_color_unknown = "FFFF00" variable_end_print_retract_filament = 10 gcode = ECHO_RATOS_VARS [delayed_gcode RATOS_INIT] initial_duration = 0.1 gcode = RATOS_ECHO MSG="Welcome to RatOS!" RATOS_ECHO MSG="Please setup your printer through the RatOS configurator. Use the link in the sidebar to proceed with the setup." [delayed_gcode RATOS_LOGO] initial_duration = 2 gcode = HELLO_RATOS [gcode_macro INITIAL_FRONTEND_UPDATE] gcode = {% set color_ok = printer["gcode_macro RatOS"].status_color_ok|string %} {% set color_error = printer["gcode_macro RatOS"].status_color_error|string %} {% set color_unknown = printer["gcode_macro RatOS"].status_color_unknown|string %} SET_GCODE_VARIABLE MACRO=T0 VARIABLE=color VALUE='"{color_unknown}"' {% if printer["dual_carriage"] is defined %} SET_GCODE_VARIABLE MACRO=T1 VARIABLE=color VALUE='"{color_unknown}"' {% endif %} {% set t0_sensor = "undefined" %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t0"] is defined %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t0"].enabled|lower == "true" %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t0"].filament_detected|lower == "true" %} {% set t0_sensor = "detected" %} {% else %} {% set t0_sensor = "empty" %} {% endif %} {% else %} {% set t0_sensor = "disabled" %} {% endif %} {% endif %} {% set t1_sensor = "undefined" %} {% if printer["dual_carriage"] is defined and printer["filament_switch_sensor toolhead_filament_sensor_t1"] is defined %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t1"].enabled|lower == "true" %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t1"].filament_detected|lower == "true" %} {% set t1_sensor = "detected" %} {% else %} {% set t1_sensor = "empty" %} {% endif %} {% else %} {% set t1_sensor = "disabled" %} {% endif %} {% endif %} {% set svv = printer.save_variables.variables %} {% if svv.t0_filament is defined and printer["gcode_macro T0"] is defined %} {% if printer["gcode_macro T0"].filament_name is defined and printer["gcode_macro T0"].filament_type is defined and printer["gcode_macro T0"].filament_temp is defined %} {% if t0_sensor != "empty" %} {% set t0_filament_type = svv.t0_filament[0]|default('')|string %} {% set t0_filament_name = svv.t0_filament[1]|default('')|string %} {% set t0_filament_temp = svv.t0_filament[2]|default(0)|float %} {% if t0_filament_name != '' and t0_filament_type != '' and t0_filament_temp > 0 %} SET_GCODE_VARIABLE MACRO=T0 VARIABLE=color VALUE='"{color_ok}"' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_name VALUE='"{t0_filament_name}"' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_type VALUE='"{t0_filament_type}"' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_temp VALUE={t0_filament_temp} {% endif %} {% else %} SAVE_VARIABLE VARIABLE=t0_filament VALUE="('""', '""', 0)" SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_name VALUE='""' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_type VALUE='""' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_temp VALUE=0 {% endif %} {% endif %} {% endif %} {% if svv.t1_filament is defined and printer["gcode_macro T1"] is defined %} {% if printer["gcode_macro T1"].filament_name is defined and printer["gcode_macro T1"].filament_type is defined and printer["gcode_macro T1"].filament_temp is defined %} {% if t1_sensor != "empty" %} {% set t1_filament_type = svv.t1_filament[0]|default('')|string %} {% set t1_filament_name = svv.t1_filament[1]|default('')|string %} {% set t1_filament_temp = svv.t1_filament[2]|default(0)|float %} {% if t1_filament_name != '' and t1_filament_type != '' and t1_filament_temp > 0 %} SET_GCODE_VARIABLE MACRO=T1 VARIABLE=color VALUE='"{color_ok}"' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_name VALUE='"{t1_filament_name}"' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_type VALUE='"{t1_filament_type}"' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_temp VALUE={t1_filament_temp} {% endif %} {% else %} SAVE_VARIABLE VARIABLE=t1_filament VALUE="('""', '""', 0)" SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_name VALUE='""' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_type VALUE='""' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_temp VALUE=0 {% endif %} {% endif %} {% endif %} [gcode_macro CALCULATE_PRINTABLE_AREA] gcode = {% set bed_margin_x = printer["gcode_macro RatOS"].bed_margin_x %} {% set bed_margin_y = printer["gcode_macro RatOS"].bed_margin_y %} {% set tool = 0 if printer["gcode_macro T0"] is not defined or printer["gcode_macro T0"].active else 1 %} {% set max_x = printer.toolhead.axis_maximum.x if printer["dual_carriage"] is defined and tool == 0 else printer.toolhead.axis_maximum.x - bed_margin_x[1] %} {% if printer["dual_carriage"] is defined %} {% set max_x = printer.toolhead.axis_maximum.x %} {% endif %} DEBUG_ECHO PREFIX="CALCULATE_PRINTABLE_AREA" MSG="printer.toolhead.axis_maximum.x {printer.toolhead.axis_maximum.x}" {% set max_y = printer.toolhead.axis_maximum.y - bed_margin_y[1]%} SET_GCODE_VARIABLE MACRO=RatOS VARIABLE=printable_x_max VALUE={max_x} SET_GCODE_VARIABLE MACRO=RatOS VARIABLE=printable_y_max VALUE={max_y} DEBUG_ECHO PREFIX="CALCULATE_PRINTABLE_AREA" MSG="Printable area calculated: X: 0,{max_x} Y: 0,{max_y}" [gcode_macro CACHE_TOOLHEAD_SETTINGS] variable_cache = {"global": {"accel": 1000, "ratio": 0.5, "speed": 50, "scv": 5}} gcode = {% set key = "global" %} {% if params.KEY is defined %} {% set key = params.KEY %} {% endif %} {% set dummy = cache.__setitem__(key, {"accel": printer.toolhead.max_accel, "ratio": printer.toolhead.minimum_cruise_ratio, "speed": printer.toolhead.max_velocity, "scv": printer.toolhead.square_corner_velocity}) %} SET_GCODE_VARIABLE MACRO=CACHE_TOOLHEAD_SETTINGS VARIABLE=cache VALUE="{cache | pprint | replace("\n", "") | replace("\"", "\\\"")}" DEBUG_ECHO PREFIX="CACHE_TOOLHEAD_SETTINGS" MSG="Toolhead settings cached for {key}. {printer.toolhead.max_accel} accel, {printer.toolhead.minimum_cruise_ratio} ratio, {printer.toolhead.max_velocity} velocity, {printer.toolhead.square_corner_velocity} scv." [gcode_macro RESTORE_TOOLHEAD_SETTINGS] gcode = {% set key = "global" %} {% if params.KEY is defined %} {% set key = params.KEY %} {% endif %} {% set values = printer["gcode_macro CACHE_TOOLHEAD_SETTINGS"].cache.__getitem__(key) %} {% if values is not defined or values == 'None' %} { action_raise_error("RESTORE_TOOLHEAD_SETTINGS: Toolhead settings not cached for key '" ~ key ~ "'.") } {% endif %} SET_VELOCITY_LIMIT ACCEL={values.accel} MINIMUM_CRUISE_RATIO={values.ratio} VELOCITY={values.speed} SQUARE_CORNER_VELOCITY={values.scv} DEBUG_ECHO PREFIX="RESTORE_TOOLHEAD_SETTINGS" MSG="Toolhead settings restored. {values.accel} accel, {values.ratio} ratio, {values.speed} velocity, {values.scv} scv." [gcode_macro SET_MACRO_TRAVEL_SETTINGS] gcode = {% set speed = printer["gcode_macro RatOS"].macro_travel_speed|float * 60 %} {% set accel = printer["gcode_macro RatOS"].macro_travel_accel %} SET_VELOCITY_LIMIT ACCEL={accel} MINIMUM_CRUISE_RATIO=0.5 VELOCITY={speed} SQUARE_CORNER_VELOCITY={5} DEBUG_ECHO PREFIX="SET_MACRO_TRAVEL_SETTINGS" MSG="Macro travel settings set. {accel} accel, {speed} velocity" [gcode_macro SET_CENTER_KINEMATIC_POSITION] description = FOR DEBUGGING PURPOSES ONLY. Sets the internal printer kinematic state to the center of all axes regardless of actual physical position. gcode = {% set printable_x_max = printer["gcode_macro RatOS"].printable_x_max|float %} {% set printable_y_max = printer["gcode_macro RatOS"].printable_y_max|float %} RATOS_ECHO MSG="WARNING: ONLY USE SET_CENTER_KINEMATIC_POSITION FOR DEBUGGING PURPOSES. YOU'RE OVERRIDING THE INTERNAL POSITIONING STATE OF THE PRINTER. PROCEED WITH CAUTION AND DO A PROPER G28 WHEN DONE." SET_GCODE_VARIABLE MACRO=MAYBE_HOME VARIABLE=is_kinematic_position_overriden VALUE=True {% if printer["dual_carriage"] is not defined %} SET_KINEMATIC_POSITION X={printable_x_max / 2} Y={printable_y_max / 2} Z={printer.toolhead.axis_maximum.z / 2} {% else %} IDEX_SET_CENTER_KINEMATIC_POSITION {% endif %} [gcode_macro IDEX_SET_CENTER_KINEMATIC_POSITION] description = FOR DEBUGGING PURPOSES ONLY. Sets the internal printer kinematic state to the center of all axes regardless of actual physical position. gcode = {% set printable_x_max = printer["gcode_macro RatOS"].printable_x_max|float %} {% set printable_y_max = printer["gcode_macro RatOS"].printable_y_max|float %} RATOS_ECHO MSG="WARNING: ONLY USE SET_CENTER_KINEMATIC_POSITION FOR DEBUGGING PURPOSES. YOU'RE OVERRIDING THE INTERNAL POSITIONING STATE OF THE PRINTER. PROCEED WITH CAUTION AND DO A PROPER G28 WHEN DONE." SET_GCODE_VARIABLE MACRO=MAYBE_HOME VARIABLE=is_kinematic_position_overriden VALUE=True {% set printable_x_max = printer["gcode_macro RatOS"].printable_x_max|float %} {% set center_x = printable_x_max / 2 %} SET_DUAL_CARRIAGE CARRIAGE=0 MODE=PRIMARY SET_KINEMATIC_POSITION X={center_x - (center_x / 2)} Y={printable_y_max / 2} Z={printer.toolhead.axis_maximum.z / 2} SET_DUAL_CARRIAGE CARRIAGE=1 MODE=PRIMARY SET_KINEMATIC_POSITION X={center_x + (center_x / 2)} Y={printable_y_max / 2} Z={printer.toolhead.axis_maximum.z / 2} SET_DUAL_CARRIAGE CARRIAGE=0 MODE=PRIMARY [gcode_macro VERIFY_HYBRID_INVERTED] gcode = {% set inverted = False %} {% if printer.configfile.settings.ratos_hybrid_corexy is defined and printer.configfile.settings.ratos_hybrid_corexy.inverted is defined %} {% if printer.configfile.settings.ratos_hybrid_corexy.inverted|lower == 'true' %} {% set inverted = True %} {% endif %} {% endif %} {% if inverted == False %} { action_emergency_stop("ratos_hybrid_corexy NOT INVERTED! Inverted hybrid core-xy bugfix not detected.") } {% endif %} [gcode_macro RATOS_ECHO] gcode = {% set prefix = "RatOS" %} {% set debug = params.DEBUG|default(0)|int %} {% if params.PREFIX is defined %} {% set prefix = prefix ~ " | " ~ params.PREFIX %} {% endif %} {% set prefix = prefix ~ ":" %} {% set msg = "" %} {% if params.MSG is defined %} {% set msg = params.MSG %} {% else %} {% set msg = "No msg parameter provided (this is a bug or unintended use)." %} {% endif %} {% if not debug %} M117 {prefix} {msg} {% endif %} RATOS_LOG PREFIX="{prefix}" MSG="{msg}" {% if not debug %} RESPOND PREFIX="{prefix}" MSG="{msg}" {% else %} CONSOLE_ECHO TITLE="{prefix}" TYPE="debug" MSG="{msg}" {% endif %} [gcode_macro ENABLE_DEBUG] gcode = SET_GCODE_VARIABLE MACRO=DEBUG_ECHO VARIABLE=enabled VALUE=True SET_GCODE_VARIABLE MACRO=DEBUG_ECHO VARIABLE=prefix_filter VALUE="'{params.FILTER|default('')|lower}'" RATOS_ECHO PREFIX="DEBUG" MSG="Debugging enabled." [gcode_macro DISABLE_DEBUG] gcode = SET_GCODE_VARIABLE MACRO=DEBUG_ECHO VARIABLE=enabled VALUE=False RATOS_ECHO PREFIX="DEBUG" MSG="Debugging disabled." [gcode_macro DEBUG_ECHO] variable_enabled = False variable_prefix_filter = '' gcode = {% set prefix = "DEBUG" %} {% if params.PREFIX is defined %} {% set prefix = prefix ~ " - " ~ params.PREFIX %} {% endif %} {% if enabled and (prefix_filter|lower == '' or prefix_filter|lower in params.PREFIX|lower) %} RATOS_ECHO PREFIX="{prefix}" MSG="{params.MSG}" DEBUG=1 {% endif %} [gcode_macro START_FEATURE] gcode = DEBUG_ECHO PREFIX="G-Code" MSG="Start {params.FEATURE} feature gcode" {% set scv = printer.toolhead.square_corner_velocity|int|default(5) %} {% set accel = printer.toolhead.max_accel|int|default(10000) %} {% set ratio = printer.toolhead.minimum_cruise_ratio|float|default(0.5) %} SET_GCODE_VARIABLE MACRO="END_FEATURE" VARIABLE="scv" VALUE={scv} SET_GCODE_VARIABLE MACRO="END_FEATURE" VARIABLE="accel" VALUE={accel} SET_GCODE_VARIABLE MACRO="END_FEATURE" VARIABLE="ratio" VALUE={ratio} _USER_START_FEATURE FEATURE="{params.FEATURE}" [gcode_macro END_FEATURE] variable_scv = 5 variable_accel = 10000 variable_ratio = 0.5 gcode = DEBUG_ECHO PREFIX="G-Code" MSG="End {params.FEATURE} feature gcode" SET_VELOCITY_LIMIT SQUARE_CORNER_VELOCITY={scv} ACCEL={accel} MINIMUM_CRUISE_RATIO={ratio} _USER_END_FEATURE FEATURE="{params.FEATURE}" SCV={scv} ACCEL={accel} RATIO={ratio} [gcode_macro _ON_LAYER_CHANGE] variable_layer_number = 0 description = INTERNAL USE ONLY. Call it from the slicers after layer change custom gcode gcode = {% set layer = params.LAYER|int %} SET_GCODE_VARIABLE MACRO=_ON_LAYER_CHANGE VARIABLE=layer_number VALUE={layer} SET_PRINT_STATS_INFO CURRENT_LAYER={layer} [gcode_macro _LEARN_MORE_CALIBRATION] gcode = {% set link_url = "https://os.ratrig.com/docs/configuration/calibration" %} {% set link_text = "RatOS Calibration Macros" %} {% set line_1 = '"Learn more about the %s"' % (link_url, link_text) %} CONSOLE_ECHO TITLE="INFO" MSG={line_1} [gcode_macro _LEARN_MORE_CHAMBER_FILTER] gcode = {% set link_url = "https://os.ratrig.com/docs/configuration/chamber_filter" %} {% set link_text = "RatOS Chamber Filter Control" %} {% set line_1 = '"Learn more about the %s"' % (link_url, link_text) %} CONSOLE_ECHO TITLE="INFO" MSG={line_1} [gcode_macro _LEARN_MORE_FILAMENT] gcode = {% set link_url = "https://os.ratrig.com/docs/configuration/filaments" %} {% set link_text = "RatOS Filament Macros" %} {% set line_1 = '"Learn more about the %s"' % (link_url, link_text) %} CONSOLE_ECHO TITLE="INFO" MSG={line_1} [gcode_macro _CONSOLE_SAVE_CONFIG] gcode = M118 Click SAVE_CONFIG to save the settings to your printer.cfg. [gcode_macro SAVE_Z_OFFSET] gcode = {% if printer.configfile.settings.beacon is defined %} _BEACON_SAVE_MULTIPLIER {% else %} Z_OFFSET_APPLY_PROBE {% endif %} [gcode_macro _LOAD_RATOS_SKEW_PROFILE] gcode = {% set ratos_skew_profile = printer["gcode_macro RatOS"].skew_profile|default("") %} {% if ratos_skew_profile != "" %} {% if printer.configfile.config["skew_correction %s" % ratos_skew_profile] is defined %} SKEW_PROFILE LOAD={ratos_skew_profile} GET_CURRENT_SKEW {% else %} {% set line_1 = '"Could not find skew profile %s!_N_Clearing skew correction."' % ratos_skew_profile %} CONSOLE_ECHO TITLE="Missing skew profile!" TYPE="warning" MSG={line_1} SET_SKEW CLEAR=1 {% endif %} {% endif %} [gcode_macro M601] gcode = PAUSE [idle_timeout] gcode = {% if printer.webhooks.state|lower == 'ready' %} {% if printer.pause_resume.is_paused|lower == 'false' %} RATOS_ECHO PREFIX="IDLE" MSG="2 hours since last activity. Powering off heaters and motors.." TURN_OFF_HEATERS M84 {% endif %} {% endif %} timeout = 7200 [temperature_sensor raspberry_pi] sensor_type = temperature_host [virtual_sdcard] path = ~/printer_data/gcodes [display_status] [pause_resume] [respond] [ratos] [mcu] serial = /tmp/klipper_host_mcu [printer] kinematics = none max_velocity = 1 max_accel = 1 [gcode_macro PAUSE] rename_existing = PAUSE_BASE gcode = RATOS_ECHO MSG="Please setup your printer through the RatOS configurator at /configure" [gcode_macro RESUME] rename_existing = RESUME_BASE gcode = RATOS_ECHO MSG="Please setup your printer through the RatOS configurator at /configure" [gcode_macro CANCEL_PRINT] rename_existing = CANCEL_BASE gcode = RATOS_ECHO MSG="Please setup your printer through the RatOS configurator at /configure" ======================= mcu 'mcu': Starting connect Loaded MCU 'mcu' 119 commands (?-20240727_132503-fv-az659-741 / gcc: (Raspbian 10.2.1-6+rpi1) 10.2.1 20210110 binutils: (GNU Binutils for Raspbian) 2.35.2) MCU 'mcu' config: ADC_MAX=4095 CLOCK_FREQ=50000000 MCU=linux PCA9685_MAX=4096 PWM_MAX=32768 STATS_SUMSQ_BASE=256 Sending MCU 'mcu' printer configuration... Configured MCU 'mcu' (1024 moves) Config error Traceback (most recent call last): File "/home/pi/klipper/klippy/klippy.py", line 135, in _connect cb() File "/home/pi/klipper/klippy/extras/ratos.py", line 58, in _connect self.register_command_overrides() File "/home/pi/klipper/klippy/extras/ratos.py", line 86, in register_command_overrides self.register_override('TEST_RESONANCES', self.override_TEST_RESONANCES, desc=(self.desc_TEST_RESONANCES)) File "/home/pi/klipper/klippy/extras/ratos.py", line 97, in register_override raise self.printer.config_error("Existing command '%s' not found in RatOS override" % (command,)) configparser.Error: Existing command 'TEST_RESONANCES' not found in RatOS override webhooks client 4126046600: New connection webhooks client 4126046600: Client info {'program': 'Moonraker', 'version': 'v0.9.3-0-g71f9e67'} webhooks client 4126046600: Disconnected Starting Klippy... Args: ['/home/pi/klipper/klippy/klippy.py', '/home/pi/printer_data/config/printer.cfg', '-l', '/home/pi/printer_data/logs/klippy.log', '-I', '/home/pi/printer_data/comms/klippy.serial', '-a', '/home/pi/printer_data/comms/klippy.sock'] Git version: 'v0.12.0-316-g96cceed23-dirty' Untracked files: klippy/extras/beacon.py, klippy/extras/gcode_shell_command.py, klippy/extras/linear_movement_vibrations.py, klippy/extras/ratos.py, klippy/extras/ratos_homing.py, klippy/extras/resonance_generator.py, klippy/extras/z_offset_probe.py, klippy/kinematics/ratos_hybrid_corexy.py Branch: master Remote: origin Tracked URL: https://github.com/Klipper3d/klipper.git CPU: 4 core ? Python: '3.9.2 (default, Mar 20 2025, 22:21:41) \n[GCC 10.2.1 20210110]' Start printer at Wed Oct 22 06:40:58 2025 (1761111658.2 20.9) ===== Config file ===== [gcode_macro ECHO_T_VARS] description = Echo Toolhead variables to the console. gcode = {% set t = params.T|default(0) %} RATOS_ECHO MSG="T{t} Variables" {% for var, value in printer["gcode_macro T%s" % t].items() %} {action_respond_info(var ~ ": " ~ value)} {% endfor %} [gcode_macro ECHO_RATOS_VARS] description = Echo RatOS variables to the console. gcode = {% for var, value in printer["gcode_macro RatOS"].items() %} {action_respond_info(var ~ ": " ~ value)} {% endfor %} [gcode_macro RatOS] description = RatOS variable storage macro, will echo variables to the console when run. variable_relative_extrusion = False variable_force_absolute_position = False variable_preheat_extruder = True variable_preheat_extruder_temp = 150 variable_macro_travel_speed = 150 variable_macro_travel_accel = 2000 variable_macro_z_speed = 15 variable_bed_margin_x = [0, 0] variable_bed_margin_y = [0, 0] variable_printable_x_min = 0 variable_printable_x_max = 0 variable_printable_y_min = 0 variable_printable_y_max = 0 variable_end_print_motors_off = True variable_status_color_ok = "00FF00" variable_status_color_error = "FF0000" variable_status_color_unknown = "FFFF00" variable_end_print_retract_filament = 10 gcode = ECHO_RATOS_VARS [delayed_gcode RATOS_INIT] initial_duration = 0.1 gcode = RATOS_ECHO MSG="Welcome to RatOS!" RATOS_ECHO MSG="Please setup your printer through the RatOS configurator. Use the link in the sidebar to proceed with the setup." [delayed_gcode RATOS_LOGO] initial_duration = 2 gcode = HELLO_RATOS [gcode_macro INITIAL_FRONTEND_UPDATE] gcode = {% set color_ok = printer["gcode_macro RatOS"].status_color_ok|string %} {% set color_error = printer["gcode_macro RatOS"].status_color_error|string %} {% set color_unknown = printer["gcode_macro RatOS"].status_color_unknown|string %} SET_GCODE_VARIABLE MACRO=T0 VARIABLE=color VALUE='"{color_unknown}"' {% if printer["dual_carriage"] is defined %} SET_GCODE_VARIABLE MACRO=T1 VARIABLE=color VALUE='"{color_unknown}"' {% endif %} {% set t0_sensor = "undefined" %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t0"] is defined %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t0"].enabled|lower == "true" %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t0"].filament_detected|lower == "true" %} {% set t0_sensor = "detected" %} {% else %} {% set t0_sensor = "empty" %} {% endif %} {% else %} {% set t0_sensor = "disabled" %} {% endif %} {% endif %} {% set t1_sensor = "undefined" %} {% if printer["dual_carriage"] is defined and printer["filament_switch_sensor toolhead_filament_sensor_t1"] is defined %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t1"].enabled|lower == "true" %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t1"].filament_detected|lower == "true" %} {% set t1_sensor = "detected" %} {% else %} {% set t1_sensor = "empty" %} {% endif %} {% else %} {% set t1_sensor = "disabled" %} {% endif %} {% endif %} {% set svv = printer.save_variables.variables %} {% if svv.t0_filament is defined and printer["gcode_macro T0"] is defined %} {% if printer["gcode_macro T0"].filament_name is defined and printer["gcode_macro T0"].filament_type is defined and printer["gcode_macro T0"].filament_temp is defined %} {% if t0_sensor != "empty" %} {% set t0_filament_type = svv.t0_filament[0]|default('')|string %} {% set t0_filament_name = svv.t0_filament[1]|default('')|string %} {% set t0_filament_temp = svv.t0_filament[2]|default(0)|float %} {% if t0_filament_name != '' and t0_filament_type != '' and t0_filament_temp > 0 %} SET_GCODE_VARIABLE MACRO=T0 VARIABLE=color VALUE='"{color_ok}"' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_name VALUE='"{t0_filament_name}"' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_type VALUE='"{t0_filament_type}"' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_temp VALUE={t0_filament_temp} {% endif %} {% else %} SAVE_VARIABLE VARIABLE=t0_filament VALUE="('""', '""', 0)" SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_name VALUE='""' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_type VALUE='""' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_temp VALUE=0 {% endif %} {% endif %} {% endif %} {% if svv.t1_filament is defined and printer["gcode_macro T1"] is defined %} {% if printer["gcode_macro T1"].filament_name is defined and printer["gcode_macro T1"].filament_type is defined and printer["gcode_macro T1"].filament_temp is defined %} {% if t1_sensor != "empty" %} {% set t1_filament_type = svv.t1_filament[0]|default('')|string %} {% set t1_filament_name = svv.t1_filament[1]|default('')|string %} {% set t1_filament_temp = svv.t1_filament[2]|default(0)|float %} {% if t1_filament_name != '' and t1_filament_type != '' and t1_filament_temp > 0 %} SET_GCODE_VARIABLE MACRO=T1 VARIABLE=color VALUE='"{color_ok}"' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_name VALUE='"{t1_filament_name}"' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_type VALUE='"{t1_filament_type}"' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_temp VALUE={t1_filament_temp} {% endif %} {% else %} SAVE_VARIABLE VARIABLE=t1_filament VALUE="('""', '""', 0)" SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_name VALUE='""' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_type VALUE='""' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_temp VALUE=0 {% endif %} {% endif %} {% endif %} [gcode_macro CALCULATE_PRINTABLE_AREA] gcode = {% set bed_margin_x = printer["gcode_macro RatOS"].bed_margin_x %} {% set bed_margin_y = printer["gcode_macro RatOS"].bed_margin_y %} {% set tool = 0 if printer["gcode_macro T0"] is not defined or printer["gcode_macro T0"].active else 1 %} {% set max_x = printer.toolhead.axis_maximum.x if printer["dual_carriage"] is defined and tool == 0 else printer.toolhead.axis_maximum.x - bed_margin_x[1] %} {% if printer["dual_carriage"] is defined %} {% set max_x = printer.toolhead.axis_maximum.x %} {% endif %} DEBUG_ECHO PREFIX="CALCULATE_PRINTABLE_AREA" MSG="printer.toolhead.axis_maximum.x {printer.toolhead.axis_maximum.x}" {% set max_y = printer.toolhead.axis_maximum.y - bed_margin_y[1]%} SET_GCODE_VARIABLE MACRO=RatOS VARIABLE=printable_x_max VALUE={max_x} SET_GCODE_VARIABLE MACRO=RatOS VARIABLE=printable_y_max VALUE={max_y} DEBUG_ECHO PREFIX="CALCULATE_PRINTABLE_AREA" MSG="Printable area calculated: X: 0,{max_x} Y: 0,{max_y}" [gcode_macro CACHE_TOOLHEAD_SETTINGS] variable_cache = {"global": {"accel": 1000, "ratio": 0.5, "speed": 50, "scv": 5}} gcode = {% set key = "global" %} {% if params.KEY is defined %} {% set key = params.KEY %} {% endif %} {% set dummy = cache.__setitem__(key, {"accel": printer.toolhead.max_accel, "ratio": printer.toolhead.minimum_cruise_ratio, "speed": printer.toolhead.max_velocity, "scv": printer.toolhead.square_corner_velocity}) %} SET_GCODE_VARIABLE MACRO=CACHE_TOOLHEAD_SETTINGS VARIABLE=cache VALUE="{cache | pprint | replace("\n", "") | replace("\"", "\\\"")}" DEBUG_ECHO PREFIX="CACHE_TOOLHEAD_SETTINGS" MSG="Toolhead settings cached for {key}. {printer.toolhead.max_accel} accel, {printer.toolhead.minimum_cruise_ratio} ratio, {printer.toolhead.max_velocity} velocity, {printer.toolhead.square_corner_velocity} scv." [gcode_macro RESTORE_TOOLHEAD_SETTINGS] gcode = {% set key = "global" %} {% if params.KEY is defined %} {% set key = params.KEY %} {% endif %} {% set values = printer["gcode_macro CACHE_TOOLHEAD_SETTINGS"].cache.__getitem__(key) %} {% if values is not defined or values == 'None' %} { action_raise_error("RESTORE_TOOLHEAD_SETTINGS: Toolhead settings not cached for key '" ~ key ~ "'.") } {% endif %} SET_VELOCITY_LIMIT ACCEL={values.accel} MINIMUM_CRUISE_RATIO={values.ratio} VELOCITY={values.speed} SQUARE_CORNER_VELOCITY={values.scv} DEBUG_ECHO PREFIX="RESTORE_TOOLHEAD_SETTINGS" MSG="Toolhead settings restored. {values.accel} accel, {values.ratio} ratio, {values.speed} velocity, {values.scv} scv." [gcode_macro SET_MACRO_TRAVEL_SETTINGS] gcode = {% set speed = printer["gcode_macro RatOS"].macro_travel_speed|float * 60 %} {% set accel = printer["gcode_macro RatOS"].macro_travel_accel %} SET_VELOCITY_LIMIT ACCEL={accel} MINIMUM_CRUISE_RATIO=0.5 VELOCITY={speed} SQUARE_CORNER_VELOCITY={5} DEBUG_ECHO PREFIX="SET_MACRO_TRAVEL_SETTINGS" MSG="Macro travel settings set. {accel} accel, {speed} velocity" [gcode_macro SET_CENTER_KINEMATIC_POSITION] description = FOR DEBUGGING PURPOSES ONLY. Sets the internal printer kinematic state to the center of all axes regardless of actual physical position. gcode = {% set printable_x_max = printer["gcode_macro RatOS"].printable_x_max|float %} {% set printable_y_max = printer["gcode_macro RatOS"].printable_y_max|float %} RATOS_ECHO MSG="WARNING: ONLY USE SET_CENTER_KINEMATIC_POSITION FOR DEBUGGING PURPOSES. YOU'RE OVERRIDING THE INTERNAL POSITIONING STATE OF THE PRINTER. PROCEED WITH CAUTION AND DO A PROPER G28 WHEN DONE." SET_GCODE_VARIABLE MACRO=MAYBE_HOME VARIABLE=is_kinematic_position_overriden VALUE=True {% if printer["dual_carriage"] is not defined %} SET_KINEMATIC_POSITION X={printable_x_max / 2} Y={printable_y_max / 2} Z={printer.toolhead.axis_maximum.z / 2} {% else %} IDEX_SET_CENTER_KINEMATIC_POSITION {% endif %} [gcode_macro IDEX_SET_CENTER_KINEMATIC_POSITION] description = FOR DEBUGGING PURPOSES ONLY. Sets the internal printer kinematic state to the center of all axes regardless of actual physical position. gcode = {% set printable_x_max = printer["gcode_macro RatOS"].printable_x_max|float %} {% set printable_y_max = printer["gcode_macro RatOS"].printable_y_max|float %} RATOS_ECHO MSG="WARNING: ONLY USE SET_CENTER_KINEMATIC_POSITION FOR DEBUGGING PURPOSES. YOU'RE OVERRIDING THE INTERNAL POSITIONING STATE OF THE PRINTER. PROCEED WITH CAUTION AND DO A PROPER G28 WHEN DONE." SET_GCODE_VARIABLE MACRO=MAYBE_HOME VARIABLE=is_kinematic_position_overriden VALUE=True {% set printable_x_max = printer["gcode_macro RatOS"].printable_x_max|float %} {% set center_x = printable_x_max / 2 %} SET_DUAL_CARRIAGE CARRIAGE=0 MODE=PRIMARY SET_KINEMATIC_POSITION X={center_x - (center_x / 2)} Y={printable_y_max / 2} Z={printer.toolhead.axis_maximum.z / 2} SET_DUAL_CARRIAGE CARRIAGE=1 MODE=PRIMARY SET_KINEMATIC_POSITION X={center_x + (center_x / 2)} Y={printable_y_max / 2} Z={printer.toolhead.axis_maximum.z / 2} SET_DUAL_CARRIAGE CARRIAGE=0 MODE=PRIMARY [gcode_macro VERIFY_HYBRID_INVERTED] gcode = {% set inverted = False %} {% if printer.configfile.settings.ratos_hybrid_corexy is defined and printer.configfile.settings.ratos_hybrid_corexy.inverted is defined %} {% if printer.configfile.settings.ratos_hybrid_corexy.inverted|lower == 'true' %} {% set inverted = True %} {% endif %} {% endif %} {% if inverted == False %} { action_emergency_stop("ratos_hybrid_corexy NOT INVERTED! Inverted hybrid core-xy bugfix not detected.") } {% endif %} [gcode_macro RATOS_ECHO] gcode = {% set prefix = "RatOS" %} {% set debug = params.DEBUG|default(0)|int %} {% if params.PREFIX is defined %} {% set prefix = prefix ~ " | " ~ params.PREFIX %} {% endif %} {% set prefix = prefix ~ ":" %} {% set msg = "" %} {% if params.MSG is defined %} {% set msg = params.MSG %} {% else %} {% set msg = "No msg parameter provided (this is a bug or unintended use)." %} {% endif %} {% if not debug %} M117 {prefix} {msg} {% endif %} RATOS_LOG PREFIX="{prefix}" MSG="{msg}" {% if not debug %} RESPOND PREFIX="{prefix}" MSG="{msg}" {% else %} CONSOLE_ECHO TITLE="{prefix}" TYPE="debug" MSG="{msg}" {% endif %} [gcode_macro ENABLE_DEBUG] gcode = SET_GCODE_VARIABLE MACRO=DEBUG_ECHO VARIABLE=enabled VALUE=True SET_GCODE_VARIABLE MACRO=DEBUG_ECHO VARIABLE=prefix_filter VALUE="'{params.FILTER|default('')|lower}'" RATOS_ECHO PREFIX="DEBUG" MSG="Debugging enabled." [gcode_macro DISABLE_DEBUG] gcode = SET_GCODE_VARIABLE MACRO=DEBUG_ECHO VARIABLE=enabled VALUE=False RATOS_ECHO PREFIX="DEBUG" MSG="Debugging disabled." [gcode_macro DEBUG_ECHO] variable_enabled = False variable_prefix_filter = '' gcode = {% set prefix = "DEBUG" %} {% if params.PREFIX is defined %} {% set prefix = prefix ~ " - " ~ params.PREFIX %} {% endif %} {% if enabled and (prefix_filter|lower == '' or prefix_filter|lower in params.PREFIX|lower) %} RATOS_ECHO PREFIX="{prefix}" MSG="{params.MSG}" DEBUG=1 {% endif %} [gcode_macro START_FEATURE] gcode = DEBUG_ECHO PREFIX="G-Code" MSG="Start {params.FEATURE} feature gcode" {% set scv = printer.toolhead.square_corner_velocity|int|default(5) %} {% set accel = printer.toolhead.max_accel|int|default(10000) %} {% set ratio = printer.toolhead.minimum_cruise_ratio|float|default(0.5) %} SET_GCODE_VARIABLE MACRO="END_FEATURE" VARIABLE="scv" VALUE={scv} SET_GCODE_VARIABLE MACRO="END_FEATURE" VARIABLE="accel" VALUE={accel} SET_GCODE_VARIABLE MACRO="END_FEATURE" VARIABLE="ratio" VALUE={ratio} _USER_START_FEATURE FEATURE="{params.FEATURE}" [gcode_macro END_FEATURE] variable_scv = 5 variable_accel = 10000 variable_ratio = 0.5 gcode = DEBUG_ECHO PREFIX="G-Code" MSG="End {params.FEATURE} feature gcode" SET_VELOCITY_LIMIT SQUARE_CORNER_VELOCITY={scv} ACCEL={accel} MINIMUM_CRUISE_RATIO={ratio} _USER_END_FEATURE FEATURE="{params.FEATURE}" SCV={scv} ACCEL={accel} RATIO={ratio} [gcode_macro _ON_LAYER_CHANGE] variable_layer_number = 0 description = INTERNAL USE ONLY. Call it from the slicers after layer change custom gcode gcode = {% set layer = params.LAYER|int %} SET_GCODE_VARIABLE MACRO=_ON_LAYER_CHANGE VARIABLE=layer_number VALUE={layer} SET_PRINT_STATS_INFO CURRENT_LAYER={layer} [gcode_macro _LEARN_MORE_CALIBRATION] gcode = {% set link_url = "https://os.ratrig.com/docs/configuration/calibration" %} {% set link_text = "RatOS Calibration Macros" %} {% set line_1 = '"Learn more about the %s"' % (link_url, link_text) %} CONSOLE_ECHO TITLE="INFO" MSG={line_1} [gcode_macro _LEARN_MORE_CHAMBER_FILTER] gcode = {% set link_url = "https://os.ratrig.com/docs/configuration/chamber_filter" %} {% set link_text = "RatOS Chamber Filter Control" %} {% set line_1 = '"Learn more about the %s"' % (link_url, link_text) %} CONSOLE_ECHO TITLE="INFO" MSG={line_1} [gcode_macro _LEARN_MORE_FILAMENT] gcode = {% set link_url = "https://os.ratrig.com/docs/configuration/filaments" %} {% set link_text = "RatOS Filament Macros" %} {% set line_1 = '"Learn more about the %s"' % (link_url, link_text) %} CONSOLE_ECHO TITLE="INFO" MSG={line_1} [gcode_macro _CONSOLE_SAVE_CONFIG] gcode = M118 Click SAVE_CONFIG to save the settings to your printer.cfg. [gcode_macro SAVE_Z_OFFSET] gcode = {% if printer.configfile.settings.beacon is defined %} _BEACON_SAVE_MULTIPLIER {% else %} Z_OFFSET_APPLY_PROBE {% endif %} [gcode_macro _LOAD_RATOS_SKEW_PROFILE] gcode = {% set ratos_skew_profile = printer["gcode_macro RatOS"].skew_profile|default("") %} {% if ratos_skew_profile != "" %} {% if printer.configfile.config["skew_correction %s" % ratos_skew_profile] is defined %} SKEW_PROFILE LOAD={ratos_skew_profile} GET_CURRENT_SKEW {% else %} {% set line_1 = '"Could not find skew profile %s!_N_Clearing skew correction."' % ratos_skew_profile %} CONSOLE_ECHO TITLE="Missing skew profile!" TYPE="warning" MSG={line_1} SET_SKEW CLEAR=1 {% endif %} {% endif %} [gcode_macro M601] gcode = PAUSE [idle_timeout] gcode = {% if printer.webhooks.state|lower == 'ready' %} {% if printer.pause_resume.is_paused|lower == 'false' %} RATOS_ECHO PREFIX="IDLE" MSG="2 hours since last activity. Powering off heaters and motors.." TURN_OFF_HEATERS M84 {% endif %} {% endif %} timeout = 7200 [temperature_sensor raspberry_pi] sensor_type = temperature_host [virtual_sdcard] path = ~/printer_data/gcodes [display_status] [pause_resume] [respond] [ratos] [mcu] serial = /tmp/klipper_host_mcu [printer] kinematics = none max_velocity = 1 max_accel = 1 [gcode_macro PAUSE] rename_existing = PAUSE_BASE gcode = RATOS_ECHO MSG="Please setup your printer through the RatOS configurator at /configure" [gcode_macro RESUME] rename_existing = RESUME_BASE gcode = RATOS_ECHO MSG="Please setup your printer through the RatOS configurator at /configure" [gcode_macro CANCEL_PRINT] rename_existing = CANCEL_BASE gcode = RATOS_ECHO MSG="Please setup your printer through the RatOS configurator at /configure" ======================= mcu 'mcu': Starting connect Loaded MCU 'mcu' 119 commands (?-20240727_132503-fv-az659-741 / gcc: (Raspbian 10.2.1-6+rpi1) 10.2.1 20210110 binutils: (GNU Binutils for Raspbian) 2.35.2) MCU 'mcu' config: ADC_MAX=4095 CLOCK_FREQ=50000000 MCU=linux PCA9685_MAX=4096 PWM_MAX=32768 STATS_SUMSQ_BASE=256 Sending MCU 'mcu' printer configuration... Configured MCU 'mcu' (1024 moves) Config error Traceback (most recent call last): File "/home/pi/klipper/klippy/klippy.py", line 135, in _connect cb() File "/home/pi/klipper/klippy/extras/ratos.py", line 58, in _connect self.register_command_overrides() File "/home/pi/klipper/klippy/extras/ratos.py", line 86, in register_command_overrides self.register_override('TEST_RESONANCES', self.override_TEST_RESONANCES, desc=(self.desc_TEST_RESONANCES)) File "/home/pi/klipper/klippy/extras/ratos.py", line 97, in register_override raise self.printer.config_error("Existing command '%s' not found in RatOS override" % (command,)) configparser.Error: Existing command 'TEST_RESONANCES' not found in RatOS override webhooks client 4127881704: New connection webhooks client 4127881704: Client info {'program': 'Moonraker', 'version': 'v0.9.3-0-g71f9e67'} Starting Klippy... Starting Klippy... Args: ['/home/pi/klipper/klippy/klippy.py', '/home/pi/printer_data/config/printer.cfg', '-l', '/home/pi/printer_data/logs/klippy.log', '-I', '/home/pi/printer_data/comms/klippy.serial', '-a', '/home/pi/printer_data/comms/klippy.sock'] Git version: 'v0.12.0-316-g96cceed23-dirty' Untracked files: klippy/extras/beacon.py, klippy/extras/gcode_shell_command.py, klippy/extras/linear_movement_vibrations.py, klippy/extras/ratos.py, klippy/extras/ratos_homing.py, klippy/extras/resonance_generator.py, klippy/extras/z_offset_probe.py, klippy/kinematics/ratos_hybrid_corexy.py Branch: master Remote: origin Tracked URL: https://github.com/Klipper3d/klipper.git CPU: 4 core ? Python: '3.9.2 (default, Mar 20 2025, 22:21:41) \n[GCC 10.2.1 20210110]' Start printer at Wed Oct 22 06:47:44 2025 (1761112064.3 378.3) ===== Config file ===== [gcode_macro ECHO_T_VARS] description = Echo Toolhead variables to the console. gcode = {% set t = params.T|default(0) %} RATOS_ECHO MSG="T{t} Variables" {% for var, value in printer["gcode_macro T%s" % t].items() %} {action_respond_info(var ~ ": " ~ value)} {% endfor %} [gcode_macro ECHO_RATOS_VARS] description = Echo RatOS variables to the console. gcode = {% for var, value in printer["gcode_macro RatOS"].items() %} {action_respond_info(var ~ ": " ~ value)} {% endfor %} [gcode_macro RatOS] description = RatOS variable storage macro, will echo variables to the console when run. variable_relative_extrusion = False variable_force_absolute_position = False variable_preheat_extruder = True variable_preheat_extruder_temp = 150 variable_macro_travel_speed = 150 variable_macro_travel_accel = 2000 variable_macro_z_speed = 15 variable_bed_margin_x = [0, 0] variable_bed_margin_y = [0, 0] variable_printable_x_min = 0 variable_printable_x_max = 0 variable_printable_y_min = 0 variable_printable_y_max = 0 variable_end_print_motors_off = True variable_status_color_ok = "00FF00" variable_status_color_error = "FF0000" variable_status_color_unknown = "FFFF00" variable_end_print_retract_filament = 10 gcode = ECHO_RATOS_VARS [delayed_gcode RATOS_INIT] initial_duration = 0.1 gcode = RATOS_ECHO MSG="Welcome to RatOS!" RATOS_ECHO MSG="Please setup your printer through the RatOS configurator. Use the link in the sidebar to proceed with the setup." [delayed_gcode RATOS_LOGO] initial_duration = 2 gcode = HELLO_RATOS [gcode_macro INITIAL_FRONTEND_UPDATE] gcode = {% set color_ok = printer["gcode_macro RatOS"].status_color_ok|string %} {% set color_error = printer["gcode_macro RatOS"].status_color_error|string %} {% set color_unknown = printer["gcode_macro RatOS"].status_color_unknown|string %} SET_GCODE_VARIABLE MACRO=T0 VARIABLE=color VALUE='"{color_unknown}"' {% if printer["dual_carriage"] is defined %} SET_GCODE_VARIABLE MACRO=T1 VARIABLE=color VALUE='"{color_unknown}"' {% endif %} {% set t0_sensor = "undefined" %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t0"] is defined %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t0"].enabled|lower == "true" %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t0"].filament_detected|lower == "true" %} {% set t0_sensor = "detected" %} {% else %} {% set t0_sensor = "empty" %} {% endif %} {% else %} {% set t0_sensor = "disabled" %} {% endif %} {% endif %} {% set t1_sensor = "undefined" %} {% if printer["dual_carriage"] is defined and printer["filament_switch_sensor toolhead_filament_sensor_t1"] is defined %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t1"].enabled|lower == "true" %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t1"].filament_detected|lower == "true" %} {% set t1_sensor = "detected" %} {% else %} {% set t1_sensor = "empty" %} {% endif %} {% else %} {% set t1_sensor = "disabled" %} {% endif %} {% endif %} {% set svv = printer.save_variables.variables %} {% if svv.t0_filament is defined and printer["gcode_macro T0"] is defined %} {% if printer["gcode_macro T0"].filament_name is defined and printer["gcode_macro T0"].filament_type is defined and printer["gcode_macro T0"].filament_temp is defined %} {% if t0_sensor != "empty" %} {% set t0_filament_type = svv.t0_filament[0]|default('')|string %} {% set t0_filament_name = svv.t0_filament[1]|default('')|string %} {% set t0_filament_temp = svv.t0_filament[2]|default(0)|float %} {% if t0_filament_name != '' and t0_filament_type != '' and t0_filament_temp > 0 %} SET_GCODE_VARIABLE MACRO=T0 VARIABLE=color VALUE='"{color_ok}"' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_name VALUE='"{t0_filament_name}"' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_type VALUE='"{t0_filament_type}"' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_temp VALUE={t0_filament_temp} {% endif %} {% else %} SAVE_VARIABLE VARIABLE=t0_filament VALUE="('""', '""', 0)" SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_name VALUE='""' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_type VALUE='""' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_temp VALUE=0 {% endif %} {% endif %} {% endif %} {% if svv.t1_filament is defined and printer["gcode_macro T1"] is defined %} {% if printer["gcode_macro T1"].filament_name is defined and printer["gcode_macro T1"].filament_type is defined and printer["gcode_macro T1"].filament_temp is defined %} {% if t1_sensor != "empty" %} {% set t1_filament_type = svv.t1_filament[0]|default('')|string %} {% set t1_filament_name = svv.t1_filament[1]|default('')|string %} {% set t1_filament_temp = svv.t1_filament[2]|default(0)|float %} {% if t1_filament_name != '' and t1_filament_type != '' and t1_filament_temp > 0 %} SET_GCODE_VARIABLE MACRO=T1 VARIABLE=color VALUE='"{color_ok}"' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_name VALUE='"{t1_filament_name}"' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_type VALUE='"{t1_filament_type}"' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_temp VALUE={t1_filament_temp} {% endif %} {% else %} SAVE_VARIABLE VARIABLE=t1_filament VALUE="('""', '""', 0)" SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_name VALUE='""' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_type VALUE='""' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_temp VALUE=0 {% endif %} {% endif %} {% endif %} [gcode_macro CALCULATE_PRINTABLE_AREA] gcode = {% set bed_margin_x = printer["gcode_macro RatOS"].bed_margin_x %} {% set bed_margin_y = printer["gcode_macro RatOS"].bed_margin_y %} {% set tool = 0 if printer["gcode_macro T0"] is not defined or printer["gcode_macro T0"].active else 1 %} {% set max_x = printer.toolhead.axis_maximum.x if printer["dual_carriage"] is defined and tool == 0 else printer.toolhead.axis_maximum.x - bed_margin_x[1] %} {% if printer["dual_carriage"] is defined %} {% set max_x = printer.toolhead.axis_maximum.x %} {% endif %} DEBUG_ECHO PREFIX="CALCULATE_PRINTABLE_AREA" MSG="printer.toolhead.axis_maximum.x {printer.toolhead.axis_maximum.x}" {% set max_y = printer.toolhead.axis_maximum.y - bed_margin_y[1]%} SET_GCODE_VARIABLE MACRO=RatOS VARIABLE=printable_x_max VALUE={max_x} SET_GCODE_VARIABLE MACRO=RatOS VARIABLE=printable_y_max VALUE={max_y} DEBUG_ECHO PREFIX="CALCULATE_PRINTABLE_AREA" MSG="Printable area calculated: X: 0,{max_x} Y: 0,{max_y}" [gcode_macro CACHE_TOOLHEAD_SETTINGS] variable_cache = {"global": {"accel": 1000, "ratio": 0.5, "speed": 50, "scv": 5}} gcode = {% set key = "global" %} {% if params.KEY is defined %} {% set key = params.KEY %} {% endif %} {% set dummy = cache.__setitem__(key, {"accel": printer.toolhead.max_accel, "ratio": printer.toolhead.minimum_cruise_ratio, "speed": printer.toolhead.max_velocity, "scv": printer.toolhead.square_corner_velocity}) %} SET_GCODE_VARIABLE MACRO=CACHE_TOOLHEAD_SETTINGS VARIABLE=cache VALUE="{cache | pprint | replace("\n", "") | replace("\"", "\\\"")}" DEBUG_ECHO PREFIX="CACHE_TOOLHEAD_SETTINGS" MSG="Toolhead settings cached for {key}. {printer.toolhead.max_accel} accel, {printer.toolhead.minimum_cruise_ratio} ratio, {printer.toolhead.max_velocity} velocity, {printer.toolhead.square_corner_velocity} scv." [gcode_macro RESTORE_TOOLHEAD_SETTINGS] gcode = {% set key = "global" %} {% if params.KEY is defined %} {% set key = params.KEY %} {% endif %} {% set values = printer["gcode_macro CACHE_TOOLHEAD_SETTINGS"].cache.__getitem__(key) %} {% if values is not defined or values == 'None' %} { action_raise_error("RESTORE_TOOLHEAD_SETTINGS: Toolhead settings not cached for key '" ~ key ~ "'.") } {% endif %} SET_VELOCITY_LIMIT ACCEL={values.accel} MINIMUM_CRUISE_RATIO={values.ratio} VELOCITY={values.speed} SQUARE_CORNER_VELOCITY={values.scv} DEBUG_ECHO PREFIX="RESTORE_TOOLHEAD_SETTINGS" MSG="Toolhead settings restored. {values.accel} accel, {values.ratio} ratio, {values.speed} velocity, {values.scv} scv." [gcode_macro SET_MACRO_TRAVEL_SETTINGS] gcode = {% set speed = printer["gcode_macro RatOS"].macro_travel_speed|float * 60 %} {% set accel = printer["gcode_macro RatOS"].macro_travel_accel %} SET_VELOCITY_LIMIT ACCEL={accel} MINIMUM_CRUISE_RATIO=0.5 VELOCITY={speed} SQUARE_CORNER_VELOCITY={5} DEBUG_ECHO PREFIX="SET_MACRO_TRAVEL_SETTINGS" MSG="Macro travel settings set. {accel} accel, {speed} velocity" [gcode_macro SET_CENTER_KINEMATIC_POSITION] description = FOR DEBUGGING PURPOSES ONLY. Sets the internal printer kinematic state to the center of all axes regardless of actual physical position. gcode = {% set printable_x_max = printer["gcode_macro RatOS"].printable_x_max|float %} {% set printable_y_max = printer["gcode_macro RatOS"].printable_y_max|float %} RATOS_ECHO MSG="WARNING: ONLY USE SET_CENTER_KINEMATIC_POSITION FOR DEBUGGING PURPOSES. YOU'RE OVERRIDING THE INTERNAL POSITIONING STATE OF THE PRINTER. PROCEED WITH CAUTION AND DO A PROPER G28 WHEN DONE." SET_GCODE_VARIABLE MACRO=MAYBE_HOME VARIABLE=is_kinematic_position_overriden VALUE=True {% if printer["dual_carriage"] is not defined %} SET_KINEMATIC_POSITION X={printable_x_max / 2} Y={printable_y_max / 2} Z={printer.toolhead.axis_maximum.z / 2} {% else %} IDEX_SET_CENTER_KINEMATIC_POSITION {% endif %} [gcode_macro IDEX_SET_CENTER_KINEMATIC_POSITION] description = FOR DEBUGGING PURPOSES ONLY. Sets the internal printer kinematic state to the center of all axes regardless of actual physical position. gcode = {% set printable_x_max = printer["gcode_macro RatOS"].printable_x_max|float %} {% set printable_y_max = printer["gcode_macro RatOS"].printable_y_max|float %} RATOS_ECHO MSG="WARNING: ONLY USE SET_CENTER_KINEMATIC_POSITION FOR DEBUGGING PURPOSES. YOU'RE OVERRIDING THE INTERNAL POSITIONING STATE OF THE PRINTER. PROCEED WITH CAUTION AND DO A PROPER G28 WHEN DONE." SET_GCODE_VARIABLE MACRO=MAYBE_HOME VARIABLE=is_kinematic_position_overriden VALUE=True {% set printable_x_max = printer["gcode_macro RatOS"].printable_x_max|float %} {% set center_x = printable_x_max / 2 %} SET_DUAL_CARRIAGE CARRIAGE=0 MODE=PRIMARY SET_KINEMATIC_POSITION X={center_x - (center_x / 2)} Y={printable_y_max / 2} Z={printer.toolhead.axis_maximum.z / 2} SET_DUAL_CARRIAGE CARRIAGE=1 MODE=PRIMARY SET_KINEMATIC_POSITION X={center_x + (center_x / 2)} Y={printable_y_max / 2} Z={printer.toolhead.axis_maximum.z / 2} SET_DUAL_CARRIAGE CARRIAGE=0 MODE=PRIMARY [gcode_macro VERIFY_HYBRID_INVERTED] gcode = {% set inverted = False %} {% if printer.configfile.settings.ratos_hybrid_corexy is defined and printer.configfile.settings.ratos_hybrid_corexy.inverted is defined %} {% if printer.configfile.settings.ratos_hybrid_corexy.inverted|lower == 'true' %} {% set inverted = True %} {% endif %} {% endif %} {% if inverted == False %} { action_emergency_stop("ratos_hybrid_corexy NOT INVERTED! Inverted hybrid core-xy bugfix not detected.") } {% endif %} [gcode_macro RATOS_ECHO] gcode = {% set prefix = "RatOS" %} {% set debug = params.DEBUG|default(0)|int %} {% if params.PREFIX is defined %} {% set prefix = prefix ~ " | " ~ params.PREFIX %} {% endif %} {% set prefix = prefix ~ ":" %} {% set msg = "" %} {% if params.MSG is defined %} {% set msg = params.MSG %} {% else %} {% set msg = "No msg parameter provided (this is a bug or unintended use)." %} {% endif %} {% if not debug %} M117 {prefix} {msg} {% endif %} RATOS_LOG PREFIX="{prefix}" MSG="{msg}" {% if not debug %} RESPOND PREFIX="{prefix}" MSG="{msg}" {% else %} CONSOLE_ECHO TITLE="{prefix}" TYPE="debug" MSG="{msg}" {% endif %} [gcode_macro ENABLE_DEBUG] gcode = SET_GCODE_VARIABLE MACRO=DEBUG_ECHO VARIABLE=enabled VALUE=True SET_GCODE_VARIABLE MACRO=DEBUG_ECHO VARIABLE=prefix_filter VALUE="'{params.FILTER|default('')|lower}'" RATOS_ECHO PREFIX="DEBUG" MSG="Debugging enabled." [gcode_macro DISABLE_DEBUG] gcode = SET_GCODE_VARIABLE MACRO=DEBUG_ECHO VARIABLE=enabled VALUE=False RATOS_ECHO PREFIX="DEBUG" MSG="Debugging disabled." [gcode_macro DEBUG_ECHO] variable_enabled = False variable_prefix_filter = '' gcode = {% set prefix = "DEBUG" %} {% if params.PREFIX is defined %} {% set prefix = prefix ~ " - " ~ params.PREFIX %} {% endif %} {% if enabled and (prefix_filter|lower == '' or prefix_filter|lower in params.PREFIX|lower) %} RATOS_ECHO PREFIX="{prefix}" MSG="{params.MSG}" DEBUG=1 {% endif %} [gcode_macro START_FEATURE] gcode = DEBUG_ECHO PREFIX="G-Code" MSG="Start {params.FEATURE} feature gcode" {% set scv = printer.toolhead.square_corner_velocity|int|default(5) %} {% set accel = printer.toolhead.max_accel|int|default(10000) %} {% set ratio = printer.toolhead.minimum_cruise_ratio|float|default(0.5) %} SET_GCODE_VARIABLE MACRO="END_FEATURE" VARIABLE="scv" VALUE={scv} SET_GCODE_VARIABLE MACRO="END_FEATURE" VARIABLE="accel" VALUE={accel} SET_GCODE_VARIABLE MACRO="END_FEATURE" VARIABLE="ratio" VALUE={ratio} _USER_START_FEATURE FEATURE="{params.FEATURE}" [gcode_macro END_FEATURE] variable_scv = 5 variable_accel = 10000 variable_ratio = 0.5 gcode = DEBUG_ECHO PREFIX="G-Code" MSG="End {params.FEATURE} feature gcode" SET_VELOCITY_LIMIT SQUARE_CORNER_VELOCITY={scv} ACCEL={accel} MINIMUM_CRUISE_RATIO={ratio} _USER_END_FEATURE FEATURE="{params.FEATURE}" SCV={scv} ACCEL={accel} RATIO={ratio} [gcode_macro _ON_LAYER_CHANGE] variable_layer_number = 0 description = INTERNAL USE ONLY. Call it from the slicers after layer change custom gcode gcode = {% set layer = params.LAYER|int %} SET_GCODE_VARIABLE MACRO=_ON_LAYER_CHANGE VARIABLE=layer_number VALUE={layer} SET_PRINT_STATS_INFO CURRENT_LAYER={layer} [gcode_macro _LEARN_MORE_CALIBRATION] gcode = {% set link_url = "https://os.ratrig.com/docs/configuration/calibration" %} {% set link_text = "RatOS Calibration Macros" %} {% set line_1 = '"Learn more about the %s"' % (link_url, link_text) %} CONSOLE_ECHO TITLE="INFO" MSG={line_1} [gcode_macro _LEARN_MORE_CHAMBER_FILTER] gcode = {% set link_url = "https://os.ratrig.com/docs/configuration/chamber_filter" %} {% set link_text = "RatOS Chamber Filter Control" %} {% set line_1 = '"Learn more about the %s"' % (link_url, link_text) %} CONSOLE_ECHO TITLE="INFO" MSG={line_1} [gcode_macro _LEARN_MORE_FILAMENT] gcode = {% set link_url = "https://os.ratrig.com/docs/configuration/filaments" %} {% set link_text = "RatOS Filament Macros" %} {% set line_1 = '"Learn more about the %s"' % (link_url, link_text) %} CONSOLE_ECHO TITLE="INFO" MSG={line_1} [gcode_macro _CONSOLE_SAVE_CONFIG] gcode = M118 Click SAVE_CONFIG to save the settings to your printer.cfg. [gcode_macro SAVE_Z_OFFSET] gcode = {% if printer.configfile.settings.beacon is defined %} _BEACON_SAVE_MULTIPLIER {% else %} Z_OFFSET_APPLY_PROBE {% endif %} [gcode_macro _LOAD_RATOS_SKEW_PROFILE] gcode = {% set ratos_skew_profile = printer["gcode_macro RatOS"].skew_profile|default("") %} {% if ratos_skew_profile != "" %} {% if printer.configfile.config["skew_correction %s" % ratos_skew_profile] is defined %} SKEW_PROFILE LOAD={ratos_skew_profile} GET_CURRENT_SKEW {% else %} {% set line_1 = '"Could not find skew profile %s!_N_Clearing skew correction."' % ratos_skew_profile %} CONSOLE_ECHO TITLE="Missing skew profile!" TYPE="warning" MSG={line_1} SET_SKEW CLEAR=1 {% endif %} {% endif %} [gcode_macro M601] gcode = PAUSE [idle_timeout] gcode = {% if printer.webhooks.state|lower == 'ready' %} {% if printer.pause_resume.is_paused|lower == 'false' %} RATOS_ECHO PREFIX="IDLE" MSG="2 hours since last activity. Powering off heaters and motors.." TURN_OFF_HEATERS M84 {% endif %} {% endif %} timeout = 7200 [temperature_sensor raspberry_pi] sensor_type = temperature_host [virtual_sdcard] path = ~/printer_data/gcodes [display_status] [pause_resume] [respond] [ratos] [mcu] serial = /tmp/klipper_host_mcu [printer] kinematics = none max_velocity = 1 max_accel = 1 [gcode_macro PAUSE] rename_existing = PAUSE_BASE gcode = RATOS_ECHO MSG="Please setup your printer through the RatOS configurator at /configure" [gcode_macro RESUME] rename_existing = RESUME_BASE gcode = RATOS_ECHO MSG="Please setup your printer through the RatOS configurator at /configure" [gcode_macro CANCEL_PRINT] rename_existing = CANCEL_BASE gcode = RATOS_ECHO MSG="Please setup your printer through the RatOS configurator at /configure" ======================= mcu 'mcu': Starting connect webhooks client 4129172424: New connection webhooks client 4129172424: Client info {'program': 'Moonraker', 'version': 'v0.9.3-0-g71f9e67'} Loaded MCU 'mcu' 119 commands (?-20240727_132503-fv-az659-741 / gcc: (Raspbian 10.2.1-6+rpi1) 10.2.1 20210110 binutils: (GNU Binutils for Raspbian) 2.35.2) MCU 'mcu' config: ADC_MAX=4095 CLOCK_FREQ=50000000 MCU=linux PCA9685_MAX=4096 PWM_MAX=32768 STATS_SUMSQ_BASE=256 Configured MCU 'mcu' (1024 moves) Config error Traceback (most recent call last): File "/home/pi/klipper/klippy/klippy.py", line 135, in _connect cb() File "/home/pi/klipper/klippy/extras/ratos.py", line 58, in _connect self.register_command_overrides() File "/home/pi/klipper/klippy/extras/ratos.py", line 86, in register_command_overrides self.register_override('TEST_RESONANCES', self.override_TEST_RESONANCES, desc=(self.desc_TEST_RESONANCES)) File "/home/pi/klipper/klippy/extras/ratos.py", line 97, in register_override raise self.printer.config_error("Existing command '%s' not found in RatOS override" % (command,)) configparser.Error: Existing command 'TEST_RESONANCES' not found in RatOS override webhooks client 4129172424: Disconnected Starting Klippy... Args: ['/home/pi/klipper/klippy/klippy.py', '/home/pi/printer_data/config/printer.cfg', '-l', '/home/pi/printer_data/logs/klippy.log', '-I', '/home/pi/printer_data/comms/klippy.serial', '-a', '/home/pi/printer_data/comms/klippy.sock'] Git version: 'v0.12.0-316-g96cceed23-dirty' Untracked files: klippy/extras/beacon.py, klippy/extras/gcode_shell_command.py, klippy/extras/linear_movement_vibrations.py, klippy/extras/ratos.py, klippy/extras/ratos_homing.py, klippy/extras/resonance_generator.py, klippy/extras/z_offset_probe.py, klippy/kinematics/ratos_hybrid_corexy.py Branch: master Remote: origin Tracked URL: https://github.com/Klipper3d/klipper.git CPU: 4 core ? Python: '3.9.2 (default, Mar 20 2025, 22:21:41) \n[GCC 10.2.1 20210110]' Start printer at Wed Oct 22 07:02:12 2025 (1761112932.1 19.8) ===== Config file ===== [gcode_macro ECHO_T_VARS] description = Echo Toolhead variables to the console. gcode = {% set t = params.T|default(0) %} RATOS_ECHO MSG="T{t} Variables" {% for var, value in printer["gcode_macro T%s" % t].items() %} {action_respond_info(var ~ ": " ~ value)} {% endfor %} [gcode_macro ECHO_RATOS_VARS] description = Echo RatOS variables to the console. gcode = {% for var, value in printer["gcode_macro RatOS"].items() %} {action_respond_info(var ~ ": " ~ value)} {% endfor %} [gcode_macro RatOS] description = RatOS variable storage macro, will echo variables to the console when run. variable_relative_extrusion = False variable_force_absolute_position = False variable_preheat_extruder = True variable_preheat_extruder_temp = 150 variable_macro_travel_speed = 150 variable_macro_travel_accel = 2000 variable_macro_z_speed = 15 variable_bed_margin_x = [0, 0] variable_bed_margin_y = [0, 0] variable_printable_x_min = 0 variable_printable_x_max = 0 variable_printable_y_min = 0 variable_printable_y_max = 0 variable_end_print_motors_off = True variable_status_color_ok = "00FF00" variable_status_color_error = "FF0000" variable_status_color_unknown = "FFFF00" variable_end_print_retract_filament = 10 gcode = ECHO_RATOS_VARS [delayed_gcode RATOS_INIT] initial_duration = 0.1 gcode = RATOS_ECHO MSG="Welcome to RatOS!" RATOS_ECHO MSG="Please setup your printer through the RatOS configurator. Use the link in the sidebar to proceed with the setup." [delayed_gcode RATOS_LOGO] initial_duration = 2 gcode = HELLO_RATOS [gcode_macro INITIAL_FRONTEND_UPDATE] gcode = {% set color_ok = printer["gcode_macro RatOS"].status_color_ok|string %} {% set color_error = printer["gcode_macro RatOS"].status_color_error|string %} {% set color_unknown = printer["gcode_macro RatOS"].status_color_unknown|string %} SET_GCODE_VARIABLE MACRO=T0 VARIABLE=color VALUE='"{color_unknown}"' {% if printer["dual_carriage"] is defined %} SET_GCODE_VARIABLE MACRO=T1 VARIABLE=color VALUE='"{color_unknown}"' {% endif %} {% set t0_sensor = "undefined" %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t0"] is defined %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t0"].enabled|lower == "true" %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t0"].filament_detected|lower == "true" %} {% set t0_sensor = "detected" %} {% else %} {% set t0_sensor = "empty" %} {% endif %} {% else %} {% set t0_sensor = "disabled" %} {% endif %} {% endif %} {% set t1_sensor = "undefined" %} {% if printer["dual_carriage"] is defined and printer["filament_switch_sensor toolhead_filament_sensor_t1"] is defined %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t1"].enabled|lower == "true" %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t1"].filament_detected|lower == "true" %} {% set t1_sensor = "detected" %} {% else %} {% set t1_sensor = "empty" %} {% endif %} {% else %} {% set t1_sensor = "disabled" %} {% endif %} {% endif %} {% set svv = printer.save_variables.variables %} {% if svv.t0_filament is defined and printer["gcode_macro T0"] is defined %} {% if printer["gcode_macro T0"].filament_name is defined and printer["gcode_macro T0"].filament_type is defined and printer["gcode_macro T0"].filament_temp is defined %} {% if t0_sensor != "empty" %} {% set t0_filament_type = svv.t0_filament[0]|default('')|string %} {% set t0_filament_name = svv.t0_filament[1]|default('')|string %} {% set t0_filament_temp = svv.t0_filament[2]|default(0)|float %} {% if t0_filament_name != '' and t0_filament_type != '' and t0_filament_temp > 0 %} SET_GCODE_VARIABLE MACRO=T0 VARIABLE=color VALUE='"{color_ok}"' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_name VALUE='"{t0_filament_name}"' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_type VALUE='"{t0_filament_type}"' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_temp VALUE={t0_filament_temp} {% endif %} {% else %} SAVE_VARIABLE VARIABLE=t0_filament VALUE="('""', '""', 0)" SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_name VALUE='""' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_type VALUE='""' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_temp VALUE=0 {% endif %} {% endif %} {% endif %} {% if svv.t1_filament is defined and printer["gcode_macro T1"] is defined %} {% if printer["gcode_macro T1"].filament_name is defined and printer["gcode_macro T1"].filament_type is defined and printer["gcode_macro T1"].filament_temp is defined %} {% if t1_sensor != "empty" %} {% set t1_filament_type = svv.t1_filament[0]|default('')|string %} {% set t1_filament_name = svv.t1_filament[1]|default('')|string %} {% set t1_filament_temp = svv.t1_filament[2]|default(0)|float %} {% if t1_filament_name != '' and t1_filament_type != '' and t1_filament_temp > 0 %} SET_GCODE_VARIABLE MACRO=T1 VARIABLE=color VALUE='"{color_ok}"' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_name VALUE='"{t1_filament_name}"' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_type VALUE='"{t1_filament_type}"' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_temp VALUE={t1_filament_temp} {% endif %} {% else %} SAVE_VARIABLE VARIABLE=t1_filament VALUE="('""', '""', 0)" SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_name VALUE='""' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_type VALUE='""' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_temp VALUE=0 {% endif %} {% endif %} {% endif %} [gcode_macro CALCULATE_PRINTABLE_AREA] gcode = {% set bed_margin_x = printer["gcode_macro RatOS"].bed_margin_x %} {% set bed_margin_y = printer["gcode_macro RatOS"].bed_margin_y %} {% set tool = 0 if printer["gcode_macro T0"] is not defined or printer["gcode_macro T0"].active else 1 %} {% set max_x = printer.toolhead.axis_maximum.x if printer["dual_carriage"] is defined and tool == 0 else printer.toolhead.axis_maximum.x - bed_margin_x[1] %} {% if printer["dual_carriage"] is defined %} {% set max_x = printer.toolhead.axis_maximum.x %} {% endif %} DEBUG_ECHO PREFIX="CALCULATE_PRINTABLE_AREA" MSG="printer.toolhead.axis_maximum.x {printer.toolhead.axis_maximum.x}" {% set max_y = printer.toolhead.axis_maximum.y - bed_margin_y[1]%} SET_GCODE_VARIABLE MACRO=RatOS VARIABLE=printable_x_max VALUE={max_x} SET_GCODE_VARIABLE MACRO=RatOS VARIABLE=printable_y_max VALUE={max_y} DEBUG_ECHO PREFIX="CALCULATE_PRINTABLE_AREA" MSG="Printable area calculated: X: 0,{max_x} Y: 0,{max_y}" [gcode_macro CACHE_TOOLHEAD_SETTINGS] variable_cache = {"global": {"accel": 1000, "ratio": 0.5, "speed": 50, "scv": 5}} gcode = {% set key = "global" %} {% if params.KEY is defined %} {% set key = params.KEY %} {% endif %} {% set dummy = cache.__setitem__(key, {"accel": printer.toolhead.max_accel, "ratio": printer.toolhead.minimum_cruise_ratio, "speed": printer.toolhead.max_velocity, "scv": printer.toolhead.square_corner_velocity}) %} SET_GCODE_VARIABLE MACRO=CACHE_TOOLHEAD_SETTINGS VARIABLE=cache VALUE="{cache | pprint | replace("\n", "") | replace("\"", "\\\"")}" DEBUG_ECHO PREFIX="CACHE_TOOLHEAD_SETTINGS" MSG="Toolhead settings cached for {key}. {printer.toolhead.max_accel} accel, {printer.toolhead.minimum_cruise_ratio} ratio, {printer.toolhead.max_velocity} velocity, {printer.toolhead.square_corner_velocity} scv." [gcode_macro RESTORE_TOOLHEAD_SETTINGS] gcode = {% set key = "global" %} {% if params.KEY is defined %} {% set key = params.KEY %} {% endif %} {% set values = printer["gcode_macro CACHE_TOOLHEAD_SETTINGS"].cache.__getitem__(key) %} {% if values is not defined or values == 'None' %} { action_raise_error("RESTORE_TOOLHEAD_SETTINGS: Toolhead settings not cached for key '" ~ key ~ "'.") } {% endif %} SET_VELOCITY_LIMIT ACCEL={values.accel} MINIMUM_CRUISE_RATIO={values.ratio} VELOCITY={values.speed} SQUARE_CORNER_VELOCITY={values.scv} DEBUG_ECHO PREFIX="RESTORE_TOOLHEAD_SETTINGS" MSG="Toolhead settings restored. {values.accel} accel, {values.ratio} ratio, {values.speed} velocity, {values.scv} scv." [gcode_macro SET_MACRO_TRAVEL_SETTINGS] gcode = {% set speed = printer["gcode_macro RatOS"].macro_travel_speed|float * 60 %} {% set accel = printer["gcode_macro RatOS"].macro_travel_accel %} SET_VELOCITY_LIMIT ACCEL={accel} MINIMUM_CRUISE_RATIO=0.5 VELOCITY={speed} SQUARE_CORNER_VELOCITY={5} DEBUG_ECHO PREFIX="SET_MACRO_TRAVEL_SETTINGS" MSG="Macro travel settings set. {accel} accel, {speed} velocity" [gcode_macro SET_CENTER_KINEMATIC_POSITION] description = FOR DEBUGGING PURPOSES ONLY. Sets the internal printer kinematic state to the center of all axes regardless of actual physical position. gcode = {% set printable_x_max = printer["gcode_macro RatOS"].printable_x_max|float %} {% set printable_y_max = printer["gcode_macro RatOS"].printable_y_max|float %} RATOS_ECHO MSG="WARNING: ONLY USE SET_CENTER_KINEMATIC_POSITION FOR DEBUGGING PURPOSES. YOU'RE OVERRIDING THE INTERNAL POSITIONING STATE OF THE PRINTER. PROCEED WITH CAUTION AND DO A PROPER G28 WHEN DONE." SET_GCODE_VARIABLE MACRO=MAYBE_HOME VARIABLE=is_kinematic_position_overriden VALUE=True {% if printer["dual_carriage"] is not defined %} SET_KINEMATIC_POSITION X={printable_x_max / 2} Y={printable_y_max / 2} Z={printer.toolhead.axis_maximum.z / 2} {% else %} IDEX_SET_CENTER_KINEMATIC_POSITION {% endif %} [gcode_macro IDEX_SET_CENTER_KINEMATIC_POSITION] description = FOR DEBUGGING PURPOSES ONLY. Sets the internal printer kinematic state to the center of all axes regardless of actual physical position. gcode = {% set printable_x_max = printer["gcode_macro RatOS"].printable_x_max|float %} {% set printable_y_max = printer["gcode_macro RatOS"].printable_y_max|float %} RATOS_ECHO MSG="WARNING: ONLY USE SET_CENTER_KINEMATIC_POSITION FOR DEBUGGING PURPOSES. YOU'RE OVERRIDING THE INTERNAL POSITIONING STATE OF THE PRINTER. PROCEED WITH CAUTION AND DO A PROPER G28 WHEN DONE." SET_GCODE_VARIABLE MACRO=MAYBE_HOME VARIABLE=is_kinematic_position_overriden VALUE=True {% set printable_x_max = printer["gcode_macro RatOS"].printable_x_max|float %} {% set center_x = printable_x_max / 2 %} SET_DUAL_CARRIAGE CARRIAGE=0 MODE=PRIMARY SET_KINEMATIC_POSITION X={center_x - (center_x / 2)} Y={printable_y_max / 2} Z={printer.toolhead.axis_maximum.z / 2} SET_DUAL_CARRIAGE CARRIAGE=1 MODE=PRIMARY SET_KINEMATIC_POSITION X={center_x + (center_x / 2)} Y={printable_y_max / 2} Z={printer.toolhead.axis_maximum.z / 2} SET_DUAL_CARRIAGE CARRIAGE=0 MODE=PRIMARY [gcode_macro VERIFY_HYBRID_INVERTED] gcode = {% set inverted = False %} {% if printer.configfile.settings.ratos_hybrid_corexy is defined and printer.configfile.settings.ratos_hybrid_corexy.inverted is defined %} {% if printer.configfile.settings.ratos_hybrid_corexy.inverted|lower == 'true' %} {% set inverted = True %} {% endif %} {% endif %} {% if inverted == False %} { action_emergency_stop("ratos_hybrid_corexy NOT INVERTED! Inverted hybrid core-xy bugfix not detected.") } {% endif %} [gcode_macro RATOS_ECHO] gcode = {% set prefix = "RatOS" %} {% set debug = params.DEBUG|default(0)|int %} {% if params.PREFIX is defined %} {% set prefix = prefix ~ " | " ~ params.PREFIX %} {% endif %} {% set prefix = prefix ~ ":" %} {% set msg = "" %} {% if params.MSG is defined %} {% set msg = params.MSG %} {% else %} {% set msg = "No msg parameter provided (this is a bug or unintended use)." %} {% endif %} {% if not debug %} M117 {prefix} {msg} {% endif %} RATOS_LOG PREFIX="{prefix}" MSG="{msg}" {% if not debug %} RESPOND PREFIX="{prefix}" MSG="{msg}" {% else %} CONSOLE_ECHO TITLE="{prefix}" TYPE="debug" MSG="{msg}" {% endif %} [gcode_macro ENABLE_DEBUG] gcode = SET_GCODE_VARIABLE MACRO=DEBUG_ECHO VARIABLE=enabled VALUE=True SET_GCODE_VARIABLE MACRO=DEBUG_ECHO VARIABLE=prefix_filter VALUE="'{params.FILTER|default('')|lower}'" RATOS_ECHO PREFIX="DEBUG" MSG="Debugging enabled." [gcode_macro DISABLE_DEBUG] gcode = SET_GCODE_VARIABLE MACRO=DEBUG_ECHO VARIABLE=enabled VALUE=False RATOS_ECHO PREFIX="DEBUG" MSG="Debugging disabled." [gcode_macro DEBUG_ECHO] variable_enabled = False variable_prefix_filter = '' gcode = {% set prefix = "DEBUG" %} {% if params.PREFIX is defined %} {% set prefix = prefix ~ " - " ~ params.PREFIX %} {% endif %} {% if enabled and (prefix_filter|lower == '' or prefix_filter|lower in params.PREFIX|lower) %} RATOS_ECHO PREFIX="{prefix}" MSG="{params.MSG}" DEBUG=1 {% endif %} [gcode_macro START_FEATURE] gcode = DEBUG_ECHO PREFIX="G-Code" MSG="Start {params.FEATURE} feature gcode" {% set scv = printer.toolhead.square_corner_velocity|int|default(5) %} {% set accel = printer.toolhead.max_accel|int|default(10000) %} {% set ratio = printer.toolhead.minimum_cruise_ratio|float|default(0.5) %} SET_GCODE_VARIABLE MACRO="END_FEATURE" VARIABLE="scv" VALUE={scv} SET_GCODE_VARIABLE MACRO="END_FEATURE" VARIABLE="accel" VALUE={accel} SET_GCODE_VARIABLE MACRO="END_FEATURE" VARIABLE="ratio" VALUE={ratio} _USER_START_FEATURE FEATURE="{params.FEATURE}" [gcode_macro END_FEATURE] variable_scv = 5 variable_accel = 10000 variable_ratio = 0.5 gcode = DEBUG_ECHO PREFIX="G-Code" MSG="End {params.FEATURE} feature gcode" SET_VELOCITY_LIMIT SQUARE_CORNER_VELOCITY={scv} ACCEL={accel} MINIMUM_CRUISE_RATIO={ratio} _USER_END_FEATURE FEATURE="{params.FEATURE}" SCV={scv} ACCEL={accel} RATIO={ratio} [gcode_macro _ON_LAYER_CHANGE] variable_layer_number = 0 description = INTERNAL USE ONLY. Call it from the slicers after layer change custom gcode gcode = {% set layer = params.LAYER|int %} SET_GCODE_VARIABLE MACRO=_ON_LAYER_CHANGE VARIABLE=layer_number VALUE={layer} SET_PRINT_STATS_INFO CURRENT_LAYER={layer} [gcode_macro _LEARN_MORE_CALIBRATION] gcode = {% set link_url = "https://os.ratrig.com/docs/configuration/calibration" %} {% set link_text = "RatOS Calibration Macros" %} {% set line_1 = '"Learn more about the %s"' % (link_url, link_text) %} CONSOLE_ECHO TITLE="INFO" MSG={line_1} [gcode_macro _LEARN_MORE_CHAMBER_FILTER] gcode = {% set link_url = "https://os.ratrig.com/docs/configuration/chamber_filter" %} {% set link_text = "RatOS Chamber Filter Control" %} {% set line_1 = '"Learn more about the %s"' % (link_url, link_text) %} CONSOLE_ECHO TITLE="INFO" MSG={line_1} [gcode_macro _LEARN_MORE_FILAMENT] gcode = {% set link_url = "https://os.ratrig.com/docs/configuration/filaments" %} {% set link_text = "RatOS Filament Macros" %} {% set line_1 = '"Learn more about the %s"' % (link_url, link_text) %} CONSOLE_ECHO TITLE="INFO" MSG={line_1} [gcode_macro _CONSOLE_SAVE_CONFIG] gcode = M118 Click SAVE_CONFIG to save the settings to your printer.cfg. [gcode_macro SAVE_Z_OFFSET] gcode = {% if printer.configfile.settings.beacon is defined %} _BEACON_SAVE_MULTIPLIER {% else %} Z_OFFSET_APPLY_PROBE {% endif %} [gcode_macro _LOAD_RATOS_SKEW_PROFILE] gcode = {% set ratos_skew_profile = printer["gcode_macro RatOS"].skew_profile|default("") %} {% if ratos_skew_profile != "" %} {% if printer.configfile.config["skew_correction %s" % ratos_skew_profile] is defined %} SKEW_PROFILE LOAD={ratos_skew_profile} GET_CURRENT_SKEW {% else %} {% set line_1 = '"Could not find skew profile %s!_N_Clearing skew correction."' % ratos_skew_profile %} CONSOLE_ECHO TITLE="Missing skew profile!" TYPE="warning" MSG={line_1} SET_SKEW CLEAR=1 {% endif %} {% endif %} [gcode_macro M601] gcode = PAUSE [idle_timeout] gcode = {% if printer.webhooks.state|lower == 'ready' %} {% if printer.pause_resume.is_paused|lower == 'false' %} RATOS_ECHO PREFIX="IDLE" MSG="2 hours since last activity. Powering off heaters and motors.." TURN_OFF_HEATERS M84 {% endif %} {% endif %} timeout = 7200 [temperature_sensor raspberry_pi] sensor_type = temperature_host [virtual_sdcard] path = ~/printer_data/gcodes [display_status] [pause_resume] [respond] [ratos] [mcu] serial = /tmp/klipper_host_mcu [printer] kinematics = none max_velocity = 1 max_accel = 1 [gcode_macro PAUSE] rename_existing = PAUSE_BASE gcode = RATOS_ECHO MSG="Please setup your printer through the RatOS configurator at /configure" [gcode_macro RESUME] rename_existing = RESUME_BASE gcode = RATOS_ECHO MSG="Please setup your printer through the RatOS configurator at /configure" [gcode_macro CANCEL_PRINT] rename_existing = CANCEL_BASE gcode = RATOS_ECHO MSG="Please setup your printer through the RatOS configurator at /configure" ======================= mcu 'mcu': Starting connect Loaded MCU 'mcu' 119 commands (?-20240727_132503-fv-az659-741 / gcc: (Raspbian 10.2.1-6+rpi1) 10.2.1 20210110 binutils: (GNU Binutils for Raspbian) 2.35.2) MCU 'mcu' config: ADC_MAX=4095 CLOCK_FREQ=50000000 MCU=linux PCA9685_MAX=4096 PWM_MAX=32768 STATS_SUMSQ_BASE=256 Sending MCU 'mcu' printer configuration... Configured MCU 'mcu' (1024 moves) Config error Traceback (most recent call last): File "/home/pi/klipper/klippy/klippy.py", line 135, in _connect cb() File "/home/pi/klipper/klippy/extras/ratos.py", line 58, in _connect self.register_command_overrides() File "/home/pi/klipper/klippy/extras/ratos.py", line 86, in register_command_overrides self.register_override('TEST_RESONANCES', self.override_TEST_RESONANCES, desc=(self.desc_TEST_RESONANCES)) File "/home/pi/klipper/klippy/extras/ratos.py", line 97, in register_override raise self.printer.config_error("Existing command '%s' not found in RatOS override" % (command,)) configparser.Error: Existing command 'TEST_RESONANCES' not found in RatOS override webhooks client 4131337672: New connection webhooks client 4131337672: Client info {'program': 'Moonraker', 'version': 'v0.9.3-0-g71f9e67'} Starting Klippy... Args: ['/home/pi/klipper/klippy/klippy.py', '/home/pi/printer_data/config/printer.cfg', '-l', '/home/pi/printer_data/logs/klippy.log', '-I', '/home/pi/printer_data/comms/klippy.serial', '-a', '/home/pi/printer_data/comms/klippy.sock'] Git version: 'v0.12.0-316-g96cceed23-dirty' Untracked files: klippy/extras/beacon.py, klippy/extras/gcode_shell_command.py, klippy/extras/linear_movement_vibrations.py, klippy/extras/ratos.py, klippy/extras/ratos_homing.py, klippy/extras/resonance_generator.py, klippy/extras/z_offset_probe.py, klippy/kinematics/ratos_hybrid_corexy.py Branch: master Remote: origin Tracked URL: https://github.com/Klipper3d/klipper.git CPU: 4 core ? Python: '3.9.2 (default, Mar 20 2025, 22:21:41) \n[GCC 10.2.1 20210110]' Start printer at Wed Oct 22 07:07:18 2025 (1761113238.3 265.4) ===== Config file ===== [gcode_macro ECHO_T_VARS] description = Echo Toolhead variables to the console. gcode = {% set t = params.T|default(0) %} RATOS_ECHO MSG="T{t} Variables" {% for var, value in printer["gcode_macro T%s" % t].items() %} {action_respond_info(var ~ ": " ~ value)} {% endfor %} [gcode_macro ECHO_RATOS_VARS] description = Echo RatOS variables to the console. gcode = {% for var, value in printer["gcode_macro RatOS"].items() %} {action_respond_info(var ~ ": " ~ value)} {% endfor %} [gcode_macro RatOS] description = RatOS variable storage macro, will echo variables to the console when run. variable_relative_extrusion = False variable_force_absolute_position = False variable_preheat_extruder = True variable_preheat_extruder_temp = 150 variable_macro_travel_speed = 150 variable_macro_travel_accel = 2000 variable_macro_z_speed = 15 variable_bed_margin_x = [0, 0] variable_bed_margin_y = [0, 0] variable_printable_x_min = 0 variable_printable_x_max = 0 variable_printable_y_min = 0 variable_printable_y_max = 0 variable_end_print_motors_off = True variable_status_color_ok = "00FF00" variable_status_color_error = "FF0000" variable_status_color_unknown = "FFFF00" variable_end_print_retract_filament = 10 gcode = ECHO_RATOS_VARS [delayed_gcode RATOS_INIT] initial_duration = 0.1 gcode = RATOS_ECHO MSG="Welcome to RatOS!" RATOS_ECHO MSG="Please setup your printer through the RatOS configurator. Use the link in the sidebar to proceed with the setup." [delayed_gcode RATOS_LOGO] initial_duration = 2 gcode = HELLO_RATOS [gcode_macro INITIAL_FRONTEND_UPDATE] gcode = {% set color_ok = printer["gcode_macro RatOS"].status_color_ok|string %} {% set color_error = printer["gcode_macro RatOS"].status_color_error|string %} {% set color_unknown = printer["gcode_macro RatOS"].status_color_unknown|string %} SET_GCODE_VARIABLE MACRO=T0 VARIABLE=color VALUE='"{color_unknown}"' {% if printer["dual_carriage"] is defined %} SET_GCODE_VARIABLE MACRO=T1 VARIABLE=color VALUE='"{color_unknown}"' {% endif %} {% set t0_sensor = "undefined" %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t0"] is defined %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t0"].enabled|lower == "true" %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t0"].filament_detected|lower == "true" %} {% set t0_sensor = "detected" %} {% else %} {% set t0_sensor = "empty" %} {% endif %} {% else %} {% set t0_sensor = "disabled" %} {% endif %} {% endif %} {% set t1_sensor = "undefined" %} {% if printer["dual_carriage"] is defined and printer["filament_switch_sensor toolhead_filament_sensor_t1"] is defined %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t1"].enabled|lower == "true" %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t1"].filament_detected|lower == "true" %} {% set t1_sensor = "detected" %} {% else %} {% set t1_sensor = "empty" %} {% endif %} {% else %} {% set t1_sensor = "disabled" %} {% endif %} {% endif %} {% set svv = printer.save_variables.variables %} {% if svv.t0_filament is defined and printer["gcode_macro T0"] is defined %} {% if printer["gcode_macro T0"].filament_name is defined and printer["gcode_macro T0"].filament_type is defined and printer["gcode_macro T0"].filament_temp is defined %} {% if t0_sensor != "empty" %} {% set t0_filament_type = svv.t0_filament[0]|default('')|string %} {% set t0_filament_name = svv.t0_filament[1]|default('')|string %} {% set t0_filament_temp = svv.t0_filament[2]|default(0)|float %} {% if t0_filament_name != '' and t0_filament_type != '' and t0_filament_temp > 0 %} SET_GCODE_VARIABLE MACRO=T0 VARIABLE=color VALUE='"{color_ok}"' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_name VALUE='"{t0_filament_name}"' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_type VALUE='"{t0_filament_type}"' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_temp VALUE={t0_filament_temp} {% endif %} {% else %} SAVE_VARIABLE VARIABLE=t0_filament VALUE="('""', '""', 0)" SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_name VALUE='""' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_type VALUE='""' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_temp VALUE=0 {% endif %} {% endif %} {% endif %} {% if svv.t1_filament is defined and printer["gcode_macro T1"] is defined %} {% if printer["gcode_macro T1"].filament_name is defined and printer["gcode_macro T1"].filament_type is defined and printer["gcode_macro T1"].filament_temp is defined %} {% if t1_sensor != "empty" %} {% set t1_filament_type = svv.t1_filament[0]|default('')|string %} {% set t1_filament_name = svv.t1_filament[1]|default('')|string %} {% set t1_filament_temp = svv.t1_filament[2]|default(0)|float %} {% if t1_filament_name != '' and t1_filament_type != '' and t1_filament_temp > 0 %} SET_GCODE_VARIABLE MACRO=T1 VARIABLE=color VALUE='"{color_ok}"' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_name VALUE='"{t1_filament_name}"' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_type VALUE='"{t1_filament_type}"' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_temp VALUE={t1_filament_temp} {% endif %} {% else %} SAVE_VARIABLE VARIABLE=t1_filament VALUE="('""', '""', 0)" SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_name VALUE='""' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_type VALUE='""' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_temp VALUE=0 {% endif %} {% endif %} {% endif %} [gcode_macro CALCULATE_PRINTABLE_AREA] gcode = {% set bed_margin_x = printer["gcode_macro RatOS"].bed_margin_x %} {% set bed_margin_y = printer["gcode_macro RatOS"].bed_margin_y %} {% set tool = 0 if printer["gcode_macro T0"] is not defined or printer["gcode_macro T0"].active else 1 %} {% set max_x = printer.toolhead.axis_maximum.x if printer["dual_carriage"] is defined and tool == 0 else printer.toolhead.axis_maximum.x - bed_margin_x[1] %} {% if printer["dual_carriage"] is defined %} {% set max_x = printer.toolhead.axis_maximum.x %} {% endif %} DEBUG_ECHO PREFIX="CALCULATE_PRINTABLE_AREA" MSG="printer.toolhead.axis_maximum.x {printer.toolhead.axis_maximum.x}" {% set max_y = printer.toolhead.axis_maximum.y - bed_margin_y[1]%} SET_GCODE_VARIABLE MACRO=RatOS VARIABLE=printable_x_max VALUE={max_x} SET_GCODE_VARIABLE MACRO=RatOS VARIABLE=printable_y_max VALUE={max_y} DEBUG_ECHO PREFIX="CALCULATE_PRINTABLE_AREA" MSG="Printable area calculated: X: 0,{max_x} Y: 0,{max_y}" [gcode_macro CACHE_TOOLHEAD_SETTINGS] variable_cache = {"global": {"accel": 1000, "ratio": 0.5, "speed": 50, "scv": 5}} gcode = {% set key = "global" %} {% if params.KEY is defined %} {% set key = params.KEY %} {% endif %} {% set dummy = cache.__setitem__(key, {"accel": printer.toolhead.max_accel, "ratio": printer.toolhead.minimum_cruise_ratio, "speed": printer.toolhead.max_velocity, "scv": printer.toolhead.square_corner_velocity}) %} SET_GCODE_VARIABLE MACRO=CACHE_TOOLHEAD_SETTINGS VARIABLE=cache VALUE="{cache | pprint | replace("\n", "") | replace("\"", "\\\"")}" DEBUG_ECHO PREFIX="CACHE_TOOLHEAD_SETTINGS" MSG="Toolhead settings cached for {key}. {printer.toolhead.max_accel} accel, {printer.toolhead.minimum_cruise_ratio} ratio, {printer.toolhead.max_velocity} velocity, {printer.toolhead.square_corner_velocity} scv." [gcode_macro RESTORE_TOOLHEAD_SETTINGS] gcode = {% set key = "global" %} {% if params.KEY is defined %} {% set key = params.KEY %} {% endif %} {% set values = printer["gcode_macro CACHE_TOOLHEAD_SETTINGS"].cache.__getitem__(key) %} {% if values is not defined or values == 'None' %} { action_raise_error("RESTORE_TOOLHEAD_SETTINGS: Toolhead settings not cached for key '" ~ key ~ "'.") } {% endif %} SET_VELOCITY_LIMIT ACCEL={values.accel} MINIMUM_CRUISE_RATIO={values.ratio} VELOCITY={values.speed} SQUARE_CORNER_VELOCITY={values.scv} DEBUG_ECHO PREFIX="RESTORE_TOOLHEAD_SETTINGS" MSG="Toolhead settings restored. {values.accel} accel, {values.ratio} ratio, {values.speed} velocity, {values.scv} scv." [gcode_macro SET_MACRO_TRAVEL_SETTINGS] gcode = {% set speed = printer["gcode_macro RatOS"].macro_travel_speed|float * 60 %} {% set accel = printer["gcode_macro RatOS"].macro_travel_accel %} SET_VELOCITY_LIMIT ACCEL={accel} MINIMUM_CRUISE_RATIO=0.5 VELOCITY={speed} SQUARE_CORNER_VELOCITY={5} DEBUG_ECHO PREFIX="SET_MACRO_TRAVEL_SETTINGS" MSG="Macro travel settings set. {accel} accel, {speed} velocity" [gcode_macro SET_CENTER_KINEMATIC_POSITION] description = FOR DEBUGGING PURPOSES ONLY. Sets the internal printer kinematic state to the center of all axes regardless of actual physical position. gcode = {% set printable_x_max = printer["gcode_macro RatOS"].printable_x_max|float %} {% set printable_y_max = printer["gcode_macro RatOS"].printable_y_max|float %} RATOS_ECHO MSG="WARNING: ONLY USE SET_CENTER_KINEMATIC_POSITION FOR DEBUGGING PURPOSES. YOU'RE OVERRIDING THE INTERNAL POSITIONING STATE OF THE PRINTER. PROCEED WITH CAUTION AND DO A PROPER G28 WHEN DONE." SET_GCODE_VARIABLE MACRO=MAYBE_HOME VARIABLE=is_kinematic_position_overriden VALUE=True {% if printer["dual_carriage"] is not defined %} SET_KINEMATIC_POSITION X={printable_x_max / 2} Y={printable_y_max / 2} Z={printer.toolhead.axis_maximum.z / 2} {% else %} IDEX_SET_CENTER_KINEMATIC_POSITION {% endif %} [gcode_macro IDEX_SET_CENTER_KINEMATIC_POSITION] description = FOR DEBUGGING PURPOSES ONLY. Sets the internal printer kinematic state to the center of all axes regardless of actual physical position. gcode = {% set printable_x_max = printer["gcode_macro RatOS"].printable_x_max|float %} {% set printable_y_max = printer["gcode_macro RatOS"].printable_y_max|float %} RATOS_ECHO MSG="WARNING: ONLY USE SET_CENTER_KINEMATIC_POSITION FOR DEBUGGING PURPOSES. YOU'RE OVERRIDING THE INTERNAL POSITIONING STATE OF THE PRINTER. PROCEED WITH CAUTION AND DO A PROPER G28 WHEN DONE." SET_GCODE_VARIABLE MACRO=MAYBE_HOME VARIABLE=is_kinematic_position_overriden VALUE=True {% set printable_x_max = printer["gcode_macro RatOS"].printable_x_max|float %} {% set center_x = printable_x_max / 2 %} SET_DUAL_CARRIAGE CARRIAGE=0 MODE=PRIMARY SET_KINEMATIC_POSITION X={center_x - (center_x / 2)} Y={printable_y_max / 2} Z={printer.toolhead.axis_maximum.z / 2} SET_DUAL_CARRIAGE CARRIAGE=1 MODE=PRIMARY SET_KINEMATIC_POSITION X={center_x + (center_x / 2)} Y={printable_y_max / 2} Z={printer.toolhead.axis_maximum.z / 2} SET_DUAL_CARRIAGE CARRIAGE=0 MODE=PRIMARY [gcode_macro VERIFY_HYBRID_INVERTED] gcode = {% set inverted = False %} {% if printer.configfile.settings.ratos_hybrid_corexy is defined and printer.configfile.settings.ratos_hybrid_corexy.inverted is defined %} {% if printer.configfile.settings.ratos_hybrid_corexy.inverted|lower == 'true' %} {% set inverted = True %} {% endif %} {% endif %} {% if inverted == False %} { action_emergency_stop("ratos_hybrid_corexy NOT INVERTED! Inverted hybrid core-xy bugfix not detected.") } {% endif %} [gcode_macro RATOS_ECHO] gcode = {% set prefix = "RatOS" %} {% set debug = params.DEBUG|default(0)|int %} {% if params.PREFIX is defined %} {% set prefix = prefix ~ " | " ~ params.PREFIX %} {% endif %} {% set prefix = prefix ~ ":" %} {% set msg = "" %} {% if params.MSG is defined %} {% set msg = params.MSG %} {% else %} {% set msg = "No msg parameter provided (this is a bug or unintended use)." %} {% endif %} {% if not debug %} M117 {prefix} {msg} {% endif %} RATOS_LOG PREFIX="{prefix}" MSG="{msg}" {% if not debug %} RESPOND PREFIX="{prefix}" MSG="{msg}" {% else %} CONSOLE_ECHO TITLE="{prefix}" TYPE="debug" MSG="{msg}" {% endif %} [gcode_macro ENABLE_DEBUG] gcode = SET_GCODE_VARIABLE MACRO=DEBUG_ECHO VARIABLE=enabled VALUE=True SET_GCODE_VARIABLE MACRO=DEBUG_ECHO VARIABLE=prefix_filter VALUE="'{params.FILTER|default('')|lower}'" RATOS_ECHO PREFIX="DEBUG" MSG="Debugging enabled." [gcode_macro DISABLE_DEBUG] gcode = SET_GCODE_VARIABLE MACRO=DEBUG_ECHO VARIABLE=enabled VALUE=False RATOS_ECHO PREFIX="DEBUG" MSG="Debugging disabled." [gcode_macro DEBUG_ECHO] variable_enabled = False variable_prefix_filter = '' gcode = {% set prefix = "DEBUG" %} {% if params.PREFIX is defined %} {% set prefix = prefix ~ " - " ~ params.PREFIX %} {% endif %} {% if enabled and (prefix_filter|lower == '' or prefix_filter|lower in params.PREFIX|lower) %} RATOS_ECHO PREFIX="{prefix}" MSG="{params.MSG}" DEBUG=1 {% endif %} [gcode_macro START_FEATURE] gcode = DEBUG_ECHO PREFIX="G-Code" MSG="Start {params.FEATURE} feature gcode" {% set scv = printer.toolhead.square_corner_velocity|int|default(5) %} {% set accel = printer.toolhead.max_accel|int|default(10000) %} {% set ratio = printer.toolhead.minimum_cruise_ratio|float|default(0.5) %} SET_GCODE_VARIABLE MACRO="END_FEATURE" VARIABLE="scv" VALUE={scv} SET_GCODE_VARIABLE MACRO="END_FEATURE" VARIABLE="accel" VALUE={accel} SET_GCODE_VARIABLE MACRO="END_FEATURE" VARIABLE="ratio" VALUE={ratio} _USER_START_FEATURE FEATURE="{params.FEATURE}" [gcode_macro END_FEATURE] variable_scv = 5 variable_accel = 10000 variable_ratio = 0.5 gcode = DEBUG_ECHO PREFIX="G-Code" MSG="End {params.FEATURE} feature gcode" SET_VELOCITY_LIMIT SQUARE_CORNER_VELOCITY={scv} ACCEL={accel} MINIMUM_CRUISE_RATIO={ratio} _USER_END_FEATURE FEATURE="{params.FEATURE}" SCV={scv} ACCEL={accel} RATIO={ratio} [gcode_macro _ON_LAYER_CHANGE] variable_layer_number = 0 description = INTERNAL USE ONLY. Call it from the slicers after layer change custom gcode gcode = {% set layer = params.LAYER|int %} SET_GCODE_VARIABLE MACRO=_ON_LAYER_CHANGE VARIABLE=layer_number VALUE={layer} SET_PRINT_STATS_INFO CURRENT_LAYER={layer} [gcode_macro _LEARN_MORE_CALIBRATION] gcode = {% set link_url = "https://os.ratrig.com/docs/configuration/calibration" %} {% set link_text = "RatOS Calibration Macros" %} {% set line_1 = '"Learn more about the %s"' % (link_url, link_text) %} CONSOLE_ECHO TITLE="INFO" MSG={line_1} [gcode_macro _LEARN_MORE_CHAMBER_FILTER] gcode = {% set link_url = "https://os.ratrig.com/docs/configuration/chamber_filter" %} {% set link_text = "RatOS Chamber Filter Control" %} {% set line_1 = '"Learn more about the %s"' % (link_url, link_text) %} CONSOLE_ECHO TITLE="INFO" MSG={line_1} [gcode_macro _LEARN_MORE_FILAMENT] gcode = {% set link_url = "https://os.ratrig.com/docs/configuration/filaments" %} {% set link_text = "RatOS Filament Macros" %} {% set line_1 = '"Learn more about the %s"' % (link_url, link_text) %} CONSOLE_ECHO TITLE="INFO" MSG={line_1} [gcode_macro _CONSOLE_SAVE_CONFIG] gcode = M118 Click SAVE_CONFIG to save the settings to your printer.cfg. [gcode_macro SAVE_Z_OFFSET] gcode = {% if printer.configfile.settings.beacon is defined %} _BEACON_SAVE_MULTIPLIER {% else %} Z_OFFSET_APPLY_PROBE {% endif %} [gcode_macro _LOAD_RATOS_SKEW_PROFILE] gcode = {% set ratos_skew_profile = printer["gcode_macro RatOS"].skew_profile|default("") %} {% if ratos_skew_profile != "" %} {% if printer.configfile.config["skew_correction %s" % ratos_skew_profile] is defined %} SKEW_PROFILE LOAD={ratos_skew_profile} GET_CURRENT_SKEW {% else %} {% set line_1 = '"Could not find skew profile %s!_N_Clearing skew correction."' % ratos_skew_profile %} CONSOLE_ECHO TITLE="Missing skew profile!" TYPE="warning" MSG={line_1} SET_SKEW CLEAR=1 {% endif %} {% endif %} [gcode_macro M601] gcode = PAUSE [idle_timeout] gcode = {% if printer.webhooks.state|lower == 'ready' %} {% if printer.pause_resume.is_paused|lower == 'false' %} RATOS_ECHO PREFIX="IDLE" MSG="2 hours since last activity. Powering off heaters and motors.." TURN_OFF_HEATERS M84 {% endif %} {% endif %} timeout = 7200 [temperature_sensor raspberry_pi] sensor_type = temperature_host [virtual_sdcard] path = ~/printer_data/gcodes [display_status] [pause_resume] [respond] [ratos] [mcu] serial = /tmp/klipper_host_mcu [printer] kinematics = none max_velocity = 1 max_accel = 1 [gcode_macro PAUSE] rename_existing = PAUSE_BASE gcode = RATOS_ECHO MSG="Please setup your printer through the RatOS configurator at /configure" [gcode_macro RESUME] rename_existing = RESUME_BASE gcode = RATOS_ECHO MSG="Please setup your printer through the RatOS configurator at /configure" [gcode_macro CANCEL_PRINT] rename_existing = CANCEL_BASE gcode = RATOS_ECHO MSG="Please setup your printer through the RatOS configurator at /configure" ======================= mcu 'mcu': Starting connect webhooks client 4127239088: New connection webhooks client 4127239088: Client info {'program': 'Moonraker', 'version': 'v0.9.3-0-g71f9e67'} Loaded MCU 'mcu' 119 commands (?-20240727_132503-fv-az659-741 / gcc: (Raspbian 10.2.1-6+rpi1) 10.2.1 20210110 binutils: (GNU Binutils for Raspbian) 2.35.2) MCU 'mcu' config: ADC_MAX=4095 CLOCK_FREQ=50000000 MCU=linux PCA9685_MAX=4096 PWM_MAX=32768 STATS_SUMSQ_BASE=256 Configured MCU 'mcu' (1024 moves) Config error Traceback (most recent call last): File "/home/pi/klipper/klippy/klippy.py", line 135, in _connect cb() File "/home/pi/klipper/klippy/extras/ratos.py", line 58, in _connect self.register_command_overrides() File "/home/pi/klipper/klippy/extras/ratos.py", line 86, in register_command_overrides self.register_override('TEST_RESONANCES', self.override_TEST_RESONANCES, desc=(self.desc_TEST_RESONANCES)) File "/home/pi/klipper/klippy/extras/ratos.py", line 97, in register_override raise self.printer.config_error("Existing command '%s' not found in RatOS override" % (command,)) configparser.Error: Existing command 'TEST_RESONANCES' not found in RatOS override Starting Klippy... Args: ['/home/pi/klipper/klippy/klippy.py', '/home/pi/printer_data/config/printer.cfg', '-l', '/home/pi/printer_data/logs/klippy.log', '-I', '/home/pi/printer_data/comms/klippy.serial', '-a', '/home/pi/printer_data/comms/klippy.sock'] Git version: 'v0.12.0-316-g96cceed23-dirty' Untracked files: klippy/extras/beacon.py, klippy/extras/gcode_shell_command.py, klippy/extras/linear_movement_vibrations.py, klippy/extras/ratos.py, klippy/extras/ratos_homing.py, klippy/extras/resonance_generator.py, klippy/extras/z_offset_probe.py, klippy/kinematics/ratos_hybrid_corexy.py Branch: master Remote: origin Tracked URL: https://github.com/Klipper3d/klipper.git CPU: 4 core ? Python: '3.9.2 (default, Mar 20 2025, 22:21:41) \n[GCC 10.2.1 20210110]' Start printer at Wed Oct 22 07:11:13 2025 (1761113473.2 500.4) ===== Config file ===== [gcode_macro ECHO_T_VARS] description = Echo Toolhead variables to the console. gcode = {% set t = params.T|default(0) %} RATOS_ECHO MSG="T{t} Variables" {% for var, value in printer["gcode_macro T%s" % t].items() %} {action_respond_info(var ~ ": " ~ value)} {% endfor %} [gcode_macro ECHO_RATOS_VARS] description = Echo RatOS variables to the console. gcode = {% for var, value in printer["gcode_macro RatOS"].items() %} {action_respond_info(var ~ ": " ~ value)} {% endfor %} [gcode_macro RatOS] description = RatOS variable storage macro, will echo variables to the console when run. variable_relative_extrusion = False variable_force_absolute_position = False variable_preheat_extruder = True variable_preheat_extruder_temp = 150 variable_macro_travel_speed = 150 variable_macro_travel_accel = 2000 variable_macro_z_speed = 15 variable_bed_margin_x = [0, 0] variable_bed_margin_y = [0, 0] variable_printable_x_min = 0 variable_printable_x_max = 0 variable_printable_y_min = 0 variable_printable_y_max = 0 variable_end_print_motors_off = True variable_status_color_ok = "00FF00" variable_status_color_error = "FF0000" variable_status_color_unknown = "FFFF00" variable_end_print_retract_filament = 10 gcode = ECHO_RATOS_VARS [delayed_gcode RATOS_INIT] initial_duration = 0.1 gcode = RATOS_ECHO MSG="Welcome to RatOS!" RATOS_ECHO MSG="Please setup your printer through the RatOS configurator. Use the link in the sidebar to proceed with the setup." [delayed_gcode RATOS_LOGO] initial_duration = 2 gcode = HELLO_RATOS [gcode_macro INITIAL_FRONTEND_UPDATE] gcode = {% set color_ok = printer["gcode_macro RatOS"].status_color_ok|string %} {% set color_error = printer["gcode_macro RatOS"].status_color_error|string %} {% set color_unknown = printer["gcode_macro RatOS"].status_color_unknown|string %} SET_GCODE_VARIABLE MACRO=T0 VARIABLE=color VALUE='"{color_unknown}"' {% if printer["dual_carriage"] is defined %} SET_GCODE_VARIABLE MACRO=T1 VARIABLE=color VALUE='"{color_unknown}"' {% endif %} {% set t0_sensor = "undefined" %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t0"] is defined %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t0"].enabled|lower == "true" %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t0"].filament_detected|lower == "true" %} {% set t0_sensor = "detected" %} {% else %} {% set t0_sensor = "empty" %} {% endif %} {% else %} {% set t0_sensor = "disabled" %} {% endif %} {% endif %} {% set t1_sensor = "undefined" %} {% if printer["dual_carriage"] is defined and printer["filament_switch_sensor toolhead_filament_sensor_t1"] is defined %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t1"].enabled|lower == "true" %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t1"].filament_detected|lower == "true" %} {% set t1_sensor = "detected" %} {% else %} {% set t1_sensor = "empty" %} {% endif %} {% else %} {% set t1_sensor = "disabled" %} {% endif %} {% endif %} {% set svv = printer.save_variables.variables %} {% if svv.t0_filament is defined and printer["gcode_macro T0"] is defined %} {% if printer["gcode_macro T0"].filament_name is defined and printer["gcode_macro T0"].filament_type is defined and printer["gcode_macro T0"].filament_temp is defined %} {% if t0_sensor != "empty" %} {% set t0_filament_type = svv.t0_filament[0]|default('')|string %} {% set t0_filament_name = svv.t0_filament[1]|default('')|string %} {% set t0_filament_temp = svv.t0_filament[2]|default(0)|float %} {% if t0_filament_name != '' and t0_filament_type != '' and t0_filament_temp > 0 %} SET_GCODE_VARIABLE MACRO=T0 VARIABLE=color VALUE='"{color_ok}"' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_name VALUE='"{t0_filament_name}"' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_type VALUE='"{t0_filament_type}"' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_temp VALUE={t0_filament_temp} {% endif %} {% else %} SAVE_VARIABLE VARIABLE=t0_filament VALUE="('""', '""', 0)" SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_name VALUE='""' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_type VALUE='""' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_temp VALUE=0 {% endif %} {% endif %} {% endif %} {% if svv.t1_filament is defined and printer["gcode_macro T1"] is defined %} {% if printer["gcode_macro T1"].filament_name is defined and printer["gcode_macro T1"].filament_type is defined and printer["gcode_macro T1"].filament_temp is defined %} {% if t1_sensor != "empty" %} {% set t1_filament_type = svv.t1_filament[0]|default('')|string %} {% set t1_filament_name = svv.t1_filament[1]|default('')|string %} {% set t1_filament_temp = svv.t1_filament[2]|default(0)|float %} {% if t1_filament_name != '' and t1_filament_type != '' and t1_filament_temp > 0 %} SET_GCODE_VARIABLE MACRO=T1 VARIABLE=color VALUE='"{color_ok}"' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_name VALUE='"{t1_filament_name}"' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_type VALUE='"{t1_filament_type}"' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_temp VALUE={t1_filament_temp} {% endif %} {% else %} SAVE_VARIABLE VARIABLE=t1_filament VALUE="('""', '""', 0)" SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_name VALUE='""' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_type VALUE='""' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_temp VALUE=0 {% endif %} {% endif %} {% endif %} [gcode_macro CALCULATE_PRINTABLE_AREA] gcode = {% set bed_margin_x = printer["gcode_macro RatOS"].bed_margin_x %} {% set bed_margin_y = printer["gcode_macro RatOS"].bed_margin_y %} {% set tool = 0 if printer["gcode_macro T0"] is not defined or printer["gcode_macro T0"].active else 1 %} {% set max_x = printer.toolhead.axis_maximum.x if printer["dual_carriage"] is defined and tool == 0 else printer.toolhead.axis_maximum.x - bed_margin_x[1] %} {% if printer["dual_carriage"] is defined %} {% set max_x = printer.toolhead.axis_maximum.x %} {% endif %} DEBUG_ECHO PREFIX="CALCULATE_PRINTABLE_AREA" MSG="printer.toolhead.axis_maximum.x {printer.toolhead.axis_maximum.x}" {% set max_y = printer.toolhead.axis_maximum.y - bed_margin_y[1]%} SET_GCODE_VARIABLE MACRO=RatOS VARIABLE=printable_x_max VALUE={max_x} SET_GCODE_VARIABLE MACRO=RatOS VARIABLE=printable_y_max VALUE={max_y} DEBUG_ECHO PREFIX="CALCULATE_PRINTABLE_AREA" MSG="Printable area calculated: X: 0,{max_x} Y: 0,{max_y}" [gcode_macro CACHE_TOOLHEAD_SETTINGS] variable_cache = {"global": {"accel": 1000, "ratio": 0.5, "speed": 50, "scv": 5}} gcode = {% set key = "global" %} {% if params.KEY is defined %} {% set key = params.KEY %} {% endif %} {% set dummy = cache.__setitem__(key, {"accel": printer.toolhead.max_accel, "ratio": printer.toolhead.minimum_cruise_ratio, "speed": printer.toolhead.max_velocity, "scv": printer.toolhead.square_corner_velocity}) %} SET_GCODE_VARIABLE MACRO=CACHE_TOOLHEAD_SETTINGS VARIABLE=cache VALUE="{cache | pprint | replace("\n", "") | replace("\"", "\\\"")}" DEBUG_ECHO PREFIX="CACHE_TOOLHEAD_SETTINGS" MSG="Toolhead settings cached for {key}. {printer.toolhead.max_accel} accel, {printer.toolhead.minimum_cruise_ratio} ratio, {printer.toolhead.max_velocity} velocity, {printer.toolhead.square_corner_velocity} scv." [gcode_macro RESTORE_TOOLHEAD_SETTINGS] gcode = {% set key = "global" %} {% if params.KEY is defined %} {% set key = params.KEY %} {% endif %} {% set values = printer["gcode_macro CACHE_TOOLHEAD_SETTINGS"].cache.__getitem__(key) %} {% if values is not defined or values == 'None' %} { action_raise_error("RESTORE_TOOLHEAD_SETTINGS: Toolhead settings not cached for key '" ~ key ~ "'.") } {% endif %} SET_VELOCITY_LIMIT ACCEL={values.accel} MINIMUM_CRUISE_RATIO={values.ratio} VELOCITY={values.speed} SQUARE_CORNER_VELOCITY={values.scv} DEBUG_ECHO PREFIX="RESTORE_TOOLHEAD_SETTINGS" MSG="Toolhead settings restored. {values.accel} accel, {values.ratio} ratio, {values.speed} velocity, {values.scv} scv." [gcode_macro SET_MACRO_TRAVEL_SETTINGS] gcode = {% set speed = printer["gcode_macro RatOS"].macro_travel_speed|float * 60 %} {% set accel = printer["gcode_macro RatOS"].macro_travel_accel %} SET_VELOCITY_LIMIT ACCEL={accel} MINIMUM_CRUISE_RATIO=0.5 VELOCITY={speed} SQUARE_CORNER_VELOCITY={5} DEBUG_ECHO PREFIX="SET_MACRO_TRAVEL_SETTINGS" MSG="Macro travel settings set. {accel} accel, {speed} velocity" [gcode_macro SET_CENTER_KINEMATIC_POSITION] description = FOR DEBUGGING PURPOSES ONLY. Sets the internal printer kinematic state to the center of all axes regardless of actual physical position. gcode = {% set printable_x_max = printer["gcode_macro RatOS"].printable_x_max|float %} {% set printable_y_max = printer["gcode_macro RatOS"].printable_y_max|float %} RATOS_ECHO MSG="WARNING: ONLY USE SET_CENTER_KINEMATIC_POSITION FOR DEBUGGING PURPOSES. YOU'RE OVERRIDING THE INTERNAL POSITIONING STATE OF THE PRINTER. PROCEED WITH CAUTION AND DO A PROPER G28 WHEN DONE." SET_GCODE_VARIABLE MACRO=MAYBE_HOME VARIABLE=is_kinematic_position_overriden VALUE=True {% if printer["dual_carriage"] is not defined %} SET_KINEMATIC_POSITION X={printable_x_max / 2} Y={printable_y_max / 2} Z={printer.toolhead.axis_maximum.z / 2} {% else %} IDEX_SET_CENTER_KINEMATIC_POSITION {% endif %} [gcode_macro IDEX_SET_CENTER_KINEMATIC_POSITION] description = FOR DEBUGGING PURPOSES ONLY. Sets the internal printer kinematic state to the center of all axes regardless of actual physical position. gcode = {% set printable_x_max = printer["gcode_macro RatOS"].printable_x_max|float %} {% set printable_y_max = printer["gcode_macro RatOS"].printable_y_max|float %} RATOS_ECHO MSG="WARNING: ONLY USE SET_CENTER_KINEMATIC_POSITION FOR DEBUGGING PURPOSES. YOU'RE OVERRIDING THE INTERNAL POSITIONING STATE OF THE PRINTER. PROCEED WITH CAUTION AND DO A PROPER G28 WHEN DONE." SET_GCODE_VARIABLE MACRO=MAYBE_HOME VARIABLE=is_kinematic_position_overriden VALUE=True {% set printable_x_max = printer["gcode_macro RatOS"].printable_x_max|float %} {% set center_x = printable_x_max / 2 %} SET_DUAL_CARRIAGE CARRIAGE=0 MODE=PRIMARY SET_KINEMATIC_POSITION X={center_x - (center_x / 2)} Y={printable_y_max / 2} Z={printer.toolhead.axis_maximum.z / 2} SET_DUAL_CARRIAGE CARRIAGE=1 MODE=PRIMARY SET_KINEMATIC_POSITION X={center_x + (center_x / 2)} Y={printable_y_max / 2} Z={printer.toolhead.axis_maximum.z / 2} SET_DUAL_CARRIAGE CARRIAGE=0 MODE=PRIMARY [gcode_macro VERIFY_HYBRID_INVERTED] gcode = {% set inverted = False %} {% if printer.configfile.settings.ratos_hybrid_corexy is defined and printer.configfile.settings.ratos_hybrid_corexy.inverted is defined %} {% if printer.configfile.settings.ratos_hybrid_corexy.inverted|lower == 'true' %} {% set inverted = True %} {% endif %} {% endif %} {% if inverted == False %} { action_emergency_stop("ratos_hybrid_corexy NOT INVERTED! Inverted hybrid core-xy bugfix not detected.") } {% endif %} [gcode_macro RATOS_ECHO] gcode = {% set prefix = "RatOS" %} {% set debug = params.DEBUG|default(0)|int %} {% if params.PREFIX is defined %} {% set prefix = prefix ~ " | " ~ params.PREFIX %} {% endif %} {% set prefix = prefix ~ ":" %} {% set msg = "" %} {% if params.MSG is defined %} {% set msg = params.MSG %} {% else %} {% set msg = "No msg parameter provided (this is a bug or unintended use)." %} {% endif %} {% if not debug %} M117 {prefix} {msg} {% endif %} RATOS_LOG PREFIX="{prefix}" MSG="{msg}" {% if not debug %} RESPOND PREFIX="{prefix}" MSG="{msg}" {% else %} CONSOLE_ECHO TITLE="{prefix}" TYPE="debug" MSG="{msg}" {% endif %} [gcode_macro ENABLE_DEBUG] gcode = SET_GCODE_VARIABLE MACRO=DEBUG_ECHO VARIABLE=enabled VALUE=True SET_GCODE_VARIABLE MACRO=DEBUG_ECHO VARIABLE=prefix_filter VALUE="'{params.FILTER|default('')|lower}'" RATOS_ECHO PREFIX="DEBUG" MSG="Debugging enabled." [gcode_macro DISABLE_DEBUG] gcode = SET_GCODE_VARIABLE MACRO=DEBUG_ECHO VARIABLE=enabled VALUE=False RATOS_ECHO PREFIX="DEBUG" MSG="Debugging disabled." [gcode_macro DEBUG_ECHO] variable_enabled = False variable_prefix_filter = '' gcode = {% set prefix = "DEBUG" %} {% if params.PREFIX is defined %} {% set prefix = prefix ~ " - " ~ params.PREFIX %} {% endif %} {% if enabled and (prefix_filter|lower == '' or prefix_filter|lower in params.PREFIX|lower) %} RATOS_ECHO PREFIX="{prefix}" MSG="{params.MSG}" DEBUG=1 {% endif %} [gcode_macro START_FEATURE] gcode = DEBUG_ECHO PREFIX="G-Code" MSG="Start {params.FEATURE} feature gcode" {% set scv = printer.toolhead.square_corner_velocity|int|default(5) %} {% set accel = printer.toolhead.max_accel|int|default(10000) %} {% set ratio = printer.toolhead.minimum_cruise_ratio|float|default(0.5) %} SET_GCODE_VARIABLE MACRO="END_FEATURE" VARIABLE="scv" VALUE={scv} SET_GCODE_VARIABLE MACRO="END_FEATURE" VARIABLE="accel" VALUE={accel} SET_GCODE_VARIABLE MACRO="END_FEATURE" VARIABLE="ratio" VALUE={ratio} _USER_START_FEATURE FEATURE="{params.FEATURE}" [gcode_macro END_FEATURE] variable_scv = 5 variable_accel = 10000 variable_ratio = 0.5 gcode = DEBUG_ECHO PREFIX="G-Code" MSG="End {params.FEATURE} feature gcode" SET_VELOCITY_LIMIT SQUARE_CORNER_VELOCITY={scv} ACCEL={accel} MINIMUM_CRUISE_RATIO={ratio} _USER_END_FEATURE FEATURE="{params.FEATURE}" SCV={scv} ACCEL={accel} RATIO={ratio} [gcode_macro _ON_LAYER_CHANGE] variable_layer_number = 0 description = INTERNAL USE ONLY. Call it from the slicers after layer change custom gcode gcode = {% set layer = params.LAYER|int %} SET_GCODE_VARIABLE MACRO=_ON_LAYER_CHANGE VARIABLE=layer_number VALUE={layer} SET_PRINT_STATS_INFO CURRENT_LAYER={layer} [gcode_macro _LEARN_MORE_CALIBRATION] gcode = {% set link_url = "https://os.ratrig.com/docs/configuration/calibration" %} {% set link_text = "RatOS Calibration Macros" %} {% set line_1 = '"Learn more about the %s"' % (link_url, link_text) %} CONSOLE_ECHO TITLE="INFO" MSG={line_1} [gcode_macro _LEARN_MORE_CHAMBER_FILTER] gcode = {% set link_url = "https://os.ratrig.com/docs/configuration/chamber_filter" %} {% set link_text = "RatOS Chamber Filter Control" %} {% set line_1 = '"Learn more about the %s"' % (link_url, link_text) %} CONSOLE_ECHO TITLE="INFO" MSG={line_1} [gcode_macro _LEARN_MORE_FILAMENT] gcode = {% set link_url = "https://os.ratrig.com/docs/configuration/filaments" %} {% set link_text = "RatOS Filament Macros" %} {% set line_1 = '"Learn more about the %s"' % (link_url, link_text) %} CONSOLE_ECHO TITLE="INFO" MSG={line_1} [gcode_macro _CONSOLE_SAVE_CONFIG] gcode = M118 Click SAVE_CONFIG to save the settings to your printer.cfg. [gcode_macro SAVE_Z_OFFSET] gcode = {% if printer.configfile.settings.beacon is defined %} _BEACON_SAVE_MULTIPLIER {% else %} Z_OFFSET_APPLY_PROBE {% endif %} [gcode_macro _LOAD_RATOS_SKEW_PROFILE] gcode = {% set ratos_skew_profile = printer["gcode_macro RatOS"].skew_profile|default("") %} {% if ratos_skew_profile != "" %} {% if printer.configfile.config["skew_correction %s" % ratos_skew_profile] is defined %} SKEW_PROFILE LOAD={ratos_skew_profile} GET_CURRENT_SKEW {% else %} {% set line_1 = '"Could not find skew profile %s!_N_Clearing skew correction."' % ratos_skew_profile %} CONSOLE_ECHO TITLE="Missing skew profile!" TYPE="warning" MSG={line_1} SET_SKEW CLEAR=1 {% endif %} {% endif %} [gcode_macro M601] gcode = PAUSE [idle_timeout] gcode = {% if printer.webhooks.state|lower == 'ready' %} {% if printer.pause_resume.is_paused|lower == 'false' %} RATOS_ECHO PREFIX="IDLE" MSG="2 hours since last activity. Powering off heaters and motors.." TURN_OFF_HEATERS M84 {% endif %} {% endif %} timeout = 7200 [temperature_sensor raspberry_pi] sensor_type = temperature_host [virtual_sdcard] path = ~/printer_data/gcodes [display_status] [pause_resume] [respond] [ratos] [mcu] serial = /tmp/klipper_host_mcu [printer] kinematics = none max_velocity = 1 max_accel = 1 [gcode_macro PAUSE] rename_existing = PAUSE_BASE gcode = RATOS_ECHO MSG="Please setup your printer through the RatOS configurator at /configure" [gcode_macro RESUME] rename_existing = RESUME_BASE gcode = RATOS_ECHO MSG="Please setup your printer through the RatOS configurator at /configure" [gcode_macro CANCEL_PRINT] rename_existing = CANCEL_BASE gcode = RATOS_ECHO MSG="Please setup your printer through the RatOS configurator at /configure" ======================= mcu 'mcu': Starting connect webhooks client 4125105096: New connection webhooks client 4125105096: Client info {'program': 'Moonraker', 'version': 'v0.9.3-0-g71f9e67'} Loaded MCU 'mcu' 119 commands (?-20240727_132503-fv-az659-741 / gcc: (Raspbian 10.2.1-6+rpi1) 10.2.1 20210110 binutils: (GNU Binutils for Raspbian) 2.35.2) MCU 'mcu' config: ADC_MAX=4095 CLOCK_FREQ=50000000 MCU=linux PCA9685_MAX=4096 PWM_MAX=32768 STATS_SUMSQ_BASE=256 Configured MCU 'mcu' (1024 moves) Config error Traceback (most recent call last): File "/home/pi/klipper/klippy/klippy.py", line 135, in _connect cb() File "/home/pi/klipper/klippy/extras/ratos.py", line 58, in _connect self.register_command_overrides() File "/home/pi/klipper/klippy/extras/ratos.py", line 86, in register_command_overrides self.register_override('TEST_RESONANCES', self.override_TEST_RESONANCES, desc=(self.desc_TEST_RESONANCES)) File "/home/pi/klipper/klippy/extras/ratos.py", line 97, in register_override raise self.printer.config_error("Existing command '%s' not found in RatOS override" % (command,)) configparser.Error: Existing command 'TEST_RESONANCES' not found in RatOS override Starting Klippy... Starting Klippy... Args: ['/home/pi/klipper/klippy/klippy.py', '/home/pi/printer_data/config/printer.cfg', '-l', '/home/pi/printer_data/logs/klippy.log', '-I', '/home/pi/printer_data/comms/klippy.serial', '-a', '/home/pi/printer_data/comms/klippy.sock'] Git version: 'v0.12.0-316-g96cceed23-dirty' Untracked files: klippy/extras/beacon.py, klippy/extras/gcode_shell_command.py, klippy/extras/linear_movement_vibrations.py, klippy/extras/ratos.py, klippy/extras/ratos_homing.py, klippy/extras/resonance_generator.py, klippy/extras/z_offset_probe.py, klippy/kinematics/ratos_hybrid_corexy.py Branch: master Remote: origin Tracked URL: https://github.com/Klipper3d/klipper.git CPU: 4 core ? Python: '3.9.2 (default, Mar 20 2025, 22:21:41) \n[GCC 10.2.1 20210110]' Start printer at Wed Oct 22 07:15:35 2025 (1761113735.8 762.9) ===== Config file ===== [gcode_macro ECHO_T_VARS] description = Echo Toolhead variables to the console. gcode = {% set t = params.T|default(0) %} RATOS_ECHO MSG="T{t} Variables" {% for var, value in printer["gcode_macro T%s" % t].items() %} {action_respond_info(var ~ ": " ~ value)} {% endfor %} [gcode_macro ECHO_RATOS_VARS] description = Echo RatOS variables to the console. gcode = {% for var, value in printer["gcode_macro RatOS"].items() %} {action_respond_info(var ~ ": " ~ value)} {% endfor %} [gcode_macro RatOS] description = RatOS variable storage macro, will echo variables to the console when run. variable_relative_extrusion = False variable_force_absolute_position = False variable_preheat_extruder = True variable_preheat_extruder_temp = 150 variable_macro_travel_speed = 150 variable_macro_travel_accel = 2000 variable_macro_z_speed = 15 variable_bed_margin_x = [0, 0] variable_bed_margin_y = [0, 0] variable_printable_x_min = 0 variable_printable_x_max = 0 variable_printable_y_min = 0 variable_printable_y_max = 0 variable_end_print_motors_off = True variable_status_color_ok = "00FF00" variable_status_color_error = "FF0000" variable_status_color_unknown = "FFFF00" variable_end_print_retract_filament = 10 gcode = ECHO_RATOS_VARS [delayed_gcode RATOS_INIT] initial_duration = 0.1 gcode = RATOS_ECHO MSG="Welcome to RatOS!" RATOS_ECHO MSG="Please setup your printer through the RatOS configurator. Use the link in the sidebar to proceed with the setup." [delayed_gcode RATOS_LOGO] initial_duration = 2 gcode = HELLO_RATOS [gcode_macro INITIAL_FRONTEND_UPDATE] gcode = {% set color_ok = printer["gcode_macro RatOS"].status_color_ok|string %} {% set color_error = printer["gcode_macro RatOS"].status_color_error|string %} {% set color_unknown = printer["gcode_macro RatOS"].status_color_unknown|string %} SET_GCODE_VARIABLE MACRO=T0 VARIABLE=color VALUE='"{color_unknown}"' {% if printer["dual_carriage"] is defined %} SET_GCODE_VARIABLE MACRO=T1 VARIABLE=color VALUE='"{color_unknown}"' {% endif %} {% set t0_sensor = "undefined" %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t0"] is defined %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t0"].enabled|lower == "true" %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t0"].filament_detected|lower == "true" %} {% set t0_sensor = "detected" %} {% else %} {% set t0_sensor = "empty" %} {% endif %} {% else %} {% set t0_sensor = "disabled" %} {% endif %} {% endif %} {% set t1_sensor = "undefined" %} {% if printer["dual_carriage"] is defined and printer["filament_switch_sensor toolhead_filament_sensor_t1"] is defined %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t1"].enabled|lower == "true" %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t1"].filament_detected|lower == "true" %} {% set t1_sensor = "detected" %} {% else %} {% set t1_sensor = "empty" %} {% endif %} {% else %} {% set t1_sensor = "disabled" %} {% endif %} {% endif %} {% set svv = printer.save_variables.variables %} {% if svv.t0_filament is defined and printer["gcode_macro T0"] is defined %} {% if printer["gcode_macro T0"].filament_name is defined and printer["gcode_macro T0"].filament_type is defined and printer["gcode_macro T0"].filament_temp is defined %} {% if t0_sensor != "empty" %} {% set t0_filament_type = svv.t0_filament[0]|default('')|string %} {% set t0_filament_name = svv.t0_filament[1]|default('')|string %} {% set t0_filament_temp = svv.t0_filament[2]|default(0)|float %} {% if t0_filament_name != '' and t0_filament_type != '' and t0_filament_temp > 0 %} SET_GCODE_VARIABLE MACRO=T0 VARIABLE=color VALUE='"{color_ok}"' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_name VALUE='"{t0_filament_name}"' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_type VALUE='"{t0_filament_type}"' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_temp VALUE={t0_filament_temp} {% endif %} {% else %} SAVE_VARIABLE VARIABLE=t0_filament VALUE="('""', '""', 0)" SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_name VALUE='""' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_type VALUE='""' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_temp VALUE=0 {% endif %} {% endif %} {% endif %} {% if svv.t1_filament is defined and printer["gcode_macro T1"] is defined %} {% if printer["gcode_macro T1"].filament_name is defined and printer["gcode_macro T1"].filament_type is defined and printer["gcode_macro T1"].filament_temp is defined %} {% if t1_sensor != "empty" %} {% set t1_filament_type = svv.t1_filament[0]|default('')|string %} {% set t1_filament_name = svv.t1_filament[1]|default('')|string %} {% set t1_filament_temp = svv.t1_filament[2]|default(0)|float %} {% if t1_filament_name != '' and t1_filament_type != '' and t1_filament_temp > 0 %} SET_GCODE_VARIABLE MACRO=T1 VARIABLE=color VALUE='"{color_ok}"' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_name VALUE='"{t1_filament_name}"' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_type VALUE='"{t1_filament_type}"' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_temp VALUE={t1_filament_temp} {% endif %} {% else %} SAVE_VARIABLE VARIABLE=t1_filament VALUE="('""', '""', 0)" SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_name VALUE='""' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_type VALUE='""' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_temp VALUE=0 {% endif %} {% endif %} {% endif %} [gcode_macro CALCULATE_PRINTABLE_AREA] gcode = {% set bed_margin_x = printer["gcode_macro RatOS"].bed_margin_x %} {% set bed_margin_y = printer["gcode_macro RatOS"].bed_margin_y %} {% set tool = 0 if printer["gcode_macro T0"] is not defined or printer["gcode_macro T0"].active else 1 %} {% set max_x = printer.toolhead.axis_maximum.x if printer["dual_carriage"] is defined and tool == 0 else printer.toolhead.axis_maximum.x - bed_margin_x[1] %} {% if printer["dual_carriage"] is defined %} {% set max_x = printer.toolhead.axis_maximum.x %} {% endif %} DEBUG_ECHO PREFIX="CALCULATE_PRINTABLE_AREA" MSG="printer.toolhead.axis_maximum.x {printer.toolhead.axis_maximum.x}" {% set max_y = printer.toolhead.axis_maximum.y - bed_margin_y[1]%} SET_GCODE_VARIABLE MACRO=RatOS VARIABLE=printable_x_max VALUE={max_x} SET_GCODE_VARIABLE MACRO=RatOS VARIABLE=printable_y_max VALUE={max_y} DEBUG_ECHO PREFIX="CALCULATE_PRINTABLE_AREA" MSG="Printable area calculated: X: 0,{max_x} Y: 0,{max_y}" [gcode_macro CACHE_TOOLHEAD_SETTINGS] variable_cache = {"global": {"accel": 1000, "ratio": 0.5, "speed": 50, "scv": 5}} gcode = {% set key = "global" %} {% if params.KEY is defined %} {% set key = params.KEY %} {% endif %} {% set dummy = cache.__setitem__(key, {"accel": printer.toolhead.max_accel, "ratio": printer.toolhead.minimum_cruise_ratio, "speed": printer.toolhead.max_velocity, "scv": printer.toolhead.square_corner_velocity}) %} SET_GCODE_VARIABLE MACRO=CACHE_TOOLHEAD_SETTINGS VARIABLE=cache VALUE="{cache | pprint | replace("\n", "") | replace("\"", "\\\"")}" DEBUG_ECHO PREFIX="CACHE_TOOLHEAD_SETTINGS" MSG="Toolhead settings cached for {key}. {printer.toolhead.max_accel} accel, {printer.toolhead.minimum_cruise_ratio} ratio, {printer.toolhead.max_velocity} velocity, {printer.toolhead.square_corner_velocity} scv." [gcode_macro RESTORE_TOOLHEAD_SETTINGS] gcode = {% set key = "global" %} {% if params.KEY is defined %} {% set key = params.KEY %} {% endif %} {% set values = printer["gcode_macro CACHE_TOOLHEAD_SETTINGS"].cache.__getitem__(key) %} {% if values is not defined or values == 'None' %} { action_raise_error("RESTORE_TOOLHEAD_SETTINGS: Toolhead settings not cached for key '" ~ key ~ "'.") } {% endif %} SET_VELOCITY_LIMIT ACCEL={values.accel} MINIMUM_CRUISE_RATIO={values.ratio} VELOCITY={values.speed} SQUARE_CORNER_VELOCITY={values.scv} DEBUG_ECHO PREFIX="RESTORE_TOOLHEAD_SETTINGS" MSG="Toolhead settings restored. {values.accel} accel, {values.ratio} ratio, {values.speed} velocity, {values.scv} scv." [gcode_macro SET_MACRO_TRAVEL_SETTINGS] gcode = {% set speed = printer["gcode_macro RatOS"].macro_travel_speed|float * 60 %} {% set accel = printer["gcode_macro RatOS"].macro_travel_accel %} SET_VELOCITY_LIMIT ACCEL={accel} MINIMUM_CRUISE_RATIO=0.5 VELOCITY={speed} SQUARE_CORNER_VELOCITY={5} DEBUG_ECHO PREFIX="SET_MACRO_TRAVEL_SETTINGS" MSG="Macro travel settings set. {accel} accel, {speed} velocity" [gcode_macro SET_CENTER_KINEMATIC_POSITION] description = FOR DEBUGGING PURPOSES ONLY. Sets the internal printer kinematic state to the center of all axes regardless of actual physical position. gcode = {% set printable_x_max = printer["gcode_macro RatOS"].printable_x_max|float %} {% set printable_y_max = printer["gcode_macro RatOS"].printable_y_max|float %} RATOS_ECHO MSG="WARNING: ONLY USE SET_CENTER_KINEMATIC_POSITION FOR DEBUGGING PURPOSES. YOU'RE OVERRIDING THE INTERNAL POSITIONING STATE OF THE PRINTER. PROCEED WITH CAUTION AND DO A PROPER G28 WHEN DONE." SET_GCODE_VARIABLE MACRO=MAYBE_HOME VARIABLE=is_kinematic_position_overriden VALUE=True {% if printer["dual_carriage"] is not defined %} SET_KINEMATIC_POSITION X={printable_x_max / 2} Y={printable_y_max / 2} Z={printer.toolhead.axis_maximum.z / 2} {% else %} IDEX_SET_CENTER_KINEMATIC_POSITION {% endif %} [gcode_macro IDEX_SET_CENTER_KINEMATIC_POSITION] description = FOR DEBUGGING PURPOSES ONLY. Sets the internal printer kinematic state to the center of all axes regardless of actual physical position. gcode = {% set printable_x_max = printer["gcode_macro RatOS"].printable_x_max|float %} {% set printable_y_max = printer["gcode_macro RatOS"].printable_y_max|float %} RATOS_ECHO MSG="WARNING: ONLY USE SET_CENTER_KINEMATIC_POSITION FOR DEBUGGING PURPOSES. YOU'RE OVERRIDING THE INTERNAL POSITIONING STATE OF THE PRINTER. PROCEED WITH CAUTION AND DO A PROPER G28 WHEN DONE." SET_GCODE_VARIABLE MACRO=MAYBE_HOME VARIABLE=is_kinematic_position_overriden VALUE=True {% set printable_x_max = printer["gcode_macro RatOS"].printable_x_max|float %} {% set center_x = printable_x_max / 2 %} SET_DUAL_CARRIAGE CARRIAGE=0 MODE=PRIMARY SET_KINEMATIC_POSITION X={center_x - (center_x / 2)} Y={printable_y_max / 2} Z={printer.toolhead.axis_maximum.z / 2} SET_DUAL_CARRIAGE CARRIAGE=1 MODE=PRIMARY SET_KINEMATIC_POSITION X={center_x + (center_x / 2)} Y={printable_y_max / 2} Z={printer.toolhead.axis_maximum.z / 2} SET_DUAL_CARRIAGE CARRIAGE=0 MODE=PRIMARY [gcode_macro VERIFY_HYBRID_INVERTED] gcode = {% set inverted = False %} {% if printer.configfile.settings.ratos_hybrid_corexy is defined and printer.configfile.settings.ratos_hybrid_corexy.inverted is defined %} {% if printer.configfile.settings.ratos_hybrid_corexy.inverted|lower == 'true' %} {% set inverted = True %} {% endif %} {% endif %} {% if inverted == False %} { action_emergency_stop("ratos_hybrid_corexy NOT INVERTED! Inverted hybrid core-xy bugfix not detected.") } {% endif %} [gcode_macro RATOS_ECHO] gcode = {% set prefix = "RatOS" %} {% set debug = params.DEBUG|default(0)|int %} {% if params.PREFIX is defined %} {% set prefix = prefix ~ " | " ~ params.PREFIX %} {% endif %} {% set prefix = prefix ~ ":" %} {% set msg = "" %} {% if params.MSG is defined %} {% set msg = params.MSG %} {% else %} {% set msg = "No msg parameter provided (this is a bug or unintended use)." %} {% endif %} {% if not debug %} M117 {prefix} {msg} {% endif %} RATOS_LOG PREFIX="{prefix}" MSG="{msg}" {% if not debug %} RESPOND PREFIX="{prefix}" MSG="{msg}" {% else %} CONSOLE_ECHO TITLE="{prefix}" TYPE="debug" MSG="{msg}" {% endif %} [gcode_macro ENABLE_DEBUG] gcode = SET_GCODE_VARIABLE MACRO=DEBUG_ECHO VARIABLE=enabled VALUE=True SET_GCODE_VARIABLE MACRO=DEBUG_ECHO VARIABLE=prefix_filter VALUE="'{params.FILTER|default('')|lower}'" RATOS_ECHO PREFIX="DEBUG" MSG="Debugging enabled." [gcode_macro DISABLE_DEBUG] gcode = SET_GCODE_VARIABLE MACRO=DEBUG_ECHO VARIABLE=enabled VALUE=False RATOS_ECHO PREFIX="DEBUG" MSG="Debugging disabled." [gcode_macro DEBUG_ECHO] variable_enabled = False variable_prefix_filter = '' gcode = {% set prefix = "DEBUG" %} {% if params.PREFIX is defined %} {% set prefix = prefix ~ " - " ~ params.PREFIX %} {% endif %} {% if enabled and (prefix_filter|lower == '' or prefix_filter|lower in params.PREFIX|lower) %} RATOS_ECHO PREFIX="{prefix}" MSG="{params.MSG}" DEBUG=1 {% endif %} [gcode_macro START_FEATURE] gcode = DEBUG_ECHO PREFIX="G-Code" MSG="Start {params.FEATURE} feature gcode" {% set scv = printer.toolhead.square_corner_velocity|int|default(5) %} {% set accel = printer.toolhead.max_accel|int|default(10000) %} {% set ratio = printer.toolhead.minimum_cruise_ratio|float|default(0.5) %} SET_GCODE_VARIABLE MACRO="END_FEATURE" VARIABLE="scv" VALUE={scv} SET_GCODE_VARIABLE MACRO="END_FEATURE" VARIABLE="accel" VALUE={accel} SET_GCODE_VARIABLE MACRO="END_FEATURE" VARIABLE="ratio" VALUE={ratio} _USER_START_FEATURE FEATURE="{params.FEATURE}" [gcode_macro END_FEATURE] variable_scv = 5 variable_accel = 10000 variable_ratio = 0.5 gcode = DEBUG_ECHO PREFIX="G-Code" MSG="End {params.FEATURE} feature gcode" SET_VELOCITY_LIMIT SQUARE_CORNER_VELOCITY={scv} ACCEL={accel} MINIMUM_CRUISE_RATIO={ratio} _USER_END_FEATURE FEATURE="{params.FEATURE}" SCV={scv} ACCEL={accel} RATIO={ratio} [gcode_macro _ON_LAYER_CHANGE] variable_layer_number = 0 description = INTERNAL USE ONLY. Call it from the slicers after layer change custom gcode gcode = {% set layer = params.LAYER|int %} SET_GCODE_VARIABLE MACRO=_ON_LAYER_CHANGE VARIABLE=layer_number VALUE={layer} SET_PRINT_STATS_INFO CURRENT_LAYER={layer} [gcode_macro _LEARN_MORE_CALIBRATION] gcode = {% set link_url = "https://os.ratrig.com/docs/configuration/calibration" %} {% set link_text = "RatOS Calibration Macros" %} {% set line_1 = '"Learn more about the %s"' % (link_url, link_text) %} CONSOLE_ECHO TITLE="INFO" MSG={line_1} [gcode_macro _LEARN_MORE_CHAMBER_FILTER] gcode = {% set link_url = "https://os.ratrig.com/docs/configuration/chamber_filter" %} {% set link_text = "RatOS Chamber Filter Control" %} {% set line_1 = '"Learn more about the %s"' % (link_url, link_text) %} CONSOLE_ECHO TITLE="INFO" MSG={line_1} [gcode_macro _LEARN_MORE_FILAMENT] gcode = {% set link_url = "https://os.ratrig.com/docs/configuration/filaments" %} {% set link_text = "RatOS Filament Macros" %} {% set line_1 = '"Learn more about the %s"' % (link_url, link_text) %} CONSOLE_ECHO TITLE="INFO" MSG={line_1} [gcode_macro _CONSOLE_SAVE_CONFIG] gcode = M118 Click SAVE_CONFIG to save the settings to your printer.cfg. [gcode_macro SAVE_Z_OFFSET] gcode = {% if printer.configfile.settings.beacon is defined %} _BEACON_SAVE_MULTIPLIER {% else %} Z_OFFSET_APPLY_PROBE {% endif %} [gcode_macro _LOAD_RATOS_SKEW_PROFILE] gcode = {% set ratos_skew_profile = printer["gcode_macro RatOS"].skew_profile|default("") %} {% if ratos_skew_profile != "" %} {% if printer.configfile.config["skew_correction %s" % ratos_skew_profile] is defined %} SKEW_PROFILE LOAD={ratos_skew_profile} GET_CURRENT_SKEW {% else %} {% set line_1 = '"Could not find skew profile %s!_N_Clearing skew correction."' % ratos_skew_profile %} CONSOLE_ECHO TITLE="Missing skew profile!" TYPE="warning" MSG={line_1} SET_SKEW CLEAR=1 {% endif %} {% endif %} [gcode_macro M601] gcode = PAUSE [idle_timeout] gcode = {% if printer.webhooks.state|lower == 'ready' %} {% if printer.pause_resume.is_paused|lower == 'false' %} RATOS_ECHO PREFIX="IDLE" MSG="2 hours since last activity. Powering off heaters and motors.." TURN_OFF_HEATERS M84 {% endif %} {% endif %} timeout = 7200 [temperature_sensor raspberry_pi] sensor_type = temperature_host [virtual_sdcard] path = ~/printer_data/gcodes [display_status] [pause_resume] [respond] [ratos] [mcu] serial = /tmp/klipper_host_mcu [printer] kinematics = none max_velocity = 1 max_accel = 1 [gcode_macro PAUSE] rename_existing = PAUSE_BASE gcode = RATOS_ECHO MSG="Please setup your printer through the RatOS configurator at /configure" [gcode_macro RESUME] rename_existing = RESUME_BASE gcode = RATOS_ECHO MSG="Please setup your printer through the RatOS configurator at /configure" [gcode_macro CANCEL_PRINT] rename_existing = CANCEL_BASE gcode = RATOS_ECHO MSG="Please setup your printer through the RatOS configurator at /configure" ======================= mcu 'mcu': Starting connect webhooks client 4128590768: New connection webhooks client 4128590768: Client info {'program': 'Moonraker', 'version': 'v0.9.3-0-g71f9e67'} Loaded MCU 'mcu' 119 commands (?-20240727_132503-fv-az659-741 / gcc: (Raspbian 10.2.1-6+rpi1) 10.2.1 20210110 binutils: (GNU Binutils for Raspbian) 2.35.2) MCU 'mcu' config: ADC_MAX=4095 CLOCK_FREQ=50000000 MCU=linux PCA9685_MAX=4096 PWM_MAX=32768 STATS_SUMSQ_BASE=256 Configured MCU 'mcu' (1024 moves) Config error Traceback (most recent call last): File "/home/pi/klipper/klippy/klippy.py", line 135, in _connect cb() File "/home/pi/klipper/klippy/extras/ratos.py", line 58, in _connect self.register_command_overrides() File "/home/pi/klipper/klippy/extras/ratos.py", line 86, in register_command_overrides self.register_override('TEST_RESONANCES', self.override_TEST_RESONANCES, desc=(self.desc_TEST_RESONANCES)) File "/home/pi/klipper/klippy/extras/ratos.py", line 97, in register_override raise self.printer.config_error("Existing command '%s' not found in RatOS override" % (command,)) configparser.Error: Existing command 'TEST_RESONANCES' not found in RatOS override Starting Klippy... Args: ['/home/pi/klipper/klippy/klippy.py', '/home/pi/printer_data/config/printer.cfg', '-l', '/home/pi/printer_data/logs/klippy.log', '-I', '/home/pi/printer_data/comms/klippy.serial', '-a', '/home/pi/printer_data/comms/klippy.sock'] Git version: 'v0.12.0-316-g96cceed23-dirty' Untracked files: klippy/extras/beacon.py, klippy/extras/gcode_shell_command.py, klippy/extras/linear_movement_vibrations.py, klippy/extras/ratos.py, klippy/extras/ratos_homing.py, klippy/extras/resonance_generator.py, klippy/extras/z_offset_probe.py, klippy/kinematics/ratos_hybrid_corexy.py Branch: master Remote: origin Tracked URL: https://github.com/Klipper3d/klipper.git CPU: 4 core ? Python: '3.9.2 (default, Mar 20 2025, 22:21:41) \n[GCC 10.2.1 20210110]' Start printer at Wed Oct 22 07:16:51 2025 (1761113811.6 838.8) ===== Config file ===== [gcode_macro ECHO_T_VARS] description = Echo Toolhead variables to the console. gcode = {% set t = params.T|default(0) %} RATOS_ECHO MSG="T{t} Variables" {% for var, value in printer["gcode_macro T%s" % t].items() %} {action_respond_info(var ~ ": " ~ value)} {% endfor %} [gcode_macro ECHO_RATOS_VARS] description = Echo RatOS variables to the console. gcode = {% for var, value in printer["gcode_macro RatOS"].items() %} {action_respond_info(var ~ ": " ~ value)} {% endfor %} [gcode_macro RatOS] description = RatOS variable storage macro, will echo variables to the console when run. variable_relative_extrusion = False variable_force_absolute_position = False variable_preheat_extruder = True variable_preheat_extruder_temp = 150 variable_macro_travel_speed = 150 variable_macro_travel_accel = 2000 variable_macro_z_speed = 15 variable_bed_margin_x = [0, 0] variable_bed_margin_y = [0, 0] variable_printable_x_min = 0 variable_printable_x_max = 0 variable_printable_y_min = 0 variable_printable_y_max = 0 variable_end_print_motors_off = True variable_status_color_ok = "00FF00" variable_status_color_error = "FF0000" variable_status_color_unknown = "FFFF00" variable_end_print_retract_filament = 10 gcode = ECHO_RATOS_VARS [delayed_gcode RATOS_INIT] initial_duration = 0.1 gcode = RATOS_ECHO MSG="Welcome to RatOS!" RATOS_ECHO MSG="Please setup your printer through the RatOS configurator. Use the link in the sidebar to proceed with the setup." [delayed_gcode RATOS_LOGO] initial_duration = 2 gcode = HELLO_RATOS [gcode_macro INITIAL_FRONTEND_UPDATE] gcode = {% set color_ok = printer["gcode_macro RatOS"].status_color_ok|string %} {% set color_error = printer["gcode_macro RatOS"].status_color_error|string %} {% set color_unknown = printer["gcode_macro RatOS"].status_color_unknown|string %} SET_GCODE_VARIABLE MACRO=T0 VARIABLE=color VALUE='"{color_unknown}"' {% if printer["dual_carriage"] is defined %} SET_GCODE_VARIABLE MACRO=T1 VARIABLE=color VALUE='"{color_unknown}"' {% endif %} {% set t0_sensor = "undefined" %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t0"] is defined %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t0"].enabled|lower == "true" %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t0"].filament_detected|lower == "true" %} {% set t0_sensor = "detected" %} {% else %} {% set t0_sensor = "empty" %} {% endif %} {% else %} {% set t0_sensor = "disabled" %} {% endif %} {% endif %} {% set t1_sensor = "undefined" %} {% if printer["dual_carriage"] is defined and printer["filament_switch_sensor toolhead_filament_sensor_t1"] is defined %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t1"].enabled|lower == "true" %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t1"].filament_detected|lower == "true" %} {% set t1_sensor = "detected" %} {% else %} {% set t1_sensor = "empty" %} {% endif %} {% else %} {% set t1_sensor = "disabled" %} {% endif %} {% endif %} {% set svv = printer.save_variables.variables %} {% if svv.t0_filament is defined and printer["gcode_macro T0"] is defined %} {% if printer["gcode_macro T0"].filament_name is defined and printer["gcode_macro T0"].filament_type is defined and printer["gcode_macro T0"].filament_temp is defined %} {% if t0_sensor != "empty" %} {% set t0_filament_type = svv.t0_filament[0]|default('')|string %} {% set t0_filament_name = svv.t0_filament[1]|default('')|string %} {% set t0_filament_temp = svv.t0_filament[2]|default(0)|float %} {% if t0_filament_name != '' and t0_filament_type != '' and t0_filament_temp > 0 %} SET_GCODE_VARIABLE MACRO=T0 VARIABLE=color VALUE='"{color_ok}"' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_name VALUE='"{t0_filament_name}"' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_type VALUE='"{t0_filament_type}"' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_temp VALUE={t0_filament_temp} {% endif %} {% else %} SAVE_VARIABLE VARIABLE=t0_filament VALUE="('""', '""', 0)" SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_name VALUE='""' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_type VALUE='""' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_temp VALUE=0 {% endif %} {% endif %} {% endif %} {% if svv.t1_filament is defined and printer["gcode_macro T1"] is defined %} {% if printer["gcode_macro T1"].filament_name is defined and printer["gcode_macro T1"].filament_type is defined and printer["gcode_macro T1"].filament_temp is defined %} {% if t1_sensor != "empty" %} {% set t1_filament_type = svv.t1_filament[0]|default('')|string %} {% set t1_filament_name = svv.t1_filament[1]|default('')|string %} {% set t1_filament_temp = svv.t1_filament[2]|default(0)|float %} {% if t1_filament_name != '' and t1_filament_type != '' and t1_filament_temp > 0 %} SET_GCODE_VARIABLE MACRO=T1 VARIABLE=color VALUE='"{color_ok}"' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_name VALUE='"{t1_filament_name}"' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_type VALUE='"{t1_filament_type}"' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_temp VALUE={t1_filament_temp} {% endif %} {% else %} SAVE_VARIABLE VARIABLE=t1_filament VALUE="('""', '""', 0)" SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_name VALUE='""' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_type VALUE='""' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_temp VALUE=0 {% endif %} {% endif %} {% endif %} [gcode_macro CALCULATE_PRINTABLE_AREA] gcode = {% set bed_margin_x = printer["gcode_macro RatOS"].bed_margin_x %} {% set bed_margin_y = printer["gcode_macro RatOS"].bed_margin_y %} {% set tool = 0 if printer["gcode_macro T0"] is not defined or printer["gcode_macro T0"].active else 1 %} {% set max_x = printer.toolhead.axis_maximum.x if printer["dual_carriage"] is defined and tool == 0 else printer.toolhead.axis_maximum.x - bed_margin_x[1] %} {% if printer["dual_carriage"] is defined %} {% set max_x = printer.toolhead.axis_maximum.x %} {% endif %} DEBUG_ECHO PREFIX="CALCULATE_PRINTABLE_AREA" MSG="printer.toolhead.axis_maximum.x {printer.toolhead.axis_maximum.x}" {% set max_y = printer.toolhead.axis_maximum.y - bed_margin_y[1]%} SET_GCODE_VARIABLE MACRO=RatOS VARIABLE=printable_x_max VALUE={max_x} SET_GCODE_VARIABLE MACRO=RatOS VARIABLE=printable_y_max VALUE={max_y} DEBUG_ECHO PREFIX="CALCULATE_PRINTABLE_AREA" MSG="Printable area calculated: X: 0,{max_x} Y: 0,{max_y}" [gcode_macro CACHE_TOOLHEAD_SETTINGS] variable_cache = {"global": {"accel": 1000, "ratio": 0.5, "speed": 50, "scv": 5}} gcode = {% set key = "global" %} {% if params.KEY is defined %} {% set key = params.KEY %} {% endif %} {% set dummy = cache.__setitem__(key, {"accel": printer.toolhead.max_accel, "ratio": printer.toolhead.minimum_cruise_ratio, "speed": printer.toolhead.max_velocity, "scv": printer.toolhead.square_corner_velocity}) %} SET_GCODE_VARIABLE MACRO=CACHE_TOOLHEAD_SETTINGS VARIABLE=cache VALUE="{cache | pprint | replace("\n", "") | replace("\"", "\\\"")}" DEBUG_ECHO PREFIX="CACHE_TOOLHEAD_SETTINGS" MSG="Toolhead settings cached for {key}. {printer.toolhead.max_accel} accel, {printer.toolhead.minimum_cruise_ratio} ratio, {printer.toolhead.max_velocity} velocity, {printer.toolhead.square_corner_velocity} scv." [gcode_macro RESTORE_TOOLHEAD_SETTINGS] gcode = {% set key = "global" %} {% if params.KEY is defined %} {% set key = params.KEY %} {% endif %} {% set values = printer["gcode_macro CACHE_TOOLHEAD_SETTINGS"].cache.__getitem__(key) %} {% if values is not defined or values == 'None' %} { action_raise_error("RESTORE_TOOLHEAD_SETTINGS: Toolhead settings not cached for key '" ~ key ~ "'.") } {% endif %} SET_VELOCITY_LIMIT ACCEL={values.accel} MINIMUM_CRUISE_RATIO={values.ratio} VELOCITY={values.speed} SQUARE_CORNER_VELOCITY={values.scv} DEBUG_ECHO PREFIX="RESTORE_TOOLHEAD_SETTINGS" MSG="Toolhead settings restored. {values.accel} accel, {values.ratio} ratio, {values.speed} velocity, {values.scv} scv." [gcode_macro SET_MACRO_TRAVEL_SETTINGS] gcode = {% set speed = printer["gcode_macro RatOS"].macro_travel_speed|float * 60 %} {% set accel = printer["gcode_macro RatOS"].macro_travel_accel %} SET_VELOCITY_LIMIT ACCEL={accel} MINIMUM_CRUISE_RATIO=0.5 VELOCITY={speed} SQUARE_CORNER_VELOCITY={5} DEBUG_ECHO PREFIX="SET_MACRO_TRAVEL_SETTINGS" MSG="Macro travel settings set. {accel} accel, {speed} velocity" [gcode_macro SET_CENTER_KINEMATIC_POSITION] description = FOR DEBUGGING PURPOSES ONLY. Sets the internal printer kinematic state to the center of all axes regardless of actual physical position. gcode = {% set printable_x_max = printer["gcode_macro RatOS"].printable_x_max|float %} {% set printable_y_max = printer["gcode_macro RatOS"].printable_y_max|float %} RATOS_ECHO MSG="WARNING: ONLY USE SET_CENTER_KINEMATIC_POSITION FOR DEBUGGING PURPOSES. YOU'RE OVERRIDING THE INTERNAL POSITIONING STATE OF THE PRINTER. PROCEED WITH CAUTION AND DO A PROPER G28 WHEN DONE." SET_GCODE_VARIABLE MACRO=MAYBE_HOME VARIABLE=is_kinematic_position_overriden VALUE=True {% if printer["dual_carriage"] is not defined %} SET_KINEMATIC_POSITION X={printable_x_max / 2} Y={printable_y_max / 2} Z={printer.toolhead.axis_maximum.z / 2} {% else %} IDEX_SET_CENTER_KINEMATIC_POSITION {% endif %} [gcode_macro IDEX_SET_CENTER_KINEMATIC_POSITION] description = FOR DEBUGGING PURPOSES ONLY. Sets the internal printer kinematic state to the center of all axes regardless of actual physical position. gcode = {% set printable_x_max = printer["gcode_macro RatOS"].printable_x_max|float %} {% set printable_y_max = printer["gcode_macro RatOS"].printable_y_max|float %} RATOS_ECHO MSG="WARNING: ONLY USE SET_CENTER_KINEMATIC_POSITION FOR DEBUGGING PURPOSES. YOU'RE OVERRIDING THE INTERNAL POSITIONING STATE OF THE PRINTER. PROCEED WITH CAUTION AND DO A PROPER G28 WHEN DONE." SET_GCODE_VARIABLE MACRO=MAYBE_HOME VARIABLE=is_kinematic_position_overriden VALUE=True {% set printable_x_max = printer["gcode_macro RatOS"].printable_x_max|float %} {% set center_x = printable_x_max / 2 %} SET_DUAL_CARRIAGE CARRIAGE=0 MODE=PRIMARY SET_KINEMATIC_POSITION X={center_x - (center_x / 2)} Y={printable_y_max / 2} Z={printer.toolhead.axis_maximum.z / 2} SET_DUAL_CARRIAGE CARRIAGE=1 MODE=PRIMARY SET_KINEMATIC_POSITION X={center_x + (center_x / 2)} Y={printable_y_max / 2} Z={printer.toolhead.axis_maximum.z / 2} SET_DUAL_CARRIAGE CARRIAGE=0 MODE=PRIMARY [gcode_macro VERIFY_HYBRID_INVERTED] gcode = {% set inverted = False %} {% if printer.configfile.settings.ratos_hybrid_corexy is defined and printer.configfile.settings.ratos_hybrid_corexy.inverted is defined %} {% if printer.configfile.settings.ratos_hybrid_corexy.inverted|lower == 'true' %} {% set inverted = True %} {% endif %} {% endif %} {% if inverted == False %} { action_emergency_stop("ratos_hybrid_corexy NOT INVERTED! Inverted hybrid core-xy bugfix not detected.") } {% endif %} [gcode_macro RATOS_ECHO] gcode = {% set prefix = "RatOS" %} {% set debug = params.DEBUG|default(0)|int %} {% if params.PREFIX is defined %} {% set prefix = prefix ~ " | " ~ params.PREFIX %} {% endif %} {% set prefix = prefix ~ ":" %} {% set msg = "" %} {% if params.MSG is defined %} {% set msg = params.MSG %} {% else %} {% set msg = "No msg parameter provided (this is a bug or unintended use)." %} {% endif %} {% if not debug %} M117 {prefix} {msg} {% endif %} RATOS_LOG PREFIX="{prefix}" MSG="{msg}" {% if not debug %} RESPOND PREFIX="{prefix}" MSG="{msg}" {% else %} CONSOLE_ECHO TITLE="{prefix}" TYPE="debug" MSG="{msg}" {% endif %} [gcode_macro ENABLE_DEBUG] gcode = SET_GCODE_VARIABLE MACRO=DEBUG_ECHO VARIABLE=enabled VALUE=True SET_GCODE_VARIABLE MACRO=DEBUG_ECHO VARIABLE=prefix_filter VALUE="'{params.FILTER|default('')|lower}'" RATOS_ECHO PREFIX="DEBUG" MSG="Debugging enabled." [gcode_macro DISABLE_DEBUG] gcode = SET_GCODE_VARIABLE MACRO=DEBUG_ECHO VARIABLE=enabled VALUE=False RATOS_ECHO PREFIX="DEBUG" MSG="Debugging disabled." [gcode_macro DEBUG_ECHO] variable_enabled = False variable_prefix_filter = '' gcode = {% set prefix = "DEBUG" %} {% if params.PREFIX is defined %} {% set prefix = prefix ~ " - " ~ params.PREFIX %} {% endif %} {% if enabled and (prefix_filter|lower == '' or prefix_filter|lower in params.PREFIX|lower) %} RATOS_ECHO PREFIX="{prefix}" MSG="{params.MSG}" DEBUG=1 {% endif %} [gcode_macro START_FEATURE] gcode = DEBUG_ECHO PREFIX="G-Code" MSG="Start {params.FEATURE} feature gcode" {% set scv = printer.toolhead.square_corner_velocity|int|default(5) %} {% set accel = printer.toolhead.max_accel|int|default(10000) %} {% set ratio = printer.toolhead.minimum_cruise_ratio|float|default(0.5) %} SET_GCODE_VARIABLE MACRO="END_FEATURE" VARIABLE="scv" VALUE={scv} SET_GCODE_VARIABLE MACRO="END_FEATURE" VARIABLE="accel" VALUE={accel} SET_GCODE_VARIABLE MACRO="END_FEATURE" VARIABLE="ratio" VALUE={ratio} _USER_START_FEATURE FEATURE="{params.FEATURE}" [gcode_macro END_FEATURE] variable_scv = 5 variable_accel = 10000 variable_ratio = 0.5 gcode = DEBUG_ECHO PREFIX="G-Code" MSG="End {params.FEATURE} feature gcode" SET_VELOCITY_LIMIT SQUARE_CORNER_VELOCITY={scv} ACCEL={accel} MINIMUM_CRUISE_RATIO={ratio} _USER_END_FEATURE FEATURE="{params.FEATURE}" SCV={scv} ACCEL={accel} RATIO={ratio} [gcode_macro _ON_LAYER_CHANGE] variable_layer_number = 0 description = INTERNAL USE ONLY. Call it from the slicers after layer change custom gcode gcode = {% set layer = params.LAYER|int %} SET_GCODE_VARIABLE MACRO=_ON_LAYER_CHANGE VARIABLE=layer_number VALUE={layer} SET_PRINT_STATS_INFO CURRENT_LAYER={layer} [gcode_macro _LEARN_MORE_CALIBRATION] gcode = {% set link_url = "https://os.ratrig.com/docs/configuration/calibration" %} {% set link_text = "RatOS Calibration Macros" %} {% set line_1 = '"Learn more about the %s"' % (link_url, link_text) %} CONSOLE_ECHO TITLE="INFO" MSG={line_1} [gcode_macro _LEARN_MORE_CHAMBER_FILTER] gcode = {% set link_url = "https://os.ratrig.com/docs/configuration/chamber_filter" %} {% set link_text = "RatOS Chamber Filter Control" %} {% set line_1 = '"Learn more about the %s"' % (link_url, link_text) %} CONSOLE_ECHO TITLE="INFO" MSG={line_1} [gcode_macro _LEARN_MORE_FILAMENT] gcode = {% set link_url = "https://os.ratrig.com/docs/configuration/filaments" %} {% set link_text = "RatOS Filament Macros" %} {% set line_1 = '"Learn more about the %s"' % (link_url, link_text) %} CONSOLE_ECHO TITLE="INFO" MSG={line_1} [gcode_macro _CONSOLE_SAVE_CONFIG] gcode = M118 Click SAVE_CONFIG to save the settings to your printer.cfg. [gcode_macro SAVE_Z_OFFSET] gcode = {% if printer.configfile.settings.beacon is defined %} _BEACON_SAVE_MULTIPLIER {% else %} Z_OFFSET_APPLY_PROBE {% endif %} [gcode_macro _LOAD_RATOS_SKEW_PROFILE] gcode = {% set ratos_skew_profile = printer["gcode_macro RatOS"].skew_profile|default("") %} {% if ratos_skew_profile != "" %} {% if printer.configfile.config["skew_correction %s" % ratos_skew_profile] is defined %} SKEW_PROFILE LOAD={ratos_skew_profile} GET_CURRENT_SKEW {% else %} {% set line_1 = '"Could not find skew profile %s!_N_Clearing skew correction."' % ratos_skew_profile %} CONSOLE_ECHO TITLE="Missing skew profile!" TYPE="warning" MSG={line_1} SET_SKEW CLEAR=1 {% endif %} {% endif %} [gcode_macro M601] gcode = PAUSE [idle_timeout] gcode = {% if printer.webhooks.state|lower == 'ready' %} {% if printer.pause_resume.is_paused|lower == 'false' %} RATOS_ECHO PREFIX="IDLE" MSG="2 hours since last activity. Powering off heaters and motors.." TURN_OFF_HEATERS M84 {% endif %} {% endif %} timeout = 7200 [temperature_sensor raspberry_pi] sensor_type = temperature_host [virtual_sdcard] path = ~/printer_data/gcodes [display_status] [pause_resume] [respond] [ratos] [mcu] serial = /tmp/klipper_host_mcu [printer] kinematics = none max_velocity = 1 max_accel = 1 [gcode_macro PAUSE] rename_existing = PAUSE_BASE gcode = RATOS_ECHO MSG="Please setup your printer through the RatOS configurator at /configure" [gcode_macro RESUME] rename_existing = RESUME_BASE gcode = RATOS_ECHO MSG="Please setup your printer through the RatOS configurator at /configure" [gcode_macro CANCEL_PRINT] rename_existing = CANCEL_BASE gcode = RATOS_ECHO MSG="Please setup your printer through the RatOS configurator at /configure" ======================= mcu 'mcu': Starting connect webhooks client 4129250224: New connection webhooks client 4129250224: Client info {'program': 'Moonraker', 'version': 'v0.9.3-0-g71f9e67'} Loaded MCU 'mcu' 119 commands (?-20240727_132503-fv-az659-741 / gcc: (Raspbian 10.2.1-6+rpi1) 10.2.1 20210110 binutils: (GNU Binutils for Raspbian) 2.35.2) MCU 'mcu' config: ADC_MAX=4095 CLOCK_FREQ=50000000 MCU=linux PCA9685_MAX=4096 PWM_MAX=32768 STATS_SUMSQ_BASE=256 Configured MCU 'mcu' (1024 moves) Config error Traceback (most recent call last): File "/home/pi/klipper/klippy/klippy.py", line 135, in _connect cb() File "/home/pi/klipper/klippy/extras/ratos.py", line 58, in _connect self.register_command_overrides() File "/home/pi/klipper/klippy/extras/ratos.py", line 86, in register_command_overrides self.register_override('TEST_RESONANCES', self.override_TEST_RESONANCES, desc=(self.desc_TEST_RESONANCES)) File "/home/pi/klipper/klippy/extras/ratos.py", line 97, in register_override raise self.printer.config_error("Existing command '%s' not found in RatOS override" % (command,)) configparser.Error: Existing command 'TEST_RESONANCES' not found in RatOS override Starting Klippy... Args: ['/home/pi/klipper/klippy/klippy.py', '/home/pi/printer_data/config/printer.cfg', '-l', '/home/pi/printer_data/logs/klippy.log', '-I', '/home/pi/printer_data/comms/klippy.serial', '-a', '/home/pi/printer_data/comms/klippy.sock'] Git version: 'v0.12.0-316-g96cceed23-dirty' Untracked files: klippy/extras/beacon.py, klippy/extras/gcode_shell_command.py, klippy/extras/linear_movement_vibrations.py, klippy/extras/ratos.py, klippy/extras/ratos_homing.py, klippy/extras/resonance_generator.py, klippy/extras/z_offset_probe.py, klippy/kinematics/ratos_hybrid_corexy.py Branch: master Remote: origin Tracked URL: https://github.com/Klipper3d/klipper.git CPU: 4 core ? Python: '3.9.2 (default, Mar 20 2025, 22:21:41) \n[GCC 10.2.1 20210110]' Start printer at Wed Oct 22 07:42:32 2025 (1761115352.3 2379.5) ===== Config file ===== [gcode_macro ECHO_T_VARS] description = Echo Toolhead variables to the console. gcode = {% set t = params.T|default(0) %} RATOS_ECHO MSG="T{t} Variables" {% for var, value in printer["gcode_macro T%s" % t].items() %} {action_respond_info(var ~ ": " ~ value)} {% endfor %} [gcode_macro ECHO_RATOS_VARS] description = Echo RatOS variables to the console. gcode = {% for var, value in printer["gcode_macro RatOS"].items() %} {action_respond_info(var ~ ": " ~ value)} {% endfor %} [gcode_macro RatOS] description = RatOS variable storage macro, will echo variables to the console when run. variable_relative_extrusion = False variable_force_absolute_position = False variable_preheat_extruder = True variable_preheat_extruder_temp = 150 variable_macro_travel_speed = 150 variable_macro_travel_accel = 2000 variable_macro_z_speed = 15 variable_bed_margin_x = [0, 0] variable_bed_margin_y = [0, 0] variable_printable_x_min = 0 variable_printable_x_max = 0 variable_printable_y_min = 0 variable_printable_y_max = 0 variable_end_print_motors_off = True variable_status_color_ok = "00FF00" variable_status_color_error = "FF0000" variable_status_color_unknown = "FFFF00" variable_end_print_retract_filament = 10 gcode = ECHO_RATOS_VARS [delayed_gcode RATOS_INIT] initial_duration = 0.1 gcode = RATOS_ECHO MSG="Welcome to RatOS!" RATOS_ECHO MSG="Please setup your printer through the RatOS configurator. Use the link in the sidebar to proceed with the setup." [delayed_gcode RATOS_LOGO] initial_duration = 2 gcode = HELLO_RATOS [gcode_macro INITIAL_FRONTEND_UPDATE] gcode = {% set color_ok = printer["gcode_macro RatOS"].status_color_ok|string %} {% set color_error = printer["gcode_macro RatOS"].status_color_error|string %} {% set color_unknown = printer["gcode_macro RatOS"].status_color_unknown|string %} SET_GCODE_VARIABLE MACRO=T0 VARIABLE=color VALUE='"{color_unknown}"' {% if printer["dual_carriage"] is defined %} SET_GCODE_VARIABLE MACRO=T1 VARIABLE=color VALUE='"{color_unknown}"' {% endif %} {% set t0_sensor = "undefined" %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t0"] is defined %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t0"].enabled|lower == "true" %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t0"].filament_detected|lower == "true" %} {% set t0_sensor = "detected" %} {% else %} {% set t0_sensor = "empty" %} {% endif %} {% else %} {% set t0_sensor = "disabled" %} {% endif %} {% endif %} {% set t1_sensor = "undefined" %} {% if printer["dual_carriage"] is defined and printer["filament_switch_sensor toolhead_filament_sensor_t1"] is defined %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t1"].enabled|lower == "true" %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t1"].filament_detected|lower == "true" %} {% set t1_sensor = "detected" %} {% else %} {% set t1_sensor = "empty" %} {% endif %} {% else %} {% set t1_sensor = "disabled" %} {% endif %} {% endif %} {% set svv = printer.save_variables.variables %} {% if svv.t0_filament is defined and printer["gcode_macro T0"] is defined %} {% if printer["gcode_macro T0"].filament_name is defined and printer["gcode_macro T0"].filament_type is defined and printer["gcode_macro T0"].filament_temp is defined %} {% if t0_sensor != "empty" %} {% set t0_filament_type = svv.t0_filament[0]|default('')|string %} {% set t0_filament_name = svv.t0_filament[1]|default('')|string %} {% set t0_filament_temp = svv.t0_filament[2]|default(0)|float %} {% if t0_filament_name != '' and t0_filament_type != '' and t0_filament_temp > 0 %} SET_GCODE_VARIABLE MACRO=T0 VARIABLE=color VALUE='"{color_ok}"' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_name VALUE='"{t0_filament_name}"' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_type VALUE='"{t0_filament_type}"' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_temp VALUE={t0_filament_temp} {% endif %} {% else %} SAVE_VARIABLE VARIABLE=t0_filament VALUE="('""', '""', 0)" SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_name VALUE='""' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_type VALUE='""' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_temp VALUE=0 {% endif %} {% endif %} {% endif %} {% if svv.t1_filament is defined and printer["gcode_macro T1"] is defined %} {% if printer["gcode_macro T1"].filament_name is defined and printer["gcode_macro T1"].filament_type is defined and printer["gcode_macro T1"].filament_temp is defined %} {% if t1_sensor != "empty" %} {% set t1_filament_type = svv.t1_filament[0]|default('')|string %} {% set t1_filament_name = svv.t1_filament[1]|default('')|string %} {% set t1_filament_temp = svv.t1_filament[2]|default(0)|float %} {% if t1_filament_name != '' and t1_filament_type != '' and t1_filament_temp > 0 %} SET_GCODE_VARIABLE MACRO=T1 VARIABLE=color VALUE='"{color_ok}"' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_name VALUE='"{t1_filament_name}"' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_type VALUE='"{t1_filament_type}"' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_temp VALUE={t1_filament_temp} {% endif %} {% else %} SAVE_VARIABLE VARIABLE=t1_filament VALUE="('""', '""', 0)" SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_name VALUE='""' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_type VALUE='""' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_temp VALUE=0 {% endif %} {% endif %} {% endif %} [gcode_macro CALCULATE_PRINTABLE_AREA] gcode = {% set bed_margin_x = printer["gcode_macro RatOS"].bed_margin_x %} {% set bed_margin_y = printer["gcode_macro RatOS"].bed_margin_y %} {% set tool = 0 if printer["gcode_macro T0"] is not defined or printer["gcode_macro T0"].active else 1 %} {% set max_x = printer.toolhead.axis_maximum.x if printer["dual_carriage"] is defined and tool == 0 else printer.toolhead.axis_maximum.x - bed_margin_x[1] %} {% if printer["dual_carriage"] is defined %} {% set max_x = printer.toolhead.axis_maximum.x %} {% endif %} DEBUG_ECHO PREFIX="CALCULATE_PRINTABLE_AREA" MSG="printer.toolhead.axis_maximum.x {printer.toolhead.axis_maximum.x}" {% set max_y = printer.toolhead.axis_maximum.y - bed_margin_y[1]%} SET_GCODE_VARIABLE MACRO=RatOS VARIABLE=printable_x_max VALUE={max_x} SET_GCODE_VARIABLE MACRO=RatOS VARIABLE=printable_y_max VALUE={max_y} DEBUG_ECHO PREFIX="CALCULATE_PRINTABLE_AREA" MSG="Printable area calculated: X: 0,{max_x} Y: 0,{max_y}" [gcode_macro CACHE_TOOLHEAD_SETTINGS] variable_cache = {"global": {"accel": 1000, "ratio": 0.5, "speed": 50, "scv": 5}} gcode = {% set key = "global" %} {% if params.KEY is defined %} {% set key = params.KEY %} {% endif %} {% set dummy = cache.__setitem__(key, {"accel": printer.toolhead.max_accel, "ratio": printer.toolhead.minimum_cruise_ratio, "speed": printer.toolhead.max_velocity, "scv": printer.toolhead.square_corner_velocity}) %} SET_GCODE_VARIABLE MACRO=CACHE_TOOLHEAD_SETTINGS VARIABLE=cache VALUE="{cache | pprint | replace("\n", "") | replace("\"", "\\\"")}" DEBUG_ECHO PREFIX="CACHE_TOOLHEAD_SETTINGS" MSG="Toolhead settings cached for {key}. {printer.toolhead.max_accel} accel, {printer.toolhead.minimum_cruise_ratio} ratio, {printer.toolhead.max_velocity} velocity, {printer.toolhead.square_corner_velocity} scv." [gcode_macro RESTORE_TOOLHEAD_SETTINGS] gcode = {% set key = "global" %} {% if params.KEY is defined %} {% set key = params.KEY %} {% endif %} {% set values = printer["gcode_macro CACHE_TOOLHEAD_SETTINGS"].cache.__getitem__(key) %} {% if values is not defined or values == 'None' %} { action_raise_error("RESTORE_TOOLHEAD_SETTINGS: Toolhead settings not cached for key '" ~ key ~ "'.") } {% endif %} SET_VELOCITY_LIMIT ACCEL={values.accel} MINIMUM_CRUISE_RATIO={values.ratio} VELOCITY={values.speed} SQUARE_CORNER_VELOCITY={values.scv} DEBUG_ECHO PREFIX="RESTORE_TOOLHEAD_SETTINGS" MSG="Toolhead settings restored. {values.accel} accel, {values.ratio} ratio, {values.speed} velocity, {values.scv} scv." [gcode_macro SET_MACRO_TRAVEL_SETTINGS] gcode = {% set speed = printer["gcode_macro RatOS"].macro_travel_speed|float * 60 %} {% set accel = printer["gcode_macro RatOS"].macro_travel_accel %} SET_VELOCITY_LIMIT ACCEL={accel} MINIMUM_CRUISE_RATIO=0.5 VELOCITY={speed} SQUARE_CORNER_VELOCITY={5} DEBUG_ECHO PREFIX="SET_MACRO_TRAVEL_SETTINGS" MSG="Macro travel settings set. {accel} accel, {speed} velocity" [gcode_macro SET_CENTER_KINEMATIC_POSITION] description = FOR DEBUGGING PURPOSES ONLY. Sets the internal printer kinematic state to the center of all axes regardless of actual physical position. gcode = {% set printable_x_max = printer["gcode_macro RatOS"].printable_x_max|float %} {% set printable_y_max = printer["gcode_macro RatOS"].printable_y_max|float %} RATOS_ECHO MSG="WARNING: ONLY USE SET_CENTER_KINEMATIC_POSITION FOR DEBUGGING PURPOSES. YOU'RE OVERRIDING THE INTERNAL POSITIONING STATE OF THE PRINTER. PROCEED WITH CAUTION AND DO A PROPER G28 WHEN DONE." SET_GCODE_VARIABLE MACRO=MAYBE_HOME VARIABLE=is_kinematic_position_overriden VALUE=True {% if printer["dual_carriage"] is not defined %} SET_KINEMATIC_POSITION X={printable_x_max / 2} Y={printable_y_max / 2} Z={printer.toolhead.axis_maximum.z / 2} {% else %} IDEX_SET_CENTER_KINEMATIC_POSITION {% endif %} [gcode_macro IDEX_SET_CENTER_KINEMATIC_POSITION] description = FOR DEBUGGING PURPOSES ONLY. Sets the internal printer kinematic state to the center of all axes regardless of actual physical position. gcode = {% set printable_x_max = printer["gcode_macro RatOS"].printable_x_max|float %} {% set printable_y_max = printer["gcode_macro RatOS"].printable_y_max|float %} RATOS_ECHO MSG="WARNING: ONLY USE SET_CENTER_KINEMATIC_POSITION FOR DEBUGGING PURPOSES. YOU'RE OVERRIDING THE INTERNAL POSITIONING STATE OF THE PRINTER. PROCEED WITH CAUTION AND DO A PROPER G28 WHEN DONE." SET_GCODE_VARIABLE MACRO=MAYBE_HOME VARIABLE=is_kinematic_position_overriden VALUE=True {% set printable_x_max = printer["gcode_macro RatOS"].printable_x_max|float %} {% set center_x = printable_x_max / 2 %} SET_DUAL_CARRIAGE CARRIAGE=0 MODE=PRIMARY SET_KINEMATIC_POSITION X={center_x - (center_x / 2)} Y={printable_y_max / 2} Z={printer.toolhead.axis_maximum.z / 2} SET_DUAL_CARRIAGE CARRIAGE=1 MODE=PRIMARY SET_KINEMATIC_POSITION X={center_x + (center_x / 2)} Y={printable_y_max / 2} Z={printer.toolhead.axis_maximum.z / 2} SET_DUAL_CARRIAGE CARRIAGE=0 MODE=PRIMARY [gcode_macro VERIFY_HYBRID_INVERTED] gcode = {% set inverted = False %} {% if printer.configfile.settings.ratos_hybrid_corexy is defined and printer.configfile.settings.ratos_hybrid_corexy.inverted is defined %} {% if printer.configfile.settings.ratos_hybrid_corexy.inverted|lower == 'true' %} {% set inverted = True %} {% endif %} {% endif %} {% if inverted == False %} { action_emergency_stop("ratos_hybrid_corexy NOT INVERTED! Inverted hybrid core-xy bugfix not detected.") } {% endif %} [gcode_macro RATOS_ECHO] gcode = {% set prefix = "RatOS" %} {% set debug = params.DEBUG|default(0)|int %} {% if params.PREFIX is defined %} {% set prefix = prefix ~ " | " ~ params.PREFIX %} {% endif %} {% set prefix = prefix ~ ":" %} {% set msg = "" %} {% if params.MSG is defined %} {% set msg = params.MSG %} {% else %} {% set msg = "No msg parameter provided (this is a bug or unintended use)." %} {% endif %} {% if not debug %} M117 {prefix} {msg} {% endif %} RATOS_LOG PREFIX="{prefix}" MSG="{msg}" {% if not debug %} RESPOND PREFIX="{prefix}" MSG="{msg}" {% else %} CONSOLE_ECHO TITLE="{prefix}" TYPE="debug" MSG="{msg}" {% endif %} [gcode_macro ENABLE_DEBUG] gcode = SET_GCODE_VARIABLE MACRO=DEBUG_ECHO VARIABLE=enabled VALUE=True SET_GCODE_VARIABLE MACRO=DEBUG_ECHO VARIABLE=prefix_filter VALUE="'{params.FILTER|default('')|lower}'" RATOS_ECHO PREFIX="DEBUG" MSG="Debugging enabled." [gcode_macro DISABLE_DEBUG] gcode = SET_GCODE_VARIABLE MACRO=DEBUG_ECHO VARIABLE=enabled VALUE=False RATOS_ECHO PREFIX="DEBUG" MSG="Debugging disabled." [gcode_macro DEBUG_ECHO] variable_enabled = False variable_prefix_filter = '' gcode = {% set prefix = "DEBUG" %} {% if params.PREFIX is defined %} {% set prefix = prefix ~ " - " ~ params.PREFIX %} {% endif %} {% if enabled and (prefix_filter|lower == '' or prefix_filter|lower in params.PREFIX|lower) %} RATOS_ECHO PREFIX="{prefix}" MSG="{params.MSG}" DEBUG=1 {% endif %} [gcode_macro START_FEATURE] gcode = DEBUG_ECHO PREFIX="G-Code" MSG="Start {params.FEATURE} feature gcode" {% set scv = printer.toolhead.square_corner_velocity|int|default(5) %} {% set accel = printer.toolhead.max_accel|int|default(10000) %} {% set ratio = printer.toolhead.minimum_cruise_ratio|float|default(0.5) %} SET_GCODE_VARIABLE MACRO="END_FEATURE" VARIABLE="scv" VALUE={scv} SET_GCODE_VARIABLE MACRO="END_FEATURE" VARIABLE="accel" VALUE={accel} SET_GCODE_VARIABLE MACRO="END_FEATURE" VARIABLE="ratio" VALUE={ratio} _USER_START_FEATURE FEATURE="{params.FEATURE}" [gcode_macro END_FEATURE] variable_scv = 5 variable_accel = 10000 variable_ratio = 0.5 gcode = DEBUG_ECHO PREFIX="G-Code" MSG="End {params.FEATURE} feature gcode" SET_VELOCITY_LIMIT SQUARE_CORNER_VELOCITY={scv} ACCEL={accel} MINIMUM_CRUISE_RATIO={ratio} _USER_END_FEATURE FEATURE="{params.FEATURE}" SCV={scv} ACCEL={accel} RATIO={ratio} [gcode_macro _ON_LAYER_CHANGE] variable_layer_number = 0 description = INTERNAL USE ONLY. Call it from the slicers after layer change custom gcode gcode = {% set layer = params.LAYER|int %} SET_GCODE_VARIABLE MACRO=_ON_LAYER_CHANGE VARIABLE=layer_number VALUE={layer} SET_PRINT_STATS_INFO CURRENT_LAYER={layer} [gcode_macro _LEARN_MORE_CALIBRATION] gcode = {% set link_url = "https://os.ratrig.com/docs/configuration/calibration" %} {% set link_text = "RatOS Calibration Macros" %} {% set line_1 = '"Learn more about the %s"' % (link_url, link_text) %} CONSOLE_ECHO TITLE="INFO" MSG={line_1} [gcode_macro _LEARN_MORE_CHAMBER_FILTER] gcode = {% set link_url = "https://os.ratrig.com/docs/configuration/chamber_filter" %} {% set link_text = "RatOS Chamber Filter Control" %} {% set line_1 = '"Learn more about the %s"' % (link_url, link_text) %} CONSOLE_ECHO TITLE="INFO" MSG={line_1} [gcode_macro _LEARN_MORE_FILAMENT] gcode = {% set link_url = "https://os.ratrig.com/docs/configuration/filaments" %} {% set link_text = "RatOS Filament Macros" %} {% set line_1 = '"Learn more about the %s"' % (link_url, link_text) %} CONSOLE_ECHO TITLE="INFO" MSG={line_1} [gcode_macro _CONSOLE_SAVE_CONFIG] gcode = M118 Click SAVE_CONFIG to save the settings to your printer.cfg. [gcode_macro SAVE_Z_OFFSET] gcode = {% if printer.configfile.settings.beacon is defined %} _BEACON_SAVE_MULTIPLIER {% else %} Z_OFFSET_APPLY_PROBE {% endif %} [gcode_macro _LOAD_RATOS_SKEW_PROFILE] gcode = {% set ratos_skew_profile = printer["gcode_macro RatOS"].skew_profile|default("") %} {% if ratos_skew_profile != "" %} {% if printer.configfile.config["skew_correction %s" % ratos_skew_profile] is defined %} SKEW_PROFILE LOAD={ratos_skew_profile} GET_CURRENT_SKEW {% else %} {% set line_1 = '"Could not find skew profile %s!_N_Clearing skew correction."' % ratos_skew_profile %} CONSOLE_ECHO TITLE="Missing skew profile!" TYPE="warning" MSG={line_1} SET_SKEW CLEAR=1 {% endif %} {% endif %} [gcode_macro M601] gcode = PAUSE [idle_timeout] gcode = {% if printer.webhooks.state|lower == 'ready' %} {% if printer.pause_resume.is_paused|lower == 'false' %} RATOS_ECHO PREFIX="IDLE" MSG="2 hours since last activity. Powering off heaters and motors.." TURN_OFF_HEATERS M84 {% endif %} {% endif %} timeout = 7200 [temperature_sensor raspberry_pi] sensor_type = temperature_host [virtual_sdcard] path = ~/printer_data/gcodes [display_status] [pause_resume] [respond] [ratos] [mcu] serial = /tmp/klipper_host_mcu [printer] kinematics = none max_velocity = 1 max_accel = 1 [gcode_macro PAUSE] rename_existing = PAUSE_BASE gcode = RATOS_ECHO MSG="Please setup your printer through the RatOS configurator at /configure" [gcode_macro RESUME] rename_existing = RESUME_BASE gcode = RATOS_ECHO MSG="Please setup your printer through the RatOS configurator at /configure" [gcode_macro CANCEL_PRINT] rename_existing = CANCEL_BASE gcode = RATOS_ECHO MSG="Please setup your printer through the RatOS configurator at /configure" ======================= mcu 'mcu': Starting connect webhooks client 4123368368: New connection webhooks client 4123368368: Client info {'program': 'Moonraker', 'version': 'v0.9.3-0-g71f9e67'} Loaded MCU 'mcu' 119 commands (?-20240727_132503-fv-az659-741 / gcc: (Raspbian 10.2.1-6+rpi1) 10.2.1 20210110 binutils: (GNU Binutils for Raspbian) 2.35.2) MCU 'mcu' config: ADC_MAX=4095 CLOCK_FREQ=50000000 MCU=linux PCA9685_MAX=4096 PWM_MAX=32768 STATS_SUMSQ_BASE=256 Configured MCU 'mcu' (1024 moves) Config error Traceback (most recent call last): File "/home/pi/klipper/klippy/klippy.py", line 135, in _connect cb() File "/home/pi/klipper/klippy/extras/ratos.py", line 58, in _connect self.register_command_overrides() File "/home/pi/klipper/klippy/extras/ratos.py", line 86, in register_command_overrides self.register_override('TEST_RESONANCES', self.override_TEST_RESONANCES, desc=(self.desc_TEST_RESONANCES)) File "/home/pi/klipper/klippy/extras/ratos.py", line 97, in register_override raise self.printer.config_error("Existing command '%s' not found in RatOS override" % (command,)) configparser.Error: Existing command 'TEST_RESONANCES' not found in RatOS override Starting Klippy... Args: ['/home/pi/klipper/klippy/klippy.py', '/home/pi/printer_data/config/printer.cfg', '-l', '/home/pi/printer_data/logs/klippy.log', '-I', '/home/pi/printer_data/comms/klippy.serial', '-a', '/home/pi/printer_data/comms/klippy.sock'] Git version: 'v0.12.0-316-g96cceed23-dirty' Untracked files: klippy/extras/beacon.py, klippy/extras/gcode_shell_command.py, klippy/extras/linear_movement_vibrations.py, klippy/extras/ratos.py, klippy/extras/ratos_homing.py, klippy/extras/resonance_generator.py, klippy/extras/z_offset_probe.py, klippy/kinematics/ratos_hybrid_corexy.py Branch: master Remote: origin Tracked URL: https://github.com/Klipper3d/klipper.git CPU: 4 core ? Python: '3.9.2 (default, Mar 20 2025, 22:21:41) \n[GCC 10.2.1 20210110]' Start printer at Wed Oct 22 07:43:20 2025 (1761115400.3 2427.5) ===== Config file ===== [gcode_macro ECHO_T_VARS] description = Echo Toolhead variables to the console. gcode = {% set t = params.T|default(0) %} RATOS_ECHO MSG="T{t} Variables" {% for var, value in printer["gcode_macro T%s" % t].items() %} {action_respond_info(var ~ ": " ~ value)} {% endfor %} [gcode_macro ECHO_RATOS_VARS] description = Echo RatOS variables to the console. gcode = {% for var, value in printer["gcode_macro RatOS"].items() %} {action_respond_info(var ~ ": " ~ value)} {% endfor %} [gcode_macro RatOS] description = RatOS variable storage macro, will echo variables to the console when run. variable_relative_extrusion = False variable_force_absolute_position = False variable_preheat_extruder = True variable_preheat_extruder_temp = 150 variable_macro_travel_speed = 150 variable_macro_travel_accel = 2000 variable_macro_z_speed = 15 variable_bed_margin_x = [0, 0] variable_bed_margin_y = [0, 0] variable_printable_x_min = 0 variable_printable_x_max = 0 variable_printable_y_min = 0 variable_printable_y_max = 0 variable_end_print_motors_off = True variable_status_color_ok = "00FF00" variable_status_color_error = "FF0000" variable_status_color_unknown = "FFFF00" variable_end_print_retract_filament = 10 gcode = ECHO_RATOS_VARS [delayed_gcode RATOS_INIT] initial_duration = 0.1 gcode = RATOS_ECHO MSG="Welcome to RatOS!" RATOS_ECHO MSG="Please setup your printer through the RatOS configurator. Use the link in the sidebar to proceed with the setup." [delayed_gcode RATOS_LOGO] initial_duration = 2 gcode = HELLO_RATOS [gcode_macro INITIAL_FRONTEND_UPDATE] gcode = {% set color_ok = printer["gcode_macro RatOS"].status_color_ok|string %} {% set color_error = printer["gcode_macro RatOS"].status_color_error|string %} {% set color_unknown = printer["gcode_macro RatOS"].status_color_unknown|string %} SET_GCODE_VARIABLE MACRO=T0 VARIABLE=color VALUE='"{color_unknown}"' {% if printer["dual_carriage"] is defined %} SET_GCODE_VARIABLE MACRO=T1 VARIABLE=color VALUE='"{color_unknown}"' {% endif %} {% set t0_sensor = "undefined" %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t0"] is defined %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t0"].enabled|lower == "true" %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t0"].filament_detected|lower == "true" %} {% set t0_sensor = "detected" %} {% else %} {% set t0_sensor = "empty" %} {% endif %} {% else %} {% set t0_sensor = "disabled" %} {% endif %} {% endif %} {% set t1_sensor = "undefined" %} {% if printer["dual_carriage"] is defined and printer["filament_switch_sensor toolhead_filament_sensor_t1"] is defined %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t1"].enabled|lower == "true" %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t1"].filament_detected|lower == "true" %} {% set t1_sensor = "detected" %} {% else %} {% set t1_sensor = "empty" %} {% endif %} {% else %} {% set t1_sensor = "disabled" %} {% endif %} {% endif %} {% set svv = printer.save_variables.variables %} {% if svv.t0_filament is defined and printer["gcode_macro T0"] is defined %} {% if printer["gcode_macro T0"].filament_name is defined and printer["gcode_macro T0"].filament_type is defined and printer["gcode_macro T0"].filament_temp is defined %} {% if t0_sensor != "empty" %} {% set t0_filament_type = svv.t0_filament[0]|default('')|string %} {% set t0_filament_name = svv.t0_filament[1]|default('')|string %} {% set t0_filament_temp = svv.t0_filament[2]|default(0)|float %} {% if t0_filament_name != '' and t0_filament_type != '' and t0_filament_temp > 0 %} SET_GCODE_VARIABLE MACRO=T0 VARIABLE=color VALUE='"{color_ok}"' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_name VALUE='"{t0_filament_name}"' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_type VALUE='"{t0_filament_type}"' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_temp VALUE={t0_filament_temp} {% endif %} {% else %} SAVE_VARIABLE VARIABLE=t0_filament VALUE="('""', '""', 0)" SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_name VALUE='""' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_type VALUE='""' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_temp VALUE=0 {% endif %} {% endif %} {% endif %} {% if svv.t1_filament is defined and printer["gcode_macro T1"] is defined %} {% if printer["gcode_macro T1"].filament_name is defined and printer["gcode_macro T1"].filament_type is defined and printer["gcode_macro T1"].filament_temp is defined %} {% if t1_sensor != "empty" %} {% set t1_filament_type = svv.t1_filament[0]|default('')|string %} {% set t1_filament_name = svv.t1_filament[1]|default('')|string %} {% set t1_filament_temp = svv.t1_filament[2]|default(0)|float %} {% if t1_filament_name != '' and t1_filament_type != '' and t1_filament_temp > 0 %} SET_GCODE_VARIABLE MACRO=T1 VARIABLE=color VALUE='"{color_ok}"' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_name VALUE='"{t1_filament_name}"' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_type VALUE='"{t1_filament_type}"' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_temp VALUE={t1_filament_temp} {% endif %} {% else %} SAVE_VARIABLE VARIABLE=t1_filament VALUE="('""', '""', 0)" SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_name VALUE='""' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_type VALUE='""' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_temp VALUE=0 {% endif %} {% endif %} {% endif %} [gcode_macro CALCULATE_PRINTABLE_AREA] gcode = {% set bed_margin_x = printer["gcode_macro RatOS"].bed_margin_x %} {% set bed_margin_y = printer["gcode_macro RatOS"].bed_margin_y %} {% set tool = 0 if printer["gcode_macro T0"] is not defined or printer["gcode_macro T0"].active else 1 %} {% set max_x = printer.toolhead.axis_maximum.x if printer["dual_carriage"] is defined and tool == 0 else printer.toolhead.axis_maximum.x - bed_margin_x[1] %} {% if printer["dual_carriage"] is defined %} {% set max_x = printer.toolhead.axis_maximum.x %} {% endif %} DEBUG_ECHO PREFIX="CALCULATE_PRINTABLE_AREA" MSG="printer.toolhead.axis_maximum.x {printer.toolhead.axis_maximum.x}" {% set max_y = printer.toolhead.axis_maximum.y - bed_margin_y[1]%} SET_GCODE_VARIABLE MACRO=RatOS VARIABLE=printable_x_max VALUE={max_x} SET_GCODE_VARIABLE MACRO=RatOS VARIABLE=printable_y_max VALUE={max_y} DEBUG_ECHO PREFIX="CALCULATE_PRINTABLE_AREA" MSG="Printable area calculated: X: 0,{max_x} Y: 0,{max_y}" [gcode_macro CACHE_TOOLHEAD_SETTINGS] variable_cache = {"global": {"accel": 1000, "ratio": 0.5, "speed": 50, "scv": 5}} gcode = {% set key = "global" %} {% if params.KEY is defined %} {% set key = params.KEY %} {% endif %} {% set dummy = cache.__setitem__(key, {"accel": printer.toolhead.max_accel, "ratio": printer.toolhead.minimum_cruise_ratio, "speed": printer.toolhead.max_velocity, "scv": printer.toolhead.square_corner_velocity}) %} SET_GCODE_VARIABLE MACRO=CACHE_TOOLHEAD_SETTINGS VARIABLE=cache VALUE="{cache | pprint | replace("\n", "") | replace("\"", "\\\"")}" DEBUG_ECHO PREFIX="CACHE_TOOLHEAD_SETTINGS" MSG="Toolhead settings cached for {key}. {printer.toolhead.max_accel} accel, {printer.toolhead.minimum_cruise_ratio} ratio, {printer.toolhead.max_velocity} velocity, {printer.toolhead.square_corner_velocity} scv." [gcode_macro RESTORE_TOOLHEAD_SETTINGS] gcode = {% set key = "global" %} {% if params.KEY is defined %} {% set key = params.KEY %} {% endif %} {% set values = printer["gcode_macro CACHE_TOOLHEAD_SETTINGS"].cache.__getitem__(key) %} {% if values is not defined or values == 'None' %} { action_raise_error("RESTORE_TOOLHEAD_SETTINGS: Toolhead settings not cached for key '" ~ key ~ "'.") } {% endif %} SET_VELOCITY_LIMIT ACCEL={values.accel} MINIMUM_CRUISE_RATIO={values.ratio} VELOCITY={values.speed} SQUARE_CORNER_VELOCITY={values.scv} DEBUG_ECHO PREFIX="RESTORE_TOOLHEAD_SETTINGS" MSG="Toolhead settings restored. {values.accel} accel, {values.ratio} ratio, {values.speed} velocity, {values.scv} scv." [gcode_macro SET_MACRO_TRAVEL_SETTINGS] gcode = {% set speed = printer["gcode_macro RatOS"].macro_travel_speed|float * 60 %} {% set accel = printer["gcode_macro RatOS"].macro_travel_accel %} SET_VELOCITY_LIMIT ACCEL={accel} MINIMUM_CRUISE_RATIO=0.5 VELOCITY={speed} SQUARE_CORNER_VELOCITY={5} DEBUG_ECHO PREFIX="SET_MACRO_TRAVEL_SETTINGS" MSG="Macro travel settings set. {accel} accel, {speed} velocity" [gcode_macro SET_CENTER_KINEMATIC_POSITION] description = FOR DEBUGGING PURPOSES ONLY. Sets the internal printer kinematic state to the center of all axes regardless of actual physical position. gcode = {% set printable_x_max = printer["gcode_macro RatOS"].printable_x_max|float %} {% set printable_y_max = printer["gcode_macro RatOS"].printable_y_max|float %} RATOS_ECHO MSG="WARNING: ONLY USE SET_CENTER_KINEMATIC_POSITION FOR DEBUGGING PURPOSES. YOU'RE OVERRIDING THE INTERNAL POSITIONING STATE OF THE PRINTER. PROCEED WITH CAUTION AND DO A PROPER G28 WHEN DONE." SET_GCODE_VARIABLE MACRO=MAYBE_HOME VARIABLE=is_kinematic_position_overriden VALUE=True {% if printer["dual_carriage"] is not defined %} SET_KINEMATIC_POSITION X={printable_x_max / 2} Y={printable_y_max / 2} Z={printer.toolhead.axis_maximum.z / 2} {% else %} IDEX_SET_CENTER_KINEMATIC_POSITION {% endif %} [gcode_macro IDEX_SET_CENTER_KINEMATIC_POSITION] description = FOR DEBUGGING PURPOSES ONLY. Sets the internal printer kinematic state to the center of all axes regardless of actual physical position. gcode = {% set printable_x_max = printer["gcode_macro RatOS"].printable_x_max|float %} {% set printable_y_max = printer["gcode_macro RatOS"].printable_y_max|float %} RATOS_ECHO MSG="WARNING: ONLY USE SET_CENTER_KINEMATIC_POSITION FOR DEBUGGING PURPOSES. YOU'RE OVERRIDING THE INTERNAL POSITIONING STATE OF THE PRINTER. PROCEED WITH CAUTION AND DO A PROPER G28 WHEN DONE." SET_GCODE_VARIABLE MACRO=MAYBE_HOME VARIABLE=is_kinematic_position_overriden VALUE=True {% set printable_x_max = printer["gcode_macro RatOS"].printable_x_max|float %} {% set center_x = printable_x_max / 2 %} SET_DUAL_CARRIAGE CARRIAGE=0 MODE=PRIMARY SET_KINEMATIC_POSITION X={center_x - (center_x / 2)} Y={printable_y_max / 2} Z={printer.toolhead.axis_maximum.z / 2} SET_DUAL_CARRIAGE CARRIAGE=1 MODE=PRIMARY SET_KINEMATIC_POSITION X={center_x + (center_x / 2)} Y={printable_y_max / 2} Z={printer.toolhead.axis_maximum.z / 2} SET_DUAL_CARRIAGE CARRIAGE=0 MODE=PRIMARY [gcode_macro VERIFY_HYBRID_INVERTED] gcode = {% set inverted = False %} {% if printer.configfile.settings.ratos_hybrid_corexy is defined and printer.configfile.settings.ratos_hybrid_corexy.inverted is defined %} {% if printer.configfile.settings.ratos_hybrid_corexy.inverted|lower == 'true' %} {% set inverted = True %} {% endif %} {% endif %} {% if inverted == False %} { action_emergency_stop("ratos_hybrid_corexy NOT INVERTED! Inverted hybrid core-xy bugfix not detected.") } {% endif %} [gcode_macro RATOS_ECHO] gcode = {% set prefix = "RatOS" %} {% set debug = params.DEBUG|default(0)|int %} {% if params.PREFIX is defined %} {% set prefix = prefix ~ " | " ~ params.PREFIX %} {% endif %} {% set prefix = prefix ~ ":" %} {% set msg = "" %} {% if params.MSG is defined %} {% set msg = params.MSG %} {% else %} {% set msg = "No msg parameter provided (this is a bug or unintended use)." %} {% endif %} {% if not debug %} M117 {prefix} {msg} {% endif %} RATOS_LOG PREFIX="{prefix}" MSG="{msg}" {% if not debug %} RESPOND PREFIX="{prefix}" MSG="{msg}" {% else %} CONSOLE_ECHO TITLE="{prefix}" TYPE="debug" MSG="{msg}" {% endif %} [gcode_macro ENABLE_DEBUG] gcode = SET_GCODE_VARIABLE MACRO=DEBUG_ECHO VARIABLE=enabled VALUE=True SET_GCODE_VARIABLE MACRO=DEBUG_ECHO VARIABLE=prefix_filter VALUE="'{params.FILTER|default('')|lower}'" RATOS_ECHO PREFIX="DEBUG" MSG="Debugging enabled." [gcode_macro DISABLE_DEBUG] gcode = SET_GCODE_VARIABLE MACRO=DEBUG_ECHO VARIABLE=enabled VALUE=False RATOS_ECHO PREFIX="DEBUG" MSG="Debugging disabled." [gcode_macro DEBUG_ECHO] variable_enabled = False variable_prefix_filter = '' gcode = {% set prefix = "DEBUG" %} {% if params.PREFIX is defined %} {% set prefix = prefix ~ " - " ~ params.PREFIX %} {% endif %} {% if enabled and (prefix_filter|lower == '' or prefix_filter|lower in params.PREFIX|lower) %} RATOS_ECHO PREFIX="{prefix}" MSG="{params.MSG}" DEBUG=1 {% endif %} [gcode_macro START_FEATURE] gcode = DEBUG_ECHO PREFIX="G-Code" MSG="Start {params.FEATURE} feature gcode" {% set scv = printer.toolhead.square_corner_velocity|int|default(5) %} {% set accel = printer.toolhead.max_accel|int|default(10000) %} {% set ratio = printer.toolhead.minimum_cruise_ratio|float|default(0.5) %} SET_GCODE_VARIABLE MACRO="END_FEATURE" VARIABLE="scv" VALUE={scv} SET_GCODE_VARIABLE MACRO="END_FEATURE" VARIABLE="accel" VALUE={accel} SET_GCODE_VARIABLE MACRO="END_FEATURE" VARIABLE="ratio" VALUE={ratio} _USER_START_FEATURE FEATURE="{params.FEATURE}" [gcode_macro END_FEATURE] variable_scv = 5 variable_accel = 10000 variable_ratio = 0.5 gcode = DEBUG_ECHO PREFIX="G-Code" MSG="End {params.FEATURE} feature gcode" SET_VELOCITY_LIMIT SQUARE_CORNER_VELOCITY={scv} ACCEL={accel} MINIMUM_CRUISE_RATIO={ratio} _USER_END_FEATURE FEATURE="{params.FEATURE}" SCV={scv} ACCEL={accel} RATIO={ratio} [gcode_macro _ON_LAYER_CHANGE] variable_layer_number = 0 description = INTERNAL USE ONLY. Call it from the slicers after layer change custom gcode gcode = {% set layer = params.LAYER|int %} SET_GCODE_VARIABLE MACRO=_ON_LAYER_CHANGE VARIABLE=layer_number VALUE={layer} SET_PRINT_STATS_INFO CURRENT_LAYER={layer} [gcode_macro _LEARN_MORE_CALIBRATION] gcode = {% set link_url = "https://os.ratrig.com/docs/configuration/calibration" %} {% set link_text = "RatOS Calibration Macros" %} {% set line_1 = '"Learn more about the %s"' % (link_url, link_text) %} CONSOLE_ECHO TITLE="INFO" MSG={line_1} [gcode_macro _LEARN_MORE_CHAMBER_FILTER] gcode = {% set link_url = "https://os.ratrig.com/docs/configuration/chamber_filter" %} {% set link_text = "RatOS Chamber Filter Control" %} {% set line_1 = '"Learn more about the %s"' % (link_url, link_text) %} CONSOLE_ECHO TITLE="INFO" MSG={line_1} [gcode_macro _LEARN_MORE_FILAMENT] gcode = {% set link_url = "https://os.ratrig.com/docs/configuration/filaments" %} {% set link_text = "RatOS Filament Macros" %} {% set line_1 = '"Learn more about the %s"' % (link_url, link_text) %} CONSOLE_ECHO TITLE="INFO" MSG={line_1} [gcode_macro _CONSOLE_SAVE_CONFIG] gcode = M118 Click SAVE_CONFIG to save the settings to your printer.cfg. [gcode_macro SAVE_Z_OFFSET] gcode = {% if printer.configfile.settings.beacon is defined %} _BEACON_SAVE_MULTIPLIER {% else %} Z_OFFSET_APPLY_PROBE {% endif %} [gcode_macro _LOAD_RATOS_SKEW_PROFILE] gcode = {% set ratos_skew_profile = printer["gcode_macro RatOS"].skew_profile|default("") %} {% if ratos_skew_profile != "" %} {% if printer.configfile.config["skew_correction %s" % ratos_skew_profile] is defined %} SKEW_PROFILE LOAD={ratos_skew_profile} GET_CURRENT_SKEW {% else %} {% set line_1 = '"Could not find skew profile %s!_N_Clearing skew correction."' % ratos_skew_profile %} CONSOLE_ECHO TITLE="Missing skew profile!" TYPE="warning" MSG={line_1} SET_SKEW CLEAR=1 {% endif %} {% endif %} [gcode_macro M601] gcode = PAUSE [idle_timeout] gcode = {% if printer.webhooks.state|lower == 'ready' %} {% if printer.pause_resume.is_paused|lower == 'false' %} RATOS_ECHO PREFIX="IDLE" MSG="2 hours since last activity. Powering off heaters and motors.." TURN_OFF_HEATERS M84 {% endif %} {% endif %} timeout = 7200 [temperature_sensor raspberry_pi] sensor_type = temperature_host [virtual_sdcard] path = ~/printer_data/gcodes [display_status] [pause_resume] [respond] [ratos] [mcu] serial = /tmp/klipper_host_mcu [printer] kinematics = none max_velocity = 1 max_accel = 1 [gcode_macro PAUSE] rename_existing = PAUSE_BASE gcode = RATOS_ECHO MSG="Please setup your printer through the RatOS configurator at /configure" [gcode_macro RESUME] rename_existing = RESUME_BASE gcode = RATOS_ECHO MSG="Please setup your printer through the RatOS configurator at /configure" [gcode_macro CANCEL_PRINT] rename_existing = CANCEL_BASE gcode = RATOS_ECHO MSG="Please setup your printer through the RatOS configurator at /configure" ======================= mcu 'mcu': Starting connect webhooks client 4125928368: New connection webhooks client 4125928368: Client info {'program': 'Moonraker', 'version': 'v0.9.3-0-g71f9e67'} Loaded MCU 'mcu' 119 commands (?-20240727_132503-fv-az659-741 / gcc: (Raspbian 10.2.1-6+rpi1) 10.2.1 20210110 binutils: (GNU Binutils for Raspbian) 2.35.2) MCU 'mcu' config: ADC_MAX=4095 CLOCK_FREQ=50000000 MCU=linux PCA9685_MAX=4096 PWM_MAX=32768 STATS_SUMSQ_BASE=256 Configured MCU 'mcu' (1024 moves) Config error Traceback (most recent call last): File "/home/pi/klipper/klippy/klippy.py", line 135, in _connect cb() File "/home/pi/klipper/klippy/extras/ratos.py", line 58, in _connect self.register_command_overrides() File "/home/pi/klipper/klippy/extras/ratos.py", line 86, in register_command_overrides self.register_override('TEST_RESONANCES', self.override_TEST_RESONANCES, desc=(self.desc_TEST_RESONANCES)) File "/home/pi/klipper/klippy/extras/ratos.py", line 97, in register_override raise self.printer.config_error("Existing command '%s' not found in RatOS override" % (command,)) configparser.Error: Existing command 'TEST_RESONANCES' not found in RatOS override Starting Klippy... Args: ['/home/pi/klipper/klippy/klippy.py', '/home/pi/printer_data/config/printer.cfg', '-l', '/home/pi/printer_data/logs/klippy.log', '-I', '/home/pi/printer_data/comms/klippy.serial', '-a', '/home/pi/printer_data/comms/klippy.sock'] Git version: 'v0.12.0-316-g96cceed23-dirty' Untracked files: klippy/extras/beacon.py, klippy/extras/gcode_shell_command.py, klippy/extras/linear_movement_vibrations.py, klippy/extras/ratos.py, klippy/extras/ratos_homing.py, klippy/extras/resonance_generator.py, klippy/extras/z_offset_probe.py, klippy/kinematics/ratos_hybrid_corexy.py Branch: master Remote: origin Tracked URL: https://github.com/Klipper3d/klipper.git CPU: 4 core ? Python: '3.9.2 (default, Mar 20 2025, 22:21:41) \n[GCC 10.2.1 20210110]' Start printer at Wed Oct 22 07:48:03 2025 (1761115683.2 2710.4) ===== Config file ===== [gcode_macro ECHO_T_VARS] description = Echo Toolhead variables to the console. gcode = {% set t = params.T|default(0) %} RATOS_ECHO MSG="T{t} Variables" {% for var, value in printer["gcode_macro T%s" % t].items() %} {action_respond_info(var ~ ": " ~ value)} {% endfor %} [gcode_macro ECHO_RATOS_VARS] description = Echo RatOS variables to the console. gcode = {% for var, value in printer["gcode_macro RatOS"].items() %} {action_respond_info(var ~ ": " ~ value)} {% endfor %} [gcode_macro RatOS] description = RatOS variable storage macro, will echo variables to the console when run. variable_relative_extrusion = False variable_force_absolute_position = False variable_preheat_extruder = True variable_preheat_extruder_temp = 150 variable_macro_travel_speed = 150 variable_macro_travel_accel = 2000 variable_macro_z_speed = 15 variable_bed_margin_x = [0, 0] variable_bed_margin_y = [0, 0] variable_printable_x_min = 0 variable_printable_x_max = 0 variable_printable_y_min = 0 variable_printable_y_max = 0 variable_end_print_motors_off = True variable_status_color_ok = "00FF00" variable_status_color_error = "FF0000" variable_status_color_unknown = "FFFF00" variable_end_print_retract_filament = 10 gcode = ECHO_RATOS_VARS [delayed_gcode RATOS_INIT] initial_duration = 0.1 gcode = RATOS_ECHO MSG="Welcome to RatOS!" RATOS_ECHO MSG="Please setup your printer through the RatOS configurator. Use the link in the sidebar to proceed with the setup." [delayed_gcode RATOS_LOGO] initial_duration = 2 gcode = HELLO_RATOS [gcode_macro INITIAL_FRONTEND_UPDATE] gcode = {% set color_ok = printer["gcode_macro RatOS"].status_color_ok|string %} {% set color_error = printer["gcode_macro RatOS"].status_color_error|string %} {% set color_unknown = printer["gcode_macro RatOS"].status_color_unknown|string %} SET_GCODE_VARIABLE MACRO=T0 VARIABLE=color VALUE='"{color_unknown}"' {% if printer["dual_carriage"] is defined %} SET_GCODE_VARIABLE MACRO=T1 VARIABLE=color VALUE='"{color_unknown}"' {% endif %} {% set t0_sensor = "undefined" %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t0"] is defined %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t0"].enabled|lower == "true" %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t0"].filament_detected|lower == "true" %} {% set t0_sensor = "detected" %} {% else %} {% set t0_sensor = "empty" %} {% endif %} {% else %} {% set t0_sensor = "disabled" %} {% endif %} {% endif %} {% set t1_sensor = "undefined" %} {% if printer["dual_carriage"] is defined and printer["filament_switch_sensor toolhead_filament_sensor_t1"] is defined %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t1"].enabled|lower == "true" %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t1"].filament_detected|lower == "true" %} {% set t1_sensor = "detected" %} {% else %} {% set t1_sensor = "empty" %} {% endif %} {% else %} {% set t1_sensor = "disabled" %} {% endif %} {% endif %} {% set svv = printer.save_variables.variables %} {% if svv.t0_filament is defined and printer["gcode_macro T0"] is defined %} {% if printer["gcode_macro T0"].filament_name is defined and printer["gcode_macro T0"].filament_type is defined and printer["gcode_macro T0"].filament_temp is defined %} {% if t0_sensor != "empty" %} {% set t0_filament_type = svv.t0_filament[0]|default('')|string %} {% set t0_filament_name = svv.t0_filament[1]|default('')|string %} {% set t0_filament_temp = svv.t0_filament[2]|default(0)|float %} {% if t0_filament_name != '' and t0_filament_type != '' and t0_filament_temp > 0 %} SET_GCODE_VARIABLE MACRO=T0 VARIABLE=color VALUE='"{color_ok}"' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_name VALUE='"{t0_filament_name}"' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_type VALUE='"{t0_filament_type}"' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_temp VALUE={t0_filament_temp} {% endif %} {% else %} SAVE_VARIABLE VARIABLE=t0_filament VALUE="('""', '""', 0)" SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_name VALUE='""' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_type VALUE='""' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_temp VALUE=0 {% endif %} {% endif %} {% endif %} {% if svv.t1_filament is defined and printer["gcode_macro T1"] is defined %} {% if printer["gcode_macro T1"].filament_name is defined and printer["gcode_macro T1"].filament_type is defined and printer["gcode_macro T1"].filament_temp is defined %} {% if t1_sensor != "empty" %} {% set t1_filament_type = svv.t1_filament[0]|default('')|string %} {% set t1_filament_name = svv.t1_filament[1]|default('')|string %} {% set t1_filament_temp = svv.t1_filament[2]|default(0)|float %} {% if t1_filament_name != '' and t1_filament_type != '' and t1_filament_temp > 0 %} SET_GCODE_VARIABLE MACRO=T1 VARIABLE=color VALUE='"{color_ok}"' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_name VALUE='"{t1_filament_name}"' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_type VALUE='"{t1_filament_type}"' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_temp VALUE={t1_filament_temp} {% endif %} {% else %} SAVE_VARIABLE VARIABLE=t1_filament VALUE="('""', '""', 0)" SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_name VALUE='""' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_type VALUE='""' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_temp VALUE=0 {% endif %} {% endif %} {% endif %} [gcode_macro CALCULATE_PRINTABLE_AREA] gcode = {% set bed_margin_x = printer["gcode_macro RatOS"].bed_margin_x %} {% set bed_margin_y = printer["gcode_macro RatOS"].bed_margin_y %} {% set tool = 0 if printer["gcode_macro T0"] is not defined or printer["gcode_macro T0"].active else 1 %} {% set max_x = printer.toolhead.axis_maximum.x if printer["dual_carriage"] is defined and tool == 0 else printer.toolhead.axis_maximum.x - bed_margin_x[1] %} {% if printer["dual_carriage"] is defined %} {% set max_x = printer.toolhead.axis_maximum.x %} {% endif %} DEBUG_ECHO PREFIX="CALCULATE_PRINTABLE_AREA" MSG="printer.toolhead.axis_maximum.x {printer.toolhead.axis_maximum.x}" {% set max_y = printer.toolhead.axis_maximum.y - bed_margin_y[1]%} SET_GCODE_VARIABLE MACRO=RatOS VARIABLE=printable_x_max VALUE={max_x} SET_GCODE_VARIABLE MACRO=RatOS VARIABLE=printable_y_max VALUE={max_y} DEBUG_ECHO PREFIX="CALCULATE_PRINTABLE_AREA" MSG="Printable area calculated: X: 0,{max_x} Y: 0,{max_y}" [gcode_macro CACHE_TOOLHEAD_SETTINGS] variable_cache = {"global": {"accel": 1000, "ratio": 0.5, "speed": 50, "scv": 5}} gcode = {% set key = "global" %} {% if params.KEY is defined %} {% set key = params.KEY %} {% endif %} {% set dummy = cache.__setitem__(key, {"accel": printer.toolhead.max_accel, "ratio": printer.toolhead.minimum_cruise_ratio, "speed": printer.toolhead.max_velocity, "scv": printer.toolhead.square_corner_velocity}) %} SET_GCODE_VARIABLE MACRO=CACHE_TOOLHEAD_SETTINGS VARIABLE=cache VALUE="{cache | pprint | replace("\n", "") | replace("\"", "\\\"")}" DEBUG_ECHO PREFIX="CACHE_TOOLHEAD_SETTINGS" MSG="Toolhead settings cached for {key}. {printer.toolhead.max_accel} accel, {printer.toolhead.minimum_cruise_ratio} ratio, {printer.toolhead.max_velocity} velocity, {printer.toolhead.square_corner_velocity} scv." [gcode_macro RESTORE_TOOLHEAD_SETTINGS] gcode = {% set key = "global" %} {% if params.KEY is defined %} {% set key = params.KEY %} {% endif %} {% set values = printer["gcode_macro CACHE_TOOLHEAD_SETTINGS"].cache.__getitem__(key) %} {% if values is not defined or values == 'None' %} { action_raise_error("RESTORE_TOOLHEAD_SETTINGS: Toolhead settings not cached for key '" ~ key ~ "'.") } {% endif %} SET_VELOCITY_LIMIT ACCEL={values.accel} MINIMUM_CRUISE_RATIO={values.ratio} VELOCITY={values.speed} SQUARE_CORNER_VELOCITY={values.scv} DEBUG_ECHO PREFIX="RESTORE_TOOLHEAD_SETTINGS" MSG="Toolhead settings restored. {values.accel} accel, {values.ratio} ratio, {values.speed} velocity, {values.scv} scv." [gcode_macro SET_MACRO_TRAVEL_SETTINGS] gcode = {% set speed = printer["gcode_macro RatOS"].macro_travel_speed|float * 60 %} {% set accel = printer["gcode_macro RatOS"].macro_travel_accel %} SET_VELOCITY_LIMIT ACCEL={accel} MINIMUM_CRUISE_RATIO=0.5 VELOCITY={speed} SQUARE_CORNER_VELOCITY={5} DEBUG_ECHO PREFIX="SET_MACRO_TRAVEL_SETTINGS" MSG="Macro travel settings set. {accel} accel, {speed} velocity" [gcode_macro SET_CENTER_KINEMATIC_POSITION] description = FOR DEBUGGING PURPOSES ONLY. Sets the internal printer kinematic state to the center of all axes regardless of actual physical position. gcode = {% set printable_x_max = printer["gcode_macro RatOS"].printable_x_max|float %} {% set printable_y_max = printer["gcode_macro RatOS"].printable_y_max|float %} RATOS_ECHO MSG="WARNING: ONLY USE SET_CENTER_KINEMATIC_POSITION FOR DEBUGGING PURPOSES. YOU'RE OVERRIDING THE INTERNAL POSITIONING STATE OF THE PRINTER. PROCEED WITH CAUTION AND DO A PROPER G28 WHEN DONE." SET_GCODE_VARIABLE MACRO=MAYBE_HOME VARIABLE=is_kinematic_position_overriden VALUE=True {% if printer["dual_carriage"] is not defined %} SET_KINEMATIC_POSITION X={printable_x_max / 2} Y={printable_y_max / 2} Z={printer.toolhead.axis_maximum.z / 2} {% else %} IDEX_SET_CENTER_KINEMATIC_POSITION {% endif %} [gcode_macro IDEX_SET_CENTER_KINEMATIC_POSITION] description = FOR DEBUGGING PURPOSES ONLY. Sets the internal printer kinematic state to the center of all axes regardless of actual physical position. gcode = {% set printable_x_max = printer["gcode_macro RatOS"].printable_x_max|float %} {% set printable_y_max = printer["gcode_macro RatOS"].printable_y_max|float %} RATOS_ECHO MSG="WARNING: ONLY USE SET_CENTER_KINEMATIC_POSITION FOR DEBUGGING PURPOSES. YOU'RE OVERRIDING THE INTERNAL POSITIONING STATE OF THE PRINTER. PROCEED WITH CAUTION AND DO A PROPER G28 WHEN DONE." SET_GCODE_VARIABLE MACRO=MAYBE_HOME VARIABLE=is_kinematic_position_overriden VALUE=True {% set printable_x_max = printer["gcode_macro RatOS"].printable_x_max|float %} {% set center_x = printable_x_max / 2 %} SET_DUAL_CARRIAGE CARRIAGE=0 MODE=PRIMARY SET_KINEMATIC_POSITION X={center_x - (center_x / 2)} Y={printable_y_max / 2} Z={printer.toolhead.axis_maximum.z / 2} SET_DUAL_CARRIAGE CARRIAGE=1 MODE=PRIMARY SET_KINEMATIC_POSITION X={center_x + (center_x / 2)} Y={printable_y_max / 2} Z={printer.toolhead.axis_maximum.z / 2} SET_DUAL_CARRIAGE CARRIAGE=0 MODE=PRIMARY [gcode_macro VERIFY_HYBRID_INVERTED] gcode = {% set inverted = False %} {% if printer.configfile.settings.ratos_hybrid_corexy is defined and printer.configfile.settings.ratos_hybrid_corexy.inverted is defined %} {% if printer.configfile.settings.ratos_hybrid_corexy.inverted|lower == 'true' %} {% set inverted = True %} {% endif %} {% endif %} {% if inverted == False %} { action_emergency_stop("ratos_hybrid_corexy NOT INVERTED! Inverted hybrid core-xy bugfix not detected.") } {% endif %} [gcode_macro RATOS_ECHO] gcode = {% set prefix = "RatOS" %} {% set debug = params.DEBUG|default(0)|int %} {% if params.PREFIX is defined %} {% set prefix = prefix ~ " | " ~ params.PREFIX %} {% endif %} {% set prefix = prefix ~ ":" %} {% set msg = "" %} {% if params.MSG is defined %} {% set msg = params.MSG %} {% else %} {% set msg = "No msg parameter provided (this is a bug or unintended use)." %} {% endif %} {% if not debug %} M117 {prefix} {msg} {% endif %} RATOS_LOG PREFIX="{prefix}" MSG="{msg}" {% if not debug %} RESPOND PREFIX="{prefix}" MSG="{msg}" {% else %} CONSOLE_ECHO TITLE="{prefix}" TYPE="debug" MSG="{msg}" {% endif %} [gcode_macro ENABLE_DEBUG] gcode = SET_GCODE_VARIABLE MACRO=DEBUG_ECHO VARIABLE=enabled VALUE=True SET_GCODE_VARIABLE MACRO=DEBUG_ECHO VARIABLE=prefix_filter VALUE="'{params.FILTER|default('')|lower}'" RATOS_ECHO PREFIX="DEBUG" MSG="Debugging enabled." [gcode_macro DISABLE_DEBUG] gcode = SET_GCODE_VARIABLE MACRO=DEBUG_ECHO VARIABLE=enabled VALUE=False RATOS_ECHO PREFIX="DEBUG" MSG="Debugging disabled." [gcode_macro DEBUG_ECHO] variable_enabled = False variable_prefix_filter = '' gcode = {% set prefix = "DEBUG" %} {% if params.PREFIX is defined %} {% set prefix = prefix ~ " - " ~ params.PREFIX %} {% endif %} {% if enabled and (prefix_filter|lower == '' or prefix_filter|lower in params.PREFIX|lower) %} RATOS_ECHO PREFIX="{prefix}" MSG="{params.MSG}" DEBUG=1 {% endif %} [gcode_macro START_FEATURE] gcode = DEBUG_ECHO PREFIX="G-Code" MSG="Start {params.FEATURE} feature gcode" {% set scv = printer.toolhead.square_corner_velocity|int|default(5) %} {% set accel = printer.toolhead.max_accel|int|default(10000) %} {% set ratio = printer.toolhead.minimum_cruise_ratio|float|default(0.5) %} SET_GCODE_VARIABLE MACRO="END_FEATURE" VARIABLE="scv" VALUE={scv} SET_GCODE_VARIABLE MACRO="END_FEATURE" VARIABLE="accel" VALUE={accel} SET_GCODE_VARIABLE MACRO="END_FEATURE" VARIABLE="ratio" VALUE={ratio} _USER_START_FEATURE FEATURE="{params.FEATURE}" [gcode_macro END_FEATURE] variable_scv = 5 variable_accel = 10000 variable_ratio = 0.5 gcode = DEBUG_ECHO PREFIX="G-Code" MSG="End {params.FEATURE} feature gcode" SET_VELOCITY_LIMIT SQUARE_CORNER_VELOCITY={scv} ACCEL={accel} MINIMUM_CRUISE_RATIO={ratio} _USER_END_FEATURE FEATURE="{params.FEATURE}" SCV={scv} ACCEL={accel} RATIO={ratio} [gcode_macro _ON_LAYER_CHANGE] variable_layer_number = 0 description = INTERNAL USE ONLY. Call it from the slicers after layer change custom gcode gcode = {% set layer = params.LAYER|int %} SET_GCODE_VARIABLE MACRO=_ON_LAYER_CHANGE VARIABLE=layer_number VALUE={layer} SET_PRINT_STATS_INFO CURRENT_LAYER={layer} [gcode_macro _LEARN_MORE_CALIBRATION] gcode = {% set link_url = "https://os.ratrig.com/docs/configuration/calibration" %} {% set link_text = "RatOS Calibration Macros" %} {% set line_1 = '"Learn more about the %s"' % (link_url, link_text) %} CONSOLE_ECHO TITLE="INFO" MSG={line_1} [gcode_macro _LEARN_MORE_CHAMBER_FILTER] gcode = {% set link_url = "https://os.ratrig.com/docs/configuration/chamber_filter" %} {% set link_text = "RatOS Chamber Filter Control" %} {% set line_1 = '"Learn more about the %s"' % (link_url, link_text) %} CONSOLE_ECHO TITLE="INFO" MSG={line_1} [gcode_macro _LEARN_MORE_FILAMENT] gcode = {% set link_url = "https://os.ratrig.com/docs/configuration/filaments" %} {% set link_text = "RatOS Filament Macros" %} {% set line_1 = '"Learn more about the %s"' % (link_url, link_text) %} CONSOLE_ECHO TITLE="INFO" MSG={line_1} [gcode_macro _CONSOLE_SAVE_CONFIG] gcode = M118 Click SAVE_CONFIG to save the settings to your printer.cfg. [gcode_macro SAVE_Z_OFFSET] gcode = {% if printer.configfile.settings.beacon is defined %} _BEACON_SAVE_MULTIPLIER {% else %} Z_OFFSET_APPLY_PROBE {% endif %} [gcode_macro _LOAD_RATOS_SKEW_PROFILE] gcode = {% set ratos_skew_profile = printer["gcode_macro RatOS"].skew_profile|default("") %} {% if ratos_skew_profile != "" %} {% if printer.configfile.config["skew_correction %s" % ratos_skew_profile] is defined %} SKEW_PROFILE LOAD={ratos_skew_profile} GET_CURRENT_SKEW {% else %} {% set line_1 = '"Could not find skew profile %s!_N_Clearing skew correction."' % ratos_skew_profile %} CONSOLE_ECHO TITLE="Missing skew profile!" TYPE="warning" MSG={line_1} SET_SKEW CLEAR=1 {% endif %} {% endif %} [gcode_macro M601] gcode = PAUSE [idle_timeout] gcode = {% if printer.webhooks.state|lower == 'ready' %} {% if printer.pause_resume.is_paused|lower == 'false' %} RATOS_ECHO PREFIX="IDLE" MSG="2 hours since last activity. Powering off heaters and motors.." TURN_OFF_HEATERS M84 {% endif %} {% endif %} timeout = 7200 [temperature_sensor raspberry_pi] sensor_type = temperature_host [virtual_sdcard] path = ~/printer_data/gcodes [display_status] [pause_resume] [respond] [ratos] [mcu] serial = /tmp/klipper_host_mcu [printer] kinematics = none max_velocity = 1 max_accel = 1 [gcode_macro PAUSE] rename_existing = PAUSE_BASE gcode = RATOS_ECHO MSG="Please setup your printer through the RatOS configurator at /configure" [gcode_macro RESUME] rename_existing = RESUME_BASE gcode = RATOS_ECHO MSG="Please setup your printer through the RatOS configurator at /configure" [gcode_macro CANCEL_PRINT] rename_existing = CANCEL_BASE gcode = RATOS_ECHO MSG="Please setup your printer through the RatOS configurator at /configure" ======================= mcu 'mcu': Starting connect webhooks client 4128590792: New connection webhooks client 4128590792: Client info {'program': 'Moonraker', 'version': 'v0.9.3-0-g71f9e67'} Loaded MCU 'mcu' 119 commands (?-20240727_132503-fv-az659-741 / gcc: (Raspbian 10.2.1-6+rpi1) 10.2.1 20210110 binutils: (GNU Binutils for Raspbian) 2.35.2) MCU 'mcu' config: ADC_MAX=4095 CLOCK_FREQ=50000000 MCU=linux PCA9685_MAX=4096 PWM_MAX=32768 STATS_SUMSQ_BASE=256 Configured MCU 'mcu' (1024 moves) Config error Traceback (most recent call last): File "/home/pi/klipper/klippy/klippy.py", line 135, in _connect cb() File "/home/pi/klipper/klippy/extras/ratos.py", line 58, in _connect self.register_command_overrides() File "/home/pi/klipper/klippy/extras/ratos.py", line 86, in register_command_overrides self.register_override('TEST_RESONANCES', self.override_TEST_RESONANCES, desc=(self.desc_TEST_RESONANCES)) File "/home/pi/klipper/klippy/extras/ratos.py", line 97, in register_override raise self.printer.config_error("Existing command '%s' not found in RatOS override" % (command,)) configparser.Error: Existing command 'TEST_RESONANCES' not found in RatOS override webhooks client 4128590792: Disconnected Starting Klippy... Args: ['/home/pi/klipper/klippy/klippy.py', '/home/pi/printer_data/config/printer.cfg', '-l', '/home/pi/printer_data/logs/klippy.log', '-I', '/home/pi/printer_data/comms/klippy.serial', '-a', '/home/pi/printer_data/comms/klippy.sock'] Git version: 'v0.12.0-316-g96cceed23-dirty' Untracked files: klippy/extras/beacon.py, klippy/extras/gcode_shell_command.py, klippy/extras/linear_movement_vibrations.py, klippy/extras/ratos.py, klippy/extras/ratos_homing.py, klippy/extras/resonance_generator.py, klippy/extras/z_offset_probe.py, klippy/kinematics/ratos_hybrid_corexy.py Branch: master Remote: origin Tracked URL: https://github.com/Klipper3d/klipper.git CPU: 4 core ? Python: '3.9.2 (default, Mar 20 2025, 22:21:41) \n[GCC 10.2.1 20210110]' Start printer at Wed Oct 22 07:50:10 2025 (1761115810.5 20.2) ===== Config file ===== [gcode_macro ECHO_T_VARS] description = Echo Toolhead variables to the console. gcode = {% set t = params.T|default(0) %} RATOS_ECHO MSG="T{t} Variables" {% for var, value in printer["gcode_macro T%s" % t].items() %} {action_respond_info(var ~ ": " ~ value)} {% endfor %} [gcode_macro ECHO_RATOS_VARS] description = Echo RatOS variables to the console. gcode = {% for var, value in printer["gcode_macro RatOS"].items() %} {action_respond_info(var ~ ": " ~ value)} {% endfor %} [gcode_macro RatOS] description = RatOS variable storage macro, will echo variables to the console when run. variable_relative_extrusion = False variable_force_absolute_position = False variable_preheat_extruder = True variable_preheat_extruder_temp = 150 variable_macro_travel_speed = 150 variable_macro_travel_accel = 2000 variable_macro_z_speed = 15 variable_bed_margin_x = [0, 0] variable_bed_margin_y = [0, 0] variable_printable_x_min = 0 variable_printable_x_max = 0 variable_printable_y_min = 0 variable_printable_y_max = 0 variable_end_print_motors_off = True variable_status_color_ok = "00FF00" variable_status_color_error = "FF0000" variable_status_color_unknown = "FFFF00" variable_end_print_retract_filament = 10 gcode = ECHO_RATOS_VARS [delayed_gcode RATOS_INIT] initial_duration = 0.1 gcode = RATOS_ECHO MSG="Welcome to RatOS!" RATOS_ECHO MSG="Please setup your printer through the RatOS configurator. Use the link in the sidebar to proceed with the setup." [delayed_gcode RATOS_LOGO] initial_duration = 2 gcode = HELLO_RATOS [gcode_macro INITIAL_FRONTEND_UPDATE] gcode = {% set color_ok = printer["gcode_macro RatOS"].status_color_ok|string %} {% set color_error = printer["gcode_macro RatOS"].status_color_error|string %} {% set color_unknown = printer["gcode_macro RatOS"].status_color_unknown|string %} SET_GCODE_VARIABLE MACRO=T0 VARIABLE=color VALUE='"{color_unknown}"' {% if printer["dual_carriage"] is defined %} SET_GCODE_VARIABLE MACRO=T1 VARIABLE=color VALUE='"{color_unknown}"' {% endif %} {% set t0_sensor = "undefined" %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t0"] is defined %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t0"].enabled|lower == "true" %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t0"].filament_detected|lower == "true" %} {% set t0_sensor = "detected" %} {% else %} {% set t0_sensor = "empty" %} {% endif %} {% else %} {% set t0_sensor = "disabled" %} {% endif %} {% endif %} {% set t1_sensor = "undefined" %} {% if printer["dual_carriage"] is defined and printer["filament_switch_sensor toolhead_filament_sensor_t1"] is defined %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t1"].enabled|lower == "true" %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t1"].filament_detected|lower == "true" %} {% set t1_sensor = "detected" %} {% else %} {% set t1_sensor = "empty" %} {% endif %} {% else %} {% set t1_sensor = "disabled" %} {% endif %} {% endif %} {% set svv = printer.save_variables.variables %} {% if svv.t0_filament is defined and printer["gcode_macro T0"] is defined %} {% if printer["gcode_macro T0"].filament_name is defined and printer["gcode_macro T0"].filament_type is defined and printer["gcode_macro T0"].filament_temp is defined %} {% if t0_sensor != "empty" %} {% set t0_filament_type = svv.t0_filament[0]|default('')|string %} {% set t0_filament_name = svv.t0_filament[1]|default('')|string %} {% set t0_filament_temp = svv.t0_filament[2]|default(0)|float %} {% if t0_filament_name != '' and t0_filament_type != '' and t0_filament_temp > 0 %} SET_GCODE_VARIABLE MACRO=T0 VARIABLE=color VALUE='"{color_ok}"' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_name VALUE='"{t0_filament_name}"' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_type VALUE='"{t0_filament_type}"' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_temp VALUE={t0_filament_temp} {% endif %} {% else %} SAVE_VARIABLE VARIABLE=t0_filament VALUE="('""', '""', 0)" SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_name VALUE='""' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_type VALUE='""' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_temp VALUE=0 {% endif %} {% endif %} {% endif %} {% if svv.t1_filament is defined and printer["gcode_macro T1"] is defined %} {% if printer["gcode_macro T1"].filament_name is defined and printer["gcode_macro T1"].filament_type is defined and printer["gcode_macro T1"].filament_temp is defined %} {% if t1_sensor != "empty" %} {% set t1_filament_type = svv.t1_filament[0]|default('')|string %} {% set t1_filament_name = svv.t1_filament[1]|default('')|string %} {% set t1_filament_temp = svv.t1_filament[2]|default(0)|float %} {% if t1_filament_name != '' and t1_filament_type != '' and t1_filament_temp > 0 %} SET_GCODE_VARIABLE MACRO=T1 VARIABLE=color VALUE='"{color_ok}"' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_name VALUE='"{t1_filament_name}"' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_type VALUE='"{t1_filament_type}"' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_temp VALUE={t1_filament_temp} {% endif %} {% else %} SAVE_VARIABLE VARIABLE=t1_filament VALUE="('""', '""', 0)" SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_name VALUE='""' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_type VALUE='""' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_temp VALUE=0 {% endif %} {% endif %} {% endif %} [gcode_macro CALCULATE_PRINTABLE_AREA] gcode = {% set bed_margin_x = printer["gcode_macro RatOS"].bed_margin_x %} {% set bed_margin_y = printer["gcode_macro RatOS"].bed_margin_y %} {% set tool = 0 if printer["gcode_macro T0"] is not defined or printer["gcode_macro T0"].active else 1 %} {% set max_x = printer.toolhead.axis_maximum.x if printer["dual_carriage"] is defined and tool == 0 else printer.toolhead.axis_maximum.x - bed_margin_x[1] %} {% if printer["dual_carriage"] is defined %} {% set max_x = printer.toolhead.axis_maximum.x %} {% endif %} DEBUG_ECHO PREFIX="CALCULATE_PRINTABLE_AREA" MSG="printer.toolhead.axis_maximum.x {printer.toolhead.axis_maximum.x}" {% set max_y = printer.toolhead.axis_maximum.y - bed_margin_y[1]%} SET_GCODE_VARIABLE MACRO=RatOS VARIABLE=printable_x_max VALUE={max_x} SET_GCODE_VARIABLE MACRO=RatOS VARIABLE=printable_y_max VALUE={max_y} DEBUG_ECHO PREFIX="CALCULATE_PRINTABLE_AREA" MSG="Printable area calculated: X: 0,{max_x} Y: 0,{max_y}" [gcode_macro CACHE_TOOLHEAD_SETTINGS] variable_cache = {"global": {"accel": 1000, "ratio": 0.5, "speed": 50, "scv": 5}} gcode = {% set key = "global" %} {% if params.KEY is defined %} {% set key = params.KEY %} {% endif %} {% set dummy = cache.__setitem__(key, {"accel": printer.toolhead.max_accel, "ratio": printer.toolhead.minimum_cruise_ratio, "speed": printer.toolhead.max_velocity, "scv": printer.toolhead.square_corner_velocity}) %} SET_GCODE_VARIABLE MACRO=CACHE_TOOLHEAD_SETTINGS VARIABLE=cache VALUE="{cache | pprint | replace("\n", "") | replace("\"", "\\\"")}" DEBUG_ECHO PREFIX="CACHE_TOOLHEAD_SETTINGS" MSG="Toolhead settings cached for {key}. {printer.toolhead.max_accel} accel, {printer.toolhead.minimum_cruise_ratio} ratio, {printer.toolhead.max_velocity} velocity, {printer.toolhead.square_corner_velocity} scv." [gcode_macro RESTORE_TOOLHEAD_SETTINGS] gcode = {% set key = "global" %} {% if params.KEY is defined %} {% set key = params.KEY %} {% endif %} {% set values = printer["gcode_macro CACHE_TOOLHEAD_SETTINGS"].cache.__getitem__(key) %} {% if values is not defined or values == 'None' %} { action_raise_error("RESTORE_TOOLHEAD_SETTINGS: Toolhead settings not cached for key '" ~ key ~ "'.") } {% endif %} SET_VELOCITY_LIMIT ACCEL={values.accel} MINIMUM_CRUISE_RATIO={values.ratio} VELOCITY={values.speed} SQUARE_CORNER_VELOCITY={values.scv} DEBUG_ECHO PREFIX="RESTORE_TOOLHEAD_SETTINGS" MSG="Toolhead settings restored. {values.accel} accel, {values.ratio} ratio, {values.speed} velocity, {values.scv} scv." [gcode_macro SET_MACRO_TRAVEL_SETTINGS] gcode = {% set speed = printer["gcode_macro RatOS"].macro_travel_speed|float * 60 %} {% set accel = printer["gcode_macro RatOS"].macro_travel_accel %} SET_VELOCITY_LIMIT ACCEL={accel} MINIMUM_CRUISE_RATIO=0.5 VELOCITY={speed} SQUARE_CORNER_VELOCITY={5} DEBUG_ECHO PREFIX="SET_MACRO_TRAVEL_SETTINGS" MSG="Macro travel settings set. {accel} accel, {speed} velocity" [gcode_macro SET_CENTER_KINEMATIC_POSITION] description = FOR DEBUGGING PURPOSES ONLY. Sets the internal printer kinematic state to the center of all axes regardless of actual physical position. gcode = {% set printable_x_max = printer["gcode_macro RatOS"].printable_x_max|float %} {% set printable_y_max = printer["gcode_macro RatOS"].printable_y_max|float %} RATOS_ECHO MSG="WARNING: ONLY USE SET_CENTER_KINEMATIC_POSITION FOR DEBUGGING PURPOSES. YOU'RE OVERRIDING THE INTERNAL POSITIONING STATE OF THE PRINTER. PROCEED WITH CAUTION AND DO A PROPER G28 WHEN DONE." SET_GCODE_VARIABLE MACRO=MAYBE_HOME VARIABLE=is_kinematic_position_overriden VALUE=True {% if printer["dual_carriage"] is not defined %} SET_KINEMATIC_POSITION X={printable_x_max / 2} Y={printable_y_max / 2} Z={printer.toolhead.axis_maximum.z / 2} {% else %} IDEX_SET_CENTER_KINEMATIC_POSITION {% endif %} [gcode_macro IDEX_SET_CENTER_KINEMATIC_POSITION] description = FOR DEBUGGING PURPOSES ONLY. Sets the internal printer kinematic state to the center of all axes regardless of actual physical position. gcode = {% set printable_x_max = printer["gcode_macro RatOS"].printable_x_max|float %} {% set printable_y_max = printer["gcode_macro RatOS"].printable_y_max|float %} RATOS_ECHO MSG="WARNING: ONLY USE SET_CENTER_KINEMATIC_POSITION FOR DEBUGGING PURPOSES. YOU'RE OVERRIDING THE INTERNAL POSITIONING STATE OF THE PRINTER. PROCEED WITH CAUTION AND DO A PROPER G28 WHEN DONE." SET_GCODE_VARIABLE MACRO=MAYBE_HOME VARIABLE=is_kinematic_position_overriden VALUE=True {% set printable_x_max = printer["gcode_macro RatOS"].printable_x_max|float %} {% set center_x = printable_x_max / 2 %} SET_DUAL_CARRIAGE CARRIAGE=0 MODE=PRIMARY SET_KINEMATIC_POSITION X={center_x - (center_x / 2)} Y={printable_y_max / 2} Z={printer.toolhead.axis_maximum.z / 2} SET_DUAL_CARRIAGE CARRIAGE=1 MODE=PRIMARY SET_KINEMATIC_POSITION X={center_x + (center_x / 2)} Y={printable_y_max / 2} Z={printer.toolhead.axis_maximum.z / 2} SET_DUAL_CARRIAGE CARRIAGE=0 MODE=PRIMARY [gcode_macro VERIFY_HYBRID_INVERTED] gcode = {% set inverted = False %} {% if printer.configfile.settings.ratos_hybrid_corexy is defined and printer.configfile.settings.ratos_hybrid_corexy.inverted is defined %} {% if printer.configfile.settings.ratos_hybrid_corexy.inverted|lower == 'true' %} {% set inverted = True %} {% endif %} {% endif %} {% if inverted == False %} { action_emergency_stop("ratos_hybrid_corexy NOT INVERTED! Inverted hybrid core-xy bugfix not detected.") } {% endif %} [gcode_macro RATOS_ECHO] gcode = {% set prefix = "RatOS" %} {% set debug = params.DEBUG|default(0)|int %} {% if params.PREFIX is defined %} {% set prefix = prefix ~ " | " ~ params.PREFIX %} {% endif %} {% set prefix = prefix ~ ":" %} {% set msg = "" %} {% if params.MSG is defined %} {% set msg = params.MSG %} {% else %} {% set msg = "No msg parameter provided (this is a bug or unintended use)." %} {% endif %} {% if not debug %} M117 {prefix} {msg} {% endif %} RATOS_LOG PREFIX="{prefix}" MSG="{msg}" {% if not debug %} RESPOND PREFIX="{prefix}" MSG="{msg}" {% else %} CONSOLE_ECHO TITLE="{prefix}" TYPE="debug" MSG="{msg}" {% endif %} [gcode_macro ENABLE_DEBUG] gcode = SET_GCODE_VARIABLE MACRO=DEBUG_ECHO VARIABLE=enabled VALUE=True SET_GCODE_VARIABLE MACRO=DEBUG_ECHO VARIABLE=prefix_filter VALUE="'{params.FILTER|default('')|lower}'" RATOS_ECHO PREFIX="DEBUG" MSG="Debugging enabled." [gcode_macro DISABLE_DEBUG] gcode = SET_GCODE_VARIABLE MACRO=DEBUG_ECHO VARIABLE=enabled VALUE=False RATOS_ECHO PREFIX="DEBUG" MSG="Debugging disabled." [gcode_macro DEBUG_ECHO] variable_enabled = False variable_prefix_filter = '' gcode = {% set prefix = "DEBUG" %} {% if params.PREFIX is defined %} {% set prefix = prefix ~ " - " ~ params.PREFIX %} {% endif %} {% if enabled and (prefix_filter|lower == '' or prefix_filter|lower in params.PREFIX|lower) %} RATOS_ECHO PREFIX="{prefix}" MSG="{params.MSG}" DEBUG=1 {% endif %} [gcode_macro START_FEATURE] gcode = DEBUG_ECHO PREFIX="G-Code" MSG="Start {params.FEATURE} feature gcode" {% set scv = printer.toolhead.square_corner_velocity|int|default(5) %} {% set accel = printer.toolhead.max_accel|int|default(10000) %} {% set ratio = printer.toolhead.minimum_cruise_ratio|float|default(0.5) %} SET_GCODE_VARIABLE MACRO="END_FEATURE" VARIABLE="scv" VALUE={scv} SET_GCODE_VARIABLE MACRO="END_FEATURE" VARIABLE="accel" VALUE={accel} SET_GCODE_VARIABLE MACRO="END_FEATURE" VARIABLE="ratio" VALUE={ratio} _USER_START_FEATURE FEATURE="{params.FEATURE}" [gcode_macro END_FEATURE] variable_scv = 5 variable_accel = 10000 variable_ratio = 0.5 gcode = DEBUG_ECHO PREFIX="G-Code" MSG="End {params.FEATURE} feature gcode" SET_VELOCITY_LIMIT SQUARE_CORNER_VELOCITY={scv} ACCEL={accel} MINIMUM_CRUISE_RATIO={ratio} _USER_END_FEATURE FEATURE="{params.FEATURE}" SCV={scv} ACCEL={accel} RATIO={ratio} [gcode_macro _ON_LAYER_CHANGE] variable_layer_number = 0 description = INTERNAL USE ONLY. Call it from the slicers after layer change custom gcode gcode = {% set layer = params.LAYER|int %} SET_GCODE_VARIABLE MACRO=_ON_LAYER_CHANGE VARIABLE=layer_number VALUE={layer} SET_PRINT_STATS_INFO CURRENT_LAYER={layer} [gcode_macro _LEARN_MORE_CALIBRATION] gcode = {% set link_url = "https://os.ratrig.com/docs/configuration/calibration" %} {% set link_text = "RatOS Calibration Macros" %} {% set line_1 = '"Learn more about the %s"' % (link_url, link_text) %} CONSOLE_ECHO TITLE="INFO" MSG={line_1} [gcode_macro _LEARN_MORE_CHAMBER_FILTER] gcode = {% set link_url = "https://os.ratrig.com/docs/configuration/chamber_filter" %} {% set link_text = "RatOS Chamber Filter Control" %} {% set line_1 = '"Learn more about the %s"' % (link_url, link_text) %} CONSOLE_ECHO TITLE="INFO" MSG={line_1} [gcode_macro _LEARN_MORE_FILAMENT] gcode = {% set link_url = "https://os.ratrig.com/docs/configuration/filaments" %} {% set link_text = "RatOS Filament Macros" %} {% set line_1 = '"Learn more about the %s"' % (link_url, link_text) %} CONSOLE_ECHO TITLE="INFO" MSG={line_1} [gcode_macro _CONSOLE_SAVE_CONFIG] gcode = M118 Click SAVE_CONFIG to save the settings to your printer.cfg. [gcode_macro SAVE_Z_OFFSET] gcode = {% if printer.configfile.settings.beacon is defined %} _BEACON_SAVE_MULTIPLIER {% else %} Z_OFFSET_APPLY_PROBE {% endif %} [gcode_macro _LOAD_RATOS_SKEW_PROFILE] gcode = {% set ratos_skew_profile = printer["gcode_macro RatOS"].skew_profile|default("") %} {% if ratos_skew_profile != "" %} {% if printer.configfile.config["skew_correction %s" % ratos_skew_profile] is defined %} SKEW_PROFILE LOAD={ratos_skew_profile} GET_CURRENT_SKEW {% else %} {% set line_1 = '"Could not find skew profile %s!_N_Clearing skew correction."' % ratos_skew_profile %} CONSOLE_ECHO TITLE="Missing skew profile!" TYPE="warning" MSG={line_1} SET_SKEW CLEAR=1 {% endif %} {% endif %} [gcode_macro M601] gcode = PAUSE [idle_timeout] gcode = {% if printer.webhooks.state|lower == 'ready' %} {% if printer.pause_resume.is_paused|lower == 'false' %} RATOS_ECHO PREFIX="IDLE" MSG="2 hours since last activity. Powering off heaters and motors.." TURN_OFF_HEATERS M84 {% endif %} {% endif %} timeout = 7200 [temperature_sensor raspberry_pi] sensor_type = temperature_host [virtual_sdcard] path = ~/printer_data/gcodes [display_status] [pause_resume] [respond] [ratos] [mcu] serial = /tmp/klipper_host_mcu [printer] kinematics = none max_velocity = 1 max_accel = 1 [gcode_macro PAUSE] rename_existing = PAUSE_BASE gcode = RATOS_ECHO MSG="Please setup your printer through the RatOS configurator at /configure" [gcode_macro RESUME] rename_existing = RESUME_BASE gcode = RATOS_ECHO MSG="Please setup your printer through the RatOS configurator at /configure" [gcode_macro CANCEL_PRINT] rename_existing = CANCEL_BASE gcode = RATOS_ECHO MSG="Please setup your printer through the RatOS configurator at /configure" ======================= mcu 'mcu': Starting connect Loaded MCU 'mcu' 119 commands (?-20240727_132503-fv-az659-741 / gcc: (Raspbian 10.2.1-6+rpi1) 10.2.1 20210110 binutils: (GNU Binutils for Raspbian) 2.35.2) MCU 'mcu' config: ADC_MAX=4095 CLOCK_FREQ=50000000 MCU=linux PCA9685_MAX=4096 PWM_MAX=32768 STATS_SUMSQ_BASE=256 Sending MCU 'mcu' printer configuration... Configured MCU 'mcu' (1024 moves) Config error Traceback (most recent call last): File "/home/pi/klipper/klippy/klippy.py", line 135, in _connect cb() File "/home/pi/klipper/klippy/extras/ratos.py", line 58, in _connect self.register_command_overrides() File "/home/pi/klipper/klippy/extras/ratos.py", line 86, in register_command_overrides self.register_override('TEST_RESONANCES', self.override_TEST_RESONANCES, desc=(self.desc_TEST_RESONANCES)) File "/home/pi/klipper/klippy/extras/ratos.py", line 97, in register_override raise self.printer.config_error("Existing command '%s' not found in RatOS override" % (command,)) configparser.Error: Existing command 'TEST_RESONANCES' not found in RatOS override webhooks client 4127767808: New connection webhooks client 4127767808: Client info {'program': 'Moonraker', 'version': 'v0.9.3-0-g71f9e67'} Starting Klippy... Args: ['/home/pi/klipper/klippy/klippy.py', '/home/pi/printer_data/config/printer.cfg', '-l', '/home/pi/printer_data/logs/klippy.log', '-I', '/home/pi/printer_data/comms/klippy.serial', '-a', '/home/pi/printer_data/comms/klippy.sock'] Git version: 'v0.12.0-316-g96cceed23-dirty' Untracked files: klippy/extras/beacon.py, klippy/extras/gcode_shell_command.py, klippy/extras/linear_movement_vibrations.py, klippy/extras/ratos.py, klippy/extras/ratos_homing.py, klippy/extras/resonance_generator.py, klippy/extras/z_offset_probe.py, klippy/kinematics/ratos_hybrid_corexy.py Branch: master Remote: origin Tracked URL: https://github.com/Klipper3d/klipper.git CPU: 4 core ? Python: '3.9.2 (default, Mar 20 2025, 22:21:41) \n[GCC 10.2.1 20210110]' Start printer at Wed Oct 22 07:51:13 2025 (1761115873.2 52.3) ===== Config file ===== [gcode_macro ECHO_T_VARS] description = Echo Toolhead variables to the console. gcode = {% set t = params.T|default(0) %} RATOS_ECHO MSG="T{t} Variables" {% for var, value in printer["gcode_macro T%s" % t].items() %} {action_respond_info(var ~ ": " ~ value)} {% endfor %} [gcode_macro ECHO_RATOS_VARS] description = Echo RatOS variables to the console. gcode = {% for var, value in printer["gcode_macro RatOS"].items() %} {action_respond_info(var ~ ": " ~ value)} {% endfor %} [gcode_macro RatOS] description = RatOS variable storage macro, will echo variables to the console when run. variable_relative_extrusion = False variable_force_absolute_position = False variable_preheat_extruder = True variable_preheat_extruder_temp = 150 variable_macro_travel_speed = 150 variable_macro_travel_accel = 2000 variable_macro_z_speed = 15 variable_bed_margin_x = [0, 0] variable_bed_margin_y = [0, 0] variable_printable_x_min = 0 variable_printable_x_max = 0 variable_printable_y_min = 0 variable_printable_y_max = 0 variable_end_print_motors_off = True variable_status_color_ok = "00FF00" variable_status_color_error = "FF0000" variable_status_color_unknown = "FFFF00" variable_end_print_retract_filament = 10 gcode = ECHO_RATOS_VARS [delayed_gcode RATOS_INIT] initial_duration = 0.1 gcode = RATOS_ECHO MSG="Welcome to RatOS!" RATOS_ECHO MSG="Please setup your printer through the RatOS configurator. Use the link in the sidebar to proceed with the setup." [delayed_gcode RATOS_LOGO] initial_duration = 2 gcode = HELLO_RATOS [gcode_macro INITIAL_FRONTEND_UPDATE] gcode = {% set color_ok = printer["gcode_macro RatOS"].status_color_ok|string %} {% set color_error = printer["gcode_macro RatOS"].status_color_error|string %} {% set color_unknown = printer["gcode_macro RatOS"].status_color_unknown|string %} SET_GCODE_VARIABLE MACRO=T0 VARIABLE=color VALUE='"{color_unknown}"' {% if printer["dual_carriage"] is defined %} SET_GCODE_VARIABLE MACRO=T1 VARIABLE=color VALUE='"{color_unknown}"' {% endif %} {% set t0_sensor = "undefined" %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t0"] is defined %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t0"].enabled|lower == "true" %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t0"].filament_detected|lower == "true" %} {% set t0_sensor = "detected" %} {% else %} {% set t0_sensor = "empty" %} {% endif %} {% else %} {% set t0_sensor = "disabled" %} {% endif %} {% endif %} {% set t1_sensor = "undefined" %} {% if printer["dual_carriage"] is defined and printer["filament_switch_sensor toolhead_filament_sensor_t1"] is defined %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t1"].enabled|lower == "true" %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t1"].filament_detected|lower == "true" %} {% set t1_sensor = "detected" %} {% else %} {% set t1_sensor = "empty" %} {% endif %} {% else %} {% set t1_sensor = "disabled" %} {% endif %} {% endif %} {% set svv = printer.save_variables.variables %} {% if svv.t0_filament is defined and printer["gcode_macro T0"] is defined %} {% if printer["gcode_macro T0"].filament_name is defined and printer["gcode_macro T0"].filament_type is defined and printer["gcode_macro T0"].filament_temp is defined %} {% if t0_sensor != "empty" %} {% set t0_filament_type = svv.t0_filament[0]|default('')|string %} {% set t0_filament_name = svv.t0_filament[1]|default('')|string %} {% set t0_filament_temp = svv.t0_filament[2]|default(0)|float %} {% if t0_filament_name != '' and t0_filament_type != '' and t0_filament_temp > 0 %} SET_GCODE_VARIABLE MACRO=T0 VARIABLE=color VALUE='"{color_ok}"' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_name VALUE='"{t0_filament_name}"' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_type VALUE='"{t0_filament_type}"' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_temp VALUE={t0_filament_temp} {% endif %} {% else %} SAVE_VARIABLE VARIABLE=t0_filament VALUE="('""', '""', 0)" SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_name VALUE='""' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_type VALUE='""' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_temp VALUE=0 {% endif %} {% endif %} {% endif %} {% if svv.t1_filament is defined and printer["gcode_macro T1"] is defined %} {% if printer["gcode_macro T1"].filament_name is defined and printer["gcode_macro T1"].filament_type is defined and printer["gcode_macro T1"].filament_temp is defined %} {% if t1_sensor != "empty" %} {% set t1_filament_type = svv.t1_filament[0]|default('')|string %} {% set t1_filament_name = svv.t1_filament[1]|default('')|string %} {% set t1_filament_temp = svv.t1_filament[2]|default(0)|float %} {% if t1_filament_name != '' and t1_filament_type != '' and t1_filament_temp > 0 %} SET_GCODE_VARIABLE MACRO=T1 VARIABLE=color VALUE='"{color_ok}"' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_name VALUE='"{t1_filament_name}"' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_type VALUE='"{t1_filament_type}"' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_temp VALUE={t1_filament_temp} {% endif %} {% else %} SAVE_VARIABLE VARIABLE=t1_filament VALUE="('""', '""', 0)" SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_name VALUE='""' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_type VALUE='""' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_temp VALUE=0 {% endif %} {% endif %} {% endif %} [gcode_macro CALCULATE_PRINTABLE_AREA] gcode = {% set bed_margin_x = printer["gcode_macro RatOS"].bed_margin_x %} {% set bed_margin_y = printer["gcode_macro RatOS"].bed_margin_y %} {% set tool = 0 if printer["gcode_macro T0"] is not defined or printer["gcode_macro T0"].active else 1 %} {% set max_x = printer.toolhead.axis_maximum.x if printer["dual_carriage"] is defined and tool == 0 else printer.toolhead.axis_maximum.x - bed_margin_x[1] %} {% if printer["dual_carriage"] is defined %} {% set max_x = printer.toolhead.axis_maximum.x %} {% endif %} DEBUG_ECHO PREFIX="CALCULATE_PRINTABLE_AREA" MSG="printer.toolhead.axis_maximum.x {printer.toolhead.axis_maximum.x}" {% set max_y = printer.toolhead.axis_maximum.y - bed_margin_y[1]%} SET_GCODE_VARIABLE MACRO=RatOS VARIABLE=printable_x_max VALUE={max_x} SET_GCODE_VARIABLE MACRO=RatOS VARIABLE=printable_y_max VALUE={max_y} DEBUG_ECHO PREFIX="CALCULATE_PRINTABLE_AREA" MSG="Printable area calculated: X: 0,{max_x} Y: 0,{max_y}" [gcode_macro CACHE_TOOLHEAD_SETTINGS] variable_cache = {"global": {"accel": 1000, "ratio": 0.5, "speed": 50, "scv": 5}} gcode = {% set key = "global" %} {% if params.KEY is defined %} {% set key = params.KEY %} {% endif %} {% set dummy = cache.__setitem__(key, {"accel": printer.toolhead.max_accel, "ratio": printer.toolhead.minimum_cruise_ratio, "speed": printer.toolhead.max_velocity, "scv": printer.toolhead.square_corner_velocity}) %} SET_GCODE_VARIABLE MACRO=CACHE_TOOLHEAD_SETTINGS VARIABLE=cache VALUE="{cache | pprint | replace("\n", "") | replace("\"", "\\\"")}" DEBUG_ECHO PREFIX="CACHE_TOOLHEAD_SETTINGS" MSG="Toolhead settings cached for {key}. {printer.toolhead.max_accel} accel, {printer.toolhead.minimum_cruise_ratio} ratio, {printer.toolhead.max_velocity} velocity, {printer.toolhead.square_corner_velocity} scv." [gcode_macro RESTORE_TOOLHEAD_SETTINGS] gcode = {% set key = "global" %} {% if params.KEY is defined %} {% set key = params.KEY %} {% endif %} {% set values = printer["gcode_macro CACHE_TOOLHEAD_SETTINGS"].cache.__getitem__(key) %} {% if values is not defined or values == 'None' %} { action_raise_error("RESTORE_TOOLHEAD_SETTINGS: Toolhead settings not cached for key '" ~ key ~ "'.") } {% endif %} SET_VELOCITY_LIMIT ACCEL={values.accel} MINIMUM_CRUISE_RATIO={values.ratio} VELOCITY={values.speed} SQUARE_CORNER_VELOCITY={values.scv} DEBUG_ECHO PREFIX="RESTORE_TOOLHEAD_SETTINGS" MSG="Toolhead settings restored. {values.accel} accel, {values.ratio} ratio, {values.speed} velocity, {values.scv} scv." [gcode_macro SET_MACRO_TRAVEL_SETTINGS] gcode = {% set speed = printer["gcode_macro RatOS"].macro_travel_speed|float * 60 %} {% set accel = printer["gcode_macro RatOS"].macro_travel_accel %} SET_VELOCITY_LIMIT ACCEL={accel} MINIMUM_CRUISE_RATIO=0.5 VELOCITY={speed} SQUARE_CORNER_VELOCITY={5} DEBUG_ECHO PREFIX="SET_MACRO_TRAVEL_SETTINGS" MSG="Macro travel settings set. {accel} accel, {speed} velocity" [gcode_macro SET_CENTER_KINEMATIC_POSITION] description = FOR DEBUGGING PURPOSES ONLY. Sets the internal printer kinematic state to the center of all axes regardless of actual physical position. gcode = {% set printable_x_max = printer["gcode_macro RatOS"].printable_x_max|float %} {% set printable_y_max = printer["gcode_macro RatOS"].printable_y_max|float %} RATOS_ECHO MSG="WARNING: ONLY USE SET_CENTER_KINEMATIC_POSITION FOR DEBUGGING PURPOSES. YOU'RE OVERRIDING THE INTERNAL POSITIONING STATE OF THE PRINTER. PROCEED WITH CAUTION AND DO A PROPER G28 WHEN DONE." SET_GCODE_VARIABLE MACRO=MAYBE_HOME VARIABLE=is_kinematic_position_overriden VALUE=True {% if printer["dual_carriage"] is not defined %} SET_KINEMATIC_POSITION X={printable_x_max / 2} Y={printable_y_max / 2} Z={printer.toolhead.axis_maximum.z / 2} {% else %} IDEX_SET_CENTER_KINEMATIC_POSITION {% endif %} [gcode_macro IDEX_SET_CENTER_KINEMATIC_POSITION] description = FOR DEBUGGING PURPOSES ONLY. Sets the internal printer kinematic state to the center of all axes regardless of actual physical position. gcode = {% set printable_x_max = printer["gcode_macro RatOS"].printable_x_max|float %} {% set printable_y_max = printer["gcode_macro RatOS"].printable_y_max|float %} RATOS_ECHO MSG="WARNING: ONLY USE SET_CENTER_KINEMATIC_POSITION FOR DEBUGGING PURPOSES. YOU'RE OVERRIDING THE INTERNAL POSITIONING STATE OF THE PRINTER. PROCEED WITH CAUTION AND DO A PROPER G28 WHEN DONE." SET_GCODE_VARIABLE MACRO=MAYBE_HOME VARIABLE=is_kinematic_position_overriden VALUE=True {% set printable_x_max = printer["gcode_macro RatOS"].printable_x_max|float %} {% set center_x = printable_x_max / 2 %} SET_DUAL_CARRIAGE CARRIAGE=0 MODE=PRIMARY SET_KINEMATIC_POSITION X={center_x - (center_x / 2)} Y={printable_y_max / 2} Z={printer.toolhead.axis_maximum.z / 2} SET_DUAL_CARRIAGE CARRIAGE=1 MODE=PRIMARY SET_KINEMATIC_POSITION X={center_x + (center_x / 2)} Y={printable_y_max / 2} Z={printer.toolhead.axis_maximum.z / 2} SET_DUAL_CARRIAGE CARRIAGE=0 MODE=PRIMARY [gcode_macro VERIFY_HYBRID_INVERTED] gcode = {% set inverted = False %} {% if printer.configfile.settings.ratos_hybrid_corexy is defined and printer.configfile.settings.ratos_hybrid_corexy.inverted is defined %} {% if printer.configfile.settings.ratos_hybrid_corexy.inverted|lower == 'true' %} {% set inverted = True %} {% endif %} {% endif %} {% if inverted == False %} { action_emergency_stop("ratos_hybrid_corexy NOT INVERTED! Inverted hybrid core-xy bugfix not detected.") } {% endif %} [gcode_macro RATOS_ECHO] gcode = {% set prefix = "RatOS" %} {% set debug = params.DEBUG|default(0)|int %} {% if params.PREFIX is defined %} {% set prefix = prefix ~ " | " ~ params.PREFIX %} {% endif %} {% set prefix = prefix ~ ":" %} {% set msg = "" %} {% if params.MSG is defined %} {% set msg = params.MSG %} {% else %} {% set msg = "No msg parameter provided (this is a bug or unintended use)." %} {% endif %} {% if not debug %} M117 {prefix} {msg} {% endif %} RATOS_LOG PREFIX="{prefix}" MSG="{msg}" {% if not debug %} RESPOND PREFIX="{prefix}" MSG="{msg}" {% else %} CONSOLE_ECHO TITLE="{prefix}" TYPE="debug" MSG="{msg}" {% endif %} [gcode_macro ENABLE_DEBUG] gcode = SET_GCODE_VARIABLE MACRO=DEBUG_ECHO VARIABLE=enabled VALUE=True SET_GCODE_VARIABLE MACRO=DEBUG_ECHO VARIABLE=prefix_filter VALUE="'{params.FILTER|default('')|lower}'" RATOS_ECHO PREFIX="DEBUG" MSG="Debugging enabled." [gcode_macro DISABLE_DEBUG] gcode = SET_GCODE_VARIABLE MACRO=DEBUG_ECHO VARIABLE=enabled VALUE=False RATOS_ECHO PREFIX="DEBUG" MSG="Debugging disabled." [gcode_macro DEBUG_ECHO] variable_enabled = False variable_prefix_filter = '' gcode = {% set prefix = "DEBUG" %} {% if params.PREFIX is defined %} {% set prefix = prefix ~ " - " ~ params.PREFIX %} {% endif %} {% if enabled and (prefix_filter|lower == '' or prefix_filter|lower in params.PREFIX|lower) %} RATOS_ECHO PREFIX="{prefix}" MSG="{params.MSG}" DEBUG=1 {% endif %} [gcode_macro START_FEATURE] gcode = DEBUG_ECHO PREFIX="G-Code" MSG="Start {params.FEATURE} feature gcode" {% set scv = printer.toolhead.square_corner_velocity|int|default(5) %} {% set accel = printer.toolhead.max_accel|int|default(10000) %} {% set ratio = printer.toolhead.minimum_cruise_ratio|float|default(0.5) %} SET_GCODE_VARIABLE MACRO="END_FEATURE" VARIABLE="scv" VALUE={scv} SET_GCODE_VARIABLE MACRO="END_FEATURE" VARIABLE="accel" VALUE={accel} SET_GCODE_VARIABLE MACRO="END_FEATURE" VARIABLE="ratio" VALUE={ratio} _USER_START_FEATURE FEATURE="{params.FEATURE}" [gcode_macro END_FEATURE] variable_scv = 5 variable_accel = 10000 variable_ratio = 0.5 gcode = DEBUG_ECHO PREFIX="G-Code" MSG="End {params.FEATURE} feature gcode" SET_VELOCITY_LIMIT SQUARE_CORNER_VELOCITY={scv} ACCEL={accel} MINIMUM_CRUISE_RATIO={ratio} _USER_END_FEATURE FEATURE="{params.FEATURE}" SCV={scv} ACCEL={accel} RATIO={ratio} [gcode_macro _ON_LAYER_CHANGE] variable_layer_number = 0 description = INTERNAL USE ONLY. Call it from the slicers after layer change custom gcode gcode = {% set layer = params.LAYER|int %} SET_GCODE_VARIABLE MACRO=_ON_LAYER_CHANGE VARIABLE=layer_number VALUE={layer} SET_PRINT_STATS_INFO CURRENT_LAYER={layer} [gcode_macro _LEARN_MORE_CALIBRATION] gcode = {% set link_url = "https://os.ratrig.com/docs/configuration/calibration" %} {% set link_text = "RatOS Calibration Macros" %} {% set line_1 = '"Learn more about the %s"' % (link_url, link_text) %} CONSOLE_ECHO TITLE="INFO" MSG={line_1} [gcode_macro _LEARN_MORE_CHAMBER_FILTER] gcode = {% set link_url = "https://os.ratrig.com/docs/configuration/chamber_filter" %} {% set link_text = "RatOS Chamber Filter Control" %} {% set line_1 = '"Learn more about the %s"' % (link_url, link_text) %} CONSOLE_ECHO TITLE="INFO" MSG={line_1} [gcode_macro _LEARN_MORE_FILAMENT] gcode = {% set link_url = "https://os.ratrig.com/docs/configuration/filaments" %} {% set link_text = "RatOS Filament Macros" %} {% set line_1 = '"Learn more about the %s"' % (link_url, link_text) %} CONSOLE_ECHO TITLE="INFO" MSG={line_1} [gcode_macro _CONSOLE_SAVE_CONFIG] gcode = M118 Click SAVE_CONFIG to save the settings to your printer.cfg. [gcode_macro SAVE_Z_OFFSET] gcode = {% if printer.configfile.settings.beacon is defined %} _BEACON_SAVE_MULTIPLIER {% else %} Z_OFFSET_APPLY_PROBE {% endif %} [gcode_macro _LOAD_RATOS_SKEW_PROFILE] gcode = {% set ratos_skew_profile = printer["gcode_macro RatOS"].skew_profile|default("") %} {% if ratos_skew_profile != "" %} {% if printer.configfile.config["skew_correction %s" % ratos_skew_profile] is defined %} SKEW_PROFILE LOAD={ratos_skew_profile} GET_CURRENT_SKEW {% else %} {% set line_1 = '"Could not find skew profile %s!_N_Clearing skew correction."' % ratos_skew_profile %} CONSOLE_ECHO TITLE="Missing skew profile!" TYPE="warning" MSG={line_1} SET_SKEW CLEAR=1 {% endif %} {% endif %} [gcode_macro M601] gcode = PAUSE [idle_timeout] gcode = {% if printer.webhooks.state|lower == 'ready' %} {% if printer.pause_resume.is_paused|lower == 'false' %} RATOS_ECHO PREFIX="IDLE" MSG="2 hours since last activity. Powering off heaters and motors.." TURN_OFF_HEATERS M84 {% endif %} {% endif %} timeout = 7200 [temperature_sensor raspberry_pi] sensor_type = temperature_host [virtual_sdcard] path = ~/printer_data/gcodes [display_status] [pause_resume] [respond] [ratos] [mcu] serial = /tmp/klipper_host_mcu [printer] kinematics = none max_velocity = 1 max_accel = 1 [gcode_macro PAUSE] rename_existing = PAUSE_BASE gcode = RATOS_ECHO MSG="Please setup your printer through the RatOS configurator at /configure" [gcode_macro RESUME] rename_existing = RESUME_BASE gcode = RATOS_ECHO MSG="Please setup your printer through the RatOS configurator at /configure" [gcode_macro CANCEL_PRINT] rename_existing = CANCEL_BASE gcode = RATOS_ECHO MSG="Please setup your printer through the RatOS configurator at /configure" ======================= mcu 'mcu': Starting connect webhooks client 4125629360: New connection webhooks client 4125629360: Client info {'program': 'Moonraker', 'version': 'v0.9.3-0-g71f9e67'} mcu 'mcu': got {'count': 140, 'sum': 208155, 'sumsq': 1612268, '#name': 'stats', '#sent_time': 53.270594097, '#receive_time': 53.300311357} Loaded MCU 'mcu' 119 commands (?-20240727_132503-fv-az659-741 / gcc: (Raspbian 10.2.1-6+rpi1) 10.2.1 20210110 binutils: (GNU Binutils for Raspbian) 2.35.2) MCU 'mcu' config: ADC_MAX=4095 CLOCK_FREQ=50000000 MCU=linux PCA9685_MAX=4096 PWM_MAX=32768 STATS_SUMSQ_BASE=256 Configured MCU 'mcu' (1024 moves) Config error Traceback (most recent call last): File "/home/pi/klipper/klippy/klippy.py", line 135, in _connect cb() File "/home/pi/klipper/klippy/extras/ratos.py", line 58, in _connect self.register_command_overrides() File "/home/pi/klipper/klippy/extras/ratos.py", line 86, in register_command_overrides self.register_override('TEST_RESONANCES', self.override_TEST_RESONANCES, desc=(self.desc_TEST_RESONANCES)) File "/home/pi/klipper/klippy/extras/ratos.py", line 97, in register_override raise self.printer.config_error("Existing command '%s' not found in RatOS override" % (command,)) configparser.Error: Existing command 'TEST_RESONANCES' not found in RatOS override Starting Klippy... Starting Klippy... Args: ['/home/pi/klipper/klippy/klippy.py', '/home/pi/printer_data/config/printer.cfg', '-l', '/home/pi/printer_data/logs/klippy.log', '-I', '/home/pi/printer_data/comms/klippy.serial', '-a', '/home/pi/printer_data/comms/klippy.sock'] Git version: 'v0.12.0-316-g96cceed23-dirty' Untracked files: klippy/extras/beacon.py, klippy/extras/gcode_shell_command.py, klippy/extras/linear_movement_vibrations.py, klippy/extras/ratos.py, klippy/extras/ratos_homing.py, klippy/extras/resonance_generator.py, klippy/extras/z_offset_probe.py, klippy/kinematics/ratos_hybrid_corexy.py Branch: master Remote: origin Tracked URL: https://github.com/Klipper3d/klipper.git CPU: 4 core ? Python: '3.9.2 (default, Mar 20 2025, 22:21:41) \n[GCC 10.2.1 20210110]' Start printer at Wed Oct 22 07:52:34 2025 (1761115954.0 133.1) ===== Config file ===== [gcode_macro ECHO_T_VARS] description = Echo Toolhead variables to the console. gcode = {% set t = params.T|default(0) %} RATOS_ECHO MSG="T{t} Variables" {% for var, value in printer["gcode_macro T%s" % t].items() %} {action_respond_info(var ~ ": " ~ value)} {% endfor %} [gcode_macro ECHO_RATOS_VARS] description = Echo RatOS variables to the console. gcode = {% for var, value in printer["gcode_macro RatOS"].items() %} {action_respond_info(var ~ ": " ~ value)} {% endfor %} [gcode_macro RatOS] description = RatOS variable storage macro, will echo variables to the console when run. variable_relative_extrusion = False variable_force_absolute_position = False variable_preheat_extruder = True variable_preheat_extruder_temp = 150 variable_macro_travel_speed = 150 variable_macro_travel_accel = 2000 variable_macro_z_speed = 15 variable_bed_margin_x = [0, 0] variable_bed_margin_y = [0, 0] variable_printable_x_min = 0 variable_printable_x_max = 0 variable_printable_y_min = 0 variable_printable_y_max = 0 variable_end_print_motors_off = True variable_status_color_ok = "00FF00" variable_status_color_error = "FF0000" variable_status_color_unknown = "FFFF00" variable_end_print_retract_filament = 10 gcode = ECHO_RATOS_VARS [delayed_gcode RATOS_INIT] initial_duration = 0.1 gcode = RATOS_ECHO MSG="Welcome to RatOS!" RATOS_ECHO MSG="Please setup your printer through the RatOS configurator. Use the link in the sidebar to proceed with the setup." [delayed_gcode RATOS_LOGO] initial_duration = 2 gcode = HELLO_RATOS [gcode_macro INITIAL_FRONTEND_UPDATE] gcode = {% set color_ok = printer["gcode_macro RatOS"].status_color_ok|string %} {% set color_error = printer["gcode_macro RatOS"].status_color_error|string %} {% set color_unknown = printer["gcode_macro RatOS"].status_color_unknown|string %} SET_GCODE_VARIABLE MACRO=T0 VARIABLE=color VALUE='"{color_unknown}"' {% if printer["dual_carriage"] is defined %} SET_GCODE_VARIABLE MACRO=T1 VARIABLE=color VALUE='"{color_unknown}"' {% endif %} {% set t0_sensor = "undefined" %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t0"] is defined %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t0"].enabled|lower == "true" %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t0"].filament_detected|lower == "true" %} {% set t0_sensor = "detected" %} {% else %} {% set t0_sensor = "empty" %} {% endif %} {% else %} {% set t0_sensor = "disabled" %} {% endif %} {% endif %} {% set t1_sensor = "undefined" %} {% if printer["dual_carriage"] is defined and printer["filament_switch_sensor toolhead_filament_sensor_t1"] is defined %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t1"].enabled|lower == "true" %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t1"].filament_detected|lower == "true" %} {% set t1_sensor = "detected" %} {% else %} {% set t1_sensor = "empty" %} {% endif %} {% else %} {% set t1_sensor = "disabled" %} {% endif %} {% endif %} {% set svv = printer.save_variables.variables %} {% if svv.t0_filament is defined and printer["gcode_macro T0"] is defined %} {% if printer["gcode_macro T0"].filament_name is defined and printer["gcode_macro T0"].filament_type is defined and printer["gcode_macro T0"].filament_temp is defined %} {% if t0_sensor != "empty" %} {% set t0_filament_type = svv.t0_filament[0]|default('')|string %} {% set t0_filament_name = svv.t0_filament[1]|default('')|string %} {% set t0_filament_temp = svv.t0_filament[2]|default(0)|float %} {% if t0_filament_name != '' and t0_filament_type != '' and t0_filament_temp > 0 %} SET_GCODE_VARIABLE MACRO=T0 VARIABLE=color VALUE='"{color_ok}"' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_name VALUE='"{t0_filament_name}"' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_type VALUE='"{t0_filament_type}"' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_temp VALUE={t0_filament_temp} {% endif %} {% else %} SAVE_VARIABLE VARIABLE=t0_filament VALUE="('""', '""', 0)" SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_name VALUE='""' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_type VALUE='""' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_temp VALUE=0 {% endif %} {% endif %} {% endif %} {% if svv.t1_filament is defined and printer["gcode_macro T1"] is defined %} {% if printer["gcode_macro T1"].filament_name is defined and printer["gcode_macro T1"].filament_type is defined and printer["gcode_macro T1"].filament_temp is defined %} {% if t1_sensor != "empty" %} {% set t1_filament_type = svv.t1_filament[0]|default('')|string %} {% set t1_filament_name = svv.t1_filament[1]|default('')|string %} {% set t1_filament_temp = svv.t1_filament[2]|default(0)|float %} {% if t1_filament_name != '' and t1_filament_type != '' and t1_filament_temp > 0 %} SET_GCODE_VARIABLE MACRO=T1 VARIABLE=color VALUE='"{color_ok}"' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_name VALUE='"{t1_filament_name}"' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_type VALUE='"{t1_filament_type}"' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_temp VALUE={t1_filament_temp} {% endif %} {% else %} SAVE_VARIABLE VARIABLE=t1_filament VALUE="('""', '""', 0)" SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_name VALUE='""' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_type VALUE='""' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_temp VALUE=0 {% endif %} {% endif %} {% endif %} [gcode_macro CALCULATE_PRINTABLE_AREA] gcode = {% set bed_margin_x = printer["gcode_macro RatOS"].bed_margin_x %} {% set bed_margin_y = printer["gcode_macro RatOS"].bed_margin_y %} {% set tool = 0 if printer["gcode_macro T0"] is not defined or printer["gcode_macro T0"].active else 1 %} {% set max_x = printer.toolhead.axis_maximum.x if printer["dual_carriage"] is defined and tool == 0 else printer.toolhead.axis_maximum.x - bed_margin_x[1] %} {% if printer["dual_carriage"] is defined %} {% set max_x = printer.toolhead.axis_maximum.x %} {% endif %} DEBUG_ECHO PREFIX="CALCULATE_PRINTABLE_AREA" MSG="printer.toolhead.axis_maximum.x {printer.toolhead.axis_maximum.x}" {% set max_y = printer.toolhead.axis_maximum.y - bed_margin_y[1]%} SET_GCODE_VARIABLE MACRO=RatOS VARIABLE=printable_x_max VALUE={max_x} SET_GCODE_VARIABLE MACRO=RatOS VARIABLE=printable_y_max VALUE={max_y} DEBUG_ECHO PREFIX="CALCULATE_PRINTABLE_AREA" MSG="Printable area calculated: X: 0,{max_x} Y: 0,{max_y}" [gcode_macro CACHE_TOOLHEAD_SETTINGS] variable_cache = {"global": {"accel": 1000, "ratio": 0.5, "speed": 50, "scv": 5}} gcode = {% set key = "global" %} {% if params.KEY is defined %} {% set key = params.KEY %} {% endif %} {% set dummy = cache.__setitem__(key, {"accel": printer.toolhead.max_accel, "ratio": printer.toolhead.minimum_cruise_ratio, "speed": printer.toolhead.max_velocity, "scv": printer.toolhead.square_corner_velocity}) %} SET_GCODE_VARIABLE MACRO=CACHE_TOOLHEAD_SETTINGS VARIABLE=cache VALUE="{cache | pprint | replace("\n", "") | replace("\"", "\\\"")}" DEBUG_ECHO PREFIX="CACHE_TOOLHEAD_SETTINGS" MSG="Toolhead settings cached for {key}. {printer.toolhead.max_accel} accel, {printer.toolhead.minimum_cruise_ratio} ratio, {printer.toolhead.max_velocity} velocity, {printer.toolhead.square_corner_velocity} scv." [gcode_macro RESTORE_TOOLHEAD_SETTINGS] gcode = {% set key = "global" %} {% if params.KEY is defined %} {% set key = params.KEY %} {% endif %} {% set values = printer["gcode_macro CACHE_TOOLHEAD_SETTINGS"].cache.__getitem__(key) %} {% if values is not defined or values == 'None' %} { action_raise_error("RESTORE_TOOLHEAD_SETTINGS: Toolhead settings not cached for key '" ~ key ~ "'.") } {% endif %} SET_VELOCITY_LIMIT ACCEL={values.accel} MINIMUM_CRUISE_RATIO={values.ratio} VELOCITY={values.speed} SQUARE_CORNER_VELOCITY={values.scv} DEBUG_ECHO PREFIX="RESTORE_TOOLHEAD_SETTINGS" MSG="Toolhead settings restored. {values.accel} accel, {values.ratio} ratio, {values.speed} velocity, {values.scv} scv." [gcode_macro SET_MACRO_TRAVEL_SETTINGS] gcode = {% set speed = printer["gcode_macro RatOS"].macro_travel_speed|float * 60 %} {% set accel = printer["gcode_macro RatOS"].macro_travel_accel %} SET_VELOCITY_LIMIT ACCEL={accel} MINIMUM_CRUISE_RATIO=0.5 VELOCITY={speed} SQUARE_CORNER_VELOCITY={5} DEBUG_ECHO PREFIX="SET_MACRO_TRAVEL_SETTINGS" MSG="Macro travel settings set. {accel} accel, {speed} velocity" [gcode_macro SET_CENTER_KINEMATIC_POSITION] description = FOR DEBUGGING PURPOSES ONLY. Sets the internal printer kinematic state to the center of all axes regardless of actual physical position. gcode = {% set printable_x_max = printer["gcode_macro RatOS"].printable_x_max|float %} {% set printable_y_max = printer["gcode_macro RatOS"].printable_y_max|float %} RATOS_ECHO MSG="WARNING: ONLY USE SET_CENTER_KINEMATIC_POSITION FOR DEBUGGING PURPOSES. YOU'RE OVERRIDING THE INTERNAL POSITIONING STATE OF THE PRINTER. PROCEED WITH CAUTION AND DO A PROPER G28 WHEN DONE." SET_GCODE_VARIABLE MACRO=MAYBE_HOME VARIABLE=is_kinematic_position_overriden VALUE=True {% if printer["dual_carriage"] is not defined %} SET_KINEMATIC_POSITION X={printable_x_max / 2} Y={printable_y_max / 2} Z={printer.toolhead.axis_maximum.z / 2} {% else %} IDEX_SET_CENTER_KINEMATIC_POSITION {% endif %} [gcode_macro IDEX_SET_CENTER_KINEMATIC_POSITION] description = FOR DEBUGGING PURPOSES ONLY. Sets the internal printer kinematic state to the center of all axes regardless of actual physical position. gcode = {% set printable_x_max = printer["gcode_macro RatOS"].printable_x_max|float %} {% set printable_y_max = printer["gcode_macro RatOS"].printable_y_max|float %} RATOS_ECHO MSG="WARNING: ONLY USE SET_CENTER_KINEMATIC_POSITION FOR DEBUGGING PURPOSES. YOU'RE OVERRIDING THE INTERNAL POSITIONING STATE OF THE PRINTER. PROCEED WITH CAUTION AND DO A PROPER G28 WHEN DONE." SET_GCODE_VARIABLE MACRO=MAYBE_HOME VARIABLE=is_kinematic_position_overriden VALUE=True {% set printable_x_max = printer["gcode_macro RatOS"].printable_x_max|float %} {% set center_x = printable_x_max / 2 %} SET_DUAL_CARRIAGE CARRIAGE=0 MODE=PRIMARY SET_KINEMATIC_POSITION X={center_x - (center_x / 2)} Y={printable_y_max / 2} Z={printer.toolhead.axis_maximum.z / 2} SET_DUAL_CARRIAGE CARRIAGE=1 MODE=PRIMARY SET_KINEMATIC_POSITION X={center_x + (center_x / 2)} Y={printable_y_max / 2} Z={printer.toolhead.axis_maximum.z / 2} SET_DUAL_CARRIAGE CARRIAGE=0 MODE=PRIMARY [gcode_macro VERIFY_HYBRID_INVERTED] gcode = {% set inverted = False %} {% if printer.configfile.settings.ratos_hybrid_corexy is defined and printer.configfile.settings.ratos_hybrid_corexy.inverted is defined %} {% if printer.configfile.settings.ratos_hybrid_corexy.inverted|lower == 'true' %} {% set inverted = True %} {% endif %} {% endif %} {% if inverted == False %} { action_emergency_stop("ratos_hybrid_corexy NOT INVERTED! Inverted hybrid core-xy bugfix not detected.") } {% endif %} [gcode_macro RATOS_ECHO] gcode = {% set prefix = "RatOS" %} {% set debug = params.DEBUG|default(0)|int %} {% if params.PREFIX is defined %} {% set prefix = prefix ~ " | " ~ params.PREFIX %} {% endif %} {% set prefix = prefix ~ ":" %} {% set msg = "" %} {% if params.MSG is defined %} {% set msg = params.MSG %} {% else %} {% set msg = "No msg parameter provided (this is a bug or unintended use)." %} {% endif %} {% if not debug %} M117 {prefix} {msg} {% endif %} RATOS_LOG PREFIX="{prefix}" MSG="{msg}" {% if not debug %} RESPOND PREFIX="{prefix}" MSG="{msg}" {% else %} CONSOLE_ECHO TITLE="{prefix}" TYPE="debug" MSG="{msg}" {% endif %} [gcode_macro ENABLE_DEBUG] gcode = SET_GCODE_VARIABLE MACRO=DEBUG_ECHO VARIABLE=enabled VALUE=True SET_GCODE_VARIABLE MACRO=DEBUG_ECHO VARIABLE=prefix_filter VALUE="'{params.FILTER|default('')|lower}'" RATOS_ECHO PREFIX="DEBUG" MSG="Debugging enabled." [gcode_macro DISABLE_DEBUG] gcode = SET_GCODE_VARIABLE MACRO=DEBUG_ECHO VARIABLE=enabled VALUE=False RATOS_ECHO PREFIX="DEBUG" MSG="Debugging disabled." [gcode_macro DEBUG_ECHO] variable_enabled = False variable_prefix_filter = '' gcode = {% set prefix = "DEBUG" %} {% if params.PREFIX is defined %} {% set prefix = prefix ~ " - " ~ params.PREFIX %} {% endif %} {% if enabled and (prefix_filter|lower == '' or prefix_filter|lower in params.PREFIX|lower) %} RATOS_ECHO PREFIX="{prefix}" MSG="{params.MSG}" DEBUG=1 {% endif %} [gcode_macro START_FEATURE] gcode = DEBUG_ECHO PREFIX="G-Code" MSG="Start {params.FEATURE} feature gcode" {% set scv = printer.toolhead.square_corner_velocity|int|default(5) %} {% set accel = printer.toolhead.max_accel|int|default(10000) %} {% set ratio = printer.toolhead.minimum_cruise_ratio|float|default(0.5) %} SET_GCODE_VARIABLE MACRO="END_FEATURE" VARIABLE="scv" VALUE={scv} SET_GCODE_VARIABLE MACRO="END_FEATURE" VARIABLE="accel" VALUE={accel} SET_GCODE_VARIABLE MACRO="END_FEATURE" VARIABLE="ratio" VALUE={ratio} _USER_START_FEATURE FEATURE="{params.FEATURE}" [gcode_macro END_FEATURE] variable_scv = 5 variable_accel = 10000 variable_ratio = 0.5 gcode = DEBUG_ECHO PREFIX="G-Code" MSG="End {params.FEATURE} feature gcode" SET_VELOCITY_LIMIT SQUARE_CORNER_VELOCITY={scv} ACCEL={accel} MINIMUM_CRUISE_RATIO={ratio} _USER_END_FEATURE FEATURE="{params.FEATURE}" SCV={scv} ACCEL={accel} RATIO={ratio} [gcode_macro _ON_LAYER_CHANGE] variable_layer_number = 0 description = INTERNAL USE ONLY. Call it from the slicers after layer change custom gcode gcode = {% set layer = params.LAYER|int %} SET_GCODE_VARIABLE MACRO=_ON_LAYER_CHANGE VARIABLE=layer_number VALUE={layer} SET_PRINT_STATS_INFO CURRENT_LAYER={layer} [gcode_macro _LEARN_MORE_CALIBRATION] gcode = {% set link_url = "https://os.ratrig.com/docs/configuration/calibration" %} {% set link_text = "RatOS Calibration Macros" %} {% set line_1 = '"Learn more about the %s"' % (link_url, link_text) %} CONSOLE_ECHO TITLE="INFO" MSG={line_1} [gcode_macro _LEARN_MORE_CHAMBER_FILTER] gcode = {% set link_url = "https://os.ratrig.com/docs/configuration/chamber_filter" %} {% set link_text = "RatOS Chamber Filter Control" %} {% set line_1 = '"Learn more about the %s"' % (link_url, link_text) %} CONSOLE_ECHO TITLE="INFO" MSG={line_1} [gcode_macro _LEARN_MORE_FILAMENT] gcode = {% set link_url = "https://os.ratrig.com/docs/configuration/filaments" %} {% set link_text = "RatOS Filament Macros" %} {% set line_1 = '"Learn more about the %s"' % (link_url, link_text) %} CONSOLE_ECHO TITLE="INFO" MSG={line_1} [gcode_macro _CONSOLE_SAVE_CONFIG] gcode = M118 Click SAVE_CONFIG to save the settings to your printer.cfg. [gcode_macro SAVE_Z_OFFSET] gcode = {% if printer.configfile.settings.beacon is defined %} _BEACON_SAVE_MULTIPLIER {% else %} Z_OFFSET_APPLY_PROBE {% endif %} [gcode_macro _LOAD_RATOS_SKEW_PROFILE] gcode = {% set ratos_skew_profile = printer["gcode_macro RatOS"].skew_profile|default("") %} {% if ratos_skew_profile != "" %} {% if printer.configfile.config["skew_correction %s" % ratos_skew_profile] is defined %} SKEW_PROFILE LOAD={ratos_skew_profile} GET_CURRENT_SKEW {% else %} {% set line_1 = '"Could not find skew profile %s!_N_Clearing skew correction."' % ratos_skew_profile %} CONSOLE_ECHO TITLE="Missing skew profile!" TYPE="warning" MSG={line_1} SET_SKEW CLEAR=1 {% endif %} {% endif %} [gcode_macro M601] gcode = PAUSE [idle_timeout] gcode = {% if printer.webhooks.state|lower == 'ready' %} {% if printer.pause_resume.is_paused|lower == 'false' %} RATOS_ECHO PREFIX="IDLE" MSG="2 hours since last activity. Powering off heaters and motors.." TURN_OFF_HEATERS M84 {% endif %} {% endif %} timeout = 7200 [temperature_sensor raspberry_pi] sensor_type = temperature_host [virtual_sdcard] path = ~/printer_data/gcodes [display_status] [pause_resume] [respond] [ratos] [mcu] serial = /tmp/klipper_host_mcu [printer] kinematics = none max_velocity = 1 max_accel = 1 [gcode_macro PAUSE] rename_existing = PAUSE_BASE gcode = RATOS_ECHO MSG="Please setup your printer through the RatOS configurator at /configure" [gcode_macro RESUME] rename_existing = RESUME_BASE gcode = RATOS_ECHO MSG="Please setup your printer through the RatOS configurator at /configure" [gcode_macro CANCEL_PRINT] rename_existing = CANCEL_BASE gcode = RATOS_ECHO MSG="Please setup your printer through the RatOS configurator at /configure" ======================= mcu 'mcu': Starting connect webhooks client 4124318640: New connection webhooks client 4124318640: Client info {'program': 'Moonraker', 'version': 'v0.9.3-0-g71f9e67'} Loaded MCU 'mcu' 119 commands (?-20240727_132503-fv-az659-741 / gcc: (Raspbian 10.2.1-6+rpi1) 10.2.1 20210110 binutils: (GNU Binutils for Raspbian) 2.35.2) MCU 'mcu' config: ADC_MAX=4095 CLOCK_FREQ=50000000 MCU=linux PCA9685_MAX=4096 PWM_MAX=32768 STATS_SUMSQ_BASE=256 Configured MCU 'mcu' (1024 moves) Config error Traceback (most recent call last): File "/home/pi/klipper/klippy/klippy.py", line 135, in _connect cb() File "/home/pi/klipper/klippy/extras/ratos.py", line 58, in _connect self.register_command_overrides() File "/home/pi/klipper/klippy/extras/ratos.py", line 86, in register_command_overrides self.register_override('TEST_RESONANCES', self.override_TEST_RESONANCES, desc=(self.desc_TEST_RESONANCES)) File "/home/pi/klipper/klippy/extras/ratos.py", line 97, in register_override raise self.printer.config_error("Existing command '%s' not found in RatOS override" % (command,)) configparser.Error: Existing command 'TEST_RESONANCES' not found in RatOS override Starting Klippy... Args: ['/home/pi/klipper/klippy/klippy.py', '/home/pi/printer_data/config/printer.cfg', '-l', '/home/pi/printer_data/logs/klippy.log', '-I', '/home/pi/printer_data/comms/klippy.serial', '-a', '/home/pi/printer_data/comms/klippy.sock'] Git version: 'v0.12.0-316-g96cceed23-dirty' Untracked files: klippy/extras/beacon.py, klippy/extras/gcode_shell_command.py, klippy/extras/linear_movement_vibrations.py, klippy/extras/ratos.py, klippy/extras/ratos_homing.py, klippy/extras/resonance_generator.py, klippy/extras/z_offset_probe.py, klippy/kinematics/ratos_hybrid_corexy.py Branch: master Remote: origin Tracked URL: https://github.com/Klipper3d/klipper.git CPU: 4 core ? Python: '3.9.2 (default, Mar 20 2025, 22:21:41) \n[GCC 10.2.1 20210110]' Start printer at Wed Oct 22 07:53:13 2025 (1761115993.8 172.8) ===== Config file ===== [gcode_macro ECHO_T_VARS] description = Echo Toolhead variables to the console. gcode = {% set t = params.T|default(0) %} RATOS_ECHO MSG="T{t} Variables" {% for var, value in printer["gcode_macro T%s" % t].items() %} {action_respond_info(var ~ ": " ~ value)} {% endfor %} [gcode_macro ECHO_RATOS_VARS] description = Echo RatOS variables to the console. gcode = {% for var, value in printer["gcode_macro RatOS"].items() %} {action_respond_info(var ~ ": " ~ value)} {% endfor %} [gcode_macro RatOS] description = RatOS variable storage macro, will echo variables to the console when run. variable_relative_extrusion = False variable_force_absolute_position = False variable_preheat_extruder = True variable_preheat_extruder_temp = 150 variable_macro_travel_speed = 150 variable_macro_travel_accel = 2000 variable_macro_z_speed = 15 variable_bed_margin_x = [0, 0] variable_bed_margin_y = [0, 0] variable_printable_x_min = 0 variable_printable_x_max = 0 variable_printable_y_min = 0 variable_printable_y_max = 0 variable_end_print_motors_off = True variable_status_color_ok = "00FF00" variable_status_color_error = "FF0000" variable_status_color_unknown = "FFFF00" variable_end_print_retract_filament = 10 gcode = ECHO_RATOS_VARS [delayed_gcode RATOS_INIT] initial_duration = 0.1 gcode = RATOS_ECHO MSG="Welcome to RatOS!" RATOS_ECHO MSG="Please setup your printer through the RatOS configurator. Use the link in the sidebar to proceed with the setup." [delayed_gcode RATOS_LOGO] initial_duration = 2 gcode = HELLO_RATOS [gcode_macro INITIAL_FRONTEND_UPDATE] gcode = {% set color_ok = printer["gcode_macro RatOS"].status_color_ok|string %} {% set color_error = printer["gcode_macro RatOS"].status_color_error|string %} {% set color_unknown = printer["gcode_macro RatOS"].status_color_unknown|string %} SET_GCODE_VARIABLE MACRO=T0 VARIABLE=color VALUE='"{color_unknown}"' {% if printer["dual_carriage"] is defined %} SET_GCODE_VARIABLE MACRO=T1 VARIABLE=color VALUE='"{color_unknown}"' {% endif %} {% set t0_sensor = "undefined" %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t0"] is defined %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t0"].enabled|lower == "true" %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t0"].filament_detected|lower == "true" %} {% set t0_sensor = "detected" %} {% else %} {% set t0_sensor = "empty" %} {% endif %} {% else %} {% set t0_sensor = "disabled" %} {% endif %} {% endif %} {% set t1_sensor = "undefined" %} {% if printer["dual_carriage"] is defined and printer["filament_switch_sensor toolhead_filament_sensor_t1"] is defined %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t1"].enabled|lower == "true" %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t1"].filament_detected|lower == "true" %} {% set t1_sensor = "detected" %} {% else %} {% set t1_sensor = "empty" %} {% endif %} {% else %} {% set t1_sensor = "disabled" %} {% endif %} {% endif %} {% set svv = printer.save_variables.variables %} {% if svv.t0_filament is defined and printer["gcode_macro T0"] is defined %} {% if printer["gcode_macro T0"].filament_name is defined and printer["gcode_macro T0"].filament_type is defined and printer["gcode_macro T0"].filament_temp is defined %} {% if t0_sensor != "empty" %} {% set t0_filament_type = svv.t0_filament[0]|default('')|string %} {% set t0_filament_name = svv.t0_filament[1]|default('')|string %} {% set t0_filament_temp = svv.t0_filament[2]|default(0)|float %} {% if t0_filament_name != '' and t0_filament_type != '' and t0_filament_temp > 0 %} SET_GCODE_VARIABLE MACRO=T0 VARIABLE=color VALUE='"{color_ok}"' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_name VALUE='"{t0_filament_name}"' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_type VALUE='"{t0_filament_type}"' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_temp VALUE={t0_filament_temp} {% endif %} {% else %} SAVE_VARIABLE VARIABLE=t0_filament VALUE="('""', '""', 0)" SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_name VALUE='""' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_type VALUE='""' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_temp VALUE=0 {% endif %} {% endif %} {% endif %} {% if svv.t1_filament is defined and printer["gcode_macro T1"] is defined %} {% if printer["gcode_macro T1"].filament_name is defined and printer["gcode_macro T1"].filament_type is defined and printer["gcode_macro T1"].filament_temp is defined %} {% if t1_sensor != "empty" %} {% set t1_filament_type = svv.t1_filament[0]|default('')|string %} {% set t1_filament_name = svv.t1_filament[1]|default('')|string %} {% set t1_filament_temp = svv.t1_filament[2]|default(0)|float %} {% if t1_filament_name != '' and t1_filament_type != '' and t1_filament_temp > 0 %} SET_GCODE_VARIABLE MACRO=T1 VARIABLE=color VALUE='"{color_ok}"' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_name VALUE='"{t1_filament_name}"' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_type VALUE='"{t1_filament_type}"' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_temp VALUE={t1_filament_temp} {% endif %} {% else %} SAVE_VARIABLE VARIABLE=t1_filament VALUE="('""', '""', 0)" SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_name VALUE='""' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_type VALUE='""' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_temp VALUE=0 {% endif %} {% endif %} {% endif %} [gcode_macro CALCULATE_PRINTABLE_AREA] gcode = {% set bed_margin_x = printer["gcode_macro RatOS"].bed_margin_x %} {% set bed_margin_y = printer["gcode_macro RatOS"].bed_margin_y %} {% set tool = 0 if printer["gcode_macro T0"] is not defined or printer["gcode_macro T0"].active else 1 %} {% set max_x = printer.toolhead.axis_maximum.x if printer["dual_carriage"] is defined and tool == 0 else printer.toolhead.axis_maximum.x - bed_margin_x[1] %} {% if printer["dual_carriage"] is defined %} {% set max_x = printer.toolhead.axis_maximum.x %} {% endif %} DEBUG_ECHO PREFIX="CALCULATE_PRINTABLE_AREA" MSG="printer.toolhead.axis_maximum.x {printer.toolhead.axis_maximum.x}" {% set max_y = printer.toolhead.axis_maximum.y - bed_margin_y[1]%} SET_GCODE_VARIABLE MACRO=RatOS VARIABLE=printable_x_max VALUE={max_x} SET_GCODE_VARIABLE MACRO=RatOS VARIABLE=printable_y_max VALUE={max_y} DEBUG_ECHO PREFIX="CALCULATE_PRINTABLE_AREA" MSG="Printable area calculated: X: 0,{max_x} Y: 0,{max_y}" [gcode_macro CACHE_TOOLHEAD_SETTINGS] variable_cache = {"global": {"accel": 1000, "ratio": 0.5, "speed": 50, "scv": 5}} gcode = {% set key = "global" %} {% if params.KEY is defined %} {% set key = params.KEY %} {% endif %} {% set dummy = cache.__setitem__(key, {"accel": printer.toolhead.max_accel, "ratio": printer.toolhead.minimum_cruise_ratio, "speed": printer.toolhead.max_velocity, "scv": printer.toolhead.square_corner_velocity}) %} SET_GCODE_VARIABLE MACRO=CACHE_TOOLHEAD_SETTINGS VARIABLE=cache VALUE="{cache | pprint | replace("\n", "") | replace("\"", "\\\"")}" DEBUG_ECHO PREFIX="CACHE_TOOLHEAD_SETTINGS" MSG="Toolhead settings cached for {key}. {printer.toolhead.max_accel} accel, {printer.toolhead.minimum_cruise_ratio} ratio, {printer.toolhead.max_velocity} velocity, {printer.toolhead.square_corner_velocity} scv." [gcode_macro RESTORE_TOOLHEAD_SETTINGS] gcode = {% set key = "global" %} {% if params.KEY is defined %} {% set key = params.KEY %} {% endif %} {% set values = printer["gcode_macro CACHE_TOOLHEAD_SETTINGS"].cache.__getitem__(key) %} {% if values is not defined or values == 'None' %} { action_raise_error("RESTORE_TOOLHEAD_SETTINGS: Toolhead settings not cached for key '" ~ key ~ "'.") } {% endif %} SET_VELOCITY_LIMIT ACCEL={values.accel} MINIMUM_CRUISE_RATIO={values.ratio} VELOCITY={values.speed} SQUARE_CORNER_VELOCITY={values.scv} DEBUG_ECHO PREFIX="RESTORE_TOOLHEAD_SETTINGS" MSG="Toolhead settings restored. {values.accel} accel, {values.ratio} ratio, {values.speed} velocity, {values.scv} scv." [gcode_macro SET_MACRO_TRAVEL_SETTINGS] gcode = {% set speed = printer["gcode_macro RatOS"].macro_travel_speed|float * 60 %} {% set accel = printer["gcode_macro RatOS"].macro_travel_accel %} SET_VELOCITY_LIMIT ACCEL={accel} MINIMUM_CRUISE_RATIO=0.5 VELOCITY={speed} SQUARE_CORNER_VELOCITY={5} DEBUG_ECHO PREFIX="SET_MACRO_TRAVEL_SETTINGS" MSG="Macro travel settings set. {accel} accel, {speed} velocity" [gcode_macro SET_CENTER_KINEMATIC_POSITION] description = FOR DEBUGGING PURPOSES ONLY. Sets the internal printer kinematic state to the center of all axes regardless of actual physical position. gcode = {% set printable_x_max = printer["gcode_macro RatOS"].printable_x_max|float %} {% set printable_y_max = printer["gcode_macro RatOS"].printable_y_max|float %} RATOS_ECHO MSG="WARNING: ONLY USE SET_CENTER_KINEMATIC_POSITION FOR DEBUGGING PURPOSES. YOU'RE OVERRIDING THE INTERNAL POSITIONING STATE OF THE PRINTER. PROCEED WITH CAUTION AND DO A PROPER G28 WHEN DONE." SET_GCODE_VARIABLE MACRO=MAYBE_HOME VARIABLE=is_kinematic_position_overriden VALUE=True {% if printer["dual_carriage"] is not defined %} SET_KINEMATIC_POSITION X={printable_x_max / 2} Y={printable_y_max / 2} Z={printer.toolhead.axis_maximum.z / 2} {% else %} IDEX_SET_CENTER_KINEMATIC_POSITION {% endif %} [gcode_macro IDEX_SET_CENTER_KINEMATIC_POSITION] description = FOR DEBUGGING PURPOSES ONLY. Sets the internal printer kinematic state to the center of all axes regardless of actual physical position. gcode = {% set printable_x_max = printer["gcode_macro RatOS"].printable_x_max|float %} {% set printable_y_max = printer["gcode_macro RatOS"].printable_y_max|float %} RATOS_ECHO MSG="WARNING: ONLY USE SET_CENTER_KINEMATIC_POSITION FOR DEBUGGING PURPOSES. YOU'RE OVERRIDING THE INTERNAL POSITIONING STATE OF THE PRINTER. PROCEED WITH CAUTION AND DO A PROPER G28 WHEN DONE." SET_GCODE_VARIABLE MACRO=MAYBE_HOME VARIABLE=is_kinematic_position_overriden VALUE=True {% set printable_x_max = printer["gcode_macro RatOS"].printable_x_max|float %} {% set center_x = printable_x_max / 2 %} SET_DUAL_CARRIAGE CARRIAGE=0 MODE=PRIMARY SET_KINEMATIC_POSITION X={center_x - (center_x / 2)} Y={printable_y_max / 2} Z={printer.toolhead.axis_maximum.z / 2} SET_DUAL_CARRIAGE CARRIAGE=1 MODE=PRIMARY SET_KINEMATIC_POSITION X={center_x + (center_x / 2)} Y={printable_y_max / 2} Z={printer.toolhead.axis_maximum.z / 2} SET_DUAL_CARRIAGE CARRIAGE=0 MODE=PRIMARY [gcode_macro VERIFY_HYBRID_INVERTED] gcode = {% set inverted = False %} {% if printer.configfile.settings.ratos_hybrid_corexy is defined and printer.configfile.settings.ratos_hybrid_corexy.inverted is defined %} {% if printer.configfile.settings.ratos_hybrid_corexy.inverted|lower == 'true' %} {% set inverted = True %} {% endif %} {% endif %} {% if inverted == False %} { action_emergency_stop("ratos_hybrid_corexy NOT INVERTED! Inverted hybrid core-xy bugfix not detected.") } {% endif %} [gcode_macro RATOS_ECHO] gcode = {% set prefix = "RatOS" %} {% set debug = params.DEBUG|default(0)|int %} {% if params.PREFIX is defined %} {% set prefix = prefix ~ " | " ~ params.PREFIX %} {% endif %} {% set prefix = prefix ~ ":" %} {% set msg = "" %} {% if params.MSG is defined %} {% set msg = params.MSG %} {% else %} {% set msg = "No msg parameter provided (this is a bug or unintended use)." %} {% endif %} {% if not debug %} M117 {prefix} {msg} {% endif %} RATOS_LOG PREFIX="{prefix}" MSG="{msg}" {% if not debug %} RESPOND PREFIX="{prefix}" MSG="{msg}" {% else %} CONSOLE_ECHO TITLE="{prefix}" TYPE="debug" MSG="{msg}" {% endif %} [gcode_macro ENABLE_DEBUG] gcode = SET_GCODE_VARIABLE MACRO=DEBUG_ECHO VARIABLE=enabled VALUE=True SET_GCODE_VARIABLE MACRO=DEBUG_ECHO VARIABLE=prefix_filter VALUE="'{params.FILTER|default('')|lower}'" RATOS_ECHO PREFIX="DEBUG" MSG="Debugging enabled." [gcode_macro DISABLE_DEBUG] gcode = SET_GCODE_VARIABLE MACRO=DEBUG_ECHO VARIABLE=enabled VALUE=False RATOS_ECHO PREFIX="DEBUG" MSG="Debugging disabled." [gcode_macro DEBUG_ECHO] variable_enabled = False variable_prefix_filter = '' gcode = {% set prefix = "DEBUG" %} {% if params.PREFIX is defined %} {% set prefix = prefix ~ " - " ~ params.PREFIX %} {% endif %} {% if enabled and (prefix_filter|lower == '' or prefix_filter|lower in params.PREFIX|lower) %} RATOS_ECHO PREFIX="{prefix}" MSG="{params.MSG}" DEBUG=1 {% endif %} [gcode_macro START_FEATURE] gcode = DEBUG_ECHO PREFIX="G-Code" MSG="Start {params.FEATURE} feature gcode" {% set scv = printer.toolhead.square_corner_velocity|int|default(5) %} {% set accel = printer.toolhead.max_accel|int|default(10000) %} {% set ratio = printer.toolhead.minimum_cruise_ratio|float|default(0.5) %} SET_GCODE_VARIABLE MACRO="END_FEATURE" VARIABLE="scv" VALUE={scv} SET_GCODE_VARIABLE MACRO="END_FEATURE" VARIABLE="accel" VALUE={accel} SET_GCODE_VARIABLE MACRO="END_FEATURE" VARIABLE="ratio" VALUE={ratio} _USER_START_FEATURE FEATURE="{params.FEATURE}" [gcode_macro END_FEATURE] variable_scv = 5 variable_accel = 10000 variable_ratio = 0.5 gcode = DEBUG_ECHO PREFIX="G-Code" MSG="End {params.FEATURE} feature gcode" SET_VELOCITY_LIMIT SQUARE_CORNER_VELOCITY={scv} ACCEL={accel} MINIMUM_CRUISE_RATIO={ratio} _USER_END_FEATURE FEATURE="{params.FEATURE}" SCV={scv} ACCEL={accel} RATIO={ratio} [gcode_macro _ON_LAYER_CHANGE] variable_layer_number = 0 description = INTERNAL USE ONLY. Call it from the slicers after layer change custom gcode gcode = {% set layer = params.LAYER|int %} SET_GCODE_VARIABLE MACRO=_ON_LAYER_CHANGE VARIABLE=layer_number VALUE={layer} SET_PRINT_STATS_INFO CURRENT_LAYER={layer} [gcode_macro _LEARN_MORE_CALIBRATION] gcode = {% set link_url = "https://os.ratrig.com/docs/configuration/calibration" %} {% set link_text = "RatOS Calibration Macros" %} {% set line_1 = '"Learn more about the %s"' % (link_url, link_text) %} CONSOLE_ECHO TITLE="INFO" MSG={line_1} [gcode_macro _LEARN_MORE_CHAMBER_FILTER] gcode = {% set link_url = "https://os.ratrig.com/docs/configuration/chamber_filter" %} {% set link_text = "RatOS Chamber Filter Control" %} {% set line_1 = '"Learn more about the %s"' % (link_url, link_text) %} CONSOLE_ECHO TITLE="INFO" MSG={line_1} [gcode_macro _LEARN_MORE_FILAMENT] gcode = {% set link_url = "https://os.ratrig.com/docs/configuration/filaments" %} {% set link_text = "RatOS Filament Macros" %} {% set line_1 = '"Learn more about the %s"' % (link_url, link_text) %} CONSOLE_ECHO TITLE="INFO" MSG={line_1} [gcode_macro _CONSOLE_SAVE_CONFIG] gcode = M118 Click SAVE_CONFIG to save the settings to your printer.cfg. [gcode_macro SAVE_Z_OFFSET] gcode = {% if printer.configfile.settings.beacon is defined %} _BEACON_SAVE_MULTIPLIER {% else %} Z_OFFSET_APPLY_PROBE {% endif %} [gcode_macro _LOAD_RATOS_SKEW_PROFILE] gcode = {% set ratos_skew_profile = printer["gcode_macro RatOS"].skew_profile|default("") %} {% if ratos_skew_profile != "" %} {% if printer.configfile.config["skew_correction %s" % ratos_skew_profile] is defined %} SKEW_PROFILE LOAD={ratos_skew_profile} GET_CURRENT_SKEW {% else %} {% set line_1 = '"Could not find skew profile %s!_N_Clearing skew correction."' % ratos_skew_profile %} CONSOLE_ECHO TITLE="Missing skew profile!" TYPE="warning" MSG={line_1} SET_SKEW CLEAR=1 {% endif %} {% endif %} [gcode_macro M601] gcode = PAUSE [idle_timeout] gcode = {% if printer.webhooks.state|lower == 'ready' %} {% if printer.pause_resume.is_paused|lower == 'false' %} RATOS_ECHO PREFIX="IDLE" MSG="2 hours since last activity. Powering off heaters and motors.." TURN_OFF_HEATERS M84 {% endif %} {% endif %} timeout = 7200 [temperature_sensor raspberry_pi] sensor_type = temperature_host [virtual_sdcard] path = ~/printer_data/gcodes [display_status] [pause_resume] [respond] [ratos] [mcu] serial = /tmp/klipper_host_mcu [printer] kinematics = none max_velocity = 1 max_accel = 1 [gcode_macro PAUSE] rename_existing = PAUSE_BASE gcode = RATOS_ECHO MSG="Please setup your printer through the RatOS configurator at /configure" [gcode_macro RESUME] rename_existing = RESUME_BASE gcode = RATOS_ECHO MSG="Please setup your printer through the RatOS configurator at /configure" [gcode_macro CANCEL_PRINT] rename_existing = CANCEL_BASE gcode = RATOS_ECHO MSG="Please setup your printer through the RatOS configurator at /configure" ======================= mcu 'mcu': Starting connect webhooks client 4123831192: New connection webhooks client 4123831192: Client info {'program': 'Moonraker', 'version': 'v0.9.3-0-g71f9e67'} Loaded MCU 'mcu' 119 commands (?-20240727_132503-fv-az659-741 / gcc: (Raspbian 10.2.1-6+rpi1) 10.2.1 20210110 binutils: (GNU Binutils for Raspbian) 2.35.2) MCU 'mcu' config: ADC_MAX=4095 CLOCK_FREQ=50000000 MCU=linux PCA9685_MAX=4096 PWM_MAX=32768 STATS_SUMSQ_BASE=256 Configured MCU 'mcu' (1024 moves) Config error Traceback (most recent call last): File "/home/pi/klipper/klippy/klippy.py", line 135, in _connect cb() File "/home/pi/klipper/klippy/extras/ratos.py", line 58, in _connect self.register_command_overrides() File "/home/pi/klipper/klippy/extras/ratos.py", line 86, in register_command_overrides self.register_override('TEST_RESONANCES', self.override_TEST_RESONANCES, desc=(self.desc_TEST_RESONANCES)) File "/home/pi/klipper/klippy/extras/ratos.py", line 97, in register_override raise self.printer.config_error("Existing command '%s' not found in RatOS override" % (command,)) configparser.Error: Existing command 'TEST_RESONANCES' not found in RatOS override Starting Klippy... Args: ['/home/pi/klipper/klippy/klippy.py', '/home/pi/printer_data/config/printer.cfg', '-l', '/home/pi/printer_data/logs/klippy.log', '-I', '/home/pi/printer_data/comms/klippy.serial', '-a', '/home/pi/printer_data/comms/klippy.sock'] Git version: 'v0.12.0-316-g96cceed23-dirty' Untracked files: klippy/extras/beacon.py, klippy/extras/gcode_shell_command.py, klippy/extras/linear_movement_vibrations.py, klippy/extras/ratos.py, klippy/extras/ratos_homing.py, klippy/extras/resonance_generator.py, klippy/extras/z_offset_probe.py, klippy/kinematics/ratos_hybrid_corexy.py Branch: master Remote: origin Tracked URL: https://github.com/Klipper3d/klipper.git CPU: 4 core ? Python: '3.9.2 (default, Mar 20 2025, 22:21:41) \n[GCC 10.2.1 20210110]' Start printer at Wed Oct 22 07:59:42 2025 (1761116382.2 561.3) ===== Config file ===== [gcode_macro ECHO_T_VARS] description = Echo Toolhead variables to the console. gcode = {% set t = params.T|default(0) %} RATOS_ECHO MSG="T{t} Variables" {% for var, value in printer["gcode_macro T%s" % t].items() %} {action_respond_info(var ~ ": " ~ value)} {% endfor %} [gcode_macro ECHO_RATOS_VARS] description = Echo RatOS variables to the console. gcode = {% for var, value in printer["gcode_macro RatOS"].items() %} {action_respond_info(var ~ ": " ~ value)} {% endfor %} [gcode_macro RatOS] description = RatOS variable storage macro, will echo variables to the console when run. variable_relative_extrusion = False variable_force_absolute_position = False variable_preheat_extruder = True variable_preheat_extruder_temp = 150 variable_macro_travel_speed = 150 variable_macro_travel_accel = 2000 variable_macro_z_speed = 15 variable_bed_margin_x = [0, 0] variable_bed_margin_y = [0, 0] variable_printable_x_min = 0 variable_printable_x_max = 0 variable_printable_y_min = 0 variable_printable_y_max = 0 variable_end_print_motors_off = True variable_status_color_ok = "00FF00" variable_status_color_error = "FF0000" variable_status_color_unknown = "FFFF00" variable_end_print_retract_filament = 10 gcode = ECHO_RATOS_VARS [delayed_gcode RATOS_INIT] initial_duration = 0.1 gcode = RATOS_ECHO MSG="Welcome to RatOS!" RATOS_ECHO MSG="Please setup your printer through the RatOS configurator. Use the link in the sidebar to proceed with the setup." [delayed_gcode RATOS_LOGO] initial_duration = 2 gcode = HELLO_RATOS [gcode_macro INITIAL_FRONTEND_UPDATE] gcode = {% set color_ok = printer["gcode_macro RatOS"].status_color_ok|string %} {% set color_error = printer["gcode_macro RatOS"].status_color_error|string %} {% set color_unknown = printer["gcode_macro RatOS"].status_color_unknown|string %} SET_GCODE_VARIABLE MACRO=T0 VARIABLE=color VALUE='"{color_unknown}"' {% if printer["dual_carriage"] is defined %} SET_GCODE_VARIABLE MACRO=T1 VARIABLE=color VALUE='"{color_unknown}"' {% endif %} {% set t0_sensor = "undefined" %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t0"] is defined %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t0"].enabled|lower == "true" %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t0"].filament_detected|lower == "true" %} {% set t0_sensor = "detected" %} {% else %} {% set t0_sensor = "empty" %} {% endif %} {% else %} {% set t0_sensor = "disabled" %} {% endif %} {% endif %} {% set t1_sensor = "undefined" %} {% if printer["dual_carriage"] is defined and printer["filament_switch_sensor toolhead_filament_sensor_t1"] is defined %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t1"].enabled|lower == "true" %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t1"].filament_detected|lower == "true" %} {% set t1_sensor = "detected" %} {% else %} {% set t1_sensor = "empty" %} {% endif %} {% else %} {% set t1_sensor = "disabled" %} {% endif %} {% endif %} {% set svv = printer.save_variables.variables %} {% if svv.t0_filament is defined and printer["gcode_macro T0"] is defined %} {% if printer["gcode_macro T0"].filament_name is defined and printer["gcode_macro T0"].filament_type is defined and printer["gcode_macro T0"].filament_temp is defined %} {% if t0_sensor != "empty" %} {% set t0_filament_type = svv.t0_filament[0]|default('')|string %} {% set t0_filament_name = svv.t0_filament[1]|default('')|string %} {% set t0_filament_temp = svv.t0_filament[2]|default(0)|float %} {% if t0_filament_name != '' and t0_filament_type != '' and t0_filament_temp > 0 %} SET_GCODE_VARIABLE MACRO=T0 VARIABLE=color VALUE='"{color_ok}"' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_name VALUE='"{t0_filament_name}"' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_type VALUE='"{t0_filament_type}"' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_temp VALUE={t0_filament_temp} {% endif %} {% else %} SAVE_VARIABLE VARIABLE=t0_filament VALUE="('""', '""', 0)" SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_name VALUE='""' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_type VALUE='""' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_temp VALUE=0 {% endif %} {% endif %} {% endif %} {% if svv.t1_filament is defined and printer["gcode_macro T1"] is defined %} {% if printer["gcode_macro T1"].filament_name is defined and printer["gcode_macro T1"].filament_type is defined and printer["gcode_macro T1"].filament_temp is defined %} {% if t1_sensor != "empty" %} {% set t1_filament_type = svv.t1_filament[0]|default('')|string %} {% set t1_filament_name = svv.t1_filament[1]|default('')|string %} {% set t1_filament_temp = svv.t1_filament[2]|default(0)|float %} {% if t1_filament_name != '' and t1_filament_type != '' and t1_filament_temp > 0 %} SET_GCODE_VARIABLE MACRO=T1 VARIABLE=color VALUE='"{color_ok}"' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_name VALUE='"{t1_filament_name}"' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_type VALUE='"{t1_filament_type}"' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_temp VALUE={t1_filament_temp} {% endif %} {% else %} SAVE_VARIABLE VARIABLE=t1_filament VALUE="('""', '""', 0)" SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_name VALUE='""' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_type VALUE='""' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_temp VALUE=0 {% endif %} {% endif %} {% endif %} [gcode_macro CALCULATE_PRINTABLE_AREA] gcode = {% set bed_margin_x = printer["gcode_macro RatOS"].bed_margin_x %} {% set bed_margin_y = printer["gcode_macro RatOS"].bed_margin_y %} {% set tool = 0 if printer["gcode_macro T0"] is not defined or printer["gcode_macro T0"].active else 1 %} {% set max_x = printer.toolhead.axis_maximum.x if printer["dual_carriage"] is defined and tool == 0 else printer.toolhead.axis_maximum.x - bed_margin_x[1] %} {% if printer["dual_carriage"] is defined %} {% set max_x = printer.toolhead.axis_maximum.x %} {% endif %} DEBUG_ECHO PREFIX="CALCULATE_PRINTABLE_AREA" MSG="printer.toolhead.axis_maximum.x {printer.toolhead.axis_maximum.x}" {% set max_y = printer.toolhead.axis_maximum.y - bed_margin_y[1]%} SET_GCODE_VARIABLE MACRO=RatOS VARIABLE=printable_x_max VALUE={max_x} SET_GCODE_VARIABLE MACRO=RatOS VARIABLE=printable_y_max VALUE={max_y} DEBUG_ECHO PREFIX="CALCULATE_PRINTABLE_AREA" MSG="Printable area calculated: X: 0,{max_x} Y: 0,{max_y}" [gcode_macro CACHE_TOOLHEAD_SETTINGS] variable_cache = {"global": {"accel": 1000, "ratio": 0.5, "speed": 50, "scv": 5}} gcode = {% set key = "global" %} {% if params.KEY is defined %} {% set key = params.KEY %} {% endif %} {% set dummy = cache.__setitem__(key, {"accel": printer.toolhead.max_accel, "ratio": printer.toolhead.minimum_cruise_ratio, "speed": printer.toolhead.max_velocity, "scv": printer.toolhead.square_corner_velocity}) %} SET_GCODE_VARIABLE MACRO=CACHE_TOOLHEAD_SETTINGS VARIABLE=cache VALUE="{cache | pprint | replace("\n", "") | replace("\"", "\\\"")}" DEBUG_ECHO PREFIX="CACHE_TOOLHEAD_SETTINGS" MSG="Toolhead settings cached for {key}. {printer.toolhead.max_accel} accel, {printer.toolhead.minimum_cruise_ratio} ratio, {printer.toolhead.max_velocity} velocity, {printer.toolhead.square_corner_velocity} scv." [gcode_macro RESTORE_TOOLHEAD_SETTINGS] gcode = {% set key = "global" %} {% if params.KEY is defined %} {% set key = params.KEY %} {% endif %} {% set values = printer["gcode_macro CACHE_TOOLHEAD_SETTINGS"].cache.__getitem__(key) %} {% if values is not defined or values == 'None' %} { action_raise_error("RESTORE_TOOLHEAD_SETTINGS: Toolhead settings not cached for key '" ~ key ~ "'.") } {% endif %} SET_VELOCITY_LIMIT ACCEL={values.accel} MINIMUM_CRUISE_RATIO={values.ratio} VELOCITY={values.speed} SQUARE_CORNER_VELOCITY={values.scv} DEBUG_ECHO PREFIX="RESTORE_TOOLHEAD_SETTINGS" MSG="Toolhead settings restored. {values.accel} accel, {values.ratio} ratio, {values.speed} velocity, {values.scv} scv." [gcode_macro SET_MACRO_TRAVEL_SETTINGS] gcode = {% set speed = printer["gcode_macro RatOS"].macro_travel_speed|float * 60 %} {% set accel = printer["gcode_macro RatOS"].macro_travel_accel %} SET_VELOCITY_LIMIT ACCEL={accel} MINIMUM_CRUISE_RATIO=0.5 VELOCITY={speed} SQUARE_CORNER_VELOCITY={5} DEBUG_ECHO PREFIX="SET_MACRO_TRAVEL_SETTINGS" MSG="Macro travel settings set. {accel} accel, {speed} velocity" [gcode_macro SET_CENTER_KINEMATIC_POSITION] description = FOR DEBUGGING PURPOSES ONLY. Sets the internal printer kinematic state to the center of all axes regardless of actual physical position. gcode = {% set printable_x_max = printer["gcode_macro RatOS"].printable_x_max|float %} {% set printable_y_max = printer["gcode_macro RatOS"].printable_y_max|float %} RATOS_ECHO MSG="WARNING: ONLY USE SET_CENTER_KINEMATIC_POSITION FOR DEBUGGING PURPOSES. YOU'RE OVERRIDING THE INTERNAL POSITIONING STATE OF THE PRINTER. PROCEED WITH CAUTION AND DO A PROPER G28 WHEN DONE." SET_GCODE_VARIABLE MACRO=MAYBE_HOME VARIABLE=is_kinematic_position_overriden VALUE=True {% if printer["dual_carriage"] is not defined %} SET_KINEMATIC_POSITION X={printable_x_max / 2} Y={printable_y_max / 2} Z={printer.toolhead.axis_maximum.z / 2} {% else %} IDEX_SET_CENTER_KINEMATIC_POSITION {% endif %} [gcode_macro IDEX_SET_CENTER_KINEMATIC_POSITION] description = FOR DEBUGGING PURPOSES ONLY. Sets the internal printer kinematic state to the center of all axes regardless of actual physical position. gcode = {% set printable_x_max = printer["gcode_macro RatOS"].printable_x_max|float %} {% set printable_y_max = printer["gcode_macro RatOS"].printable_y_max|float %} RATOS_ECHO MSG="WARNING: ONLY USE SET_CENTER_KINEMATIC_POSITION FOR DEBUGGING PURPOSES. YOU'RE OVERRIDING THE INTERNAL POSITIONING STATE OF THE PRINTER. PROCEED WITH CAUTION AND DO A PROPER G28 WHEN DONE." SET_GCODE_VARIABLE MACRO=MAYBE_HOME VARIABLE=is_kinematic_position_overriden VALUE=True {% set printable_x_max = printer["gcode_macro RatOS"].printable_x_max|float %} {% set center_x = printable_x_max / 2 %} SET_DUAL_CARRIAGE CARRIAGE=0 MODE=PRIMARY SET_KINEMATIC_POSITION X={center_x - (center_x / 2)} Y={printable_y_max / 2} Z={printer.toolhead.axis_maximum.z / 2} SET_DUAL_CARRIAGE CARRIAGE=1 MODE=PRIMARY SET_KINEMATIC_POSITION X={center_x + (center_x / 2)} Y={printable_y_max / 2} Z={printer.toolhead.axis_maximum.z / 2} SET_DUAL_CARRIAGE CARRIAGE=0 MODE=PRIMARY [gcode_macro VERIFY_HYBRID_INVERTED] gcode = {% set inverted = False %} {% if printer.configfile.settings.ratos_hybrid_corexy is defined and printer.configfile.settings.ratos_hybrid_corexy.inverted is defined %} {% if printer.configfile.settings.ratos_hybrid_corexy.inverted|lower == 'true' %} {% set inverted = True %} {% endif %} {% endif %} {% if inverted == False %} { action_emergency_stop("ratos_hybrid_corexy NOT INVERTED! Inverted hybrid core-xy bugfix not detected.") } {% endif %} [gcode_macro RATOS_ECHO] gcode = {% set prefix = "RatOS" %} {% set debug = params.DEBUG|default(0)|int %} {% if params.PREFIX is defined %} {% set prefix = prefix ~ " | " ~ params.PREFIX %} {% endif %} {% set prefix = prefix ~ ":" %} {% set msg = "" %} {% if params.MSG is defined %} {% set msg = params.MSG %} {% else %} {% set msg = "No msg parameter provided (this is a bug or unintended use)." %} {% endif %} {% if not debug %} M117 {prefix} {msg} {% endif %} RATOS_LOG PREFIX="{prefix}" MSG="{msg}" {% if not debug %} RESPOND PREFIX="{prefix}" MSG="{msg}" {% else %} CONSOLE_ECHO TITLE="{prefix}" TYPE="debug" MSG="{msg}" {% endif %} [gcode_macro ENABLE_DEBUG] gcode = SET_GCODE_VARIABLE MACRO=DEBUG_ECHO VARIABLE=enabled VALUE=True SET_GCODE_VARIABLE MACRO=DEBUG_ECHO VARIABLE=prefix_filter VALUE="'{params.FILTER|default('')|lower}'" RATOS_ECHO PREFIX="DEBUG" MSG="Debugging enabled." [gcode_macro DISABLE_DEBUG] gcode = SET_GCODE_VARIABLE MACRO=DEBUG_ECHO VARIABLE=enabled VALUE=False RATOS_ECHO PREFIX="DEBUG" MSG="Debugging disabled." [gcode_macro DEBUG_ECHO] variable_enabled = False variable_prefix_filter = '' gcode = {% set prefix = "DEBUG" %} {% if params.PREFIX is defined %} {% set prefix = prefix ~ " - " ~ params.PREFIX %} {% endif %} {% if enabled and (prefix_filter|lower == '' or prefix_filter|lower in params.PREFIX|lower) %} RATOS_ECHO PREFIX="{prefix}" MSG="{params.MSG}" DEBUG=1 {% endif %} [gcode_macro START_FEATURE] gcode = DEBUG_ECHO PREFIX="G-Code" MSG="Start {params.FEATURE} feature gcode" {% set scv = printer.toolhead.square_corner_velocity|int|default(5) %} {% set accel = printer.toolhead.max_accel|int|default(10000) %} {% set ratio = printer.toolhead.minimum_cruise_ratio|float|default(0.5) %} SET_GCODE_VARIABLE MACRO="END_FEATURE" VARIABLE="scv" VALUE={scv} SET_GCODE_VARIABLE MACRO="END_FEATURE" VARIABLE="accel" VALUE={accel} SET_GCODE_VARIABLE MACRO="END_FEATURE" VARIABLE="ratio" VALUE={ratio} _USER_START_FEATURE FEATURE="{params.FEATURE}" [gcode_macro END_FEATURE] variable_scv = 5 variable_accel = 10000 variable_ratio = 0.5 gcode = DEBUG_ECHO PREFIX="G-Code" MSG="End {params.FEATURE} feature gcode" SET_VELOCITY_LIMIT SQUARE_CORNER_VELOCITY={scv} ACCEL={accel} MINIMUM_CRUISE_RATIO={ratio} _USER_END_FEATURE FEATURE="{params.FEATURE}" SCV={scv} ACCEL={accel} RATIO={ratio} [gcode_macro _ON_LAYER_CHANGE] variable_layer_number = 0 description = INTERNAL USE ONLY. Call it from the slicers after layer change custom gcode gcode = {% set layer = params.LAYER|int %} SET_GCODE_VARIABLE MACRO=_ON_LAYER_CHANGE VARIABLE=layer_number VALUE={layer} SET_PRINT_STATS_INFO CURRENT_LAYER={layer} [gcode_macro _LEARN_MORE_CALIBRATION] gcode = {% set link_url = "https://os.ratrig.com/docs/configuration/calibration" %} {% set link_text = "RatOS Calibration Macros" %} {% set line_1 = '"Learn more about the %s"' % (link_url, link_text) %} CONSOLE_ECHO TITLE="INFO" MSG={line_1} [gcode_macro _LEARN_MORE_CHAMBER_FILTER] gcode = {% set link_url = "https://os.ratrig.com/docs/configuration/chamber_filter" %} {% set link_text = "RatOS Chamber Filter Control" %} {% set line_1 = '"Learn more about the %s"' % (link_url, link_text) %} CONSOLE_ECHO TITLE="INFO" MSG={line_1} [gcode_macro _LEARN_MORE_FILAMENT] gcode = {% set link_url = "https://os.ratrig.com/docs/configuration/filaments" %} {% set link_text = "RatOS Filament Macros" %} {% set line_1 = '"Learn more about the %s"' % (link_url, link_text) %} CONSOLE_ECHO TITLE="INFO" MSG={line_1} [gcode_macro _CONSOLE_SAVE_CONFIG] gcode = M118 Click SAVE_CONFIG to save the settings to your printer.cfg. [gcode_macro SAVE_Z_OFFSET] gcode = {% if printer.configfile.settings.beacon is defined %} _BEACON_SAVE_MULTIPLIER {% else %} Z_OFFSET_APPLY_PROBE {% endif %} [gcode_macro _LOAD_RATOS_SKEW_PROFILE] gcode = {% set ratos_skew_profile = printer["gcode_macro RatOS"].skew_profile|default("") %} {% if ratos_skew_profile != "" %} {% if printer.configfile.config["skew_correction %s" % ratos_skew_profile] is defined %} SKEW_PROFILE LOAD={ratos_skew_profile} GET_CURRENT_SKEW {% else %} {% set line_1 = '"Could not find skew profile %s!_N_Clearing skew correction."' % ratos_skew_profile %} CONSOLE_ECHO TITLE="Missing skew profile!" TYPE="warning" MSG={line_1} SET_SKEW CLEAR=1 {% endif %} {% endif %} [gcode_macro M601] gcode = PAUSE [idle_timeout] gcode = {% if printer.webhooks.state|lower == 'ready' %} {% if printer.pause_resume.is_paused|lower == 'false' %} RATOS_ECHO PREFIX="IDLE" MSG="2 hours since last activity. Powering off heaters and motors.." TURN_OFF_HEATERS M84 {% endif %} {% endif %} timeout = 7200 [temperature_sensor raspberry_pi] sensor_type = temperature_host [virtual_sdcard] path = ~/printer_data/gcodes [display_status] [pause_resume] [respond] [ratos] [mcu] serial = /tmp/klipper_host_mcu [printer] kinematics = none max_velocity = 1 max_accel = 1 [gcode_macro PAUSE] rename_existing = PAUSE_BASE gcode = RATOS_ECHO MSG="Please setup your printer through the RatOS configurator at /configure" [gcode_macro RESUME] rename_existing = RESUME_BASE gcode = RATOS_ECHO MSG="Please setup your printer through the RatOS configurator at /configure" [gcode_macro CANCEL_PRINT] rename_existing = CANCEL_BASE gcode = RATOS_ECHO MSG="Please setup your printer through the RatOS configurator at /configure" ======================= mcu 'mcu': Starting connect webhooks client 4123270088: New connection webhooks client 4123270088: Client info {'program': 'Moonraker', 'version': 'v0.9.3-0-g71f9e67'} Loaded MCU 'mcu' 119 commands (?-20240727_132503-fv-az659-741 / gcc: (Raspbian 10.2.1-6+rpi1) 10.2.1 20210110 binutils: (GNU Binutils for Raspbian) 2.35.2) MCU 'mcu' config: ADC_MAX=4095 CLOCK_FREQ=50000000 MCU=linux PCA9685_MAX=4096 PWM_MAX=32768 STATS_SUMSQ_BASE=256 Configured MCU 'mcu' (1024 moves) Config error Traceback (most recent call last): File "/home/pi/klipper/klippy/klippy.py", line 135, in _connect cb() File "/home/pi/klipper/klippy/extras/ratos.py", line 58, in _connect self.register_command_overrides() File "/home/pi/klipper/klippy/extras/ratos.py", line 86, in register_command_overrides self.register_override('TEST_RESONANCES', self.override_TEST_RESONANCES, desc=(self.desc_TEST_RESONANCES)) File "/home/pi/klipper/klippy/extras/ratos.py", line 97, in register_override raise self.printer.config_error("Existing command '%s' not found in RatOS override" % (command,)) configparser.Error: Existing command 'TEST_RESONANCES' not found in RatOS override Starting Klippy... Args: ['/home/pi/klipper/klippy/klippy.py', '/home/pi/printer_data/config/printer.cfg', '-l', '/home/pi/printer_data/logs/klippy.log', '-I', '/home/pi/printer_data/comms/klippy.serial', '-a', '/home/pi/printer_data/comms/klippy.sock'] Git version: 'v0.12.0-396-gb7233d119-dirty' Untracked files: klippy/extras/beacon.py, klippy/extras/gcode_shell_command.py, klippy/extras/linear_movement_vibrations.py, klippy/extras/ratos.py, klippy/extras/ratos_homing.py, klippy/extras/resonance_generator.py, klippy/extras/z_offset_probe.py, klippy/kinematics/ratos_hybrid_corexy.py Branch: master Remote: origin Tracked URL: https://github.com/Klipper3d/klipper.git CPU: 4 core ? Python: '3.9.2 (default, Mar 20 2025, 22:21:41) \n[GCC 10.2.1 20210110]' Start printer at Wed Oct 22 08:04:49 2025 (1761116689.8 868.9) ===== Config file ===== [gcode_macro ECHO_T_VARS] description = Echo Toolhead variables to the console. gcode = {% set t = params.T|default(0) %} RATOS_ECHO MSG="T{t} Variables" {% for var, value in printer["gcode_macro T%s" % t].items() %} {action_respond_info(var ~ ": " ~ value)} {% endfor %} [gcode_macro ECHO_RATOS_VARS] description = Echo RatOS variables to the console. gcode = {% for var, value in printer["gcode_macro RatOS"].items() %} {action_respond_info(var ~ ": " ~ value)} {% endfor %} [gcode_macro RatOS] description = RatOS variable storage macro, will echo variables to the console when run. variable_relative_extrusion = False variable_force_absolute_position = False variable_preheat_extruder = True variable_preheat_extruder_temp = 150 variable_macro_travel_speed = 150 variable_macro_travel_accel = 2000 variable_macro_z_speed = 15 variable_bed_margin_x = [0, 0] variable_bed_margin_y = [0, 0] variable_printable_x_min = 0 variable_printable_x_max = 0 variable_printable_y_min = 0 variable_printable_y_max = 0 variable_end_print_motors_off = True variable_status_color_ok = "00FF00" variable_status_color_error = "FF0000" variable_status_color_unknown = "FFFF00" variable_end_print_retract_filament = 10 gcode = ECHO_RATOS_VARS [delayed_gcode RATOS_INIT] initial_duration = 0.1 gcode = RATOS_ECHO MSG="Welcome to RatOS!" RATOS_ECHO MSG="Please setup your printer through the RatOS configurator. Use the link in the sidebar to proceed with the setup." [delayed_gcode RATOS_LOGO] initial_duration = 2 gcode = HELLO_RATOS [gcode_macro INITIAL_FRONTEND_UPDATE] gcode = {% set color_ok = printer["gcode_macro RatOS"].status_color_ok|string %} {% set color_error = printer["gcode_macro RatOS"].status_color_error|string %} {% set color_unknown = printer["gcode_macro RatOS"].status_color_unknown|string %} SET_GCODE_VARIABLE MACRO=T0 VARIABLE=color VALUE='"{color_unknown}"' {% if printer["dual_carriage"] is defined %} SET_GCODE_VARIABLE MACRO=T1 VARIABLE=color VALUE='"{color_unknown}"' {% endif %} {% set t0_sensor = "undefined" %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t0"] is defined %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t0"].enabled|lower == "true" %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t0"].filament_detected|lower == "true" %} {% set t0_sensor = "detected" %} {% else %} {% set t0_sensor = "empty" %} {% endif %} {% else %} {% set t0_sensor = "disabled" %} {% endif %} {% endif %} {% set t1_sensor = "undefined" %} {% if printer["dual_carriage"] is defined and printer["filament_switch_sensor toolhead_filament_sensor_t1"] is defined %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t1"].enabled|lower == "true" %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t1"].filament_detected|lower == "true" %} {% set t1_sensor = "detected" %} {% else %} {% set t1_sensor = "empty" %} {% endif %} {% else %} {% set t1_sensor = "disabled" %} {% endif %} {% endif %} {% set svv = printer.save_variables.variables %} {% if svv.t0_filament is defined and printer["gcode_macro T0"] is defined %} {% if printer["gcode_macro T0"].filament_name is defined and printer["gcode_macro T0"].filament_type is defined and printer["gcode_macro T0"].filament_temp is defined %} {% if t0_sensor != "empty" %} {% set t0_filament_type = svv.t0_filament[0]|default('')|string %} {% set t0_filament_name = svv.t0_filament[1]|default('')|string %} {% set t0_filament_temp = svv.t0_filament[2]|default(0)|float %} {% if t0_filament_name != '' and t0_filament_type != '' and t0_filament_temp > 0 %} SET_GCODE_VARIABLE MACRO=T0 VARIABLE=color VALUE='"{color_ok}"' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_name VALUE='"{t0_filament_name}"' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_type VALUE='"{t0_filament_type}"' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_temp VALUE={t0_filament_temp} {% endif %} {% else %} SAVE_VARIABLE VARIABLE=t0_filament VALUE="('""', '""', 0)" SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_name VALUE='""' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_type VALUE='""' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_temp VALUE=0 {% endif %} {% endif %} {% endif %} {% if svv.t1_filament is defined and printer["gcode_macro T1"] is defined %} {% if printer["gcode_macro T1"].filament_name is defined and printer["gcode_macro T1"].filament_type is defined and printer["gcode_macro T1"].filament_temp is defined %} {% if t1_sensor != "empty" %} {% set t1_filament_type = svv.t1_filament[0]|default('')|string %} {% set t1_filament_name = svv.t1_filament[1]|default('')|string %} {% set t1_filament_temp = svv.t1_filament[2]|default(0)|float %} {% if t1_filament_name != '' and t1_filament_type != '' and t1_filament_temp > 0 %} SET_GCODE_VARIABLE MACRO=T1 VARIABLE=color VALUE='"{color_ok}"' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_name VALUE='"{t1_filament_name}"' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_type VALUE='"{t1_filament_type}"' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_temp VALUE={t1_filament_temp} {% endif %} {% else %} SAVE_VARIABLE VARIABLE=t1_filament VALUE="('""', '""', 0)" SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_name VALUE='""' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_type VALUE='""' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_temp VALUE=0 {% endif %} {% endif %} {% endif %} [gcode_macro CALCULATE_PRINTABLE_AREA] gcode = {% set bed_margin_x = printer["gcode_macro RatOS"].bed_margin_x %} {% set bed_margin_y = printer["gcode_macro RatOS"].bed_margin_y %} {% set tool = 0 if printer["gcode_macro T0"] is not defined or printer["gcode_macro T0"].active else 1 %} {% set max_x = printer.toolhead.axis_maximum.x if printer["dual_carriage"] is defined and tool == 0 else printer.toolhead.axis_maximum.x - bed_margin_x[1] %} {% if printer["dual_carriage"] is defined %} {% set max_x = printer.toolhead.axis_maximum.x %} {% endif %} DEBUG_ECHO PREFIX="CALCULATE_PRINTABLE_AREA" MSG="printer.toolhead.axis_maximum.x {printer.toolhead.axis_maximum.x}" {% set max_y = printer.toolhead.axis_maximum.y - bed_margin_y[1]%} SET_GCODE_VARIABLE MACRO=RatOS VARIABLE=printable_x_max VALUE={max_x} SET_GCODE_VARIABLE MACRO=RatOS VARIABLE=printable_y_max VALUE={max_y} DEBUG_ECHO PREFIX="CALCULATE_PRINTABLE_AREA" MSG="Printable area calculated: X: 0,{max_x} Y: 0,{max_y}" [gcode_macro CACHE_TOOLHEAD_SETTINGS] variable_cache = {"global": {"accel": 1000, "ratio": 0.5, "speed": 50, "scv": 5}} gcode = {% set key = "global" %} {% if params.KEY is defined %} {% set key = params.KEY %} {% endif %} {% set dummy = cache.__setitem__(key, {"accel": printer.toolhead.max_accel, "ratio": printer.toolhead.minimum_cruise_ratio, "speed": printer.toolhead.max_velocity, "scv": printer.toolhead.square_corner_velocity}) %} SET_GCODE_VARIABLE MACRO=CACHE_TOOLHEAD_SETTINGS VARIABLE=cache VALUE="{cache | pprint | replace("\n", "") | replace("\"", "\\\"")}" DEBUG_ECHO PREFIX="CACHE_TOOLHEAD_SETTINGS" MSG="Toolhead settings cached for {key}. {printer.toolhead.max_accel} accel, {printer.toolhead.minimum_cruise_ratio} ratio, {printer.toolhead.max_velocity} velocity, {printer.toolhead.square_corner_velocity} scv." [gcode_macro RESTORE_TOOLHEAD_SETTINGS] gcode = {% set key = "global" %} {% if params.KEY is defined %} {% set key = params.KEY %} {% endif %} {% set values = printer["gcode_macro CACHE_TOOLHEAD_SETTINGS"].cache.__getitem__(key) %} {% if values is not defined or values == 'None' %} { action_raise_error("RESTORE_TOOLHEAD_SETTINGS: Toolhead settings not cached for key '" ~ key ~ "'.") } {% endif %} SET_VELOCITY_LIMIT ACCEL={values.accel} MINIMUM_CRUISE_RATIO={values.ratio} VELOCITY={values.speed} SQUARE_CORNER_VELOCITY={values.scv} DEBUG_ECHO PREFIX="RESTORE_TOOLHEAD_SETTINGS" MSG="Toolhead settings restored. {values.accel} accel, {values.ratio} ratio, {values.speed} velocity, {values.scv} scv." [gcode_macro SET_MACRO_TRAVEL_SETTINGS] gcode = {% set speed = printer["gcode_macro RatOS"].macro_travel_speed|float * 60 %} {% set accel = printer["gcode_macro RatOS"].macro_travel_accel %} SET_VELOCITY_LIMIT ACCEL={accel} MINIMUM_CRUISE_RATIO=0.5 VELOCITY={speed} SQUARE_CORNER_VELOCITY={5} DEBUG_ECHO PREFIX="SET_MACRO_TRAVEL_SETTINGS" MSG="Macro travel settings set. {accel} accel, {speed} velocity" [gcode_macro SET_CENTER_KINEMATIC_POSITION] description = FOR DEBUGGING PURPOSES ONLY. Sets the internal printer kinematic state to the center of all axes regardless of actual physical position. gcode = {% set printable_x_max = printer["gcode_macro RatOS"].printable_x_max|float %} {% set printable_y_max = printer["gcode_macro RatOS"].printable_y_max|float %} RATOS_ECHO MSG="WARNING: ONLY USE SET_CENTER_KINEMATIC_POSITION FOR DEBUGGING PURPOSES. YOU'RE OVERRIDING THE INTERNAL POSITIONING STATE OF THE PRINTER. PROCEED WITH CAUTION AND DO A PROPER G28 WHEN DONE." SET_GCODE_VARIABLE MACRO=MAYBE_HOME VARIABLE=is_kinematic_position_overriden VALUE=True {% if printer["dual_carriage"] is not defined %} SET_KINEMATIC_POSITION X={printable_x_max / 2} Y={printable_y_max / 2} Z={printer.toolhead.axis_maximum.z / 2} {% else %} IDEX_SET_CENTER_KINEMATIC_POSITION {% endif %} [gcode_macro IDEX_SET_CENTER_KINEMATIC_POSITION] description = FOR DEBUGGING PURPOSES ONLY. Sets the internal printer kinematic state to the center of all axes regardless of actual physical position. gcode = {% set printable_x_max = printer["gcode_macro RatOS"].printable_x_max|float %} {% set printable_y_max = printer["gcode_macro RatOS"].printable_y_max|float %} RATOS_ECHO MSG="WARNING: ONLY USE SET_CENTER_KINEMATIC_POSITION FOR DEBUGGING PURPOSES. YOU'RE OVERRIDING THE INTERNAL POSITIONING STATE OF THE PRINTER. PROCEED WITH CAUTION AND DO A PROPER G28 WHEN DONE." SET_GCODE_VARIABLE MACRO=MAYBE_HOME VARIABLE=is_kinematic_position_overriden VALUE=True {% set printable_x_max = printer["gcode_macro RatOS"].printable_x_max|float %} {% set center_x = printable_x_max / 2 %} SET_DUAL_CARRIAGE CARRIAGE=0 MODE=PRIMARY SET_KINEMATIC_POSITION X={center_x - (center_x / 2)} Y={printable_y_max / 2} Z={printer.toolhead.axis_maximum.z / 2} SET_DUAL_CARRIAGE CARRIAGE=1 MODE=PRIMARY SET_KINEMATIC_POSITION X={center_x + (center_x / 2)} Y={printable_y_max / 2} Z={printer.toolhead.axis_maximum.z / 2} SET_DUAL_CARRIAGE CARRIAGE=0 MODE=PRIMARY [gcode_macro VERIFY_HYBRID_INVERTED] gcode = {% set inverted = False %} {% if printer.configfile.settings.ratos_hybrid_corexy is defined and printer.configfile.settings.ratos_hybrid_corexy.inverted is defined %} {% if printer.configfile.settings.ratos_hybrid_corexy.inverted|lower == 'true' %} {% set inverted = True %} {% endif %} {% endif %} {% if inverted == False %} { action_emergency_stop("ratos_hybrid_corexy NOT INVERTED! Inverted hybrid core-xy bugfix not detected.") } {% endif %} [gcode_macro RATOS_ECHO] gcode = {% set prefix = "RatOS" %} {% set debug = params.DEBUG|default(0)|int %} {% if params.PREFIX is defined %} {% set prefix = prefix ~ " | " ~ params.PREFIX %} {% endif %} {% set prefix = prefix ~ ":" %} {% set msg = "" %} {% if params.MSG is defined %} {% set msg = params.MSG %} {% else %} {% set msg = "No msg parameter provided (this is a bug or unintended use)." %} {% endif %} {% if not debug %} M117 {prefix} {msg} {% endif %} RATOS_LOG PREFIX="{prefix}" MSG="{msg}" {% if not debug %} RESPOND PREFIX="{prefix}" MSG="{msg}" {% else %} CONSOLE_ECHO TITLE="{prefix}" TYPE="debug" MSG="{msg}" {% endif %} [gcode_macro ENABLE_DEBUG] gcode = SET_GCODE_VARIABLE MACRO=DEBUG_ECHO VARIABLE=enabled VALUE=True SET_GCODE_VARIABLE MACRO=DEBUG_ECHO VARIABLE=prefix_filter VALUE="'{params.FILTER|default('')|lower}'" RATOS_ECHO PREFIX="DEBUG" MSG="Debugging enabled." [gcode_macro DISABLE_DEBUG] gcode = SET_GCODE_VARIABLE MACRO=DEBUG_ECHO VARIABLE=enabled VALUE=False RATOS_ECHO PREFIX="DEBUG" MSG="Debugging disabled." [gcode_macro DEBUG_ECHO] variable_enabled = False variable_prefix_filter = '' gcode = {% set prefix = "DEBUG" %} {% if params.PREFIX is defined %} {% set prefix = prefix ~ " - " ~ params.PREFIX %} {% endif %} {% if enabled and (prefix_filter|lower == '' or prefix_filter|lower in params.PREFIX|lower) %} RATOS_ECHO PREFIX="{prefix}" MSG="{params.MSG}" DEBUG=1 {% endif %} [gcode_macro START_FEATURE] gcode = DEBUG_ECHO PREFIX="G-Code" MSG="Start {params.FEATURE} feature gcode" {% set scv = printer.toolhead.square_corner_velocity|int|default(5) %} {% set accel = printer.toolhead.max_accel|int|default(10000) %} {% set ratio = printer.toolhead.minimum_cruise_ratio|float|default(0.5) %} SET_GCODE_VARIABLE MACRO="END_FEATURE" VARIABLE="scv" VALUE={scv} SET_GCODE_VARIABLE MACRO="END_FEATURE" VARIABLE="accel" VALUE={accel} SET_GCODE_VARIABLE MACRO="END_FEATURE" VARIABLE="ratio" VALUE={ratio} _USER_START_FEATURE FEATURE="{params.FEATURE}" [gcode_macro END_FEATURE] variable_scv = 5 variable_accel = 10000 variable_ratio = 0.5 gcode = DEBUG_ECHO PREFIX="G-Code" MSG="End {params.FEATURE} feature gcode" SET_VELOCITY_LIMIT SQUARE_CORNER_VELOCITY={scv} ACCEL={accel} MINIMUM_CRUISE_RATIO={ratio} _USER_END_FEATURE FEATURE="{params.FEATURE}" SCV={scv} ACCEL={accel} RATIO={ratio} [gcode_macro _ON_LAYER_CHANGE] variable_layer_number = 0 description = INTERNAL USE ONLY. Call it from the slicers after layer change custom gcode gcode = {% set layer = params.LAYER|int %} SET_GCODE_VARIABLE MACRO=_ON_LAYER_CHANGE VARIABLE=layer_number VALUE={layer} SET_PRINT_STATS_INFO CURRENT_LAYER={layer} [gcode_macro _LEARN_MORE_CALIBRATION] gcode = {% set link_url = "https://os.ratrig.com/docs/configuration/calibration" %} {% set link_text = "RatOS Calibration Macros" %} {% set line_1 = '"Learn more about the %s"' % (link_url, link_text) %} CONSOLE_ECHO TITLE="INFO" MSG={line_1} [gcode_macro _LEARN_MORE_CHAMBER_FILTER] gcode = {% set link_url = "https://os.ratrig.com/docs/configuration/chamber_filter" %} {% set link_text = "RatOS Chamber Filter Control" %} {% set line_1 = '"Learn more about the %s"' % (link_url, link_text) %} CONSOLE_ECHO TITLE="INFO" MSG={line_1} [gcode_macro _LEARN_MORE_FILAMENT] gcode = {% set link_url = "https://os.ratrig.com/docs/configuration/filaments" %} {% set link_text = "RatOS Filament Macros" %} {% set line_1 = '"Learn more about the %s"' % (link_url, link_text) %} CONSOLE_ECHO TITLE="INFO" MSG={line_1} [gcode_macro _CONSOLE_SAVE_CONFIG] gcode = M118 Click SAVE_CONFIG to save the settings to your printer.cfg. [gcode_macro SAVE_Z_OFFSET] gcode = {% if printer.configfile.settings.beacon is defined %} _BEACON_SAVE_MULTIPLIER {% else %} Z_OFFSET_APPLY_PROBE {% endif %} [gcode_macro _LOAD_RATOS_SKEW_PROFILE] gcode = {% set ratos_skew_profile = printer["gcode_macro RatOS"].skew_profile|default("") %} {% if ratos_skew_profile != "" %} {% if printer.configfile.config["skew_correction %s" % ratos_skew_profile] is defined %} SKEW_PROFILE LOAD={ratos_skew_profile} GET_CURRENT_SKEW {% else %} {% set line_1 = '"Could not find skew profile %s!_N_Clearing skew correction."' % ratos_skew_profile %} CONSOLE_ECHO TITLE="Missing skew profile!" TYPE="warning" MSG={line_1} SET_SKEW CLEAR=1 {% endif %} {% endif %} [gcode_macro M601] gcode = PAUSE [idle_timeout] gcode = {% if printer.webhooks.state|lower == 'ready' %} {% if printer.pause_resume.is_paused|lower == 'false' %} RATOS_ECHO PREFIX="IDLE" MSG="2 hours since last activity. Powering off heaters and motors.." TURN_OFF_HEATERS M84 {% endif %} {% endif %} timeout = 7200 [temperature_sensor raspberry_pi] sensor_type = temperature_host [virtual_sdcard] path = ~/printer_data/gcodes [display_status] [pause_resume] [respond] [ratos] [mcu] serial = /tmp/klipper_host_mcu [printer] kinematics = none max_velocity = 1 max_accel = 1 [gcode_macro PAUSE] rename_existing = PAUSE_BASE gcode = RATOS_ECHO MSG="Please setup your printer through the RatOS configurator at /configure" [gcode_macro RESUME] rename_existing = RESUME_BASE gcode = RATOS_ECHO MSG="Please setup your printer through the RatOS configurator at /configure" [gcode_macro CANCEL_PRINT] rename_existing = CANCEL_BASE gcode = RATOS_ECHO MSG="Please setup your printer through the RatOS configurator at /configure" ======================= mcu 'mcu': Starting connect webhooks client 4126814704: New connection webhooks client 4126814704: Client info {'program': 'Moonraker', 'version': 'v0.9.3-0-g71f9e67'} Loaded MCU 'mcu' 119 commands (?-20240727_132503-fv-az659-741 / gcc: (Raspbian 10.2.1-6+rpi1) 10.2.1 20210110 binutils: (GNU Binutils for Raspbian) 2.35.2) MCU 'mcu' config: ADC_MAX=4095 CLOCK_FREQ=50000000 MCU=linux PCA9685_MAX=4096 PWM_MAX=32768 STATS_SUMSQ_BASE=256 Configured MCU 'mcu' (1024 moves) Config error Traceback (most recent call last): File "/home/pi/klipper/klippy/klippy.py", line 135, in _connect cb() File "/home/pi/klipper/klippy/extras/ratos.py", line 58, in _connect self.register_command_overrides() File "/home/pi/klipper/klippy/extras/ratos.py", line 86, in register_command_overrides self.register_override('TEST_RESONANCES', self.override_TEST_RESONANCES, desc=(self.desc_TEST_RESONANCES)) File "/home/pi/klipper/klippy/extras/ratos.py", line 97, in register_override raise self.printer.config_error("Existing command '%s' not found in RatOS override" % (command,)) configparser.Error: Existing command 'TEST_RESONANCES' not found in RatOS override webhooks client 4126814704: Disconnected Starting Klippy... Args: ['/home/pi/klipper/klippy/klippy.py', '/home/pi/printer_data/config/printer.cfg', '-l', '/home/pi/printer_data/logs/klippy.log', '-I', '/home/pi/printer_data/comms/klippy.serial', '-a', '/home/pi/printer_data/comms/klippy.sock'] Git version: 'v0.12.0-396-gb7233d119-dirty' Untracked files: klippy/extras/beacon.py, klippy/extras/gcode_shell_command.py, klippy/extras/linear_movement_vibrations.py, klippy/extras/ratos.py, klippy/extras/ratos_homing.py, klippy/extras/resonance_generator.py, klippy/extras/z_offset_probe.py, klippy/kinematics/ratos_hybrid_corexy.py Branch: master Remote: origin Tracked URL: https://github.com/Klipper3d/klipper.git CPU: 4 core ? Python: '3.9.2 (default, Mar 20 2025, 22:21:41) \n[GCC 10.2.1 20210110]' Start printer at Wed Oct 22 08:05:54 2025 (1761116754.1 21.7) ===== Config file ===== [gcode_macro ECHO_T_VARS] description = Echo Toolhead variables to the console. gcode = {% set t = params.T|default(0) %} RATOS_ECHO MSG="T{t} Variables" {% for var, value in printer["gcode_macro T%s" % t].items() %} {action_respond_info(var ~ ": " ~ value)} {% endfor %} [gcode_macro ECHO_RATOS_VARS] description = Echo RatOS variables to the console. gcode = {% for var, value in printer["gcode_macro RatOS"].items() %} {action_respond_info(var ~ ": " ~ value)} {% endfor %} [gcode_macro RatOS] description = RatOS variable storage macro, will echo variables to the console when run. variable_relative_extrusion = False variable_force_absolute_position = False variable_preheat_extruder = True variable_preheat_extruder_temp = 150 variable_macro_travel_speed = 150 variable_macro_travel_accel = 2000 variable_macro_z_speed = 15 variable_bed_margin_x = [0, 0] variable_bed_margin_y = [0, 0] variable_printable_x_min = 0 variable_printable_x_max = 0 variable_printable_y_min = 0 variable_printable_y_max = 0 variable_end_print_motors_off = True variable_status_color_ok = "00FF00" variable_status_color_error = "FF0000" variable_status_color_unknown = "FFFF00" variable_end_print_retract_filament = 10 gcode = ECHO_RATOS_VARS [delayed_gcode RATOS_INIT] initial_duration = 0.1 gcode = RATOS_ECHO MSG="Welcome to RatOS!" RATOS_ECHO MSG="Please setup your printer through the RatOS configurator. Use the link in the sidebar to proceed with the setup." [delayed_gcode RATOS_LOGO] initial_duration = 2 gcode = HELLO_RATOS [gcode_macro INITIAL_FRONTEND_UPDATE] gcode = {% set color_ok = printer["gcode_macro RatOS"].status_color_ok|string %} {% set color_error = printer["gcode_macro RatOS"].status_color_error|string %} {% set color_unknown = printer["gcode_macro RatOS"].status_color_unknown|string %} SET_GCODE_VARIABLE MACRO=T0 VARIABLE=color VALUE='"{color_unknown}"' {% if printer["dual_carriage"] is defined %} SET_GCODE_VARIABLE MACRO=T1 VARIABLE=color VALUE='"{color_unknown}"' {% endif %} {% set t0_sensor = "undefined" %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t0"] is defined %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t0"].enabled|lower == "true" %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t0"].filament_detected|lower == "true" %} {% set t0_sensor = "detected" %} {% else %} {% set t0_sensor = "empty" %} {% endif %} {% else %} {% set t0_sensor = "disabled" %} {% endif %} {% endif %} {% set t1_sensor = "undefined" %} {% if printer["dual_carriage"] is defined and printer["filament_switch_sensor toolhead_filament_sensor_t1"] is defined %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t1"].enabled|lower == "true" %} {% if printer["filament_switch_sensor toolhead_filament_sensor_t1"].filament_detected|lower == "true" %} {% set t1_sensor = "detected" %} {% else %} {% set t1_sensor = "empty" %} {% endif %} {% else %} {% set t1_sensor = "disabled" %} {% endif %} {% endif %} {% set svv = printer.save_variables.variables %} {% if svv.t0_filament is defined and printer["gcode_macro T0"] is defined %} {% if printer["gcode_macro T0"].filament_name is defined and printer["gcode_macro T0"].filament_type is defined and printer["gcode_macro T0"].filament_temp is defined %} {% if t0_sensor != "empty" %} {% set t0_filament_type = svv.t0_filament[0]|default('')|string %} {% set t0_filament_name = svv.t0_filament[1]|default('')|string %} {% set t0_filament_temp = svv.t0_filament[2]|default(0)|float %} {% if t0_filament_name != '' and t0_filament_type != '' and t0_filament_temp > 0 %} SET_GCODE_VARIABLE MACRO=T0 VARIABLE=color VALUE='"{color_ok}"' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_name VALUE='"{t0_filament_name}"' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_type VALUE='"{t0_filament_type}"' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_temp VALUE={t0_filament_temp} {% endif %} {% else %} SAVE_VARIABLE VARIABLE=t0_filament VALUE="('""', '""', 0)" SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_name VALUE='""' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_type VALUE='""' SET_GCODE_VARIABLE MACRO=T0 VARIABLE=filament_temp VALUE=0 {% endif %} {% endif %} {% endif %} {% if svv.t1_filament is defined and printer["gcode_macro T1"] is defined %} {% if printer["gcode_macro T1"].filament_name is defined and printer["gcode_macro T1"].filament_type is defined and printer["gcode_macro T1"].filament_temp is defined %} {% if t1_sensor != "empty" %} {% set t1_filament_type = svv.t1_filament[0]|default('')|string %} {% set t1_filament_name = svv.t1_filament[1]|default('')|string %} {% set t1_filament_temp = svv.t1_filament[2]|default(0)|float %} {% if t1_filament_name != '' and t1_filament_type != '' and t1_filament_temp > 0 %} SET_GCODE_VARIABLE MACRO=T1 VARIABLE=color VALUE='"{color_ok}"' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_name VALUE='"{t1_filament_name}"' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_type VALUE='"{t1_filament_type}"' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_temp VALUE={t1_filament_temp} {% endif %} {% else %} SAVE_VARIABLE VARIABLE=t1_filament VALUE="('""', '""', 0)" SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_name VALUE='""' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_type VALUE='""' SET_GCODE_VARIABLE MACRO=T1 VARIABLE=filament_temp VALUE=0 {% endif %} {% endif %} {% endif %} [gcode_macro CALCULATE_PRINTABLE_AREA] gcode = {% set bed_margin_x = printer["gcode_macro RatOS"].bed_margin_x %} {% set bed_margin_y = printer["gcode_macro RatOS"].bed_margin_y %} {% set tool = 0 if printer["gcode_macro T0"] is not defined or printer["gcode_macro T0"].active else 1 %} {% set max_x = printer.toolhead.axis_maximum.x if printer["dual_carriage"] is defined and tool == 0 else printer.toolhead.axis_maximum.x - bed_margin_x[1] %} {% if printer["dual_carriage"] is defined %} {% set max_x = printer.toolhead.axis_maximum.x %} {% endif %} DEBUG_ECHO PREFIX="CALCULATE_PRINTABLE_AREA" MSG="printer.toolhead.axis_maximum.x {printer.toolhead.axis_maximum.x}" {% set max_y = printer.toolhead.axis_maximum.y - bed_margin_y[1]%} SET_GCODE_VARIABLE MACRO=RatOS VARIABLE=printable_x_max VALUE={max_x} SET_GCODE_VARIABLE MACRO=RatOS VARIABLE=printable_y_max VALUE={max_y} DEBUG_ECHO PREFIX="CALCULATE_PRINTABLE_AREA" MSG="Printable area calculated: X: 0,{max_x} Y: 0,{max_y}" [gcode_macro CACHE_TOOLHEAD_SETTINGS] variable_cache = {"global": {"accel": 1000, "ratio": 0.5, "speed": 50, "scv": 5}} gcode = {% set key = "global" %} {% if params.KEY is defined %} {% set key = params.KEY %} {% endif %} {% set dummy = cache.__setitem__(key, {"accel": printer.toolhead.max_accel, "ratio": printer.toolhead.minimum_cruise_ratio, "speed": printer.toolhead.max_velocity, "scv": printer.toolhead.square_corner_velocity}) %} SET_GCODE_VARIABLE MACRO=CACHE_TOOLHEAD_SETTINGS VARIABLE=cache VALUE="{cache | pprint | replace("\n", "") | replace("\"", "\\\"")}" DEBUG_ECHO PREFIX="CACHE_TOOLHEAD_SETTINGS" MSG="Toolhead settings cached for {key}. {printer.toolhead.max_accel} accel, {printer.toolhead.minimum_cruise_ratio} ratio, {printer.toolhead.max_velocity} velocity, {printer.toolhead.square_corner_velocity} scv." [gcode_macro RESTORE_TOOLHEAD_SETTINGS] gcode = {% set key = "global" %} {% if params.KEY is defined %} {% set key = params.KEY %} {% endif %} {% set values = printer["gcode_macro CACHE_TOOLHEAD_SETTINGS"].cache.__getitem__(key) %} {% if values is not defined or values == 'None' %} { action_raise_error("RESTORE_TOOLHEAD_SETTINGS: Toolhead settings not cached for key '" ~ key ~ "'.") } {% endif %} SET_VELOCITY_LIMIT ACCEL={values.accel} MINIMUM_CRUISE_RATIO={values.ratio} VELOCITY={values.speed} SQUARE_CORNER_VELOCITY={values.scv} DEBUG_ECHO PREFIX="RESTORE_TOOLHEAD_SETTINGS" MSG="Toolhead settings restored. {values.accel} accel, {values.ratio} ratio, {values.speed} velocity, {values.scv} scv." [gcode_macro SET_MACRO_TRAVEL_SETTINGS] gcode = {% set speed = printer["gcode_macro RatOS"].macro_travel_speed|float * 60 %} {% set accel = printer["gcode_macro RatOS"].macro_travel_accel %} SET_VELOCITY_LIMIT ACCEL={accel} MINIMUM_CRUISE_RATIO=0.5 VELOCITY={speed} SQUARE_CORNER_VELOCITY={5} DEBUG_ECHO PREFIX="SET_MACRO_TRAVEL_SETTINGS" MSG="Macro travel settings set. {accel} accel, {speed} velocity" [gcode_macro SET_CENTER_KINEMATIC_POSITION] description = FOR DEBUGGING PURPOSES ONLY. Sets the internal printer kinematic state to the center of all axes regardless of actual physical position. gcode = {% set printable_x_max = printer["gcode_macro RatOS"].printable_x_max|float %} {% set printable_y_max = printer["gcode_macro RatOS"].printable_y_max|float %} RATOS_ECHO MSG="WARNING: ONLY USE SET_CENTER_KINEMATIC_POSITION FOR DEBUGGING PURPOSES. YOU'RE OVERRIDING THE INTERNAL POSITIONING STATE OF THE PRINTER. PROCEED WITH CAUTION AND DO A PROPER G28 WHEN DONE." SET_GCODE_VARIABLE MACRO=MAYBE_HOME VARIABLE=is_kinematic_position_overriden VALUE=True {% if printer["dual_carriage"] is not defined %} SET_KINEMATIC_POSITION X={printable_x_max / 2} Y={printable_y_max / 2} Z={printer.toolhead.axis_maximum.z / 2} {% else %} IDEX_SET_CENTER_KINEMATIC_POSITION {% endif %} [gcode_macro IDEX_SET_CENTER_KINEMATIC_POSITION] description = FOR DEBUGGING PURPOSES ONLY. Sets the internal printer kinematic state to the center of all axes regardless of actual physical position. gcode = {% set printable_x_max = printer["gcode_macro RatOS"].printable_x_max|float %} {% set printable_y_max = printer["gcode_macro RatOS"].printable_y_max|float %} RATOS_ECHO MSG="WARNING: ONLY USE SET_CENTER_KINEMATIC_POSITION FOR DEBUGGING PURPOSES. YOU'RE OVERRIDING THE INTERNAL POSITIONING STATE OF THE PRINTER. PROCEED WITH CAUTION AND DO A PROPER G28 WHEN DONE." SET_GCODE_VARIABLE MACRO=MAYBE_HOME VARIABLE=is_kinematic_position_overriden VALUE=True {% set printable_x_max = printer["gcode_macro RatOS"].printable_x_max|float %} {% set center_x = printable_x_max / 2 %} SET_DUAL_CARRIAGE CARRIAGE=0 MODE=PRIMARY SET_KINEMATIC_POSITION X={center_x - (center_x / 2)} Y={printable_y_max / 2} Z={printer.toolhead.axis_maximum.z / 2} SET_DUAL_CARRIAGE CARRIAGE=1 MODE=PRIMARY SET_KINEMATIC_POSITION X={center_x + (center_x / 2)} Y={printable_y_max / 2} Z={printer.toolhead.axis_maximum.z / 2} SET_DUAL_CARRIAGE CARRIAGE=0 MODE=PRIMARY [gcode_macro VERIFY_HYBRID_INVERTED] gcode = {% set inverted = False %} {% if printer.configfile.settings.ratos_hybrid_corexy is defined and printer.configfile.settings.ratos_hybrid_corexy.inverted is defined %} {% if printer.configfile.settings.ratos_hybrid_corexy.inverted|lower == 'true' %} {% set inverted = True %} {% endif %} {% endif %} {% if inverted == False %} { action_emergency_stop("ratos_hybrid_corexy NOT INVERTED! Inverted hybrid core-xy bugfix not detected.") } {% endif %} [gcode_macro RATOS_ECHO] gcode = {% set prefix = "RatOS" %} {% set debug = params.DEBUG|default(0)|int %} {% if params.PREFIX is defined %} {% set prefix = prefix ~ " | " ~ params.PREFIX %} {% endif %} {% set prefix = prefix ~ ":" %} {% set msg = "" %} {% if params.MSG is defined %} {% set msg = params.MSG %} {% else %} {% set msg = "No msg parameter provided (this is a bug or unintended use)." %} {% endif %} {% if not debug %} M117 {prefix} {msg} {% endif %} RATOS_LOG PREFIX="{prefix}" MSG="{msg}" {% if not debug %} RESPOND PREFIX="{prefix}" MSG="{msg}" {% else %} CONSOLE_ECHO TITLE="{prefix}" TYPE="debug" MSG="{msg}" {% endif %} [gcode_macro ENABLE_DEBUG] gcode = SET_GCODE_VARIABLE MACRO=DEBUG_ECHO VARIABLE=enabled VALUE=True SET_GCODE_VARIABLE MACRO=DEBUG_ECHO VARIABLE=prefix_filter VALUE="'{params.FILTER|default('')|lower}'" RATOS_ECHO PREFIX="DEBUG" MSG="Debugging enabled." [gcode_macro DISABLE_DEBUG] gcode = SET_GCODE_VARIABLE MACRO=DEBUG_ECHO VARIABLE=enabled VALUE=False RATOS_ECHO PREFIX="DEBUG" MSG="Debugging disabled." [gcode_macro DEBUG_ECHO] variable_enabled = False variable_prefix_filter = '' gcode = {% set prefix = "DEBUG" %} {% if params.PREFIX is defined %} {% set prefix = prefix ~ " - " ~ params.PREFIX %} {% endif %} {% if enabled and (prefix_filter|lower == '' or prefix_filter|lower in params.PREFIX|lower) %} RATOS_ECHO PREFIX="{prefix}" MSG="{params.MSG}" DEBUG=1 {% endif %} [gcode_macro START_FEATURE] gcode = DEBUG_ECHO PREFIX="G-Code" MSG="Start {params.FEATURE} feature gcode" {% set scv = printer.toolhead.square_corner_velocity|int|default(5) %} {% set accel = printer.toolhead.max_accel|int|default(10000) %} {% set ratio = printer.toolhead.minimum_cruise_ratio|float|default(0.5) %} SET_GCODE_VARIABLE MACRO="END_FEATURE" VARIABLE="scv" VALUE={scv} SET_GCODE_VARIABLE MACRO="END_FEATURE" VARIABLE="accel" VALUE={accel} SET_GCODE_VARIABLE MACRO="END_FEATURE" VARIABLE="ratio" VALUE={ratio} _USER_START_FEATURE FEATURE="{params.FEATURE}" [gcode_macro END_FEATURE] variable_scv = 5 variable_accel = 10000 variable_ratio = 0.5 gcode = DEBUG_ECHO PREFIX="G-Code" MSG="End {params.FEATURE} feature gcode" SET_VELOCITY_LIMIT SQUARE_CORNER_VELOCITY={scv} ACCEL={accel} MINIMUM_CRUISE_RATIO={ratio} _USER_END_FEATURE FEATURE="{params.FEATURE}" SCV={scv} ACCEL={accel} RATIO={ratio} [gcode_macro _ON_LAYER_CHANGE] variable_layer_number = 0 description = INTERNAL USE ONLY. Call it from the slicers after layer change custom gcode gcode = {% set layer = params.LAYER|int %} SET_GCODE_VARIABLE MACRO=_ON_LAYER_CHANGE VARIABLE=layer_number VALUE={layer} SET_PRINT_STATS_INFO CURRENT_LAYER={layer} [gcode_macro _LEARN_MORE_CALIBRATION] gcode = {% set link_url = "https://os.ratrig.com/docs/configuration/calibration" %} {% set link_text = "RatOS Calibration Macros" %} {% set line_1 = '"Learn more about the %s"' % (link_url, link_text) %} CONSOLE_ECHO TITLE="INFO" MSG={line_1} [gcode_macro _LEARN_MORE_CHAMBER_FILTER] gcode = {% set link_url = "https://os.ratrig.com/docs/configuration/chamber_filter" %} {% set link_text = "RatOS Chamber Filter Control" %} {% set line_1 = '"Learn more about the %s"' % (link_url, link_text) %} CONSOLE_ECHO TITLE="INFO" MSG={line_1} [gcode_macro _LEARN_MORE_FILAMENT] gcode = {% set link_url = "https://os.ratrig.com/docs/configuration/filaments" %} {% set link_text = "RatOS Filament Macros" %} {% set line_1 = '"Learn more about the %s"' % (link_url, link_text) %} CONSOLE_ECHO TITLE="INFO" MSG={line_1} [gcode_macro _CONSOLE_SAVE_CONFIG] gcode = M118 Click SAVE_CONFIG to save the settings to your printer.cfg. [gcode_macro SAVE_Z_OFFSET] gcode = {% if printer.configfile.settings.beacon is defined %} _BEACON_SAVE_MULTIPLIER {% else %} Z_OFFSET_APPLY_PROBE {% endif %} [gcode_macro _LOAD_RATOS_SKEW_PROFILE] gcode = {% set ratos_skew_profile = printer["gcode_macro RatOS"].skew_profile|default("") %} {% if ratos_skew_profile != "" %} {% if printer.configfile.config["skew_correction %s" % ratos_skew_profile] is defined %} SKEW_PROFILE LOAD={ratos_skew_profile} GET_CURRENT_SKEW {% else %} {% set line_1 = '"Could not find skew profile %s!_N_Clearing skew correction."' % ratos_skew_profile %} CONSOLE_ECHO TITLE="Missing skew profile!" TYPE="warning" MSG={line_1} SET_SKEW CLEAR=1 {% endif %} {% endif %} [gcode_macro M601] gcode = PAUSE [idle_timeout] gcode = {% if printer.webhooks.state|lower == 'ready' %} {% if printer.pause_resume.is_paused|lower == 'false' %} RATOS_ECHO PREFIX="IDLE" MSG="2 hours since last activity. Powering off heaters and motors.." TURN_OFF_HEATERS M84 {% endif %} {% endif %} timeout = 7200 [temperature_sensor raspberry_pi] sensor_type = temperature_host [virtual_sdcard] path = ~/printer_data/gcodes [display_status] [pause_resume] [respond] [ratos] [mcu] serial = /tmp/klipper_host_mcu [printer] kinematics = none max_velocity = 1 max_accel = 1 [gcode_macro PAUSE] rename_existing = PAUSE_BASE gcode = RATOS_ECHO MSG="Please setup your printer through the RatOS configurator at /configure" [gcode_macro RESUME] rename_existing = RESUME_BASE gcode = RATOS_ECHO MSG="Please setup your printer through the RatOS configurator at /configure" [gcode_macro CANCEL_PRINT] rename_existing = CANCEL_BASE gcode = RATOS_ECHO MSG="Please setup your printer through the RatOS configurator at /configure" ======================= mcu 'mcu': Starting connect mcu 'mcu': got {'count': 140, 'sum': 197594, 'sumsq': 1422487, '#name': 'stats', '#sent_time': 22.961316467, '#receive_time': 23.00021356} Loaded MCU 'mcu' 119 commands (?-20240727_132503-fv-az659-741 / gcc: (Raspbian 10.2.1-6+rpi1) 10.2.1 20210110 binutils: (GNU Binutils for Raspbian) 2.35.2) MCU 'mcu' config: ADC_MAX=4095 CLOCK_FREQ=50000000 MCU=linux PCA9685_MAX=4096 PWM_MAX=32768 STATS_SUMSQ_BASE=256 Sending MCU 'mcu' printer configuration... Configured MCU 'mcu' (1024 moves) Config error Traceback (most recent call last): File "/home/pi/klipper/klippy/klippy.py", line 135, in _connect cb() File "/home/pi/klipper/klippy/extras/ratos.py", line 58, in _connect self.register_command_overrides() File "/home/pi/klipper/klippy/extras/ratos.py", line 86, in register_command_overrides self.register_override('TEST_RESONANCES', self.override_TEST_RESONANCES, desc=(self.desc_TEST_RESONANCES)) File "/home/pi/klipper/klippy/extras/ratos.py", line 97, in register_override raise self.printer.config_error("Existing command '%s' not found in RatOS override" % (command,)) configparser.Error: Existing command 'TEST_RESONANCES' not found in RatOS override webhooks client 4123150704: New connection webhooks client 4123150704: Client info {'program': 'Moonraker', 'version': 'v0.9.3-0-g71f9e67'}