mirror of
https://github.com/UtilitechAS/amsreader-firmware.git
synced 2026-05-03 06:39:32 +00:00
aggregate obis 1.8.x and 2.8.x for L&G
This commit is contained in:
23
src/LNG.cpp
23
src/LNG.cpp
@@ -11,6 +11,8 @@ LNG::LNG(const char* payload, uint8_t useMeterType, MeterConfig* meterConfig, Da
|
|||||||
uint8_t* ptr = (uint8_t*) &h[1];
|
uint8_t* ptr = (uint8_t*) &h[1];
|
||||||
uint8_t* data = ptr + (18*h->arrayLength); // Skip descriptors
|
uint8_t* data = ptr + (18*h->arrayLength); // Skip descriptors
|
||||||
|
|
||||||
|
uint16_t o181 = 0, o182 = 0;
|
||||||
|
uint16_t o281 = 0, o282 = 0;
|
||||||
LngObisDescriptor* descriptor = (LngObisDescriptor*) ptr;
|
LngObisDescriptor* descriptor = (LngObisDescriptor*) ptr;
|
||||||
for(uint8_t x = 0; x < h->arrayLength-1; x++) {
|
for(uint8_t x = 0; x < h->arrayLength-1; x++) {
|
||||||
ptr = (uint8_t*) &descriptor[1];
|
ptr = (uint8_t*) &descriptor[1];
|
||||||
@@ -30,6 +32,12 @@ LNG::LNG(const char* payload, uint8_t useMeterType, MeterConfig* meterConfig, Da
|
|||||||
activeImportCounter = ntohl(item->dlu.data);
|
activeImportCounter = ntohl(item->dlu.data);
|
||||||
listType = listType >= 3 ? listType : 3;
|
listType = listType >= 3 ? listType : 3;
|
||||||
if(debugger->isActive(RemoteDebug::VERBOSE)) debugger->printf(" and value %d (dlu)", ntohl(item->dlu.data));
|
if(debugger->isActive(RemoteDebug::VERBOSE)) debugger->printf(" and value %d (dlu)", ntohl(item->dlu.data));
|
||||||
|
} else if(descriptor->obis[4] == 1) {
|
||||||
|
o181 = ntohl(item->dlu.data);
|
||||||
|
if(debugger->isActive(RemoteDebug::VERBOSE)) debugger->printf(" and value %d (dlu)", ntohl(item->dlu.data));
|
||||||
|
} else if(descriptor->obis[4] == 2) {
|
||||||
|
o182 = ntohl(item->dlu.data);
|
||||||
|
if(debugger->isActive(RemoteDebug::VERBOSE)) debugger->printf(" and value %d (dlu)", ntohl(item->dlu.data));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if(descriptor->obis[2] == 2) {
|
} else if(descriptor->obis[2] == 2) {
|
||||||
@@ -44,6 +52,12 @@ LNG::LNG(const char* payload, uint8_t useMeterType, MeterConfig* meterConfig, Da
|
|||||||
activeExportCounter = ntohl(item->dlu.data);
|
activeExportCounter = ntohl(item->dlu.data);
|
||||||
listType = listType >= 3 ? listType : 3;
|
listType = listType >= 3 ? listType : 3;
|
||||||
if(debugger->isActive(RemoteDebug::VERBOSE)) debugger->printf(" and value %d (dlu)", ntohl(item->dlu.data));
|
if(debugger->isActive(RemoteDebug::VERBOSE)) debugger->printf(" and value %d (dlu)", ntohl(item->dlu.data));
|
||||||
|
} else if(descriptor->obis[4] == 1) {
|
||||||
|
o281 = ntohl(item->dlu.data);
|
||||||
|
if(debugger->isActive(RemoteDebug::VERBOSE)) debugger->printf(" and value %d (dlu)", ntohl(item->dlu.data));
|
||||||
|
} else if(descriptor->obis[4] == 2) {
|
||||||
|
o282 = ntohl(item->dlu.data);
|
||||||
|
if(debugger->isActive(RemoteDebug::VERBOSE)) debugger->printf(" and value %d (dlu)", ntohl(item->dlu.data));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if(descriptor->obis[2] == 96) {
|
} else if(descriptor->obis[2] == 96) {
|
||||||
@@ -66,6 +80,15 @@ LNG::LNG(const char* payload, uint8_t useMeterType, MeterConfig* meterConfig, Da
|
|||||||
|
|
||||||
if(debugger->isActive(RemoteDebug::VERBOSE)) debugger->printf("\n");
|
if(debugger->isActive(RemoteDebug::VERBOSE)) debugger->printf("\n");
|
||||||
|
|
||||||
|
if(o181 > 0 || o182 > 0) {
|
||||||
|
activeImportCounter = o181 + o182;
|
||||||
|
listType = listType >= 3 ? listType : 3;
|
||||||
|
}
|
||||||
|
if(o281 > 0 || o282 > 0) {
|
||||||
|
activeExportCounter = o281 + o282;
|
||||||
|
listType = listType >= 3 ? listType : 3;
|
||||||
|
}
|
||||||
|
|
||||||
if((*data) == 0x09) {
|
if((*data) == 0x09) {
|
||||||
data += (*(data+1))+2;
|
data += (*(data+1))+2;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user