Optimize Power-Loss Recovery (#12440)
This commit is contained in:
@ -37,7 +37,7 @@
|
||||
*/
|
||||
|
||||
// Change EEPROM version if the structure changes
|
||||
#define EEPROM_VERSION "V62"
|
||||
#define EEPROM_VERSION "V63"
|
||||
#define EEPROM_OFFSET 100
|
||||
|
||||
// Check the integrity of data offsets.
|
||||
@ -82,6 +82,11 @@
|
||||
#endif
|
||||
|
||||
#include "../feature/fwretract.h"
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
#include "../feature/power_loss_recovery.h"
|
||||
#endif
|
||||
|
||||
#include "../feature/pause.h"
|
||||
|
||||
#if EXTRUDERS > 1
|
||||
@ -221,6 +226,11 @@ typedef struct SettingsDataStruct {
|
||||
//
|
||||
int16_t lcd_contrast; // M250 C
|
||||
|
||||
//
|
||||
// POWER_LOSS_RECOVERY
|
||||
//
|
||||
bool recovery_enabled; // M413 S
|
||||
|
||||
//
|
||||
// FWRETRACT
|
||||
//
|
||||
@ -269,7 +279,7 @@ typedef struct SettingsDataStruct {
|
||||
// Tool-change settings
|
||||
//
|
||||
#if EXTRUDERS > 1
|
||||
toolchange_settings_t toolchange_settings; // M217 S P R
|
||||
toolchange_settings_t toolchange_settings; // M217 S P R
|
||||
#endif
|
||||
|
||||
} SettingsData;
|
||||
@ -746,6 +756,22 @@ void MarlinSettings::postprocess() {
|
||||
EEPROM_WRITE(lcd_contrast);
|
||||
}
|
||||
|
||||
//
|
||||
// Power-Loss Recovery
|
||||
//
|
||||
{
|
||||
_FIELD_TEST(recovery_enabled);
|
||||
|
||||
const bool recovery_enabled =
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
recovery.enabled
|
||||
#else
|
||||
true
|
||||
#endif
|
||||
;
|
||||
EEPROM_WRITE(recovery_enabled);
|
||||
}
|
||||
|
||||
//
|
||||
// Firmware Retraction
|
||||
//
|
||||
@ -1387,6 +1413,20 @@ void MarlinSettings::postprocess() {
|
||||
#endif
|
||||
}
|
||||
|
||||
//
|
||||
// Power-Loss Recovery
|
||||
//
|
||||
{
|
||||
_FIELD_TEST(recovery_enabled);
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
EEPROM_READ(recovery.enabled);
|
||||
#else
|
||||
bool recovery_enabled;
|
||||
EEPROM_READ(recovery_enabled);
|
||||
#endif
|
||||
}
|
||||
|
||||
//
|
||||
// Firmware Retraction
|
||||
//
|
||||
@ -2075,6 +2115,10 @@ void MarlinSettings::reset(PORTARG_SOLO) {
|
||||
ui.set_contrast(DEFAULT_LCD_CONTRAST);
|
||||
#endif
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
recovery.enable(true);
|
||||
#endif
|
||||
|
||||
#if ENABLED(FWRETRACT)
|
||||
fwretract.reset();
|
||||
#endif
|
||||
@ -2643,6 +2687,15 @@ void MarlinSettings::reset(PORTARG_SOLO) {
|
||||
SERIAL_ECHOLNPAIR_P(port, " M250 C", ui.contrast);
|
||||
#endif
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
if (!forReplay) {
|
||||
CONFIG_ECHO_START;
|
||||
SERIAL_ECHOLNPGM_P(port, "Power-Loss Recovery:");
|
||||
}
|
||||
CONFIG_ECHO_START;
|
||||
SERIAL_ECHOLNPAIR_P(port, " M413 S", int(recovery.enabled));
|
||||
#endif
|
||||
|
||||
#if ENABLED(FWRETRACT)
|
||||
|
||||
if (!forReplay) {
|
||||
@ -2683,7 +2736,7 @@ void MarlinSettings::reset(PORTARG_SOLO) {
|
||||
#if HAS_BED_PROBE
|
||||
if (!forReplay) {
|
||||
CONFIG_ECHO_START;
|
||||
SERIAL_ECHOPGM_P(port, "Z-Probe Offset (mm):");
|
||||
SERIAL_ECHOPGM_P(port, "Z-Probe Offset");
|
||||
SAY_UNITS_P(port, true);
|
||||
}
|
||||
CONFIG_ECHO_START;
|
||||
|
Reference in New Issue
Block a user