🚸 More automatic MMU2 load (#24750)

This commit is contained in:
FBN
2022-09-16 07:02:08 +08:00
committed by GitHub
parent 1ab6e5cdc9
commit d0e7c2c208

View File

@@ -585,7 +585,7 @@ static void mmu2_not_responding() {
command(MMU_CMD_T0 + index);
manage_response(true, true);
mmu_continue_loading();
command(MMU_CMD_C0);
//command(MMU_CMD_C0);
extruder = index;
active_extruder = 0;
@@ -653,13 +653,33 @@ static void mmu2_not_responding() {
}
void MMU2::mmu_continue_loading() {
// Try to load the filament a limited number of times
for (uint8_t i = 0; i < MMU_LOADING_ATTEMPTS_NR; i++) {
DEBUG_ECHOLNPGM("Additional load attempt #", i);
if (FILAMENT_PRESENT()) break;
DEBUG_ECHOLNPGM("Load attempt #", i + 1);
// Done as soon as filament is present
bool fil_present = FILAMENT_PRESENT();
if (fil_present) break;
// Attempt to load the filament, 1mm at a time, for 3s
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);
}
if (!FILAMENT_PRESENT()) {
// Was the filament still missing in the last check?
if (!fil_present) {
DEBUG_ECHOLNPGM("Filament never reached sensor, runout");
filament_runout();
}
@@ -682,7 +702,7 @@ static void mmu2_not_responding() {
command(MMU_CMD_T0 + index);
manage_response(true, true);
command(MMU_CMD_C0);
extruder = index; //filament change is finished
extruder = index; // Filament change is finished
active_extruder = 0;
stepper.enable_extruder();
SERIAL_ECHO_MSG(STR_ACTIVE_EXTRUDER, extruder);