From cd3372dc92732bc5c56e30b4c555454b0416c524 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gu=C3=B0ni=20M=C3=A1r=20Gilbert?= Date: Wed, 18 Oct 2023 22:57:34 +0000 Subject: [PATCH] mmu: formatting --- Firmware/mmu2.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) 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; }