diff --git a/Firmware/mmu2.cpp b/Firmware/mmu2.cpp index 4237b5c5c..ffe6a9a52 100644 --- a/Firmware/mmu2.cpp +++ b/Firmware/mmu2.cpp @@ -91,6 +91,9 @@ void MMU2::Reset(ResetForm level) { case CutThePower: PowerCycle(); break; + case EraseEEPROM: + ResetX42(); + break; default: break; } @@ -100,6 +103,10 @@ void MMU2::ResetX0() { logic.ResetMMU(); // Send soft reset } +void MMU2::ResetX42(){ + logic.ResetMMU(42); +} + void MMU2::TriggerResetPin() { reset(); } diff --git a/Firmware/mmu2.h b/Firmware/mmu2.h index cc6f043b5..f21fe614e 100644 --- a/Firmware/mmu2.h +++ b/Firmware/mmu2.h @@ -50,7 +50,8 @@ public: enum ResetForm : uint8_t { Software = 0, ///< sends a X0 command into the MMU, the MMU will watchdog-reset itself ResetPin = 1, ///< trigger the reset pin of the MMU - CutThePower = 2 ///< power off and power on (that includes +5V and +24V power lines) + CutThePower = 2, ///< power off and power on (that includes +5V and +24V power lines) + EraseEEPROM = 42, ///< erase MMU EEPROM and then perform a software reset }; /// Saved print state on error. @@ -196,6 +197,9 @@ private: /// Perform software self-reset of the MMU (sends an X0 command) void ResetX0(); + /// Perform software self-reset of the MMU + erase its EEPROM (sends X2a command) + void ResetX42(); + /// Trigger reset pin of the MMU void TriggerResetPin(); diff --git a/Firmware/mmu2/errors_list.h b/Firmware/mmu2/errors_list.h index 0c9dbea20..2101fdd10 100644 --- a/Firmware/mmu2/errors_list.h +++ b/Firmware/mmu2/errors_list.h @@ -259,7 +259,7 @@ static const char MSG_DESC_UNLOAD_MANUALLY[] PROGMEM_I1 = ISTR("Filament detecte static const char MSG_DESC_FILAMENT_EJECTED[] PROGMEM_I1 = ISTR("Remove the ejected filament from the front of the MMU unit."); ////MSG_DESC_FILAMENT_EJECTED c=20 r=8 // Read explanation in mmu2_protocol_logic.cpp -> supportedMmuFWVersion -static constexpr char MSG_DESC_FW_UPDATE_NEEDED[] PROGMEM_I1 = ISTR("The MMU unit firmware version incompatible with the printer's FW. Update to version 2.1.6."); ////MSG_DESC_FW_UPDATE_NEEDED c=20 r=9 +static constexpr char MSG_DESC_FW_UPDATE_NEEDED[] PROGMEM_I1 = ISTR("The MMU unit firmware version incompatible with the printer's FW. Update to version 2.1.7."); ////MSG_DESC_FW_UPDATE_NEEDED c=20 r=9 static constexpr uint8_t szFWUN = sizeof(MSG_DESC_FW_UPDATE_NEEDED); // at least check the individual version characters in MSG_DESC_FW_UPDATE_NEEDED static_assert(MSG_DESC_FW_UPDATE_NEEDED[szFWUN - 7] == ('0' + mmuVersionMajor)); diff --git a/Firmware/mmu2_protocol_logic.cpp b/Firmware/mmu2_protocol_logic.cpp index 2fb0121c6..9c91776a0 100644 --- a/Firmware/mmu2_protocol_logic.cpp +++ b/Firmware/mmu2_protocol_logic.cpp @@ -579,8 +579,8 @@ void ProtocolLogic::CutFilament(uint8_t slot) { PlanGenericRequest(RequestMsg(RequestMsgCodes::Cut, slot)); } -void ProtocolLogic::ResetMMU() { - PlanGenericRequest(RequestMsg(RequestMsgCodes::Reset, 0)); +void ProtocolLogic::ResetMMU(uint8_t mode /* = 0 */) { + PlanGenericRequest(RequestMsg(RequestMsgCodes::Reset, mode)); } void ProtocolLogic::Button(uint8_t index) { diff --git a/Firmware/mmu2_protocol_logic.h b/Firmware/mmu2_protocol_logic.h index f96e91f40..53ec0002a 100644 --- a/Firmware/mmu2_protocol_logic.h +++ b/Firmware/mmu2_protocol_logic.h @@ -105,7 +105,7 @@ public: void LoadFilament(uint8_t slot); void EjectFilament(uint8_t slot); void CutFilament(uint8_t slot); - void ResetMMU(); + void ResetMMU(uint8_t mode = 0); void Button(uint8_t index); void Home(uint8_t mode); void ReadRegister(uint8_t address); diff --git a/Firmware/mmu2_supported_version.h b/Firmware/mmu2_supported_version.h index aa5faafee..d228323ff 100644 --- a/Firmware/mmu2_supported_version.h +++ b/Firmware/mmu2_supported_version.h @@ -5,6 +5,6 @@ namespace MMU2 { static constexpr uint8_t mmuVersionMajor = 2; static constexpr uint8_t mmuVersionMinor = 1; -static constexpr uint8_t mmuVersionPatch = 6; +static constexpr uint8_t mmuVersionPatch = 7; } // namespace MMU2