From f424da498a8fabf19a7bdabe23c6d843cd4a5191 Mon Sep 17 00:00:00 2001 From: vyacheslav-shubin Date: Sat, 24 Apr 2021 09:16:14 +0300 Subject: [PATCH] ExtUI::onPostprocessSettings (#21683) --- Marlin/src/lcd/extui/anycubic_chiron_lcd.cpp | 4 ++++ Marlin/src/lcd/extui/anycubic_i3mega_lcd.cpp | 4 ++++ Marlin/src/lcd/extui/dgus_lcd.cpp | 4 ++++ Marlin/src/lcd/extui/example.cpp | 4 ++++ Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/marlin_events.cpp | 4 ++++ Marlin/src/lcd/extui/malyan_lcd.cpp | 1 + Marlin/src/lcd/extui/nextion_lcd.cpp | 4 ++++ Marlin/src/lcd/extui/ui_api.h | 1 + Marlin/src/module/settings.cpp | 2 ++ 9 files changed, 28 insertions(+) diff --git a/Marlin/src/lcd/extui/anycubic_chiron_lcd.cpp b/Marlin/src/lcd/extui/anycubic_chiron_lcd.cpp index 10c791cbc5..2ec5104310 100644 --- a/Marlin/src/lcd/extui/anycubic_chiron_lcd.cpp +++ b/Marlin/src/lcd/extui/anycubic_chiron_lcd.cpp @@ -88,6 +88,10 @@ namespace ExtUI { // memcpy(&myDataStruct, buff, sizeof(myDataStruct)); } + void onPostprocessSettings() { + // Called after loading or resetting stored settings + } + void onConfigurationStoreWritten(bool success) { // Called after the entire EEPROM has been written, // whether successful or not. diff --git a/Marlin/src/lcd/extui/anycubic_i3mega_lcd.cpp b/Marlin/src/lcd/extui/anycubic_i3mega_lcd.cpp index a98da07959..fb66d1f68e 100644 --- a/Marlin/src/lcd/extui/anycubic_i3mega_lcd.cpp +++ b/Marlin/src/lcd/extui/anycubic_i3mega_lcd.cpp @@ -79,6 +79,10 @@ namespace ExtUI { // memcpy(&myDataStruct, buff, sizeof(myDataStruct)); } + void onPostprocessSettings() { + // Called after loading or resetting stored settings + } + void onConfigurationStoreWritten(bool success) { // Called after the entire EEPROM has been written, // whether successful or not. diff --git a/Marlin/src/lcd/extui/dgus_lcd.cpp b/Marlin/src/lcd/extui/dgus_lcd.cpp index 73542090c5..4776ceb154 100644 --- a/Marlin/src/lcd/extui/dgus_lcd.cpp +++ b/Marlin/src/lcd/extui/dgus_lcd.cpp @@ -98,6 +98,10 @@ namespace ExtUI { // memcpy(&myDataStruct, buff, sizeof(myDataStruct)); } + void onPostprocessSettings() { + // Called after loading or resetting stored settings + } + void onConfigurationStoreWritten(bool success) { // Called after the entire EEPROM has been written, // whether successful or not. diff --git a/Marlin/src/lcd/extui/example.cpp b/Marlin/src/lcd/extui/example.cpp index 38986fba73..8f00d26fd8 100644 --- a/Marlin/src/lcd/extui/example.cpp +++ b/Marlin/src/lcd/extui/example.cpp @@ -84,6 +84,10 @@ namespace ExtUI { // memcpy(&myDataStruct, buff, sizeof(myDataStruct)); } + void onPostprocessSettings() { + // Called after loading or resetting stored settings + } + void onConfigurationStoreWritten(bool success) { // Called after the entire EEPROM has been written, // whether successful or not. diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/marlin_events.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/marlin_events.cpp index 8193ec24d4..b3a9e42766 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/marlin_events.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/marlin_events.cpp @@ -113,6 +113,10 @@ namespace ExtUI { InterfaceSettingsScreen::loadSettings(buff); } + void onPostprocessSettings() { + // Called after loading or resetting stored settings + } + void onConfigurationStoreWritten(bool success) { #ifdef ARCHIM2_SPI_FLASH_EEPROM_BACKUP_SIZE if (success && InterfaceSettingsScreen::backupEEPROM()) { diff --git a/Marlin/src/lcd/extui/malyan_lcd.cpp b/Marlin/src/lcd/extui/malyan_lcd.cpp index c82ea76457..b4e2e328e4 100644 --- a/Marlin/src/lcd/extui/malyan_lcd.cpp +++ b/Marlin/src/lcd/extui/malyan_lcd.cpp @@ -519,6 +519,7 @@ namespace ExtUI { void onFactoryReset() {} void onStoreSettings(char*) {} void onLoadSettings(const char*) {} + void onPostprocessSettings() {} void onConfigurationStoreWritten(bool) {} void onConfigurationStoreRead(bool) {} diff --git a/Marlin/src/lcd/extui/nextion_lcd.cpp b/Marlin/src/lcd/extui/nextion_lcd.cpp index fa45f4ef51..2ec8eeb30e 100644 --- a/Marlin/src/lcd/extui/nextion_lcd.cpp +++ b/Marlin/src/lcd/extui/nextion_lcd.cpp @@ -75,6 +75,10 @@ namespace ExtUI { // memcpy(&myDataStruct, buff, sizeof(myDataStruct)); } + void onPostprocessSettings() { + // Called after loading or resetting stored settings + } + void onConfigurationStoreWritten(bool success) { // Called after the entire EEPROM has been written, // whether successful or not. diff --git a/Marlin/src/lcd/extui/ui_api.h b/Marlin/src/lcd/extui/ui_api.h index ba633741f7..04395bec4e 100644 --- a/Marlin/src/lcd/extui/ui_api.h +++ b/Marlin/src/lcd/extui/ui_api.h @@ -389,6 +389,7 @@ namespace ExtUI { void onFactoryReset(); void onStoreSettings(char *); void onLoadSettings(const char *); + void onPostprocessSettings(); void onConfigurationStoreWritten(bool success); void onConfigurationStoreRead(bool success); #if ENABLED(POWER_LOSS_RECOVERY) diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index 4273c4b062..13c01954a0 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -533,6 +533,8 @@ void MarlinSettings::postprocess() { TERN_(CASELIGHT_USES_BRIGHTNESS, caselight.update_brightness()); + TERN_(EXTENSIBLE_UI, ExtUI::onPostprocessSettings()); + // Refresh steps_to_mm with the reciprocal of axis_steps_per_mm // and init stepper.count[], planner.position[] with current_position planner.refresh_positioning();