Browse Source

AP_GPS: only use PPS time when there is atleast 2D Fix

apm_2208
bugobliterator 3 years ago committed by Andrew Tridgell
parent
commit
79c45049e0
  1. 7
      libraries/AP_GPS/GPS_Backend.cpp

7
libraries/AP_GPS/GPS_Backend.cpp

@ -250,11 +250,12 @@ void AP_GPS_Backend::check_new_itow(uint32_t itow, uint32_t msg_length) @@ -250,11 +250,12 @@ void AP_GPS_Backend::check_new_itow(uint32_t itow, uint32_t msg_length)
// get the time the packet arrived on the UART
uint64_t uart_us;
if (port && _last_pps_time_us == 0) {
uart_us = port->receive_time_constraint_us(msg_length);
} else if (_last_pps_time_us != 0) {
if (_last_pps_time_us != 0 && (state.status >= AP_GPS::GPS_OK_FIX_2D)) {
// pps is only reliable when we have some sort of GPS fix
uart_us = _last_pps_time_us;
_last_pps_time_us = 0;
} else if (port) {
uart_us = port->receive_time_constraint_us(msg_length);
} else {
uart_us = AP_HAL::micros64();
}

Loading…
Cancel
Save