Skip to content

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

Closed
wants to merge 1 commit into from
Closed

avoid some MK2_MULTIPLEXER pitfalls #8544

wants to merge 1 commit into from

Conversation

revilor
Copy link
Contributor

@revilor revilor commented Nov 24, 2017

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.

Copy link
Member

@thinkyhead thinkyhead left a 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
Copy link
Member

@thinkyhead thinkyhead Nov 24, 2017

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
Copy link
Member

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.

thinkyhead added a commit to robpower/Marlin that referenced this pull request Nov 24, 2017
@thinkyhead thinkyhead added Bug: Confirmed ! Needs: Patch A patch is needed to fix this S: Don't Merge Work in progress or under discussion. labels Nov 24, 2017
@thinkyhead
Copy link
Member

I've merged the patch described in my review into bugfix-1.1.x. Please confirm that it fixes the issue!

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.

@thinkyhead thinkyhead closed this Nov 24, 2017
@revilor
Copy link
Contributor Author

revilor commented Nov 24, 2017

I tested the latest bugfix-2.0.x and my extruders 1 and 3 are running backwards now (I don't use the original Prusa extruder set), so your fix works. I still had to set E2_x_PIN and E3_x_PIN because SanityCheck.h requires so. See #8551 and #8552 targeting this issue.

@thinkyhead
Copy link
Member

And now those are merged - w00t!

mtm88001 pushed a commit to mtm88001/Marlin that referenced this pull request Dec 9, 2017
damicreabox pushed a commit to damicreabox/Marlin that referenced this pull request Sep 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug: Confirmed ! Needs: Patch A patch is needed to fix this S: Don't Merge Work in progress or under discussion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants