diff --git a/sw/ground_segment/cockpit/live.ml b/sw/ground_segment/cockpit/live.ml index f12fd4695f..244db7a4d5 100644 --- a/sw/ground_segment/cockpit/live.ml +++ b/sw/ground_segment/cockpit/live.ml @@ -104,7 +104,8 @@ type aircraft = { mutable last_dist_to_wp : float; mutable dl_values : string option array; mutable last_unix_time : float; - mutable airspeed : float + mutable airspeed : float; + mutable version : string; } let aircrafts = Hashtbl.create 3 @@ -681,7 +682,8 @@ let create_ac = fun alert (geomap:G.widget) (acs_notebook:GPack.notebook) (ac_id notebook_label = _label; got_track_status_timer = 1000; dl_values = [||]; last_unix_time = 0.; - airspeed = 0. + airspeed = 0.; + version = "" } in Hashtbl.add aircrafts ac_id ac; select_ac acs_notebook ac_id; @@ -1389,13 +1391,13 @@ let listen_info_msg = fun a -> tele_bind "INFO_MSG" (get_msg a) let listen_autopilot_version_msg = fun a -> - let got_version = ref false in let get_msg = fun a _sender vs -> let ac = find_ac _sender in let desc_array = Pprz.assoc "desc" vs in - if !got_version = false then - log a ac.ac_name (sprintf "%s version:\n%s" ac.ac_name (Pprz.string_of_value desc_array)); - got_version := true in + let version = Pprz.string_of_value desc_array in + if ac.version <> version then + log a ac.ac_name (sprintf "%s version:\n%s" ac.ac_name version); + ac.version <- version in tele_bind "AUTOPILOT_VERSION" (get_msg a) let listen_tcas = fun a -> diff --git a/sw/ground_segment/cockpit/live.mli b/sw/ground_segment/cockpit/live.mli index 4222af0202..b00bf2b580 100644 --- a/sw/ground_segment/cockpit/live.mli +++ b/sw/ground_segment/cockpit/live.mli @@ -61,7 +61,8 @@ type aircraft = private { mutable last_dist_to_wp : float; mutable dl_values : string option array; mutable last_unix_time : float; - mutable airspeed : float + mutable airspeed : float; + mutable version : string } val aircrafts : (string, aircraft) Hashtbl.t