🚸 Use M600 for disabled MMU (#21865)

This commit is contained in:
Giuliano Zaro 2021-12-14 01:47:57 +01:00 committed by Scott Lahteine
parent 6264736968
commit f4b808456a
3 changed files with 34 additions and 31 deletions

View File

@ -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());

View File

@ -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(

View File

@ -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