Maintian "no config" state after vendor config (#999)

This commit is contained in:
Gunnar Skjold 2025-09-25 10:46:02 +02:00 committed by GitHub
parent 4a3ad6ab9b
commit f1089faab5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 14 additions and 9 deletions

View File

@ -13,13 +13,17 @@
bool AmsConfiguration::getSystemConfig(SystemConfig& config) {
EEPROM.begin(EEPROM_SIZE);
uint8_t configVersion = EEPROM.read(EEPROM_CONFIG_ADDRESS);
if(configVersion == EEPROM_CHECK_SUM || configVersion == EEPROM_CLEARED_INDICATOR) {
if(configVersion == EEPROM_CHECK_SUM) {
EEPROM.get(CONFIG_SYSTEM_START, config);
EEPROM.end();
return true;
} else {
config.boardType = 0xFF;
config.vendorConfigured = false;
if(configVersion == EEPROM_CLEARED_INDICATOR) {
config.vendorConfigured = true;
} else {
config.vendorConfigured = false;
config.boardType = 0xFF;
}
config.userConfigured = false;
config.dataCollectionConsent = 0;
config.energyspeedometer = 0;
@ -1101,6 +1105,7 @@ bool AmsConfiguration::relocateConfig103() {
bool AmsConfiguration::save() {
EEPROM.begin(EEPROM_SIZE);
uint8_t configVersion = EEPROM.read(EEPROM_CONFIG_ADDRESS);
EEPROM.put(EEPROM_CONFIG_ADDRESS, EEPROM_CHECK_SUM);
bool success = EEPROM.commit();
EEPROM.end();

File diff suppressed because one or more lines are too long

View File

@ -35,7 +35,7 @@
navigate(basepath + (sysinfo.usrcfg ? "" : "setup"));
}
let cc = false;
let cc = true;
sysinfoStore.subscribe(update => {
sysinfo = update;
if(update.fwconsent === 1) {

View File

@ -1190,9 +1190,6 @@ void AmsWebServer::handleSave() {
if(server.hasArg(F("v")) && server.arg(F("v")) == F("true")) {
int boardType = server.arg(F("vb")).toInt();
int hanPin = server.arg(F("vh")).toInt();
if(server.hasArg(F("vr")) && server.arg(F("vr")) == F("true")) {
config->clear();
}
MeterConfig meterConfig;
config->getMeterConfig(meterConfig);
@ -1656,7 +1653,10 @@ void AmsWebServer::handleSave() {
#endif
debugger->printf_P(PSTR("Saving configuration now...\n"));
if (config->save()) {
// If vendor page and clear all config is selected
if(server.hasArg(F("v")) && server.arg(F("v")) == F("true") && server.hasArg(F("vr")) && server.arg(F("vr")) == F("true")) {
config->clear();
} else if(config->save()) {
#if defined(AMS_REMOTE_DEBUG)
if (debugger->isActive(RemoteDebug::INFO))
#endif