mirror of
https://github.com/UtilitechAS/amsreader-firmware.git
synced 2026-03-06 11:33:38 +00:00
Added default settings to KMP communicator
This commit is contained in:
@@ -31,8 +31,6 @@ public:
|
||||
bool loop();
|
||||
AmsData* getData(AmsData& meterState);
|
||||
int getLastError();
|
||||
bool isConfigChanged() { return false; }
|
||||
void ackConfigChanged() {}
|
||||
void getCurrentConfig(MeterConfig& meterConfig) {
|
||||
meterConfig = this->meterConfig;
|
||||
}
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user