Skip to content

Commit a9c30cb

Browse files
📝 Fix X2_MAX_POS comment (MarlinFirmware#23873)
1 parent 4d40764 commit a9c30cb

File tree

2 files changed

+19
-23
lines changed

2 files changed

+19
-23
lines changed

Marlin/Configuration_adv.h

+9-10
Original file line numberDiff line numberDiff line change
@@ -811,16 +811,15 @@
811811
*/
812812
//#define DUAL_X_CARRIAGE
813813
#if ENABLED(DUAL_X_CARRIAGE)
814-
#define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS
815-
#define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage
816-
#define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage
817-
#define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed
818-
#define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position
819-
#define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS.
820-
// However: In this mode the HOTEND_OFFSET_X value for the second extruder provides a software
821-
// override for X2_HOME_POS. This also allow recalibration of the distance between the two endstops
822-
// without modifying the firmware (through the "M218 T1 X???" command).
823-
// Remember: you should set the second extruder x-offset to 0 in your slicer.
814+
#define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS
815+
#define X1_MAX_POS X_BED_SIZE // A max coordinate so the X1 carriage can't hit the parked X2 carriage
816+
#define X2_MIN_POS 80 // A min coordinate so the X2 carriage can't hit the parked X1 carriage
817+
#define X2_MAX_POS 353 // The max position of the X2 carriage, typically also the home position
818+
#define X2_HOME_DIR 1 // Set to 1. The X2 carriage always homes to the max endstop position
819+
#define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS.
820+
// NOTE: For Dual X Carriage use M218 T1 Xn to override the X2_HOME_POS.
821+
// This allows recalibration of endstops distance without a rebuild.
822+
// Remember to set the second extruder's X-offset to 0 in your slicer.
824823

825824
// This is the default power-up mode which can be changed later using M605 S<mode>.
826825
#define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE

Marlin/src/module/motion.cpp

+10-13
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,7 @@ xyze_pos_t destination; // {0}
125125
);
126126
// Transpose from [XYZ][HOTENDS] to [HOTENDS][XYZ]
127127
HOTEND_LOOP() LOOP_ABC(a) hotend_offset[e][a] = tmp[a][e];
128-
#if ENABLED(DUAL_X_CARRIAGE)
129-
hotend_offset[1].x = _MAX(X2_HOME_POS, X2_MAX_POS);
130-
#endif
128+
TERN_(DUAL_X_CARRIAGE, hotend_offset[1].x = _MAX(X2_HOME_POS, X2_MAX_POS));
131129
}
132130
#endif
133131

@@ -1116,16 +1114,15 @@ FORCE_INLINE void segment_idle(millis_t &next_idle_ms) {
11161114
bool idex_mirrored_mode = false; // Used in mode 3
11171115

11181116
float x_home_pos(const uint8_t extruder) {
1119-
if (extruder == 0)
1120-
return X_HOME_POS;
1121-
else
1122-
/**
1123-
* In dual carriage mode the extruder offset provides an override of the
1124-
* second X-carriage position when homed - otherwise X2_HOME_POS is used.
1125-
* This allows soft recalibration of the second extruder home position
1126-
* without firmware reflash (through the M218 command).
1127-
*/
1128-
return hotend_offset[1].x > 0 ? hotend_offset[1].x : X2_HOME_POS;
1117+
if (extruder == 0) return X_HOME_POS;
1118+
1119+
/**
1120+
* In dual carriage mode the extruder offset provides an override of the
1121+
* second X-carriage position when homed - otherwise X2_HOME_POS is used.
1122+
* This allows soft recalibration of the second extruder home position
1123+
* (with M218 T1 Xn) without firmware reflash.
1124+
*/
1125+
return hotend_offset[1].x > 0 ? hotend_offset[1].x : X2_HOME_POS;
11291126
}
11301127

11311128
void idex_set_mirrored_mode(const bool mirr) {

0 commit comments

Comments
 (0)