Skip to content

Commit c1c857b

Browse files
committed
Add _resetCurrentSentenceOnBusError
1 parent 9df0b57 commit c1c857b

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/u-blox_GNSS.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1153,7 +1153,12 @@ bool DevUBLOXGNSS::checkUbloxI2C(ubxPacket *incomingUBX, uint8_t requestedClass,
11531153
}
11541154
}
11551155
else
1156-
return (false); // Sensor did not respond
1156+
{
1157+
//Something has gone very wrong. Sensor did not respond - or a bus error happened...
1158+
if (_resetCurrentSentenceOnBusError)
1159+
currentSentence = SFE_UBLOX_SENTENCE_TYPE_NONE; //Reset the sentence to being looking for a new start char
1160+
return (false);
1161+
}
11571162

11581163
bytesAvailable -= bytesToRead;
11591164
}

src/u-blox_GNSS.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1530,6 +1530,10 @@ class DevUBLOXGNSS
15301530
size_t _autoSendAtSpaceRemaining = 0;
15311531

15321532
public:
1533+
1534+
//Flag to indicate if currentSentence should be reset on a (I2C) bus error
1535+
bool _resetCurrentSentenceOnBusError = true;
1536+
15331537
typedef union
15341538
{
15351539
uint64_t unsigned64;

0 commit comments

Comments
 (0)