mmu: add DisableMMUInSettings
power_on should not be modifying EEPROM_MMU_ENABLED. The code is never executed unless it's already been set. Only disable EEPROM_MMU_ENABLED through Buttons::DisableMMU Change in memory: Flash: -18 bytes SRAM: 0 bytes
This commit is contained in:
parent
cd3372dc92
commit
ef33db9a71
|
|
@ -69,7 +69,7 @@ void MMU2::Start() {
|
||||||
|
|
||||||
void MMU2::Stop() {
|
void MMU2::Stop() {
|
||||||
StopKeepPowered();
|
StopKeepPowered();
|
||||||
PowerOff(); // This also disables the MMU in the EEPROM.
|
PowerOff();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MMU2::StopKeepPowered() {
|
void MMU2::StopKeepPowered() {
|
||||||
|
|
@ -125,11 +125,9 @@ void MMU2::TriggerResetPin() {
|
||||||
void MMU2::PowerCycle() {
|
void MMU2::PowerCycle() {
|
||||||
// cut the power to the MMU and after a while restore it
|
// cut the power to the MMU and after a while restore it
|
||||||
// Sadly, MK3/S/+ cannot do this
|
// Sadly, MK3/S/+ cannot do this
|
||||||
// NOTE: the below will toggle the EEPROM var. Should we
|
Stop();
|
||||||
// assert this function is never called in the MK3 FW? Do we even care?
|
|
||||||
PowerOff();
|
|
||||||
safe_delay_keep_alive(1000);
|
safe_delay_keep_alive(1000);
|
||||||
PowerOn();
|
Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MMU2::PowerOff() {
|
void MMU2::PowerOff() {
|
||||||
|
|
@ -735,7 +733,8 @@ void MMU2::CheckUserInput() {
|
||||||
// ... but mmu2_power.cpp knows this and triggers a soft-reset instead.
|
// ... but mmu2_power.cpp knows this and triggers a soft-reset instead.
|
||||||
break;
|
break;
|
||||||
case Buttons::DisableMMU:
|
case Buttons::DisableMMU:
|
||||||
Stop(); // Poweroff handles updating the EEPROM shutoff.
|
Stop();
|
||||||
|
DisableMMUInSettings();
|
||||||
break;
|
break;
|
||||||
case Buttons::StopPrint:
|
case Buttons::StopPrint:
|
||||||
// @@TODO not sure if we shall handle this high level operation at this spot
|
// @@TODO not sure if we shall handle this high level operation at this spot
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@
|
||||||
#include "fastio.h"
|
#include "fastio.h"
|
||||||
#include <util/delay.h>
|
#include <util/delay.h>
|
||||||
#include "mmu2.h"
|
#include "mmu2.h"
|
||||||
#include "eeprom.h"
|
|
||||||
|
|
||||||
namespace MMU2 {
|
namespace MMU2 {
|
||||||
|
|
||||||
|
|
@ -16,13 +15,10 @@ void power_on() {
|
||||||
SET_OUTPUT(MMU_RST_PIN); // setup reset pin
|
SET_OUTPUT(MMU_RST_PIN); // setup reset pin
|
||||||
#endif //MMU_HWRESET
|
#endif //MMU_HWRESET
|
||||||
|
|
||||||
eeprom_update_byte((uint8_t *)EEPROM_MMU_ENABLED, true);
|
|
||||||
|
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void power_off() {
|
void power_off() {
|
||||||
eeprom_update_byte((uint8_t *)EEPROM_MMU_ENABLED, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void reset() {
|
void reset() {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
#include <avr/pgmspace.h>
|
#include <avr/pgmspace.h>
|
||||||
|
#include "eeprom.h"
|
||||||
#include "mmu2.h"
|
#include "mmu2.h"
|
||||||
#include "mmu2_log.h"
|
#include "mmu2_log.h"
|
||||||
#include "mmu2_reporting.h"
|
#include "mmu2_reporting.h"
|
||||||
|
|
@ -344,6 +345,11 @@ void TryLoadUnloadReporter::DumpToSerial(){
|
||||||
MMU2_ECHO_MSGLN(buf);
|
MMU2_ECHO_MSGLN(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Disables MMU in EEPROM
|
||||||
|
void DisableMMUInSettings() {
|
||||||
|
eeprom_update_byte((uint8_t *)EEPROM_MMU_ENABLED, false);
|
||||||
|
}
|
||||||
|
|
||||||
void IncrementLoadFails(){
|
void IncrementLoadFails(){
|
||||||
eeprom_increment_byte((uint8_t *)EEPROM_MMU_LOAD_FAIL);
|
eeprom_increment_byte((uint8_t *)EEPROM_MMU_LOAD_FAIL);
|
||||||
eeprom_increment_word((uint16_t *)EEPROM_MMU_LOAD_FAIL_TOT);
|
eeprom_increment_word((uint16_t *)EEPROM_MMU_LOAD_FAIL_TOT);
|
||||||
|
|
|
||||||
|
|
@ -84,6 +84,9 @@ bool MMUAvailable();
|
||||||
/// Global Enable/Disable use MMU (to be stored in EEPROM)
|
/// Global Enable/Disable use MMU (to be stored in EEPROM)
|
||||||
bool UseMMU();
|
bool UseMMU();
|
||||||
|
|
||||||
|
/// Disables MMU in EEPROM
|
||||||
|
void DisableMMUInSettings();
|
||||||
|
|
||||||
/// Increments EEPROM cell - number of failed loads into the nozzle
|
/// Increments EEPROM cell - number of failed loads into the nozzle
|
||||||
/// Note: technically, this is not an MMU error but an error of the printer.
|
/// Note: technically, this is not an MMU error but an error of the printer.
|
||||||
void IncrementLoadFails();
|
void IncrementLoadFails();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue