🧑‍💻 ExtUI::onSetPowerLoss

This commit is contained in:
Scott Lahteine 2023-03-22 03:22:29 -05:00
parent 2ecd4cca1b
commit 91b5015a8b
11 changed files with 49 additions and 20 deletions

View file

@ -113,6 +113,7 @@ void PrintJobRecovery::changed() {
purge(); purge();
else if (IS_SD_PRINTING()) else if (IS_SD_PRINTING())
save(true); save(true);
TERN_(EXTENSIBLE_UI, ExtUI::onSetPowerLoss(onoff));
} }
/** /**

View file

@ -94,12 +94,12 @@ namespace ExtUI {
// Called after loading or resetting stored settings // Called after loading or resetting stored settings
} }
void onSettingsStored(bool success) { void onSettingsStored(const bool success) {
// Called after the entire EEPROM has been written, // Called after the entire EEPROM has been written,
// whether successful or not. // whether successful or not.
} }
void onSettingsLoaded(bool success) { void onSettingsLoaded(const bool success) {
// Called after the entire EEPROM has been read, // Called after the entire EEPROM has been read,
// whether successful or not. // whether successful or not.
} }
@ -120,6 +120,9 @@ namespace ExtUI {
#endif #endif
#if ENABLED(POWER_LOSS_RECOVERY) #if ENABLED(POWER_LOSS_RECOVERY)
void onSetPowerLoss(const bool onoff) {
// Called when power-loss is enabled/disabled
}
void onPowerLoss() { void onPowerLoss() {
// Called when power-loss state is detected // Called when power-loss state is detected
} }

View file

@ -81,12 +81,12 @@ namespace ExtUI {
// Called after loading or resetting stored settings // Called after loading or resetting stored settings
} }
void onSettingsStored(bool success) { void onSettingsStored(const bool success) {
// Called after the entire EEPROM has been written, // Called after the entire EEPROM has been written,
// whether successful or not. // whether successful or not.
} }
void onSettingsLoaded(bool success) { void onSettingsLoaded(const bool success) {
// Called after the entire EEPROM has been read, // Called after the entire EEPROM has been read,
// whether successful or not. // whether successful or not.
} }
@ -106,6 +106,9 @@ namespace ExtUI {
#endif #endif
#if ENABLED(POWER_LOSS_RECOVERY) #if ENABLED(POWER_LOSS_RECOVERY)
void onSetPowerLoss(const bool onoff) {
// Called when power-loss is enabled/disabled
}
void onPowerLoss() { void onPowerLoss() {
// Called when power-loss state is detected // Called when power-loss state is detected
} }

View file

@ -102,12 +102,12 @@ namespace ExtUI {
// Called after loading or resetting stored settings // Called after loading or resetting stored settings
} }
void onSettingsStored(bool success) { void onSettingsStored(const bool success) {
// Called after the entire EEPROM has been written, // Called after the entire EEPROM has been written,
// whether successful or not. // whether successful or not.
} }
void onSettingsLoaded(bool success) { void onSettingsLoaded(const bool success) {
// Called after the entire EEPROM has been read, // Called after the entire EEPROM has been read,
// whether successful or not. // whether successful or not.
} }
@ -126,6 +126,9 @@ namespace ExtUI {
#endif #endif
#if ENABLED(POWER_LOSS_RECOVERY) #if ENABLED(POWER_LOSS_RECOVERY)
void onSetPowerLoss(const bool onoff) {
// Called when power-loss is enabled/disabled
}
void onPowerLoss() { void onPowerLoss() {
// Called when power-loss state is detected // Called when power-loss state is detected
} }

View file

@ -100,11 +100,11 @@ namespace ExtUI {
void onPostprocessSettings() {} void onPostprocessSettings() {}
void onSettingsStored(bool success) { void onSettingsStored(const bool success) {
dgus_screen_handler.ConfigurationStoreWritten(success); dgus_screen_handler.ConfigurationStoreWritten(success);
} }
void onSettingsLoaded(bool success) { void onSettingsLoaded(const bool success) {
dgus_screen_handler.ConfigurationStoreRead(success); dgus_screen_handler.ConfigurationStoreRead(success);
} }
@ -123,6 +123,9 @@ namespace ExtUI {
#endif #endif
#if ENABLED(POWER_LOSS_RECOVERY) #if ENABLED(POWER_LOSS_RECOVERY)
void onSetPowerLoss(const bool onoff) {
// Called when power-loss is enabled/disabled
}
void onPowerLoss() { void onPowerLoss() {
// Called when power-loss state is detected // Called when power-loss state is detected
} }

View file

@ -88,12 +88,12 @@ namespace ExtUI {
// Called after loading or resetting stored settings // Called after loading or resetting stored settings
} }
void onSettingsStored(bool success) { void onSettingsStored(const bool success) {
// Called after the entire EEPROM has been written, // Called after the entire EEPROM has been written,
// whether successful or not. // whether successful or not.
} }
void onSettingsLoaded(bool success) { void onSettingsLoaded(const bool success) {
// Called after the entire EEPROM has been read, // Called after the entire EEPROM has been read,
// whether successful or not. // whether successful or not.
} }
@ -112,6 +112,9 @@ namespace ExtUI {
#endif #endif
#if ENABLED(POWER_LOSS_RECOVERY) #if ENABLED(POWER_LOSS_RECOVERY)
void onSetPowerLoss(const bool onoff) {
// Called when power-loss is enabled/disabled
}
void onPowerLoss() { void onPowerLoss() {
// Called when power-loss state is detected // Called when power-loss state is detected
} }

View file

@ -97,7 +97,7 @@ namespace ExtUI {
void onLoadSettings(const char *buff) { InterfaceSettingsScreen::loadSettings(buff); } void onLoadSettings(const char *buff) { InterfaceSettingsScreen::loadSettings(buff); }
void onPostprocessSettings() {} // Called after loading or resetting stored settings void onPostprocessSettings() {} // Called after loading or resetting stored settings
void onSettingsStored(bool success) { void onSettingsStored(const bool success) {
#ifdef ARCHIM2_SPI_FLASH_EEPROM_BACKUP_SIZE #ifdef ARCHIM2_SPI_FLASH_EEPROM_BACKUP_SIZE
if (success && InterfaceSettingsScreen::backupEEPROM()) { if (success && InterfaceSettingsScreen::backupEEPROM()) {
SERIAL_ECHOLNPGM("EEPROM backed up to SPI Flash"); SERIAL_ECHOLNPGM("EEPROM backed up to SPI Flash");
@ -106,7 +106,7 @@ namespace ExtUI {
UNUSED(success); UNUSED(success);
#endif #endif
} }
void onSettingsLoaded(bool) {} void onSettingsLoaded(const bool) {}
void onPlayTone(const uint16_t frequency, const uint16_t duration) { sound.play_tone(frequency, duration); } void onPlayTone(const uint16_t frequency, const uint16_t duration) { sound.play_tone(frequency, duration); }
@ -125,6 +125,9 @@ namespace ExtUI {
#endif #endif
#if ENABLED(POWER_LOSS_RECOVERY) #if ENABLED(POWER_LOSS_RECOVERY)
void onSetPowerLoss(const bool onoff) {
// Called when power-loss is enabled/disabled
}
void onPowerLoss() { void onPowerLoss() {
// Called when power-loss state is detected // Called when power-loss state is detected
} }

View file

@ -1995,12 +1995,12 @@ namespace ExtUI {
SetTouchScreenConfiguration(); SetTouchScreenConfiguration();
} }
void onSettingsStored(bool success) { void onSettingsStored(const bool success) {
// This is called after the entire EEPROM has been written, // This is called after the entire EEPROM has been written,
// whether successful or not. // whether successful or not.
} }
void onSettingsLoaded(bool success) { void onSettingsLoaded(const bool success) {
#if HAS_MESH #if HAS_MESH
if (ExtUI::getMeshValid()) { if (ExtUI::getMeshValid()) {
uint8_t abl_probe_index = 0; uint8_t abl_probe_index = 0;
@ -2026,6 +2026,9 @@ namespace ExtUI {
} }
#if ENABLED(POWER_LOSS_RECOVERY) #if ENABLED(POWER_LOSS_RECOVERY)
void onSetPowerLoss(const bool onoff) {
// Called when power-loss is enabled/disabled
}
void onPowerLoss() { void onPowerLoss() {
// Called when power-loss state is detected // Called when power-loss state is detected
} }

View file

@ -147,8 +147,8 @@ namespace ExtUI {
void onStoreSettings(char*) {} void onStoreSettings(char*) {}
void onLoadSettings(const char*) {} void onLoadSettings(const char*) {}
void onPostprocessSettings() {} void onPostprocessSettings() {}
void onSettingsStored(bool) {} void onSettingsStored(const bool) {}
void onSettingsLoaded(bool) {} void onSettingsLoaded(const bool) {}
#if HAS_MESH #if HAS_MESH
void onLevelingStart() {} void onLevelingStart() {}
@ -158,6 +158,9 @@ namespace ExtUI {
#endif #endif
#if ENABLED(POWER_LOSS_RECOVERY) #if ENABLED(POWER_LOSS_RECOVERY)
void onSetPowerLoss(const bool onoff) {
// Called when power-loss is enabled/disabled
}
void onPowerLoss() { void onPowerLoss() {
// Called when power-loss state is detected // Called when power-loss state is detected
} }

View file

@ -79,12 +79,12 @@ namespace ExtUI {
// Called after loading or resetting stored settings // Called after loading or resetting stored settings
} }
void onSettingsStored(bool success) { void onSettingsStored(const bool success) {
// Called after the entire EEPROM has been written, // Called after the entire EEPROM has been written,
// whether successful or not. // whether successful or not.
} }
void onSettingsLoaded(bool success) { void onSettingsLoaded(const bool success) {
// Called after the entire EEPROM has been read, // Called after the entire EEPROM has been read,
// whether successful or not. // whether successful or not.
} }
@ -103,6 +103,9 @@ namespace ExtUI {
#endif #endif
#if ENABLED(POWER_LOSS_RECOVERY) #if ENABLED(POWER_LOSS_RECOVERY)
void onSetPowerLoss(const bool onoff) {
// Called when power-loss is enabled/disabled
}
void onPowerLoss() { void onPowerLoss() {
// Called when power-loss state is detected // Called when power-loss state is detected
} }

View file

@ -423,9 +423,10 @@ namespace ExtUI {
void onStoreSettings(char *); void onStoreSettings(char *);
void onLoadSettings(const char *); void onLoadSettings(const char *);
void onPostprocessSettings(); void onPostprocessSettings();
void onSettingsStored(bool success); void onSettingsStored(const bool success);
void onSettingsLoaded(bool success); void onSettingsLoaded(const bool success);
#if ENABLED(POWER_LOSS_RECOVERY) #if ENABLED(POWER_LOSS_RECOVERY)
void onSetPowerLoss(const bool onoff);
void onPowerLoss(); void onPowerLoss();
void onPowerLossResume(); void onPowerLossResume();
#endif #endif