mirror of
https://github.com/UtilitechAS/amsreader-firmware.git
synced 2026-01-29 05:20:58 +00:00
Changes for Energy Speedometer connection
This commit is contained in:
@@ -13,13 +13,22 @@ bool AmsConfiguration::getSystemConfig(SystemConfig& config) {
|
||||
config.vendorConfigured = false;
|
||||
config.userConfigured = false;
|
||||
config.dataCollectionConsent = 0;
|
||||
config.energyspeedometer = false;
|
||||
config.energyspeedometer = 0;
|
||||
strcpy(config.country, "");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool AmsConfiguration::setSystemConfig(SystemConfig& config) {
|
||||
SystemConfig existing;
|
||||
if(getSystemConfig(existing)) {
|
||||
sysChanged |= config.boardType != existing.boardType;
|
||||
sysChanged |= config.vendorConfigured != existing.vendorConfigured;
|
||||
sysChanged |= config.userConfigured != existing.userConfigured;
|
||||
sysChanged |= config.dataCollectionConsent != existing.dataCollectionConsent;
|
||||
sysChanged |= strcmp(config.country, existing.country) != 0;
|
||||
sysChanged |= config.energyspeedometer != existing.energyspeedometer;
|
||||
}
|
||||
EEPROM.begin(EEPROM_SIZE);
|
||||
stripNonAscii((uint8_t*) config.country, 2);
|
||||
EEPROM.put(CONFIG_SYSTEM_START, config);
|
||||
@@ -28,6 +37,14 @@ bool AmsConfiguration::setSystemConfig(SystemConfig& config) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool AmsConfiguration::isSystemConfigChanged() {
|
||||
return sysChanged;
|
||||
}
|
||||
|
||||
void AmsConfiguration::ackSystemConfigChanged() {
|
||||
sysChanged = false;
|
||||
}
|
||||
|
||||
bool AmsConfiguration::getWiFiConfig(WiFiConfig& config) {
|
||||
if(hasConfig()) {
|
||||
EEPROM.begin(EEPROM_SIZE);
|
||||
@@ -739,6 +756,7 @@ void AmsConfiguration::clear() {
|
||||
EEPROM.get(CONFIG_SYSTEM_START, sys);
|
||||
sys.userConfigured = false;
|
||||
sys.dataCollectionConsent = 0;
|
||||
sys.energyspeedometer = 0;
|
||||
strcpy(sys.country, "");
|
||||
EEPROM.put(CONFIG_SYSTEM_START, sys);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user