diff --git a/Firmware/mmu2.cpp b/Firmware/mmu2.cpp index 6d80c982c..442f2ef32 100644 --- a/Firmware/mmu2.cpp +++ b/Firmware/mmu2.cpp @@ -835,45 +835,58 @@ bool MMU2::manage_response(const bool move_axes, const bool turn_off_nozzle) { } StepStatus MMU2::LogicStep(bool reportErrors) { - CheckUserInput(); // Process any buttons before proceeding with another MMU Query - StepStatus ss = logic.Step(); + // Process any buttons before proceeding with another MMU Query + CheckUserInput(); + + const 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; + case ButtonPushed: lastButton = logic.Button(); LogEchoEvent_P(PSTR("MMU Button pushed")); CheckUserInput(); // Process the button immediately break; + case Interrupted: // can be silently handed over to a higher layer, no processing necessary at this spot break; + default: if (reportErrors) { switch (ss) { + case CommandError: ReportError(logic.Error(), ErrorSourceMMU); break; + case CommunicationTimeout: state = xState::Connecting; ReportError(ErrorCode::MMU_NOT_RESPONDING, ErrorSourcePrinter); break; + case ProtocolError: state = xState::Connecting; ReportError(ErrorCode::PROTOCOL_ERROR, ErrorSourcePrinter); break; + case VersionMismatch: StopKeepPowered(); ReportError(ErrorCode::VERSION_MISMATCH, ErrorSourcePrinter); break; + case PrinterError: ReportError(logic.PrinterError(), ErrorSourcePrinter); break; + default: break; } @@ -883,6 +896,7 @@ StepStatus MMU2::LogicStep(bool reportErrors) { if (logic.Running()) { state = xState::Active; } + return ss; }