diff --git a/sw/ground_segment/cockpit/gcs.ml b/sw/ground_segment/cockpit/gcs.ml index 985ca3adc9..ac998ec559 100644 --- a/sw/ground_segment/cockpit/gcs.ml +++ b/sw/ground_segment/cockpit/gcs.ml @@ -375,6 +375,7 @@ let options = "-zoom", Arg.Set_float zoom, "Initial zoom"; "-auto_hide_fp", Arg.Unit (fun () -> Live.auto_hide_fp true; hide_fp := true), "Automatically hide flight plans of unselected aircraft"; "-timestamp", Arg.Set timestamp, "Bind on timestampped telemetry messages"; + "-ac_ids", Arg.String (fun s -> Live.filter_ac_ids s), "comma separated list of AC IDs to show in GCS"; ] diff --git a/sw/ground_segment/cockpit/live.ml b/sw/ground_segment/cockpit/live.ml index 25ab14f12f..b03740bad0 100644 --- a/sw/ground_segment/cockpit/live.ml +++ b/sw/ground_segment/cockpit/live.ml @@ -114,6 +114,9 @@ type aircraft = { mutable last_gps_acc : gps_acc_level } +let list_separator = Str.regexp "," +let filter_acs = ref [] + let aircrafts = Hashtbl.create 3 exception AC_not_found let find_ac = fun ac_id -> @@ -174,7 +177,11 @@ let select_ac = fun acs_notebook ac_id -> (* Select and enlarge the label of the A/C notebook *) let n = acs_notebook#page_num ac.pages in acs_notebook#goto_page n; - ac.notebook_label#set_width_chars 20; + ac.notebook_label#set_width_chars 20 + +let filter_ac_ids = fun acs -> + let acs = Str.split list_separator acs in + filter_acs := acs; module M = Map.Make (struct type t = string let compare = compare end) let log = @@ -814,7 +821,7 @@ let ask_config = fun alert geomap fp_notebook strips ac -> let one_new_ac = fun alert (geomap:G.widget) fp_notebook strips ac -> - if not (Hashtbl.mem aircrafts ac) then + if (List.length !filter_acs = 0) || (List.mem ac !filter_acs) && not (Hashtbl.mem aircrafts ac) then ask_config alert geomap fp_notebook strips ac @@ -907,8 +914,6 @@ let listen_if_calib_msg = fun () -> let listen_telemetry_status = fun a -> safe_bind "TELEMETRY_STATUS" (get_telemetry_status a) -let list_separator = Str.regexp "," - let aircrafts_msg = fun alert (geomap:G.widget) fp_notebook strips acs -> let acs = Pprz.string_assoc "ac_list" acs in let acs = Str.split list_separator acs in diff --git a/sw/ground_segment/cockpit/live.mli b/sw/ground_segment/cockpit/live.mli index 08f29ad2a7..0f94e67b28 100644 --- a/sw/ground_segment/cockpit/live.mli +++ b/sw/ground_segment/cockpit/live.mli @@ -87,3 +87,4 @@ val jump_to_block : string -> int -> unit val dl_setting : string -> int -> float -> unit (** [dl_setting ac_id var_index value] Sends a DL_SETTING message *) +val filter_ac_ids: string -> unit