Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/Parse_NMEA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ void sempNmeaValidateChecksum(SEMP_PARSE_STATE *parse)
checksum = sempAsciiToNibble(parse->buffer[parse->length - 2]) << 4;
checksum |= sempAsciiToNibble(parse->buffer[parse->length - 1]);

// If this is a command response from a Unicore module, include the '$' in the checksum
if(strcmp((char *)scratchPad->nmea.sentenceName, "command") == 0)
parse->crc ^= '$';

// Validate the checksum
if ((checksum == parse->crc) || (parse->badCrc && (!parse->badCrc(parse))))
{
Expand All @@ -63,6 +67,7 @@ void sempNmeaValidateChecksum(SEMP_PARSE_STATE *parse)
parse->eomCallback(parse, parse->type); // Pass parser array index
}
else
{
// Display the checksum error
sempPrintf(parse->printDebug,
"SEMP: %s NMEA %s, 0x%04x (%d) bytes, bad checksum, "
Expand All @@ -73,6 +78,10 @@ void sempNmeaValidateChecksum(SEMP_PARSE_STATE *parse)
parse->buffer[parse->length - 2],
parse->buffer[parse->length - 1],
parse->crc);

// Dump the buffer
sempPrintf(parse->printDebug, "SEMP Buffer: %s", parse->buffer);
}
}

// Read the linefeed
Expand Down