diff --git a/macros/util.cfg b/macros/util.cfg index 6c1a8224..782e61d5 100644 --- a/macros/util.cfg +++ b/macros/util.cfg @@ -399,3 +399,28 @@ gcode: [gcode_macro M601] gcode: PAUSE + +[gcode_macro CALCULATE_DC_ENDSTOP] +gcode: + {% if printer["dual_carriage"] is defined %} + + {% set svv = printer.save_variables.variables %} + {% set idex_xoffset = svv.idex_xoffset|float %} + {% set idex_xcontrolpoint = svv.idex_xcontrolpoint|float %} + {% set idex_ycontrolpoint = svv.idex_ycontrolpoint|float %} + + {% set bed_margin_x = printer["gcode_macro RatOS"].bed_margin_x %} + {% set stepper_dc_position_max = printer.configfile.settings.stepper_x.position_max|float %} + {% set stepper_dc_position_endstop = printer.configfile.settings.stepper_x.position_endstop|float %} + + {% set line_1 = "_N_[dual_carriage]" %} + {% set line_2 = "position_max: %.3f" % (stepper_dc_position_max + idex_xoffset) %} + {% set line_3 = "position_endstop: %.3f" % (stepper_dc_position_endstop + idex_xoffset) %} + {% set line_4 = "_N_[gcode_macro RatOS]" %} + {% set line_5 = "variable_bed_margin_x: [%.3f, %.3f]" % (bed_margin_x[0], bed_margin_x[1] + idex_xoffset) %} + {% set line_6 = "_N_[gcode_macro _VAOC]" %} + {% set line_7 = "variable_expected_camera_x_position: %.3f" % idex_xcontrolpoint %} + {% set line_8 = "variable_expected_camera_y_position: %.3f" % idex_ycontrolpoint %} + 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_ "' % (line_1, line_2, line_3, line_4, line_5, line_6, line_7, line_8)} + + {% endif %}