From 2367644ead28c42a69d284069433a2be99b9f63c Mon Sep 17 00:00:00 2001 From: HelgeKeck Date: Sat, 7 Dec 2024 06:45:56 +0100 Subject: [PATCH] MACRO: add helper macro INCREASE_Y_MAX (#320) --- macros/util.cfg | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/macros/util.cfg b/macros/util.cfg index d43b911f..98f133e7 100644 --- a/macros/util.cfg +++ b/macros/util.cfg @@ -429,3 +429,20 @@ gcode: CONSOLE_ECHO TITLE="Copy and paste to your printer.cfg" TYPE="info" MSG={'"%s_N_%s_N_%s_N_%s_N_%s_N_%s_N_%s_N_%s_N_%s_N_%s_N_%s_N_%s_N_ "' % (line_1, line_2, line_3, line_4, line_5, line_6, line_7, line_8, line_9, line_10, line_11, line_12)} {% endif %} + + +[gcode_macro INCREASE_Y_MAX] +gcode: + {% if printer["dual_carriage"] is defined %} + + {% set bed_margin_y = printer["gcode_macro RatOS"].bed_margin_y %} + {% set stepper_y_position_max = printer.configfile.settings.stepper_y.position_max|float %} + {% set stepper_y_position_endstop = printer.configfile.settings.stepper_y.position_endstop|float %} + + {% set line_1 = "_N_[stepper_y]" %} + {% set line_2 = "position_max: %.3f" % (stepper_y_position_max + 1) %} + {% set line_3 = "_N_[gcode_macro RatOS]" %} + {% set line_4 = "variable_bed_margin_y: [%.3f, %.3f]" % (stepper_y_position_endstop|abs, (bed_margin_y[1] + 1)) %} + CONSOLE_ECHO TITLE="Copy and paste to your printer.cfg" TYPE="info" MSG={'"%s_N_%s_N_%s_N_%s_N_ "' % (line_1, line_2, line_3, line_4)} + + {% endif %}