From b2e144efcfa8ed56724da64035d29016e3547b0e Mon Sep 17 00:00:00 2001 From: Gunnar Skjold Date: Fri, 13 May 2022 09:03:38 +0200 Subject: [PATCH] Fixed error --- src/AmsToMqttBridge.ino | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/AmsToMqttBridge.ino b/src/AmsToMqttBridge.ino index a1838063..d4f57206 100644 --- a/src/AmsToMqttBridge.ino +++ b/src/AmsToMqttBridge.ino @@ -801,7 +801,7 @@ bool readHanPort() { return false; } CosemDateTime timestamp = {0}; - HDLCContext context; + HDLCContext context = {0,0,0}; AmsData data; if(currentMeterType == 1) { // DLMS int pos = HDLC_FRAME_INCOMPLETE; @@ -827,7 +827,7 @@ bool readHanPort() { } if(ma->append((uint8_t *) hanBuffer, len) < 0) { debugE("MBUS assembler failed"); - pos = 0; + len = 0; return false; } if(Debug.isActive(RemoteDebug::VERBOSE)) { @@ -847,7 +847,7 @@ bool readHanPort() { pos = HDLC_validate((uint8_t *) hanBuffer, len, hc, ×tamp, &context); } else { debugE("MBUS assembler failed"); - pos = 0; + len = 0; return false; } } @@ -861,7 +861,7 @@ bool readHanPort() { ga->init((uint8_t *) hanBuffer, &context); if(ga->append((uint8_t *) hanBuffer+context.apduStart, len, &Debug) < 0) { debugE("GBT assembler failed"); - pos = 0; + len = 0; return false; } if(Debug.isActive(RemoteDebug::VERBOSE)) { @@ -881,7 +881,7 @@ bool readHanPort() { pos = HDLC_validate((uint8_t *) hanBuffer, len, hc, ×tamp, &context); } else { debugE("GBT assembler failed"); - pos = 0; + len = 0; return false; } }