From f4b808456ac5b2ce55329a2ad8db00b6cc9510cb Mon Sep 17 00:00:00 2001 From: Giuliano Zaro <3684609+GMagician@users.noreply.github.com> Date: Tue, 14 Dec 2021 01:47:57 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=B8=20Use=20M600=20for=20disabled=20MM?= =?UTF-8?q?U=20(#21865)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/MarlinCore.cpp | 5 ++- Marlin/src/feature/pause.h | 15 +++------ Marlin/src/gcode/feature/pause/M600.cpp | 45 ++++++++++++++----------- 3 files changed, 34 insertions(+), 31 deletions(-) diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index adc5ef08b0..972a393a6f 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -774,7 +774,10 @@ void idle(bool no_stepper_sleep/*=false*/) { (void)check_tool_sensor_stats(active_extruder, true); // Handle filament runout sensors - TERN_(HAS_FILAMENT_SENSOR, runout.run()); + #if HAS_FILAMENT_SENSOR + if (TERN1(HAS_PRUSA_MMU2, !mmu2.enabled())) + runout.run(); + #endif // Run HAL idle tasks TERN_(HAL_IDLETASK, HAL_idletask()); diff --git a/Marlin/src/feature/pause.h b/Marlin/src/feature/pause.h index d2c45e44a5..134b1d1b32 100644 --- a/Marlin/src/feature/pause.h +++ b/Marlin/src/feature/pause.h @@ -73,17 +73,10 @@ extern fil_change_settings_t fc_settings[EXTRUDERS]; extern uint8_t did_pause_print; -#if ENABLED(DUAL_X_CARRIAGE) - #define DXC_PARAMS , const int8_t DXC_ext=-1 - #define DXC_ARGS , const int8_t DXC_ext - #define DXC_PASS , DXC_ext - #define DXC_SAY , " dxc:", int(DXC_ext) -#else - #define DXC_PARAMS - #define DXC_ARGS - #define DXC_PASS - #define DXC_SAY -#endif +#define DXC_PARAMS OPTARG(DUAL_X_CARRIAGE, const int8_t DXC_ext=-1) +#define DXC_ARGS OPTARG(DUAL_X_CARRIAGE, const int8_t DXC_ext) +#define DXC_PASS OPTARG(DUAL_X_CARRIAGE, DXC_ext) +#define DXC_SAY OPTARG(DUAL_X_CARRIAGE, " dxc:", int(DXC_ext)) // Pause the print. If unload_length is set, do a Filament Unload bool pause_print( diff --git a/Marlin/src/gcode/feature/pause/M600.cpp b/Marlin/src/gcode/feature/pause/M600.cpp index a95e3e02b4..665967ca56 100644 --- a/Marlin/src/gcode/feature/pause/M600.cpp +++ b/Marlin/src/gcode/feature/pause/M600.cpp @@ -34,8 +34,11 @@ #include "../../../module/tool_change.h" #endif -#if ENABLED(MMU2_MENUS) - #include "../../../lcd/menu/menu_mmu2.h" +#if ENABLED(HAS_PRUSA_MMU2) + #include "../../../feature/mmu/mmu2.h" + #if ENABLED(MMU2_MENUS) + #include "../../../lcd/menu/menu_mmu2.h" + #endif #endif #if ENABLED(MIXING_EXTRUDER) @@ -92,10 +95,11 @@ void GcodeSuite::M600() { } #endif + const bool standardM600 = TERN1(MMU2_MENUS, !mmu2.enabled()); + // Show initial "wait for start" message - #if DISABLED(MMU2_MENUS) + if (standardM600) ui.pause_show_message(PAUSE_MESSAGE_CHANGING, PAUSE_MODE_PAUSE_PRINT, target_extruder); - #endif #if ENABLED(HOME_BEFORE_FILAMENT_CHANGE) // If needed, home before parking for filament change @@ -126,17 +130,11 @@ void GcodeSuite::M600() { #endif #if ENABLED(MMU2_MENUS) - // For MMU2 reset retract and load/unload values so they don't mess with MMU filament handling - constexpr float unload_length = 0.5f, - slow_load_length = 0.0f, - fast_load_length = 0.0f; + // For MMU2, when enabled, reset retract value so it doesn't mess with MMU filament handling + const float unload_length = standardM600 ? -ABS(parser.axisunitsval('U', E_AXIS, fc_settings[active_extruder].unload_length)) : 0.5f; #else // Unload filament const float unload_length = -ABS(parser.axisunitsval('U', E_AXIS, fc_settings[active_extruder].unload_length)); - // Slow load filament - constexpr float slow_load_length = FILAMENT_CHANGE_SLOW_LOAD_LENGTH; - // Fast load filament - const float fast_load_length = ABS(parser.axisunitsval('L', E_AXIS, fc_settings[active_extruder].load_length)); #endif const int beep_count = parser.intval('B', -1 @@ -146,14 +144,23 @@ void GcodeSuite::M600() { ); if (pause_print(retract, park_point, true, unload_length DXC_PASS)) { - #if ENABLED(MMU2_MENUS) - mmu2_M600(); - resume_print(slow_load_length, fast_load_length, 0, beep_count DXC_PASS); - #else + if (standardM600) { wait_for_confirmation(true, beep_count DXC_PASS); - resume_print(slow_load_length, fast_load_length, ADVANCED_PAUSE_PURGE_LENGTH, - beep_count, (parser.seenval('R') ? parser.value_celsius() : 0) DXC_PASS); - #endif + resume_print( + FILAMENT_CHANGE_SLOW_LOAD_LENGTH, + ABS(parser.axisunitsval('L', E_AXIS, fc_settings[active_extruder].load_length)), + ADVANCED_PAUSE_PURGE_LENGTH, + beep_count, + parser.celsiusval('R') + DXC_PASS + ); + } + else { + #if ENABLED(MMU2_MENUS) + mmu2_M600(); + resume_print(0, 0, 0, beep_count, 0 DXC_PASS); + #endif + } } #if HAS_MULTI_EXTRUDER