Browse Source

🚸 More automatic MMU2 load (#24750, #24770)

FB4S_WIFI^2^2
FBN 2 years ago
committed by Scott Lahteine
parent
commit
b9428bf087
  1. 31
      Marlin/src/feature/mmu/mmu2.cpp
  2. 1
      Marlin/src/feature/mmu/mmu2.h

31
Marlin/src/feature/mmu/mmu2.cpp

@ -585,7 +585,7 @@ static void mmu2_not_responding() {
command(MMU_CMD_T0 + index); command(MMU_CMD_T0 + index);
manage_response(true, true); manage_response(true, true);
mmu_continue_loading(); mmu_continue_loading();
command(MMU_CMD_C0); //command(MMU_CMD_C0);
extruder = index; extruder = index;
active_extruder = 0; active_extruder = 0;
@ -653,13 +653,34 @@ static void mmu2_not_responding() {
} }
void MMU2::mmu_continue_loading() { void MMU2::mmu_continue_loading() {
// Try to load the filament a limited number of times
bool fil_present = 0;
for (uint8_t i = 0; i < MMU_LOADING_ATTEMPTS_NR; i++) { for (uint8_t i = 0; i < MMU_LOADING_ATTEMPTS_NR; i++) {
DEBUG_ECHOLNPGM("Additional load attempt #", i); DEBUG_ECHOLNPGM("Load attempt #", i + 1);
if (FILAMENT_PRESENT()) break;
// Done as soon as filament is present
fil_present = FILAMENT_PRESENT();
if (fil_present) break;
// Attempt to load the filament, 1mm at a time, for 3s
command(MMU_CMD_C0); command(MMU_CMD_C0);
stepper.enable_extruder();
const millis_t expire_ms = millis() + 3000;
do {
current_position.e += 1;
line_to_current_position(MMU_LOAD_FEEDRATE);
planner.synchronize();
// When (T0 rx->ok) load is ready, but in fact it did not load
// successfully or an overload created pressure in the extruder.
// Send (C0) to load more and move E_AXIS a little to release pressure.
if ((fil_present = FILAMENT_PRESENT())) MMU2_COMMAND("A");
} while (!fil_present && PENDING(millis(), expire_ms));
stepper.disable_extruder();
manage_response(true, true); manage_response(true, true);
} }
if (!FILAMENT_PRESENT()) {
// Was the filament still missing in the last check?
if (!fil_present) {
DEBUG_ECHOLNPGM("Filament never reached sensor, runout"); DEBUG_ECHOLNPGM("Filament never reached sensor, runout");
filament_runout(); filament_runout();
} }
@ -682,7 +703,7 @@ static void mmu2_not_responding() {
command(MMU_CMD_T0 + index); command(MMU_CMD_T0 + index);
manage_response(true, true); manage_response(true, true);
command(MMU_CMD_C0); command(MMU_CMD_C0);
extruder = index; //filament change is finished extruder = index; // Filament change is finished
active_extruder = 0; active_extruder = 0;
stepper.enable_extruder(); stepper.enable_extruder();
SERIAL_ECHO_MSG(STR_ACTIVE_EXTRUDER, extruder); SERIAL_ECHO_MSG(STR_ACTIVE_EXTRUDER, extruder);

1
Marlin/src/feature/mmu/mmu2.h

@ -86,6 +86,7 @@ private:
#endif #endif
#if ENABLED(MMU_EXTRUDER_SENSOR) #if ENABLED(MMU_EXTRUDER_SENSOR)
#define MMU_LOAD_FEEDRATE 19.02f // (mm/s)
static void mmu_continue_loading(); static void mmu_continue_loading();
#endif #endif

Loading…
Cancel
Save