From 4c9642ac0899b29dc6b55439e3d6b6e09c5e78e7 Mon Sep 17 00:00:00 2001 From: Tom Pittenger Date: Tue, 12 Jul 2016 12:49:45 -0700 Subject: [PATCH] AP_ADSB: callsign gen should use ICAO in hex --- libraries/AP_ADSB/AP_ADSB.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libraries/AP_ADSB/AP_ADSB.cpp b/libraries/AP_ADSB/AP_ADSB.cpp index 173d004d90..6d84b89192 100644 --- a/libraries/AP_ADSB/AP_ADSB.cpp +++ b/libraries/AP_ADSB/AP_ADSB.cpp @@ -203,13 +203,12 @@ void AP_ADSB::update(void) // if param changed then regenerate. This allows the param to be changed back to zero to trigger a re-generate if (out_state.cfg.ICAO_id_param == 0) { out_state.cfg.ICAO_id = genICAO(_my_loc); - GCS_MAVLINK::send_statustext_all(MAV_SEVERITY_INFO, "ADSB: Generated ICAO_id: %d", out_state.cfg.ICAO_id); } else { out_state.cfg.ICAO_id = out_state.cfg.ICAO_id_param; - GCS_MAVLINK::send_statustext_all(MAV_SEVERITY_INFO, "ADSB: Using ICAO_id: %d", out_state.cfg.ICAO_id); } out_state.cfg.ICAO_id_param_prev = out_state.cfg.ICAO_id_param; set_callsign("PING", true); + GCS_MAVLINK::send_statustext_all(MAV_SEVERITY_INFO, "ADSB: Using ICAO_id %d and Callsign %s", out_state.cfg.ICAO_id, out_state.cfg.callsign); out_state.last_config_ms = 0; // send now } @@ -645,7 +644,7 @@ void AP_ADSB::set_callsign(const char* str, bool append_icao) if (append_icao) { char str_icao[5]; - sprintf(str_icao, "%4d", out_state.cfg.ICAO_id % 10000); + sprintf(str_icao, "%04X", out_state.cfg.ICAO_id % 0x10000); out_state.cfg.callsign[4] = str_icao[0]; out_state.cfg.callsign[5] = str_icao[1]; out_state.cfg.callsign[6] = str_icao[2];