diff --git a/Marlin/src/module/configuration_store.cpp b/Marlin/src/module/configuration_store.cpp index d80fe5019..2ecc9299c 100644 --- a/Marlin/src/module/configuration_store.cpp +++ b/Marlin/src/module/configuration_store.cpp @@ -127,6 +127,11 @@ void M710_report(const bool forReplay); #endif +#define HAS_CASE_LIGHT_BRIGHTNESS (ENABLED(CASE_LIGHT_MENU) && DISABLED(CASE_LIGHT_NO_BRIGHTNESS)) +#if HAS_CASE_LIGHT_BRIGHTNESS + #include "../feature/caselight.h" +#endif + #pragma pack(push, 1) // No padding between variables typedef struct { uint16_t X, Y, Z, X2, Y2, Z2, Z3, Z4, E0, E1, E2, E3, E4, E5; } tmc_stepper_current_t; @@ -376,6 +381,13 @@ typedef struct SettingsDataStruct { uint8_t extui_data[ExtUI::eeprom_data_size]; #endif + // + // HAS_CASE_LIGHT_BRIGHTNESS + // + #if HAS_CASE_LIGHT_BRIGHTNESS + uint8_t case_light_brightness; + #endif + } SettingsData; //static_assert(sizeof(SettingsData) <= E2END + 1, "EEPROM too small to contain SettingsData!"); @@ -441,6 +453,10 @@ void MarlinSettings::postprocess() { planner.recalculate_max_e_jerk(); #endif + #if HAS_CASE_LIGHT_BRIGHTNESS + update_case_light(); + #endif + // Refresh steps_to_mm with the reciprocal of axis_steps_per_mm // and init stepper.count[], planner.position[] with current_position planner.refresh_positioning(); @@ -1309,6 +1325,13 @@ void MarlinSettings::postprocess() { } #endif + // + // Case Light Brightness + // + #if HAS_CASE_LIGHT_BRIGHTNESS + EEPROM_WRITE(case_light_brightness); + #endif + // // Validate CRC and Data Size // @@ -2163,6 +2186,14 @@ void MarlinSettings::postprocess() { } #endif + // + // Case Light Brightness + // + #if HAS_CASE_LIGHT_BRIGHTNESS + _FIELD_TEST(case_light_brightness); + EEPROM_READ(case_light_brightness); + #endif + eeprom_error = size_error(eeprom_index - (EEPROM_OFFSET)); if (eeprom_error) { DEBUG_ECHO_START(); @@ -2458,6 +2489,14 @@ void MarlinSettings::reset() { ExtUI::onFactoryReset(); #endif + // + // Case Light Brightness + // + + #if HAS_CASE_LIGHT_BRIGHTNESS + case_light_brightness = CASE_LIGHT_DEFAULT_BRIGHTNESS; + #endif + // // Magnetic Parking Extruder //