KMP stuff

This commit is contained in:
Gunnar Skjold
2024-06-03 18:09:40 +02:00
parent d0621e98cd
commit e7b496280d
6 changed files with 163 additions and 96 deletions

View File

@@ -82,7 +82,7 @@ ADC_MODE(ADC_VCC);
#include "MeterCommunicator.h"
#include "PassiveMeterCommunicator.h"
//#include "KmpCommunicator.h"
#include "KmpCommunicator.h"
#include "PulseMeterCommunicator.h"
#include "Uptime.h"
@@ -175,7 +175,7 @@ RealtimePlot rtp;
MeterCommunicator* mc = NULL;
PassiveMeterCommunicator* passiveMc = NULL;
//KmpCommunicator* kmpMc = NULL;
KmpCommunicator* kmpMc = NULL;
PulseMeterCommunicator* pulseMc = NULL;
bool networkConnected = false;
@@ -264,11 +264,9 @@ void rxerr(int err) {
if(passiveMc != NULL) {
passiveMc->rxerr(err);
}
/*
if(kmpMc != NULL) {
kmpMc->rxerr(err);
}
*/
}
#endif
@@ -745,12 +743,10 @@ void loop() {
delete pulseMc;
pulseMc = NULL;
}
/*
if(kmpMc != NULL) {
delete(kmpMc);
kmpMc = NULL;
}
*/
if(passiveMc == NULL) {
passiveMc = new PassiveMeterCommunicator(&Debug);
}
@@ -758,7 +754,6 @@ void loop() {
hwSerial = passiveMc->getHwSerial();
mc = passiveMc;
break;
/*
case METER_PARSER_KAMSTRUP:
if(pulseMc != NULL) {
delete pulseMc;
@@ -775,14 +770,11 @@ void loop() {
hwSerial = kmpMc->getHwSerial();
mc = kmpMc;
break;
*/
case METER_PARSER_PULSE:
/*
if(kmpMc != NULL) {
delete(kmpMc);
kmpMc = NULL;
}
*/
if(passiveMc != NULL) {
delete(passiveMc);
passiveMc = NULL;

View File

@@ -31,5 +31,7 @@ private:
bool readPacket();
int16_t unwrapData(uint8_t *buf, DataParserContext &context);
uint8_t stuff(uint8_t* buf, uint8_t len);
uint8_t unstuff(uint8_t* buf, uint8_t len);
void send(uint8_t* buf, uint8_t len);
double convertvalue(uint32_t val, uint8_t unit, uint8_t siex);
};