Skip to content

Commit

Permalink
clarify settings idiom
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Apr 26, 2022
1 parent 94fd41e commit 9f9616c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions Marlin/src/lcd/e3v2/proui/dwin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1726,11 +1726,11 @@ void DWIN_SetDataDefaults() {
#endif
}

void DWIN_StoreSettings(char *buff) {
memcpy(buff, &HMI_data, _MIN(sizeof(HMI_data), eeprom_data_size));
void DWIN_CopySettingsTo(char * const buff) {
memcpy(buff, &HMI_data, eeprom_data_size);
}

void DWIN_LoadSettings(const char *buff) {
void DWIN_CopySettingsFrom(const char * const buff) {
memcpy(&HMI_data, buff, sizeof(HMI_data_t));
if (HMI_data.Text_Color == HMI_data.Background_Color) DWIN_SetColorDefaults();
DWINUI::SetColors(HMI_data.Text_Color, HMI_data.Background_Color, HMI_data.StatusBg_Color);
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/lcd/e3v2/proui/dwin.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@ void DWIN_M73();
void DWIN_Print_Header(const char *text);
void DWIN_SetColorDefaults();
void DWIN_ApplyColor();
void DWIN_StoreSettings(char *buff);
void DWIN_LoadSettings(const char *buff);
void DWIN_CopySettingsTo(char * const buff);
void DWIN_CopySettingsFrom(const char * const buff);
void DWIN_SetDataDefaults();
void DWIN_RebootScreen();

Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/module/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1517,7 +1517,7 @@ void MarlinSettings::postprocess() {
{
_FIELD_TEST(dwin_data);
char dwin_data[eeprom_data_size] = { 0 };
DWIN_StoreSettings(dwin_data);
DWIN_CopySettingsTo(dwin_data);
EEPROM_WRITE(dwin_data);
}
#endif
Expand Down Expand Up @@ -2493,7 +2493,7 @@ void MarlinSettings::postprocess() {
const char dwin_data[eeprom_data_size] = { 0 };
_FIELD_TEST(dwin_data);
EEPROM_READ(dwin_data);
if (!validating) DWIN_LoadSettings(dwin_data);
if (!validating) DWIN_CopySettingsFrom(dwin_data);
}
#elif ENABLED(DWIN_CREALITY_LCD_JYERSUI)
{
Expand Down

0 comments on commit 9f9616c

Please sign in to comment.