mirror of
https://github.com/UtilitechAS/amsreader-firmware.git
synced 2026-01-29 21:40:50 +00:00
GUI translations
This commit is contained in:
@@ -703,6 +703,12 @@ bool AmsConfiguration::getUiConfig(UiConfig& config) {
|
||||
}
|
||||
|
||||
bool AmsConfiguration::setUiConfig(UiConfig& config) {
|
||||
UiConfig existing;
|
||||
if(getUiConfig(existing)) {
|
||||
uiLanguageChanged |= strcmp(config.language, existing.language) != 0;
|
||||
} else {
|
||||
uiLanguageChanged = true;
|
||||
}
|
||||
EEPROM.begin(EEPROM_SIZE);
|
||||
EEPROM.put(CONFIG_UI_START, config);
|
||||
bool ret = EEPROM.commit();
|
||||
@@ -727,6 +733,15 @@ void AmsConfiguration::clearUiConfig(UiConfig& config) {
|
||||
config.showPerPhasePower = 2;
|
||||
config.showPowerFactor = 2;
|
||||
config.darkMode = 2;
|
||||
strcpy(config.language, "");
|
||||
}
|
||||
|
||||
bool AmsConfiguration::isUiLanguageChanged() {
|
||||
return uiLanguageChanged;
|
||||
}
|
||||
|
||||
void AmsConfiguration::ackUiLanguageChange() {
|
||||
uiLanguageChanged = false;
|
||||
}
|
||||
|
||||
bool AmsConfiguration::setUpgradeInformation(int16_t exitCode, int16_t errorCode, const char* currentVersion, const char* nextVersion) {
|
||||
@@ -817,6 +832,10 @@ void AmsConfiguration::ackCloudConfig() {
|
||||
cloudChanged = false;
|
||||
}
|
||||
|
||||
void AmsConfiguration::setUiLanguageChanged() {
|
||||
uiLanguageChanged = true;
|
||||
}
|
||||
|
||||
void AmsConfiguration::clear() {
|
||||
EEPROM.begin(EEPROM_SIZE);
|
||||
|
||||
@@ -1040,6 +1059,8 @@ bool AmsConfiguration::relocateConfig103() {
|
||||
strcpy(web.password, web103.password);
|
||||
strcpy(web.context, "");
|
||||
|
||||
strcpy(ui.language, "en");
|
||||
|
||||
EEPROM.put(CONFIG_UPGRADE_INFO_START, upinfo);
|
||||
EEPROM.put(CONFIG_NETWORK_START, wifi);
|
||||
EEPROM.put(CONFIG_METER_START, meter);
|
||||
@@ -1250,5 +1271,11 @@ void AmsConfiguration::print(Print* debugger)
|
||||
debugger->flush();
|
||||
}
|
||||
|
||||
UiConfig ui;
|
||||
if(getUiConfig(ui)) {
|
||||
debugger->println(F("--UI configuration--"));
|
||||
debugger->printf_P(PSTR("Language: %s\r\n"), ui.language);
|
||||
}
|
||||
|
||||
debugger->println(F("-----------------------------------------------"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user