diff --git a/configuration/macros/idex/util.cfg b/configuration/macros/idex/util.cfg new file mode 100644 index 000000000..0b8a6bfaa --- /dev/null +++ b/configuration/macros/idex/util.cfg @@ -0,0 +1,50 @@ +# WARNING: DO NOT EDIT THIS FILE +# To override settings from this file, you can copy and paste the relevant +# sections into your printer.cfg and change it there. + +[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 stepper_x_position_max = printer.configfile.settings.stepper_x.position_max|float %} + {% set stepper_x_position_endstop = printer.configfile.settings.stepper_x.position_endstop|float %} + {% set dual_carriage_position_max = printer.configfile.settings.dual_carriage.position_max|float %} + {% set dual_carriage_position_endstop = printer.configfile.settings.dual_carriage.position_endstop|float %} + + {% set line_1 = "_N_[dual_carriage]" %} + {% set line_2 = "position_max: %.3f" % (dual_carriage_position_max + idex_xoffset) %} + {% set line_3 = "position_endstop: %.3f" % (dual_carriage_position_endstop + idex_xoffset) %} + {% set line_4 = "_N_[gcode_macro RatOS]" %} + {% set line_5 = "variable_bed_margin_x: [%.3f, %.3f]" % (stepper_x_position_endstop|abs, dual_carriage_position_max - stepper_x_position_max + 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 %} + {% set line_9 = "_N_[gcode_macro T0]" %} + {% set line_10 = "variable_parking_position: %.3f" % (stepper_x_position_endstop + 2) %} + {% set line_11 = "_N_[gcode_macro T1]" %} + {% set line_12 = "variable_parking_position: %.3f" % (dual_carriage_position_endstop + idex_xoffset - 2) %} + 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)} + {% else %} + CONSOLE_ECHO TITLE="Invalid machine type" TYPE="error" MSG="This macro is only available on IDEX machines." + {% 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)} + {% else %} + CONSOLE_ECHO TITLE="Invalid machine type" TYPE="error" MSG="This macro is only available on IDEX machines." + {% endif %} \ No newline at end of file diff --git a/configuration/macros/util.cfg b/configuration/macros/util.cfg index d548f139c..5db858b4b 100644 --- a/configuration/macros/util.cfg +++ b/configuration/macros/util.cfg @@ -397,34 +397,4 @@ 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 stepper_x_position_max = printer.configfile.settings.stepper_x.position_max|float %} - {% set stepper_x_position_endstop = printer.configfile.settings.stepper_x.position_endstop|float %} - {% set dual_carriage_position_max = printer.configfile.settings.dual_carriage.position_max|float %} - {% set dual_carriage_position_endstop = printer.configfile.settings.dual_carriage.position_endstop|float %} - - {% set line_1 = "_N_[dual_carriage]" %} - {% set line_2 = "position_max: %.3f" % (dual_carriage_position_max + idex_xoffset) %} - {% set line_3 = "position_endstop: %.3f" % (dual_carriage_position_endstop + idex_xoffset) %} - {% set line_4 = "_N_[gcode_macro RatOS]" %} - {% set line_5 = "variable_bed_margin_x: [%.3f, %.3f]" % (stepper_x_position_endstop|abs, dual_carriage_position_max - stepper_x_position_max + 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 %} - {% set line_9 = "_N_[gcode_macro T0]" %} - {% set line_10 = "variable_parking_position: %.3f" % (stepper_x_position_endstop + 2) %} - {% set line_11 = "_N_[gcode_macro T1]" %} - {% set line_12 = "variable_parking_position: %.3f" % (dual_carriage_position_endstop + idex_xoffset - 2) %} - 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 %} \ No newline at end of file + PAUSE \ No newline at end of file