diff --git a/Firmware/mmu2.cpp b/Firmware/mmu2.cpp index 442f2ef32..6bd6f1605 100644 --- a/Firmware/mmu2.cpp +++ b/Firmware/mmu2.cpp @@ -69,7 +69,7 @@ void MMU2::Start() { void MMU2::Stop() { StopKeepPowered(); - PowerOff(); // This also disables the MMU in the EEPROM. + PowerOff(); } void MMU2::StopKeepPowered() { @@ -125,11 +125,9 @@ void MMU2::TriggerResetPin() { void MMU2::PowerCycle() { // cut the power to the MMU and after a while restore it // Sadly, MK3/S/+ cannot do this - // NOTE: the below will toggle the EEPROM var. Should we - // assert this function is never called in the MK3 FW? Do we even care? - PowerOff(); + Stop(); safe_delay_keep_alive(1000); - PowerOn(); + Start(); } void MMU2::PowerOff() { @@ -735,7 +733,8 @@ void MMU2::CheckUserInput() { // ... but mmu2_power.cpp knows this and triggers a soft-reset instead. break; case Buttons::DisableMMU: - Stop(); // Poweroff handles updating the EEPROM shutoff. + Stop(); + DisableMMUInSettings(); break; case Buttons::StopPrint: // @@TODO not sure if we shall handle this high level operation at this spot diff --git a/Firmware/mmu2_power.cpp b/Firmware/mmu2_power.cpp index 14f119156..4db6be1bc 100644 --- a/Firmware/mmu2_power.cpp +++ b/Firmware/mmu2_power.cpp @@ -4,7 +4,6 @@ #include "fastio.h" #include #include "mmu2.h" -#include "eeprom.h" namespace MMU2 { @@ -16,13 +15,10 @@ void power_on() { SET_OUTPUT(MMU_RST_PIN); // setup reset pin #endif //MMU_HWRESET - eeprom_update_byte((uint8_t *)EEPROM_MMU_ENABLED, true); - reset(); } void power_off() { - eeprom_update_byte((uint8_t *)EEPROM_MMU_ENABLED, false); } void reset() { diff --git a/Firmware/mmu2_reporting.cpp b/Firmware/mmu2_reporting.cpp index 5bbf4e60a..e6ae89b20 100644 --- a/Firmware/mmu2_reporting.cpp +++ b/Firmware/mmu2_reporting.cpp @@ -1,4 +1,5 @@ #include +#include "eeprom.h" #include "mmu2.h" #include "mmu2_log.h" #include "mmu2_reporting.h" @@ -344,6 +345,11 @@ void TryLoadUnloadReporter::DumpToSerial(){ MMU2_ECHO_MSGLN(buf); } +/// Disables MMU in EEPROM +void DisableMMUInSettings() { + eeprom_update_byte((uint8_t *)EEPROM_MMU_ENABLED, false); +} + void IncrementLoadFails(){ eeprom_increment_byte((uint8_t *)EEPROM_MMU_LOAD_FAIL); eeprom_increment_word((uint16_t *)EEPROM_MMU_LOAD_FAIL_TOT); diff --git a/Firmware/mmu2_reporting.h b/Firmware/mmu2_reporting.h index 9429ecbac..927c2b20b 100644 --- a/Firmware/mmu2_reporting.h +++ b/Firmware/mmu2_reporting.h @@ -84,6 +84,9 @@ bool MMUAvailable(); /// Global Enable/Disable use MMU (to be stored in EEPROM) bool UseMMU(); +/// Disables MMU in EEPROM +void DisableMMUInSettings(); + /// Increments EEPROM cell - number of failed loads into the nozzle /// Note: technically, this is not an MMU error but an error of the printer. void IncrementLoadFails();