AP_GPS_NMEA: fix gps startup

when no valid gps data, gps would restart in a loop. Take the frame without
gps fix into account for frame counting
This commit is contained in:
Julien BERAUD 2015-07-10 19:17:23 +02:00 committed by Andrew Tridgell
parent 14e462706d
commit a852e48f37

View File

@ -280,11 +280,9 @@ bool AP_GPS_NMEA::_term_complete()
state.ground_speed = _new_speed*0.01f;
state.ground_course_cd = _new_course;
make_gps_time(_new_date, _new_time * 10);
state.last_gps_time_ms = hal.scheduler->millis();
// To-Do: add support for proper reporting of 2D and 3D fix
state.status = AP_GPS::GPS_OK_FIX_3D;
fill_3d_velocity();
_last_GPRMC_ms = state.last_gps_time_ms;
break;
case _GPS_SENTENCE_GPGGA:
state.location.alt = _new_altitude;
@ -294,12 +292,10 @@ bool AP_GPS_NMEA::_term_complete()
state.hdop = _new_hdop;
// To-Do: add support for proper reporting of 2D and 3D fix
state.status = AP_GPS::GPS_OK_FIX_3D;
_last_GPGGA_ms = hal.scheduler->millis();
break;
case _GPS_SENTENCE_GPVTG:
state.ground_speed = _new_speed*0.01f;
state.ground_course_cd = _new_course;
_last_GPVTG_ms = hal.scheduler->millis();
// VTG has no fix indicator, can't change fix status
break;
}
@ -323,12 +319,15 @@ bool AP_GPS_NMEA::_term_complete()
if (_term_number == 0) {
if (!strcmp_P(_term, _gprmc_string)) {
_sentence_type = _GPS_SENTENCE_GPRMC;
_last_GPRMC_ms = hal.scheduler->millis();
} else if (!strcmp_P(_term, _gpgga_string)) {
_sentence_type = _GPS_SENTENCE_GPGGA;
_last_GPGGA_ms = hal.scheduler->millis();
} else if (!strcmp_P(_term, _gpvtg_string)) {
_sentence_type = _GPS_SENTENCE_GPVTG;
// VTG may not contain a data qualifier, presume the solution is good
// unless it tells us otherwise.
_last_GPVTG_ms = hal.scheduler->millis();
_gps_data_good = true;
} else {
_sentence_type = _GPS_SENTENCE_OTHER;