diff --git a/Firmware/mmu2.cpp b/Firmware/mmu2.cpp index d8bace241..9e23cc7d3 100644 --- a/Firmware/mmu2.cpp +++ b/Firmware/mmu2.cpp @@ -212,6 +212,11 @@ void MMU2::mmu_loop() { ReportErrorHook((uint16_t)lastErrorCode, mmu2.MMUCurrentErrorCode() == ErrorCode::OK ? ErrorSourcePrinter : ErrorSourceMMU); } + avoidRecursion = false; +} + +void MMU2::CheckFINDARunout() +{ // Check for FINDA filament runout if (!FindaDetectsFilament() && CHECK_FSENSOR) { SERIAL_ECHOLNPGM("FINDA filament runout!"); @@ -226,8 +231,6 @@ void MMU2::mmu_loop() { enquecommand_front_P(PSTR("M600")); //save print and run M600 command } } - - avoidRecursion = false; } struct ReportingRAII { @@ -731,6 +734,9 @@ StepStatus MMU2::LogicStep() { StepStatus ss = logic.Step(); switch (ss) { case Finished: + // At this point it is safe to trigger a runout and not interrupt the MMU protocol + CheckFINDARunout(); + break; case Processing: OnMMUProgressMsg(logic.Progress()); break; diff --git a/Firmware/mmu2.h b/Firmware/mmu2.h index 4ebf78668..f459fa0cf 100644 --- a/Firmware/mmu2.h +++ b/Firmware/mmu2.h @@ -244,6 +244,11 @@ private: /// Check for any button/user input coming from the printer's UI void CheckUserInput(); + /// @brief Check whether to trigger a FINDA runout. If triggered this function will call M600 AUTO + /// if SpoolJoin is enabled, otherwise M600 is called without AUTO which will prompt the user + /// for the next filament slot to use + void CheckFINDARunout(); + /// Entry check of all external commands. /// It can wait until the MMU becomes ready. /// Optionally, it can also emit/display an error screen and the user can decide what to do next.