fix some errors (#18077)

fix some checksum errors in standard mode
fix format error counting for DATE field
This commit is contained in:
Charles 2023-03-01 09:01:27 +01:00 committed by GitHub
parent 10cc10742f
commit 873567a999
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 4 deletions

View File

@ -247,6 +247,8 @@ ValueList * TInfo::valueAdd(char * name, char * value, uint8_t checksum, uint8_t
// Time stamped field? // Time stamped field?
if (horodate && *horodate) { if (horodate && *horodate) {
ts = horodate2Timestamp(horodate); ts = horodate2Timestamp(horodate);
// We don't check horodate (not used) on storage so re calculate checksum without this one
checksum = calcChecksum(name,value) ;
} }
// Loop thru the node // Loop thru the node
@ -275,8 +277,7 @@ ValueList * TInfo::valueAdd(char * name, char * value, uint8_t checksum, uint8_t
if (strlen(me->value) >= lgvalue ) { if (strlen(me->value) >= lgvalue ) {
// Copy it // Copy it
strlcpy(me->value, value , lgvalue + 1 ); strlcpy(me->value, value , lgvalue + 1 );
// store checksum for future check without horodate me->checksum = checksum ;
me->checksum = ts ? calcChecksum(name,value) : checksum ;
// That's all // That's all
return (me); return (me);
} else { } else {
@ -939,8 +940,11 @@ ValueList * TInfo::checkLine(char * pline)
} }
else else
{ {
// Specific field not formated has others, don't set as an error
if ( strcmp(ptok, "DATE") ) {
_frameformaterror++; _frameformaterror++;
AddLog(1, PSTR("LibTeleinfo::checkLine frame format error, total=%d"), _frameformaterror); AddLog(1, PSTR("LibTeleinfo::checkLine frame format error total=%d"), _frameformaterror);
}
} }
} }
// Next char // Next char