From b880559ba78b08756024c35a437a7802e3aec990 Mon Sep 17 00:00:00 2001 From: "D.R.racer" Date: Fri, 10 Jun 2022 08:21:34 +0200 Subject: [PATCH] Reset MMU upon start + fix reporting its start errors --- Firmware/mmu2.cpp | 4 +++- Firmware/mmu2_protocol_logic.cpp | 13 +++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Firmware/mmu2.cpp b/Firmware/mmu2.cpp index ccc1dbba3..1917383c8 100644 --- a/Firmware/mmu2.cpp +++ b/Firmware/mmu2.cpp @@ -103,7 +103,9 @@ void MMU2::Start() { mmu2Serial.begin(MMU_BAUD); - PowerOn(); + // PowerOn(); we cannot do that on MK3, but at least reset the MMU + Reset(ResetForm::ResetPin); + mmu2Serial.flush(); // make sure the UART buffer is clear before starting communication extruder = MMU2_NO_TOOL; diff --git a/Firmware/mmu2_protocol_logic.cpp b/Firmware/mmu2_protocol_logic.cpp index 35c65b1b6..12134d010 100644 --- a/Firmware/mmu2_protocol_logic.cpp +++ b/Firmware/mmu2_protocol_logic.cpp @@ -294,6 +294,19 @@ StepStatus Idle::Step() { logic->SwitchFromIdleToCommand(); return Processing; } + break; + case RequestMsgCodes::Reset: + // this one is kind of special + // we do not transfer to any "running" command (i.e. we stay in Idle), + // but in case there is an error reported we must make sure it gets propagated + if( logic->rsp.paramCode != ResponseMsgParamCodes::Finished ){ + logic->errorCode = static_cast(logic->rsp.paramValue); + SendFINDAQuery(); // continue Idle state without restarting the communication + return CommandError; + } else { + logic->errorCode = ErrorCode::OK; + } + break; default: break; }