diff --git a/lib/MeterCommunicators/include/KmpCommunicator.h b/lib/MeterCommunicators/include/KmpCommunicator.h index 1981e87f..03e32fd4 100644 --- a/lib/MeterCommunicators/include/KmpCommunicator.h +++ b/lib/MeterCommunicators/include/KmpCommunicator.h @@ -31,8 +31,6 @@ class KmpCommunicator : public PassiveMeterCommunicator { bool loop(); AmsData* getData(AmsData& meterState); int getLastError(); - bool isConfigChanged() { return false; } - void ackConfigChanged() {} void getCurrentConfig(MeterConfig& meterConfig) { meterConfig = this->meterConfig; } diff --git a/lib/MeterCommunicators/include/PassiveMeterCommunicator.h b/lib/MeterCommunicators/include/PassiveMeterCommunicator.h index 7540acce..84acb717 100644 --- a/lib/MeterCommunicators/include/PassiveMeterCommunicator.h +++ b/lib/MeterCommunicators/include/PassiveMeterCommunicator.h @@ -20,7 +20,7 @@ #include "SoftwareSerial.h" #endif -const uint32_t AUTO_BAUD_RATES[] = { 2400, 115200 }; +const uint32_t AUTO_BAUD_RATES[] = { 2400, 9600, 115200 }; class PassiveMeterCommunicator : public MeterCommunicator { public: diff --git a/lib/MeterCommunicators/src/KmpCommunicator.cpp b/lib/MeterCommunicators/src/KmpCommunicator.cpp index d1b75aed..381922dc 100644 --- a/lib/MeterCommunicators/src/KmpCommunicator.cpp +++ b/lib/MeterCommunicators/src/KmpCommunicator.cpp @@ -12,12 +12,19 @@ void KmpCommunicator::configure(MeterConfig& meterConfig) { this->meterConfig = meterConfig; this->configChanged = false; + if(meterConfig.baud == 0) { + this->configChanged = true; + meterConfig.baud = 9600; + meterConfig.parity = 7; + meterConfig.invert = false; + } setupHanPort(meterConfig.baud, meterConfig.parity, meterConfig.invert, false); talker = new KmpTalker(hanSerial, hanBuffer, hanBufferSize); } bool KmpCommunicator::loop() { uint64_t now = millis64(); + bool ret = talker->loop(); int lastError = getLastError(); if(ret) {