AP_GPS: moved place we graph uart timestamp

This commit is contained in:
Andrew Tridgell 2018-11-20 12:01:00 +11:00
parent 685771c145
commit 7c50aacc92

View File

@ -243,7 +243,10 @@ void AP_GPS_Backend::check_new_itow(uint32_t itow, uint32_t msg_length)
poll time to be higher
*/
const uint32_t gps_min_period_ms = 50;
// get the time the packet arrived on the UART
uint64_t uart_us = port->receive_time_constraint_us(msg_length);
uint32_t now = AP_HAL::millis();
uint32_t dt_ms = now - _last_ms;
_last_ms = now;
@ -274,8 +277,7 @@ void AP_GPS_Backend::check_new_itow(uint32_t itow, uint32_t msg_length)
// calculate pseudo-itow
_pseudo_itow += dt_ms * 1000U;
// get msg arrival time, and correct for jitter
uint64_t uart_us = port->receive_time_constraint_us(msg_length);
// use msg arrival time, and correct for jitter
uint64_t local_us = jitter_correction.correct_offboard_timestamp_usec(_pseudo_itow, uart_us);
state.uart_timestamp_ms = local_us / 1000U;
}