Skip to content

Commit

Permalink
tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Mar 13, 2022
1 parent 7627248 commit f6ab49d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 18 deletions.
10 changes: 5 additions & 5 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -812,11 +812,11 @@
//#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 maximum position of the X2 carriage, typically also the home position, referenced from X0
#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.
#define X1_MAX_POS X_BED_SIZE // A max coordinate so the first X-carriage can't hit the parked second X-carriage
#define X2_MIN_POS 80 // A min coordinate to ensure the second X-carriage can't hit the parked first X-carriage
#define X2_MAX_POS 353 // The max position of carriage X2, typically also the home position, referenced from X0
#define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the max 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).
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
* without firmware reflash (through the M218 command).
*/
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 f6ab49d

Please sign in to comment.