Store case light brightness in EEPROM (#17307)
This commit is contained in:
		
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							bed41af868
						
					
				
				
					commit
					8752fbd92c
				
			| @@ -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 | ||||
|   // | ||||
|   | ||||
		Reference in New Issue
	
	Block a user