Skip to content

Commit

Permalink
AP_Periph: use ublox message local time through PPS time
Browse files Browse the repository at this point in the history
  • Loading branch information
bugobliterator committed Jan 31, 2024
1 parent c1a1405 commit f251ef4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions AP_Periph/sensor_gps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ void AP_Periph_DroneCAN::can_gps_update(void)
// send time sync message every second
uavcan_protocol_GlobalTimeSync ts {};
for (uint8_t i=0; i<HAL_NUM_CAN_IFACES; i++) {
uint64_t last_corrected_gps_time_us = periph.gps.last_corrected_gps_time_usec();
uint64_t last_gps_local_time_us = periph.gps.last_pps_time_usec();
uint64_t last_message_epoch_usec = periph.gps.last_message_epoch_usec();
if (periph.can_iface_periph[i] && last_corrected_gps_time_us != 0 && last_message_epoch_usec != 0) {
ts.previous_transmission_timestamp_usec = last_message_epoch_usec + periph.get_tracked_tx_timestamp(i) - last_corrected_gps_time_us;
if (periph.can_iface_periph[i] && last_gps_local_time_us != 0 && last_message_epoch_usec != 0) {
ts.previous_transmission_timestamp_usec = last_message_epoch_usec + periph.get_tracked_tx_timestamp(i) - last_gps_local_time_us;
global_time_sync_pub[i].broadcast(ts);
}
}
Expand Down

0 comments on commit f251ef4

Please sign in to comment.