diff --git a/src/lib/adsb/AdsbConflict.cpp b/src/lib/adsb/AdsbConflict.cpp index 14113e649e73..22f393cd3083 100644 --- a/src/lib/adsb/AdsbConflict.cpp +++ b/src/lib/adsb/AdsbConflict.cpp @@ -111,9 +111,9 @@ void AdsbConflict::remove_icao_address_from_conflict_list(int traffic_index) PX4_INFO("icao_address removed. Buffer Size: %d", (int)_traffic_buffer.timestamp.size()); } -void AdsbConflict::add_icao_address_from_conflict_list(uint32_t icao_address) +void AdsbConflict::add_icao_address_from_conflict_list(uint32_t icao_address, hrt_abstime now) { - _traffic_buffer.timestamp.push_back(hrt_absolute_time()); + _traffic_buffer.timestamp.push_back(now); _traffic_buffer.icao_address.push_back(icao_address); PX4_INFO("icao_address added. Buffer Size: %d", (int)_traffic_buffer.timestamp.size()); } @@ -133,7 +133,7 @@ void AdsbConflict::get_traffic_state(hrt_abstime now) } if (new_traffic && _conflict_detected && !_traffic_buffer_full) { - add_icao_address_from_conflict_list(_transponder_report.icao_address); + add_icao_address_from_conflict_list(_transponder_report.icao_address, now); _traffic_state = TRAFFIC_STATE::ADD_CONFLICT; } else if (new_traffic && _conflict_detected && _traffic_buffer_full) { diff --git a/src/lib/adsb/AdsbConflict.h b/src/lib/adsb/AdsbConflict.h index e35850fd408f..5b6dc4edd923 100644 --- a/src/lib/adsb/AdsbConflict.h +++ b/src/lib/adsb/AdsbConflict.h @@ -109,7 +109,7 @@ class AdsbConflict void remove_icao_address_from_conflict_list(int traffic_index); - void add_icao_address_from_conflict_list(uint32_t icao_address); + void add_icao_address_from_conflict_list(uint32_t icao_address, hrt_abstime now); void get_traffic_state(hrt_abstime now); @@ -129,8 +129,7 @@ class AdsbConflict float hor_velocity, float ver_velocity, int emitter_type, uint32_t icao_address, double lat_uav, double lon_uav, float &alt_uav); - void run_fake_traffic(double &lat_uav, double &lon_uav, - float &alt_uav); + void run_fake_traffic(double &lat_uav, double &lon_uav, float &alt_uav); void remove_expired_conflicts();