-
-
Notifications
You must be signed in to change notification settings - Fork 19.5k
avoid some MK2_MULTIPLEXER pitfalls #8544
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This appears to be a hack to work around a bug. Let's fix the bug!
#define E3_DIR_PIN E0_DIR_PIN | ||
#define E3_ENABLE_PIN E0_ENABLE_PIN | ||
|
||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a workaround for a bug elsewhere. When MK2_MULTIPLEXER
is set, all E movement should be tailored for that system. This is handled by the stepper_indirection.h
code, so let's see if it matches up…
/**
* Extruder indirection for the single E axis
*/
#if ENABLED(SWITCHING_EXTRUDER)
. . .
#elif EXTRUDERS > 4
. . .
#elif EXTRUDERS > 3
. . .
#elif EXTRUDERS > 2
. . .
#elif EXTRUDERS > 1
#if ENABLED(DUAL_X_CARRIAGE) || ENABLED(DUAL_NOZZLE_DUPLICATION_MODE)
. . .
#else
. . .
#endif
#elif ENABLED(MIXING_EXTRUDER)
. . .
#else
#define E_STEP_WRITE(v) E0_STEP_WRITE(v)
#if ENABLED(MK2_MULTIPLEXER)
// Even-numbered steppers are reversed
#define NORM_E_DIR() E0_DIR_WRITE(TEST(current_block->active_extruder, 0) ? !INVERT_E0_DIR: INVERT_E0_DIR)
#define REV_E_DIR() E0_DIR_WRITE(TEST(current_block->active_extruder, 0) ? INVERT_E0_DIR: !INVERT_E0_DIR)
#else
#define NORM_E_DIR() E0_DIR_WRITE(!INVERT_E0_DIR)
#define REV_E_DIR() E0_DIR_WRITE(INVERT_E0_DIR)
#endif
#endif
The bug seems to be that if the value for EXTRUDERS
isn't "1" the MK2_MULTIPLEXER
code will never be applied. So that should be fixed! The correct code should be…
/**
* Extruder indirection for the single E axis
*/
#if ENABLED(SWITCHING_EXTRUDER)
. . .
#elif ENABLED(MK2_MULTIPLEXER) // Even-numbered steppers are reversed
#define E_STEP_WRITE(v) E0_STEP_WRITE(v)
#define NORM_E_DIR() E0_DIR_WRITE(TEST(current_block->active_extruder, 0) ? !INVERT_E0_DIR: INVERT_E0_DIR)
#define REV_E_DIR() E0_DIR_WRITE(TEST(current_block->active_extruder, 0) ? INVERT_E0_DIR: !INVERT_E0_DIR)
#elif EXTRUDERS > 4
. . .
#elif EXTRUDERS > 3
. . .
#elif EXTRUDERS > 2
. . .
#elif EXTRUDERS > 1
#if ENABLED(DUAL_X_CARRIAGE) || ENABLED(DUAL_NOZZLE_DUPLICATION_MODE)
. . .
#else
. . .
#endif
#elif ENABLED(MIXING_EXTRUDER)
. . .
#else
#define E_STEP_WRITE(v) E0_STEP_WRITE(v)
#define NORM_E_DIR() E0_DIR_WRITE(!INVERT_E0_DIR)
#define REV_E_DIR() E0_DIR_WRITE(INVERT_E0_DIR)
#endif
#define E1_DIR_PIN 34 | ||
#define E1_ENABLE_PIN 30 | ||
#define E1_CS_PIN 44 | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for this with above fix.
I've merged the patch described in my review into Additional work is still needed to fully integrate the MK2 filament-swapping behavior. It's pretty much a cut-and-paste job from the MK2 branch, except that in adapting it for the main Marlin fork we'll want to make the behaviors —feedrate, retract length, etc.— customizable. We'll aim to get that done for the 1.1.8 release. |
And now those are merged - w00t! |
The MK2_MULTIPLEXER feature requires a set of other configuration options to have the correct values. Some are checked by SanityCheck.h but others are not. To avoid some pitfalls for other users I added a block in Configuration_adv.h to set some requirements for MK2_MULTIPLEXER.
I also had to disable the E1_*_PIN defines in pins_RAMPS.h to get the 2nd extruder working. The corresponding undefs in Configuration_adv.h seem to have no effect on this behalf.