From f6ab49d95b99ee09e26e59e653be3547c74475a4 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 12 Mar 2022 19:28:00 -0600 Subject: [PATCH] tweak --- Marlin/Configuration_adv.h | 10 +++++----- Marlin/src/module/motion.cpp | 23 ++++++++++------------- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 32df3b15d2d70..74ba1b93a16f5 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -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). diff --git a/Marlin/src/module/motion.cpp b/Marlin/src/module/motion.cpp index 4b0c6aba7d358..ceff70b4b7296 100644 --- a/Marlin/src/module/motion.cpp +++ b/Marlin/src/module/motion.cpp @@ -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 @@ -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) {