Skip to content
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

Add SMUFF support #19912

Merged
merged 34 commits into from
Nov 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
0b75243
Add SMUFF support
GMagician Oct 27, 2020
be8448c
Update platformio.ini
thinkyhead Oct 28, 2020
c8b3dc8
Config tweaks
thinkyhead Oct 28, 2020
11ab6da
Fix up config
thinkyhead Oct 28, 2020
0327ba1
Set HAS_PRUSA_MMU2 for S also
thinkyhead Oct 28, 2020
392ed3c
Adjust formatting
thinkyhead Oct 28, 2020
ee706f6
Set MAX_EXTRUDERS to 15 for SMUFF
thinkyhead Oct 28, 2020
16c79ff
Drop some MAX_EXTRUDERS checks
thinkyhead Oct 28, 2020
19ae189
MMU2S is also MMU2
thinkyhead Oct 28, 2020
ca34edc
Misc adjustments
thinkyhead Oct 28, 2020
47ad2ca
Towards MMU2 without LCD
thinkyhead Oct 28, 2020
df092e4
Shrink some remarks
GMagician Oct 28, 2020
611d8da
Shrink remarks message
GMagician Oct 28, 2020
f589443
Reduce smuff supported extruders
GMagician Oct 28, 2020
da37364
Reduce smuff supported colors
GMagician Oct 28, 2020
58e1bcf
Remove senseless #undef
GMagician Oct 28, 2020
71ff2cf
Restore senseless #undef
thinkyhead Oct 28, 2020
5433f5e
human-readability
thinkyhead Oct 28, 2020
24c0ed3
Future units
thinkyhead Oct 28, 2020
f18d312
Clean up, permit "Tc" with no LCD
thinkyhead Oct 29, 2020
283cbe5
Use common way to test MMU options in precompiler conditions
GMagician Oct 29, 2020
6469c9c
Use TERN_ instead of #if
GMagician Nov 2, 2020
e20511e
Use SMUFF developper nickname
GMagician Nov 2, 2020
2d9c819
Some fixes
GMagician Nov 16, 2020
3fa5d33
Remove no more valid sanity check
GMagician Nov 16, 2020
8ee8ec0
Merge remote-tracking branch 'upstream/bugfix-2.0.x' into pr/19912
thinkyhead Nov 17, 2020
8d4b8bb
Remove extra marker
thinkyhead Nov 17, 2020
a80c6cc
Move SNMM checks up
thinkyhead Nov 17, 2020
7b991d8
Fix some tests
thinkyhead Nov 17, 2020
a9995cb
and this test too
thinkyhead Nov 17, 2020
fb23f0c
Test seems intended for 5 sensors
thinkyhead Nov 18, 2020
fed2f0c
Clarify sanity error with MMU2
thinkyhead Nov 18, 2020
5ce20ad
Fixes, more to come
thinkyhead Nov 18, 2020
e995e6b
Merge remote-tracking branch 'upstream/bugfix-2.0.x' into pr/19912
thinkyhead Nov 18, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 10 additions & 24 deletions Marlin/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,33 +158,19 @@
#endif

/**
* Průša MK2 Single Nozzle Multi-Material Multiplexer, and variants.
*
* This device allows one stepper driver on a control board to drive
* two to eight stepper motors, one at a time, in a manner suitable
* for extruders.
*
* This option only allows the multiplexer to switch on tool-change.
* Additional options to configure custom E moves are pending.
*/
//#define MK2_MULTIPLEXER
#if ENABLED(MK2_MULTIPLEXER)
// Override the default DIO selector pins here, if needed.
// Some pins files may provide defaults for these pins.
//#define E_MUX0_PIN 40 // Always Required
//#define E_MUX1_PIN 42 // Needed for 3 to 8 inputs
//#define E_MUX2_PIN 44 // Needed for 5 to 8 inputs
#endif

/**
* Průša Multi-Material Unit v2
* Multi-Material Unit
* Set to one of these predefined models:
*
* Requires NOZZLE_PARK_FEATURE to park print head in case MMU unit fails.
* Requires EXTRUDERS = 5
* PRUSA_MMU1 : Průša MMU1 (The "multiplexer" version)
* PRUSA_MMU2 : Průša MMU2
* PRUSA_MMU2S : Průša MMU2S (Requires MK3S extruder with motion sensor, EXTRUDERS = 5)
* SMUFF_EMU_MMU2 : Technik Gegg SMUFF (Průša MMU2 emulation mode)
* SMUFF_EMU_MMU2S : Technik Gegg SMUFF (Průša MMU2S emulation mode)
*
* For additional configuration see Configuration_adv.h
* Requires NOZZLE_PARK_FEATURE to park print head in case MMU unit fails.
* See additional options in Configuration_adv.h.
*/
//#define PRUSA_MMU2
//#define MMU_MODEL PRUSA_MMU2

// A dual extruder that uses a single stepper motor
//#define SWITCHING_EXTRUDER
Expand Down
60 changes: 37 additions & 23 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -3529,11 +3529,24 @@
#endif

/**
* Průša Multi-Material Unit v2
* Průša Multi-Material Unit (MMU)
* Enable in Configuration.h
*
* These devices allow a single stepper driver on the board to drive
* multi-material feeders with any number of stepper motors.
*/
#if ENABLED(PRUSA_MMU2)

#if HAS_PRUSA_MMU1
/**
* This option only allows the multiplexer to switch on tool-change.
* Additional options to configure custom E moves are pending.
*
* Override the default DIO selector pins here, if needed.
* Some pins files may provide defaults for these pins.
*/
//#define E_MUX0_PIN 40 // Always Required
//#define E_MUX1_PIN 42 // Needed for 3 to 8 inputs
//#define E_MUX2_PIN 44 // Needed for 5 to 8 inputs
#elif HAS_PRUSA_MMU2
// Serial port used for communication with MMU2.
// For AVR enable the UART port used for the MMU. (e.g., mmuSerial)
// For 32-bit boards check your HAL for available serial ports. (e.g., Serial2)
Expand All @@ -3551,7 +3564,7 @@

// Add an LCD menu for MMU2
//#define MMU2_MENUS
#if ENABLED(MMU2_MENUS)
#if EITHER(MMU2_MENUS, HAS_PRUSA_MMU2S)
// Settings for filament load / unload from the LCD menu.
// This is for Průša MK3-style extruders. Customize for your hardware.
#define MMU2_FILAMENTCHANGE_EJECT_FEED 80.0
Expand All @@ -3576,29 +3589,12 @@
{ -50.0, 2000 }
#endif

/**
* MMU Extruder Sensor
*
* Support for a Průša (or other) IR Sensor to detect filament near the extruder
* and make loading more reliable. Suitable for an extruder equipped with a filament
* sensor less than 38mm from the gears.
*
* During loading the extruder will stop when the sensor is triggered, then do a last
* move up to the gears. If no filament is detected, the MMU2 can make some more attempts.
* If all attempts fail, a filament runout will be triggered.
*/
//#define MMU_EXTRUDER_SENSOR
#if ENABLED(MMU_EXTRUDER_SENSOR)
#define MMU_LOADING_ATTEMPTS_NR 5 // max. number of attempts to load filament if first load fail
#endif

/**
* Using a sensor like the MMU2S
* This mode requires a MK3S extruder with a sensor at the extruder idler, like the MMU2S.
* See https://help.prusa3d.com/en/guide/3b-mk3s-mk2-5s-extruder-upgrade_41560, step 11
*/
//#define PRUSA_MMU2_S_MODE
#if ENABLED(PRUSA_MMU2_S_MODE)
#if HAS_PRUSA_MMU2S
#define MMU2_C0_RETRY 5 // Number of retries (total time = timeout*retries)

#define MMU2_CAN_LOAD_FEEDRATE 800 // (mm/min)
Expand All @@ -3614,11 +3610,29 @@
#define MMU2_CAN_LOAD_INCREMENT_SEQUENCE \
{ -MMU2_CAN_LOAD_INCREMENT, MMU2_CAN_LOAD_FEEDRATE }

#else

/**
* MMU1 Extruder Sensor
*
* Support for a Průša (or other) IR Sensor to detect filament near the extruder
* and make loading more reliable. Suitable for an extruder equipped with a filament
* sensor less than 38mm from the gears.
*
* During loading the extruder will stop when the sensor is triggered, then do a last
* move up to the gears. If no filament is detected, the MMU2 can make some more attempts.
* If all attempts fail, a filament runout will be triggered.
*/
//#define MMU_EXTRUDER_SENSOR
#if ENABLED(MMU_EXTRUDER_SENSOR)
#define MMU_LOADING_ATTEMPTS_NR 5 // max. number of attempts to load filament if first load fail
#endif

#endif

//#define MMU2_DEBUG // Write debug info to serial output

#endif // PRUSA_MMU2
#endif // HAS_PRUSA_MMU2

/**
* Advanced Print Counter settings
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/HAL/LPC1768/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ static_assert(DISABLED(BAUD_RATE_GCODE), "BAUD_RATE_GCODE is not yet supported o
#define IS_RX0(P) (P == P0_03)
#if IS_TX0(TMC_SW_MISO) || IS_RX0(TMC_SW_MOSI)
#error "Serial port pins (0) conflict with Trinamic SPI pins!"
#elif ENABLED(MK2_MULTIPLEXER) && (IS_TX0(E_MUX1_PIN) || IS_RX0(E_MUX0_PIN))
#error "Serial port pins (0) conflict with MK2 multiplexer pins!"
#elif HAS_PRUSA_MMU1 && (IS_TX0(E_MUX1_PIN) || IS_RX0(E_MUX0_PIN))
#error "Serial port pins (0) conflict with Multi-Material-Unit multiplexer pins!"
#elif (AXIS_HAS_SPI(X) && IS_TX0(X_CS_PIN)) || (AXIS_HAS_SPI(Y) && IS_RX0(Y_CS_PIN))
#error "Serial port pins (0) conflict with X/Y axis SPI pins!"
#endif
Expand Down
21 changes: 9 additions & 12 deletions Marlin/src/MarlinCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,8 @@
#include "feature/controllerfan.h"
#endif

#if ENABLED(PRUSA_MMU2)
#include "feature/mmu2/mmu2.h"
#if HAS_PRUSA_MMU2
#include "feature/mmu/mmu2.h"
#endif

#if HAS_L64XX
Expand Down Expand Up @@ -713,9 +713,7 @@ void idle(TERN_(ADVANCED_PAUSE_FEATURE, bool no_stepper_sleep/*=false*/)) {
TERN_(HAS_FILAMENT_SENSOR, runout.run());

// Run HAL idle tasks
#ifdef HAL_IDLETASK
HAL_idletask();
#endif
TERN_(HAL_IDLETASK, HAL_idletask());

// Check network connection
TERN_(HAS_ETHERNET, ethernet.check());
Expand Down Expand Up @@ -772,17 +770,16 @@ void idle(TERN_(ADVANCED_PAUSE_FEATURE, bool no_stepper_sleep/*=false*/)) {
#endif

// Update the Průša MMU2
TERN_(PRUSA_MMU2, mmu2.mmu_loop());
TERN_(HAS_PRUSA_MMU2, mmu2.mmu_loop());

// Handle Joystick jogging
TERN_(POLL_JOG, joystick.inject_jog_moves());

// Direct Stepping
TERN_(DIRECT_STEPPING, page_manager.write_responses());

#if HAS_TFT_LVGL_UI
LV_TASK_HANDLER();
#endif
// Update the LVGL interface
TERN_(HAS_TFT_LVGL_UI, LV_TASK_HANDLER());
}

/**
Expand Down Expand Up @@ -1187,8 +1184,8 @@ void setup() {
SETUP_RUN(caselight.update_brightness());
#endif

#if ENABLED(MK2_MULTIPLEXER)
SETUP_LOG("MK2_MULTIPLEXER");
#if HAS_PRUSA_MMU1
SETUP_LOG("Prusa MMU1");
SET_OUTPUT(E_MUX0_PIN);
SET_OUTPUT(E_MUX1_PIN);
SET_OUTPUT(E_MUX2_PIN);
Expand Down Expand Up @@ -1268,7 +1265,7 @@ void setup() {
SETUP_RUN(test_tmc_connection(true, true, true, true));
#endif

#if ENABLED(PRUSA_MMU2)
#if HAS_PRUSA_MMU2
SETUP_RUN(mmu2.init());
#endif

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#include "../inc/MarlinConfig.h"

#if ENABLED(MK2_MULTIPLEXER)
#if HAS_PRUSA_MMU1

#include "../module/stepper.h"

Expand All @@ -35,4 +35,4 @@ void select_multiplexed_stepper(const uint8_t e) {
safe_delay(100);
}

#endif // MK2_MULTIPLEXER
#endif // HAS_PRUSA_MMU1
File renamed without changes.
Loading