diff --git a/conf/flight_plans/muret_mini.xml b/conf/flight_plans/muret_mini.xml index 021c7b3652..10040b13a9 100644 --- a/conf/flight_plans/muret_mini.xml +++ b/conf/flight_plans/muret_mini.xml @@ -11,6 +11,12 @@ + + + + + + diff --git a/sw/airborne/traffic_info.h b/sw/airborne/traffic_info.h index 1fe176b6ec..45c4fc5ec2 100644 --- a/sw/airborne/traffic_info.h +++ b/sw/airborne/traffic_info.h @@ -29,7 +29,7 @@ #ifndef TI_H #define TI_H -#define NB_ACS 4 +#define NB_ACS 8 struct ac_info_ { float east; /* m */ diff --git a/sw/ground_segment/cockpit/map2d.ml b/sw/ground_segment/cockpit/map2d.ml index ef8df663bd..18e029e4ad 100644 --- a/sw/ground_segment/cockpit/map2d.ml +++ b/sw/ground_segment/cockpit/map2d.ml @@ -713,8 +713,8 @@ let button_press = fun (geomap:G.widget) ev -> Ground_Pprz.message_send "map2d" "SEND_EVENT" ["ac_id", Pprz.String ac; "event_id", Pprz.Int e] - let dl_settings = fun ac_id xml -> - let window = GWindow.window ~title:("Datalink settings ") () in + let dl_settings = fun ac_id ac_name xml -> + let window = GWindow.window ~title:(sprintf "Datalink settings %s" ac_name) () in let quit = fun () -> GMain.Main.quit (); exit 0 in ignore (window#connect#destroy ~callback:quit); let vbox = GPack.vbox ~packing:window#add () in @@ -734,13 +734,22 @@ let button_press = fun (geomap:G.widget) ev -> let value = (lower +. upper) /. 2. in let text = ExtXml.attrib s "var" in let adj = GData.adjustment ~value ~lower ~upper:(upper+.10.) ~step_incr () in - let hbox = GPack.hbox ~width:400 ~packing:vbox#add () in + let hbox = GPack.hbox ~width:500 ~packing:vbox#add () in let _l = GMisc.label ~width:100 ~text ~packing:hbox#pack () in + let _v = GMisc.label ~width:50 ~text:"N/A" ~packing:hbox#pack () in let _scale = GRange.scale `HORIZONTAL ~digits:2 ~adjustment:adj ~packing:hbox#add () in let ii = !i in - let b = GButton.button ~label:"Update" ~stock:`REFRESH ~packing:hbox#pack () in +(*** let b = GButton.button ~label:"Update" ~stock:`REFRESH ~packing:hbox#pack () in let update = fun () -> adj#set_value current_values.(ii) in - ignore (b#connect#clicked ~callback:update); + ignore (b#connect#clicked ~callback:update); ***) + + let update_current_value = fun _ -> + let s = string_of_float current_values.(ii) in + if _v#text <> s then + _v#set_text s; + true in + + ignore (Glib.Timeout.add 500 update_current_value); let callback = fun () -> let vs = ["ac_id", Pprz.String ac_id; "index", Pprz.Int ii;"value", Pprz.Float adj#value] in @@ -835,7 +844,7 @@ let create_ac = fun (geomap:G.widget) ac_id config -> let fp_xml = ExtXml.child fp_xml_dump "flight_plan" in - let ds_window, ds_adjs = dl_settings ac_id fp_xml in + let ds_window, ds_adjs = dl_settings ac_id name fp_xml in let fp = load_mission color geomap fp_xml in fp#hide (); diff --git a/sw/ground_segment/tmtc/link.ml b/sw/ground_segment/tmtc/link.ml index af61f16be0..64189bf319 100644 --- a/sw/ground_segment/tmtc/link.ml +++ b/sw/ground_segment/tmtc/link.ml @@ -125,15 +125,18 @@ module Wc = struct done; b.(buffer_size-1) <- null_buffer_entry - let rec flush = fun () -> + let rec repeat_send = fun fd cmd n -> + W.send fd cmd; + timer := Some (GMain.Timeout.add 300 (fun _ -> Debug.trace 'b' (sprintf "Retry %d" n); repeat_send fd cmd (n+1); false)) + + let rec flush = fun n -> let status, b = buffer in if !status = Ready then let (priority, fd, cmd) = b.(0) in if priority <> Null then begin - Debug.trace 'w' (sprintf "%.2f send" (Unix.gettimeofday ())); - W.send fd cmd; + shift_buffer b; status := Busy; - timer := Some (GMain.Timeout.add 300 (fun _ -> Debug.trace 'b' "Retry"; flush (); false)) + repeat_send fd cmd 0 end let buffer_ready = fun () -> @@ -155,6 +158,7 @@ module Wc = struct for j = i + 1 to buffer_size - 1 do (** Shift *) b.(j) <- b.(j-1) done; + Debug.trace 'b' (sprintf "Set in %d" i); b.(i) <- (priority, fd, cmd) end else @@ -174,15 +178,19 @@ module Wc = struct match com with W.RECEIVED_FRAME -> use_tele_message (Serial.payload_of_string data) + | W.RES_SEND_FRAME -> + Debug.trace 'b' "RES_SEND_FRAME"; + ignore (GMain.Timeout.add 100 (fun _ -> buffer_ready (); false)) + | W.RES_READ_REMOTE_RSSI -> - Tm_Pprz.message_send "link" "WC_RSSI" ["raw_level", Pprz.Int (Char.code data.[0])]; + Tm_Pprz.message_send "link" "WC_RSSI" ["raw_level", Pprz.Int (Char.code data.[0])]; Debug.call 'w' (fun f -> fprintf f "%.2f wv remote RSSI %d\n" (Unix.gettimeofday ()) (Char.code data.[0])); + ignore (GMain.Timeout.add 100 (fun _ -> buffer_ready (); false)) | W.RES_READ_RADIO_PARAM -> Ivy.send (sprintf "WC_ADDR %s" data); Debug.call 'w' (fun f -> fprintf f "wv local addr : %s\n" (Debug.xprint data)); | W.ACK -> - Debug.trace 'w' (sprintf "%.2f wv ACK" (Unix.gettimeofday ())); - buffer_ready () + Debug.trace 'w' (sprintf "%.2f wv ACK" (Unix.gettimeofday ())) | _ -> Debug.call 'w' (fun f -> fprintf f "wv receiving: %02x %s\n" (W.code_of_cmd com) (Debug.xprint data)); () @@ -221,6 +229,7 @@ let get_fp = fun device _sender vs -> (fun (dest_id, _) -> if dest_id <> ac_id then (** Do not send to itself *) try + Debug.trace 'b' (sprintf "ACINFO %d for %d" ac_id dest_id); let ac_device = airborne_device dest_id airframes device.transport in let f = fun a -> Pprz.float_assoc a vs in let lat = (Deg>>Rad) (f "lat")