From 7707473b4e290eedfa83a684a96d00872c2db438 Mon Sep 17 00:00:00 2001 From: Charles Date: Tue, 26 Mar 2024 08:46:55 +0100 Subject: [PATCH] Lib_teleinfo : Fixed too restrictive checksum checks (#21033) * Fixed too restrictive checks Fixed too restrictive checks that may introduce checksum errors on some contracts * Bump to v1.1.7 Bump to v1.1.7 --- lib/lib_div/LibTeleinfo/library.json | 2 +- lib/lib_div/LibTeleinfo/library.properties | 2 +- lib/lib_div/LibTeleinfo/src/LibTeleinfo.cpp | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/lib_div/LibTeleinfo/library.json b/lib/lib_div/LibTeleinfo/library.json index 84593d3a6..61cf20b90 100644 --- a/lib/lib_div/LibTeleinfo/library.json +++ b/lib/lib_div/LibTeleinfo/library.json @@ -1,6 +1,6 @@ { "name": "LibTeleinfo", - "version": "1.1.5", + "version": "1.1.7", "keywords": "teleinfo, french, meter, power, erdf, linky, tic", "description": "Decoder for Teleinfo (aka TIC) from French smart power meters", "repository": diff --git a/lib/lib_div/LibTeleinfo/library.properties b/lib/lib_div/LibTeleinfo/library.properties index 562d96c62..2b4877ca5 100644 --- a/lib/lib_div/LibTeleinfo/library.properties +++ b/lib/lib_div/LibTeleinfo/library.properties @@ -1,5 +1,5 @@ name=LibTeleinfo -version=1.1.5 +version=1.1.7 author=Charles-Henri Hallard maintainer=Charles-Henri Hallard sentence=Decoder for Teleinfo (aka TIC) from French smart power meters diff --git a/lib/lib_div/LibTeleinfo/src/LibTeleinfo.cpp b/lib/lib_div/LibTeleinfo/src/LibTeleinfo.cpp index 92bd7e359..94f0c6af1 100644 --- a/lib/lib_div/LibTeleinfo/src/LibTeleinfo.cpp +++ b/lib/lib_div/LibTeleinfo/src/LibTeleinfo.cpp @@ -700,8 +700,8 @@ unsigned char TInfo::calcChecksum(char *etiquette, char *valeur, char * horodate if (strlen(etiquette) && strlen(valeur)) { while (*etiquette) { c =*etiquette++; - // Add another validity check since checksum may not be sufficient - if ( (c>='A' && c<='Z') || (c>='0' && c<='9') || c=='-' || c=='+') { + // Add another validity check + if (c>=0x20 && c<=0x7E) { sum += c ; } else { return 0; @@ -710,8 +710,8 @@ unsigned char TInfo::calcChecksum(char *etiquette, char *valeur, char * horodate while(*valeur) { c = *valeur++ ; - // Add another validity check since checksum may not be sufficient (space authorized in Standard mode) - if ( (c>='A' && c<='Z') || (c>='0' && c<='9') || c==' ' || c=='.' || c=='-' || c=='+' || c=='/') { + // Add another validity check + if (c>=0x20 && c<=0x7E) { sum += c ; } else { return 0;