From 452a57fa77d72d241914cae8ebd23b9112edf43e Mon Sep 17 00:00:00 2001 From: jantenhove Date: Thu, 11 Jan 2018 09:49:18 +0100 Subject: [PATCH] Fix for CRC checking (end crc with null) --- P1Meter.ino | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/P1Meter.ino b/P1Meter.ino index 5d76705..72d6e5e 100644 --- a/P1Meter.ino +++ b/P1Meter.ino @@ -204,8 +204,9 @@ bool decodeTelegram(int len) { { //add to crc calc currentCRC=CRC16(currentCRC,(unsigned char*)telegram+endChar, 1); - char messageCRC[4]; + char messageCRC[5]; strncpy(messageCRC, telegram + endChar + 1, 4); + messageCRC[4]=0; //thanks to HarmOtten (issue 5) if(outputOnSerial) { for(int cnt=0; cnt