AP_GPS: adjust NMEA sentence length calculation

review feedback
This commit is contained in:
Andrew Tridgell 2018-06-15 10:50:48 +10:00
parent 3fe4b9c0f8
commit 4af857da44

View File

@ -85,6 +85,8 @@ bool AP_GPS_NMEA::_decode(char c)
{
bool valid_sentence = false;
_sentence_length++;
switch (c) {
case ',': // term terminators
_parity ^= c;
@ -99,7 +101,6 @@ bool AP_GPS_NMEA::_decode(char c)
++_term_number;
_term_offset = 0;
_is_checksum_term = c == '*';
_sentence_length++;
return valid_sentence;
case '$': // sentence begin
@ -108,7 +109,7 @@ bool AP_GPS_NMEA::_decode(char c)
_sentence_type = _GPS_SENTENCE_OTHER;
_is_checksum_term = false;
_gps_data_good = false;
_sentence_length = 0;
_sentence_length = 1;
return valid_sentence;
}
@ -118,8 +119,6 @@ bool AP_GPS_NMEA::_decode(char c)
if (!_is_checksum_term)
_parity ^= c;
_sentence_length++;
return valid_sentence;
}