mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-15 17:21:38 +08:00
Don't use ADSB messages with undefined fields in navigator (#8900)
Don't use ADSB messages with undefined fields in navigator
This commit is contained in:
committed by
Lorenz Meier
parent
a1f660119c
commit
135162522a
@@ -1346,6 +1346,8 @@ protected:
|
||||
while (_pos_sub->update(&_pos_time, &pos)) {
|
||||
mavlink_adsb_vehicle_t msg = {};
|
||||
|
||||
if (!(pos.flags & transponder_report_s::PX4_ADSB_FLAGS_RETRANSLATE)) { continue; }
|
||||
|
||||
msg.ICAO_address = pos.ICAO_address;
|
||||
msg.lat = pos.lat * 1e7;
|
||||
msg.lon = pos.lon * 1e7;
|
||||
@@ -1357,9 +1359,22 @@ protected:
|
||||
memcpy(&msg.callsign[0], &pos.callsign[0], sizeof(msg.callsign));
|
||||
msg.emitter_type = pos.emitter_type;
|
||||
msg.tslc = pos.tslc;
|
||||
msg.flags = pos.flags;
|
||||
msg.squawk = pos.squawk;
|
||||
|
||||
msg.flags = 0;
|
||||
|
||||
if (pos.flags & transponder_report_s::PX4_ADSB_FLAGS_VALID_COORDS) { msg.flags |= ADSB_FLAGS_VALID_COORDS; }
|
||||
|
||||
if (pos.flags & transponder_report_s::PX4_ADSB_FLAGS_VALID_ALTITUDE) { msg.flags |= ADSB_FLAGS_VALID_ALTITUDE; }
|
||||
|
||||
if (pos.flags & transponder_report_s::PX4_ADSB_FLAGS_VALID_HEADING) { msg.flags |= ADSB_FLAGS_VALID_HEADING; }
|
||||
|
||||
if (pos.flags & transponder_report_s::PX4_ADSB_FLAGS_VALID_VELOCITY) { msg.flags |= ADSB_FLAGS_VALID_VELOCITY; }
|
||||
|
||||
if (pos.flags & transponder_report_s::PX4_ADSB_FLAGS_VALID_CALLSIGN) { msg.flags |= ADSB_FLAGS_VALID_CALLSIGN; }
|
||||
|
||||
if (pos.flags & transponder_report_s::PX4_ADSB_FLAGS_VALID_SQUAWK) { msg.flags |= ADSB_FLAGS_VALID_SQUAWK; }
|
||||
|
||||
mavlink_msg_adsb_vehicle_send_struct(_mavlink->get_channel(), &msg);
|
||||
sent = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user