mirror of
https://github.com/UtilitechAS/amsreader-firmware.git
synced 2026-03-01 01:39:55 +00:00
Various bug fixes (#1041)
* Fixing board type overwrite, zmartcharge default issues and disabling entsoe * Fixed Zmartcharge configuration issue
This commit is contained in:
@@ -322,20 +322,15 @@ void setup() {
|
||||
if(!config.getGpioConfig(gpioConfig)) {
|
||||
config.clearGpio(gpioConfig);
|
||||
}
|
||||
if(config.getSystemConfig(sysConfig)) {
|
||||
config.getMeterConfig(meterConfig);
|
||||
if(sysConfig.boardType < 20) {
|
||||
config.clearGpio(gpioConfig, false);
|
||||
hw.applyBoardConfig(sysConfig.boardType, gpioConfig, meterConfig, meterConfig.rxPin);
|
||||
config.setMeterConfig(meterConfig);
|
||||
config.setGpioConfig(gpioConfig);
|
||||
}
|
||||
} else {
|
||||
config.clearMeter(meterConfig);
|
||||
sysConfig.boardType = 0;
|
||||
sysConfig.vendorConfigured = false;
|
||||
sysConfig.userConfigured = false;
|
||||
sysConfig.dataCollectionConsent = false;
|
||||
config.getSystemConfig(sysConfig);
|
||||
config.getMeterConfig(meterConfig);
|
||||
|
||||
if(sysConfig.boardType < 20) {
|
||||
Serial.printf_P(PSTR("Applying default GPIO configuration for board type %d\n"), sysConfig.boardType);
|
||||
config.clearGpio(gpioConfig, false);
|
||||
hw.applyBoardConfig(sysConfig.boardType, gpioConfig, meterConfig, meterConfig.rxPin);
|
||||
config.setMeterConfig(meterConfig);
|
||||
config.setGpioConfig(gpioConfig);
|
||||
}
|
||||
|
||||
delay(1);
|
||||
@@ -363,6 +358,8 @@ void setup() {
|
||||
if(!hw.ledBlink(LED_RED, 6)) {
|
||||
hw.ledBlink(LED_INTERNAL, 6);
|
||||
}
|
||||
ESP.restart();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -432,10 +429,11 @@ void setup() {
|
||||
float vcc = hw.getVcc();
|
||||
|
||||
debugI_P(PSTR("AMS reader %s started"), FirmwareVersion::VersionString);
|
||||
debugI_P(PSTR("Configuration version: %d, board type: %d"), config.getConfigVersion(), sysConfig.boardType);
|
||||
debugI_P(PSTR("Voltage: %.2fV"), vcc);
|
||||
|
||||
float vccBootLimit = gpioConfig.vccBootLimit == 0 ? 0 : min(3.29, gpioConfig.vccBootLimit / 10.0); // Make sure it is never above 3.3v
|
||||
if(vccBootLimit > 2.5 && vccBootLimit < 3.3 && (gpioConfig.apPin == 0xFF || digitalRead(gpioConfig.apPin) == HIGH)) { // Skip if user is holding AP button while booting (HIGH = button is released)
|
||||
if(vcc > 2.5 && vccBootLimit > 2.5 && vccBootLimit < 3.3 && (gpioConfig.apPin == 0xFF || digitalRead(gpioConfig.apPin) == HIGH)) { // Skip if user is holding AP button while booting (HIGH = button is released)
|
||||
if (vcc < vccBootLimit) {
|
||||
{
|
||||
Debug.printf_P(PSTR("(setup) Voltage is too low (%.2f < %.2f), sleeping\n"), vcc, vccBootLimit);
|
||||
@@ -1422,6 +1420,7 @@ bool readHanPort() {
|
||||
}
|
||||
if(mc->isConfigChanged()) {
|
||||
mc->getCurrentConfig(meterConfig);
|
||||
debugI_P(PSTR("Meter configuration based on auto-detect"));
|
||||
config.setMeterConfig(meterConfig);
|
||||
mc->ackConfigChanged();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user