Skip to content

Commit

Permalink
📝 Fix X2_MAX_POS comment (MarlinFirmware#23873)
Browse files Browse the repository at this point in the history
  • Loading branch information
InsanityAutomation authored Mar 13, 2022
1 parent 4d40764 commit a9c30cb
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 23 deletions.
19 changes: 9 additions & 10 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -811,16 +811,15 @@
*/
//#define DUAL_X_CARRIAGE
#if ENABLED(DUAL_X_CARRIAGE)
#define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS
#define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage
#define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage
#define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed
#define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position
#define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS.
// However: In this mode the HOTEND_OFFSET_X value for the second extruder provides a software
// override for X2_HOME_POS. This also allow recalibration of the distance between the two endstops
// without modifying the firmware (through the "M218 T1 X???" command).
// Remember: you should set the second extruder x-offset to 0 in your slicer.
#define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS
#define X1_MAX_POS X_BED_SIZE // A max coordinate so the X1 carriage can't hit the parked X2 carriage
#define X2_MIN_POS 80 // A min coordinate so the X2 carriage can't hit the parked X1 carriage
#define X2_MAX_POS 353 // The max position of the X2 carriage, typically also the home position
#define X2_HOME_DIR 1 // Set to 1. The X2 carriage always homes to the max endstop position
#define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS.
// NOTE: For Dual X Carriage use M218 T1 Xn to override the X2_HOME_POS.
// This allows recalibration of endstops distance without a rebuild.
// Remember to set the second extruder's X-offset to 0 in your slicer.

// This is the default power-up mode which can be changed later using M605 S<mode>.
#define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE
Expand Down
23 changes: 10 additions & 13 deletions Marlin/src/module/motion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,7 @@ xyze_pos_t destination; // {0}
);
// Transpose from [XYZ][HOTENDS] to [HOTENDS][XYZ]
HOTEND_LOOP() LOOP_ABC(a) hotend_offset[e][a] = tmp[a][e];
#if ENABLED(DUAL_X_CARRIAGE)
hotend_offset[1].x = _MAX(X2_HOME_POS, X2_MAX_POS);
#endif
TERN_(DUAL_X_CARRIAGE, hotend_offset[1].x = _MAX(X2_HOME_POS, X2_MAX_POS));
}
#endif

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

float x_home_pos(const uint8_t extruder) {
if (extruder == 0)
return X_HOME_POS;
else
/**
* In dual carriage mode the extruder offset provides an override of the
* second X-carriage position when homed - otherwise X2_HOME_POS is used.
* This allows soft recalibration of the second extruder home position
* without firmware reflash (through the M218 command).
*/
return hotend_offset[1].x > 0 ? hotend_offset[1].x : X2_HOME_POS;
if (extruder == 0) return X_HOME_POS;

/**
* In dual carriage mode the extruder offset provides an override of the
* second X-carriage position when homed - otherwise X2_HOME_POS is used.
* This allows soft recalibration of the second extruder home position
* (with M218 T1 Xn) without firmware reflash.
*/
return hotend_offset[1].x > 0 ? hotend_offset[1].x : X2_HOME_POS;
}

void idex_set_mirrored_mode(const bool mirr) {
Expand Down

0 comments on commit a9c30cb

Please sign in to comment.