The GPS module sometimes sends incomplete NMEA messages such as this:
$GP$GGA...*
This changeset makes it so we'd only parse the second, complete message
in that example.
let hexdigits = b"0123456789abcdef";
while let Some(received) = try_read() {
+ if received == b'$' {
+ self.state = ParseState::InPacket;
+ self.offset = 0;
+ self.checksum = 0x00;
+
+ continue;
+ }
+
match self.state {
ParseState::Start => {
- if received == b'$' {
- self.state = ParseState::InPacket;
- self.offset = 0;
- self.checksum = 0x00;
- }
+ // Empty.
},
ParseState::InPacket => {
if received == b'*' {