SMUFF (MMU2 clone) support (#19912)

This commit is contained in:
Giuliano Zaro
2020-11-18 08:27:21 +01:00
committed by Scott Lahteine
parent b6d2671260
commit bd38e59479
29 changed files with 622 additions and 616 deletions

View File

@ -31,13 +31,13 @@
*
* Report the current speed percentage factor if no parameter is specified
*
* With PRUSA_MMU2...
* For MMU2 and MMU2S devices...
* B : Flag to back up the current factor
* R : Flag to restore the last-saved factor
*/
void GcodeSuite::M220() {
#if ENABLED(PRUSA_MMU2)
#if HAS_PRUSA_MMU2
static int16_t backup_feedrate_percentage = 100;
if (parser.seen('B')) backup_feedrate_percentage = feedrate_percentage;
if (parser.seen('R')) feedrate_percentage = backup_feedrate_percentage;

View File

@ -27,8 +27,8 @@
#include "../../module/motion.h"
#endif
#if ENABLED(PRUSA_MMU2)
#include "../../feature/mmu2/mmu2.h"
#if HAS_PRUSA_MMU2
#include "../../feature/mmu/mmu2.h"
#endif
#define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE)
@ -40,7 +40,7 @@
* F[units/min] Set the movement feedrate
* S1 Don't move the tool in XY after change
*
* For PRUSA_MMU2:
* For PRUSA_MMU2(S) and SMUFF_EMU_MMU2(S)
* T[n] Gcode to extrude at least 38.10 mm at feedrate 19.02 mm/s must follow immediately to load to extruder wheels.
* T? Gcode to extrude shouldn't have to follow. Load to extruder wheels is done automatically.
* Tx Same as T?, but nozzle doesn't have to be preheated. Tc requires a preheated nozzle to finish filament load.
@ -54,7 +54,7 @@ void GcodeSuite::T(const int8_t tool_index) {
// Count this command as movement / activity
reset_stepper_timeout();
#if ENABLED(PRUSA_MMU2)
#if HAS_PRUSA_MMU2
if (parser.string_arg) {
mmu2.tool_change(parser.string_arg); // Special commands T?/Tx/Tc
return;

View File

@ -38,8 +38,8 @@
#include "../../../lcd/marlinui.h"
#endif
#if ENABLED(PRUSA_MMU2)
#include "../../../feature/mmu2/mmu2.h"
#if HAS_PRUSA_MMU2
#include "../../../feature/mmu/mmu2.h"
#endif
#if ENABLED(MIXING_EXTRUDER)
@ -86,7 +86,7 @@ void GcodeSuite::M701() {
// Show initial "wait for load" message
TERN_(HAS_LCD_MENU, lcd_pause_show_message(PAUSE_MESSAGE_LOAD, PAUSE_MODE_LOAD_FILAMENT, target_extruder));
#if HAS_MULTI_EXTRUDER && DISABLED(PRUSA_MMU2)
#if HAS_MULTI_EXTRUDER && (HAS_PRUSA_MMU1 || !HAS_MMU)
// Change toolhead if specified
uint8_t active_extruder_before_filament_change = active_extruder;
if (active_extruder != target_extruder)
@ -98,7 +98,7 @@ void GcodeSuite::M701() {
do_blocking_move_to_z(_MIN(current_position.z + park_point.z, Z_MAX_POS), feedRate_t(NOZZLE_PARK_Z_FEEDRATE));
// Load filament
#if ENABLED(PRUSA_MMU2)
#if HAS_PRUSA_MMU2
mmu2.load_filament_to_nozzle(target_extruder);
#else
constexpr float purge_length = ADVANCED_PAUSE_PURGE_LENGTH,
@ -121,7 +121,7 @@ void GcodeSuite::M701() {
if (park_point.z > 0)
do_blocking_move_to_z(_MAX(current_position.z - park_point.z, 0), feedRate_t(NOZZLE_PARK_Z_FEEDRATE));
#if HAS_MULTI_EXTRUDER && DISABLED(PRUSA_MMU2)
#if HAS_MULTI_EXTRUDER && (HAS_PRUSA_MMU1 || !HAS_MMU)
// Restore toolhead if it was changed
if (active_extruder_before_filament_change != active_extruder)
tool_change(active_extruder_before_filament_change, false);
@ -186,7 +186,7 @@ void GcodeSuite::M702() {
// Show initial "wait for unload" message
TERN_(HAS_LCD_MENU, lcd_pause_show_message(PAUSE_MESSAGE_UNLOAD, PAUSE_MODE_UNLOAD_FILAMENT, target_extruder));
#if HAS_MULTI_EXTRUDER && DISABLED(PRUSA_MMU2)
#if HAS_MULTI_EXTRUDER && (HAS_PRUSA_MMU1 || !HAS_MMU)
// Change toolhead if specified
uint8_t active_extruder_before_filament_change = active_extruder;
if (active_extruder != target_extruder)
@ -198,7 +198,7 @@ void GcodeSuite::M702() {
do_blocking_move_to_z(_MIN(current_position.z + park_point.z, Z_MAX_POS), feedRate_t(NOZZLE_PARK_Z_FEEDRATE));
// Unload filament
#if ENABLED(PRUSA_MMU2)
#if HAS_PRUSA_MMU2
mmu2.unload();
#else
#if BOTH(HAS_MULTI_EXTRUDER, FILAMENT_UNLOAD_ALL_EXTRUDERS)
@ -227,7 +227,7 @@ void GcodeSuite::M702() {
if (park_point.z > 0)
do_blocking_move_to_z(_MAX(current_position.z - park_point.z, 0), feedRate_t(NOZZLE_PARK_Z_FEEDRATE));
#if HAS_MULTI_EXTRUDER && DISABLED(PRUSA_MMU2)
#if HAS_MULTI_EXTRUDER && (HAS_PRUSA_MMU1 || !HAS_MMU)
// Restore toolhead if it was changed
if (active_extruder_before_filament_change != active_extruder)
tool_change(active_extruder_before_filament_change, false);

View File

@ -22,10 +22,10 @@
#include "../../../inc/MarlinConfigPre.h"
#if ENABLED(PRUSA_MMU2)
#if HAS_PRUSA_MMU2
#include "../../gcode.h"
#include "../../../feature/mmu2/mmu2.h"
#include "../../../feature/mmu/mmu2.h"
/**
* M403: Set filament type for MMU2
@ -46,4 +46,4 @@ void GcodeSuite::M403() {
SERIAL_ECHO_MSG("M403 - bad arguments.");
}
#endif // PRUSA_MMU2
#endif // HAS_PRUSA_MMU2

View File

@ -702,7 +702,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
case 402: M402(); break; // M402: Stow probe
#endif
#if ENABLED(PRUSA_MMU2)
#if HAS_PRUSA_MMU2
case 403: M403(); break;
#endif

View File

@ -181,7 +181,7 @@
* M217 - Set filament swap parameters: "M217 S<length> P<feedrate> R<feedrate>". (Requires SINGLENOZZLE)
* M218 - Set/get a tool offset: "M218 T<index> X<offset> Y<offset>". (Requires 2 or more extruders)
* M220 - Set Feedrate Percentage: "M220 S<percent>" (i.e., "FR" on the LCD)
* Use "M220 B" to back up the Feedrate Percentage and "M220 R" to restore it. (Requires PRUSA_MMU2)
* Use "M220 B" to back up the Feedrate Percentage and "M220 R" to restore it. (Requires an MMU_MODEL version 2 or 2S)
* M221 - Set Flow Percentage: "M221 S<percent>"
* M226 - Wait until a pin is in a given state: "M226 P<pin> S<state>" (Requires DIRECT_PIN_CONTROL)
* M240 - Trigger a camera to take a photograph. (Requires PHOTO_GCODE)
@ -735,7 +735,7 @@ private:
static void M402();
#endif
TERN_(PRUSA_MMU2, static void M403());
TERN_(HAS_PRUSA_MMU2, static void M403());
#if ENABLED(FILAMENT_WIDTH_SENSOR)
static void M404();

View File

@ -155,7 +155,7 @@ void GCodeParser::parse(char *p) {
// Skip spaces to get the numeric part
while (*p == ' ') p++;
#if ENABLED(PRUSA_MMU2)
#if HAS_PRUSA_MMU2
if (letter == 'T') {
// check for special MMU2 T?/Tx/Tc commands
if (*p == '?' || *p == 'x' || *p == 'c') {