From 91b5015a8b3ec5efd1052fdf7208124ff8b4120b Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 22 Mar 2023 03:22:29 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20ExtUI::onSe?= =?UTF-8?q?tPowerLoss?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/feature/powerloss.cpp | 1 + Marlin/src/lcd/extui/anycubic_chiron/chiron_extui.cpp | 7 +++++-- Marlin/src/lcd/extui/anycubic_i3mega/anycubic_extui.cpp | 7 +++++-- Marlin/src/lcd/extui/dgus/dgus_extui.cpp | 7 +++++-- Marlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp | 7 +++++-- Marlin/src/lcd/extui/example/example.cpp | 7 +++++-- Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_extui.cpp | 7 +++++-- Marlin/src/lcd/extui/ia_creality/creality_extui.cpp | 7 +++++-- Marlin/src/lcd/extui/malyan/malyan_extui.cpp | 7 +++++-- Marlin/src/lcd/extui/nextion/nextion_extui.cpp | 7 +++++-- Marlin/src/lcd/extui/ui_api.h | 5 +++-- 11 files changed, 49 insertions(+), 20 deletions(-) diff --git a/Marlin/src/feature/powerloss.cpp b/Marlin/src/feature/powerloss.cpp index faec893928e6..dd20d0427866 100644 --- a/Marlin/src/feature/powerloss.cpp +++ b/Marlin/src/feature/powerloss.cpp @@ -113,6 +113,7 @@ void PrintJobRecovery::changed() { purge(); else if (IS_SD_PRINTING()) save(true); + TERN_(EXTENSIBLE_UI, ExtUI::onSetPowerLoss(onoff)); } /** diff --git a/Marlin/src/lcd/extui/anycubic_chiron/chiron_extui.cpp b/Marlin/src/lcd/extui/anycubic_chiron/chiron_extui.cpp index 39b328d80814..520ca587e335 100644 --- a/Marlin/src/lcd/extui/anycubic_chiron/chiron_extui.cpp +++ b/Marlin/src/lcd/extui/anycubic_chiron/chiron_extui.cpp @@ -94,12 +94,12 @@ namespace ExtUI { // Called after loading or resetting stored settings } - void onSettingsStored(bool success) { + void onSettingsStored(const bool success) { // Called after the entire EEPROM has been written, // whether successful or not. } - void onSettingsLoaded(bool success) { + void onSettingsLoaded(const bool success) { // Called after the entire EEPROM has been read, // whether successful or not. } @@ -120,6 +120,9 @@ namespace ExtUI { #endif #if ENABLED(POWER_LOSS_RECOVERY) + void onSetPowerLoss(const bool onoff) { + // Called when power-loss is enabled/disabled + } void onPowerLoss() { // Called when power-loss state is detected } diff --git a/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_extui.cpp b/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_extui.cpp index afe88bf583d0..a2ad678ac62e 100644 --- a/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_extui.cpp +++ b/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_extui.cpp @@ -81,12 +81,12 @@ namespace ExtUI { // Called after loading or resetting stored settings } - void onSettingsStored(bool success) { + void onSettingsStored(const bool success) { // Called after the entire EEPROM has been written, // whether successful or not. } - void onSettingsLoaded(bool success) { + void onSettingsLoaded(const bool success) { // Called after the entire EEPROM has been read, // whether successful or not. } @@ -106,6 +106,9 @@ namespace ExtUI { #endif #if ENABLED(POWER_LOSS_RECOVERY) + void onSetPowerLoss(const bool onoff) { + // Called when power-loss is enabled/disabled + } void onPowerLoss() { // Called when power-loss state is detected } diff --git a/Marlin/src/lcd/extui/dgus/dgus_extui.cpp b/Marlin/src/lcd/extui/dgus/dgus_extui.cpp index 2f3bbd64cc42..2fe4e03016b5 100644 --- a/Marlin/src/lcd/extui/dgus/dgus_extui.cpp +++ b/Marlin/src/lcd/extui/dgus/dgus_extui.cpp @@ -102,12 +102,12 @@ namespace ExtUI { // Called after loading or resetting stored settings } - void onSettingsStored(bool success) { + void onSettingsStored(const bool success) { // Called after the entire EEPROM has been written, // whether successful or not. } - void onSettingsLoaded(bool success) { + void onSettingsLoaded(const bool success) { // Called after the entire EEPROM has been read, // whether successful or not. } @@ -126,6 +126,9 @@ namespace ExtUI { #endif #if ENABLED(POWER_LOSS_RECOVERY) + void onSetPowerLoss(const bool onoff) { + // Called when power-loss is enabled/disabled + } void onPowerLoss() { // Called when power-loss state is detected } diff --git a/Marlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp b/Marlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp index 9aecf65f984b..fb8ef8cc8458 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp @@ -100,11 +100,11 @@ namespace ExtUI { void onPostprocessSettings() {} - void onSettingsStored(bool success) { + void onSettingsStored(const bool success) { dgus_screen_handler.ConfigurationStoreWritten(success); } - void onSettingsLoaded(bool success) { + void onSettingsLoaded(const bool success) { dgus_screen_handler.ConfigurationStoreRead(success); } @@ -123,6 +123,9 @@ namespace ExtUI { #endif #if ENABLED(POWER_LOSS_RECOVERY) + void onSetPowerLoss(const bool onoff) { + // Called when power-loss is enabled/disabled + } void onPowerLoss() { // Called when power-loss state is detected } diff --git a/Marlin/src/lcd/extui/example/example.cpp b/Marlin/src/lcd/extui/example/example.cpp index a5e816efd85c..83b7a0a3cabc 100644 --- a/Marlin/src/lcd/extui/example/example.cpp +++ b/Marlin/src/lcd/extui/example/example.cpp @@ -88,12 +88,12 @@ namespace ExtUI { // Called after loading or resetting stored settings } - void onSettingsStored(bool success) { + void onSettingsStored(const bool success) { // Called after the entire EEPROM has been written, // whether successful or not. } - void onSettingsLoaded(bool success) { + void onSettingsLoaded(const bool success) { // Called after the entire EEPROM has been read, // whether successful or not. } @@ -112,6 +112,9 @@ namespace ExtUI { #endif #if ENABLED(POWER_LOSS_RECOVERY) + void onSetPowerLoss(const bool onoff) { + // Called when power-loss is enabled/disabled + } void onPowerLoss() { // Called when power-loss state is detected } diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_extui.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_extui.cpp index 159847bde19c..b82b4a07bd7f 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_extui.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_extui.cpp @@ -97,7 +97,7 @@ namespace ExtUI { void onLoadSettings(const char *buff) { InterfaceSettingsScreen::loadSettings(buff); } 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 if (success && InterfaceSettingsScreen::backupEEPROM()) { SERIAL_ECHOLNPGM("EEPROM backed up to SPI Flash"); @@ -106,7 +106,7 @@ namespace ExtUI { UNUSED(success); #endif } - void onSettingsLoaded(bool) {} + void onSettingsLoaded(const bool) {} void onPlayTone(const uint16_t frequency, const uint16_t duration) { sound.play_tone(frequency, duration); } @@ -125,6 +125,9 @@ namespace ExtUI { #endif #if ENABLED(POWER_LOSS_RECOVERY) + void onSetPowerLoss(const bool onoff) { + // Called when power-loss is enabled/disabled + } void onPowerLoss() { // Called when power-loss state is detected } diff --git a/Marlin/src/lcd/extui/ia_creality/creality_extui.cpp b/Marlin/src/lcd/extui/ia_creality/creality_extui.cpp index c9c064fdc86e..d92517578f68 100644 --- a/Marlin/src/lcd/extui/ia_creality/creality_extui.cpp +++ b/Marlin/src/lcd/extui/ia_creality/creality_extui.cpp @@ -1995,12 +1995,12 @@ namespace ExtUI { SetTouchScreenConfiguration(); } - void onSettingsStored(bool success) { + void onSettingsStored(const bool success) { // This is called after the entire EEPROM has been written, // whether successful or not. } - void onSettingsLoaded(bool success) { + void onSettingsLoaded(const bool success) { #if HAS_MESH if (ExtUI::getMeshValid()) { uint8_t abl_probe_index = 0; @@ -2026,6 +2026,9 @@ namespace ExtUI { } #if ENABLED(POWER_LOSS_RECOVERY) + void onSetPowerLoss(const bool onoff) { + // Called when power-loss is enabled/disabled + } void onPowerLoss() { // Called when power-loss state is detected } diff --git a/Marlin/src/lcd/extui/malyan/malyan_extui.cpp b/Marlin/src/lcd/extui/malyan/malyan_extui.cpp index b978937defd0..8bffa442b68c 100644 --- a/Marlin/src/lcd/extui/malyan/malyan_extui.cpp +++ b/Marlin/src/lcd/extui/malyan/malyan_extui.cpp @@ -147,8 +147,8 @@ namespace ExtUI { void onStoreSettings(char*) {} void onLoadSettings(const char*) {} void onPostprocessSettings() {} - void onSettingsStored(bool) {} - void onSettingsLoaded(bool) {} + void onSettingsStored(const bool) {} + void onSettingsLoaded(const bool) {} #if HAS_MESH void onLevelingStart() {} @@ -158,6 +158,9 @@ namespace ExtUI { #endif #if ENABLED(POWER_LOSS_RECOVERY) + void onSetPowerLoss(const bool onoff) { + // Called when power-loss is enabled/disabled + } void onPowerLoss() { // Called when power-loss state is detected } diff --git a/Marlin/src/lcd/extui/nextion/nextion_extui.cpp b/Marlin/src/lcd/extui/nextion/nextion_extui.cpp index 433bbfbe8b88..bf40fe97ac71 100644 --- a/Marlin/src/lcd/extui/nextion/nextion_extui.cpp +++ b/Marlin/src/lcd/extui/nextion/nextion_extui.cpp @@ -79,12 +79,12 @@ namespace ExtUI { // Called after loading or resetting stored settings } - void onSettingsStored(bool success) { + void onSettingsStored(const bool success) { // Called after the entire EEPROM has been written, // whether successful or not. } - void onSettingsLoaded(bool success) { + void onSettingsLoaded(const bool success) { // Called after the entire EEPROM has been read, // whether successful or not. } @@ -103,6 +103,9 @@ namespace ExtUI { #endif #if ENABLED(POWER_LOSS_RECOVERY) + void onSetPowerLoss(const bool onoff) { + // Called when power-loss is enabled/disabled + } void onPowerLoss() { // Called when power-loss state is detected } diff --git a/Marlin/src/lcd/extui/ui_api.h b/Marlin/src/lcd/extui/ui_api.h index 46f0891bb706..98441ccdd9d5 100644 --- a/Marlin/src/lcd/extui/ui_api.h +++ b/Marlin/src/lcd/extui/ui_api.h @@ -423,9 +423,10 @@ namespace ExtUI { void onStoreSettings(char *); void onLoadSettings(const char *); void onPostprocessSettings(); - void onSettingsStored(bool success); - void onSettingsLoaded(bool success); + void onSettingsStored(const bool success); + void onSettingsLoaded(const bool success); #if ENABLED(POWER_LOSS_RECOVERY) + void onSetPowerLoss(const bool onoff); void onPowerLoss(); void onPowerLossResume(); #endif