mmu: formatting

This commit is contained in:
Guðni Már Gilbert 2023-10-18 22:57:34 +00:00
parent 12a3051c50
commit cd3372dc92
1 changed files with 16 additions and 2 deletions

View File

@ -835,45 +835,58 @@ bool MMU2::manage_response(const bool move_axes, const bool turn_off_nozzle) {
} }
StepStatus MMU2::LogicStep(bool reportErrors) { StepStatus MMU2::LogicStep(bool reportErrors) {
CheckUserInput(); // Process any buttons before proceeding with another MMU Query // Process any buttons before proceeding with another MMU Query
StepStatus ss = logic.Step(); CheckUserInput();
const StepStatus ss = logic.Step();
switch (ss) { switch (ss) {
case Finished: case Finished:
// At this point it is safe to trigger a runout and not interrupt the MMU protocol // At this point it is safe to trigger a runout and not interrupt the MMU protocol
CheckFINDARunout(); CheckFINDARunout();
break; break;
case Processing: case Processing:
OnMMUProgressMsg(logic.Progress()); OnMMUProgressMsg(logic.Progress());
break; break;
case ButtonPushed: case ButtonPushed:
lastButton = logic.Button(); lastButton = logic.Button();
LogEchoEvent_P(PSTR("MMU Button pushed")); LogEchoEvent_P(PSTR("MMU Button pushed"));
CheckUserInput(); // Process the button immediately CheckUserInput(); // Process the button immediately
break; break;
case Interrupted: case Interrupted:
// can be silently handed over to a higher layer, no processing necessary at this spot // can be silently handed over to a higher layer, no processing necessary at this spot
break; break;
default: default:
if (reportErrors) { if (reportErrors) {
switch (ss) { switch (ss) {
case CommandError: case CommandError:
ReportError(logic.Error(), ErrorSourceMMU); ReportError(logic.Error(), ErrorSourceMMU);
break; break;
case CommunicationTimeout: case CommunicationTimeout:
state = xState::Connecting; state = xState::Connecting;
ReportError(ErrorCode::MMU_NOT_RESPONDING, ErrorSourcePrinter); ReportError(ErrorCode::MMU_NOT_RESPONDING, ErrorSourcePrinter);
break; break;
case ProtocolError: case ProtocolError:
state = xState::Connecting; state = xState::Connecting;
ReportError(ErrorCode::PROTOCOL_ERROR, ErrorSourcePrinter); ReportError(ErrorCode::PROTOCOL_ERROR, ErrorSourcePrinter);
break; break;
case VersionMismatch: case VersionMismatch:
StopKeepPowered(); StopKeepPowered();
ReportError(ErrorCode::VERSION_MISMATCH, ErrorSourcePrinter); ReportError(ErrorCode::VERSION_MISMATCH, ErrorSourcePrinter);
break; break;
case PrinterError: case PrinterError:
ReportError(logic.PrinterError(), ErrorSourcePrinter); ReportError(logic.PrinterError(), ErrorSourcePrinter);
break; break;
default: default:
break; break;
} }
@ -883,6 +896,7 @@ StepStatus MMU2::LogicStep(bool reportErrors) {
if (logic.Running()) { if (logic.Running()) {
state = xState::Active; state = xState::Active;
} }
return ss; return ss;
} }