Skip to content

Commit 613ad2f

Browse files
committed
Correct checkRtcmMessage rtcmParsingState RTCM_TRANSPORT_STATE_READ_LENGTH_1
1 parent 3174cb7 commit 613ad2f

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

Firmware/RTK_Surveyor/support.ino

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -450,11 +450,8 @@ bool checkRtcmMessage(uint8_t data)
450450
{
451451
//Read the upper two bits of the length
452452
case RTCM_TRANSPORT_STATE_READ_LENGTH_1:
453-
// PaulZC: The next line checks if the first length byte is zero. Curious...
454-
// This limits 'valid' message lengths to 255 bytes instead of 1023. TODO: check this.
455-
// Maybe the intent is to check that the 6 unused bits are all zero?
456-
// In which case, the next line should be: if (data <= 3)
457-
if (!(data & 3))
453+
//Verify the length byte - check the 6 MS bits are all zero
454+
if (!(data & (~3)))
458455
{
459456
length = data << 8;
460457
rtcmParsingState = RTCM_TRANSPORT_STATE_READ_LENGTH_2;
@@ -868,7 +865,7 @@ uint8_t rtcmReadLength2(PARSE_STATE * parse, uint8_t data)
868865
//Read the upper two bits of the length
869866
uint8_t rtcmReadLength1(PARSE_STATE * parse, uint8_t data)
870867
{
871-
//Verify the length byte
868+
//Verify the length byte - check the 6 MS bits are all zero
872869
if (data & (~3))
873870
{
874871
//Invalid length, place this byte at the beginning of the buffer

0 commit comments

Comments
 (0)