diff --git a/sw/ground_segment/cockpit/live.ml b/sw/ground_segment/cockpit/live.ml index 2cad11a0ba..e409f81d17 100644 --- a/sw/ground_segment/cockpit/live.ml +++ b/sw/ground_segment/cockpit/live.ml @@ -514,7 +514,13 @@ let listen_flight_params = fun geomap auto_center_new_ac alert -> ac.last_block_name <- b; let b = String.sub b 0 (min 10 (String.length b)) in Strip.set_label ac.strip "block_name" b - end + end; + let block_time = Int32.to_int (Pprz.int32_assoc "block_time" vs) + and stage_time = Int32.to_int (Pprz.int32_assoc "stage_time" vs) in + let bt = sprintf "%02d:%02d" (block_time / 60) (block_time mod 60) in + Strip.set_label ac.strip "block_time" bt; + let st = sprintf "%02d:%02d" (stage_time / 60) (block_time mod 60) in + Strip.set_label ac.strip "stage_time" st in safe_bind "NAV_STATUS" get_ns; @@ -560,7 +566,8 @@ let listen_flight_params = fun geomap auto_center_new_ac alert -> let get_ap_status = fun _sender vs -> let ac = get_ac vs in - ac.track#update_ap_status ( float_of_int (Pprz.int32_assoc "flight_time" vs )); + let flight_time = Int32.to_int (Pprz.int32_assoc "flight_time" vs) in + ac.track#update_ap_status (float_of_int flight_time); let ap_mode = Pprz.string_assoc "ap_mode" vs in if ap_mode <> ac.last_ap_mode then begin log_and_say alert (sprintf "%s, %s" ac.ac_name ap_mode); @@ -572,8 +579,7 @@ let listen_flight_params = fun geomap auto_center_new_ac alert -> Strip.set_label ac.strip "GPS" gps_mode; Strip.set_color ac.strip "GPS" (if gps_mode<>"3D" then alert_color else ok_color); let ft = - let t = Int32.to_int (Int32.of_string (Pprz.string_assoc "flight_time" vs)) in - sprintf "%02d:%02d:%02d" (t / 3600) ((t mod 3600) / 60) ((t mod 3600) mod 60) in + sprintf "%02d:%02d:%02d" (flight_time / 3600) ((flight_time / 60) mod 60) (flight_time mod 60) in Strip.set_label ac.strip "flight_time" ft; let kill_mode = Pprz.string_assoc "kill_mode" vs in if not ac.in_kill_mode then diff --git a/sw/ground_segment/cockpit/strip.ml b/sw/ground_segment/cockpit/strip.ml index 6a7c0fb10f..cc7c4f1c92 100644 --- a/sw/ground_segment/cockpit/strip.ml +++ b/sw/ground_segment/cockpit/strip.ml @@ -47,7 +47,9 @@ let add config color select center_ac commit_moves mark = let framevb = GPack.vbox ~packing:frame#add () in (** Table (everything except the user buttons) *) - let strip = GPack.table ~rows ~columns ~col_spacings:5 ~row_spacings:3 ~packing:framevb#add () in + let strip = GPack.table ~rows ~columns ~col_spacings:3 ~packing:framevb#add () in + strip#set_row_spacing 0 3; + strip#set_row_spacing (rows-2) 3; (* Name in top left *) let name = (GMisc.label ~text: (ac_name) ~packing: (strip#attach ~top: 0 ~left: 0) ()) in @@ -60,9 +62,18 @@ let add config color select center_ac commit_moves mark = let h = GPack.hbox ~packing:plane_color#add () in let ft = GMisc.label ~text: "00:00:00" ~packing:h#add () in ft#set_width_chars 8; - add_label ("flight_time_value") (plane_color, ft); + add_label "flight_time_value" (plane_color, ft); + + let block_time = GMisc.label ~text: "00:00" ~packing:h#add () in + add_label "block_time_value" (plane_color, block_time); + + let stage_time = GMisc.label ~text: "00:00" ~packing:h#add () in + add_label "stage_time_value" (plane_color, stage_time); + let block_name = GMisc.label ~text: "______" ~packing:h#add () in - add_label ("block_name_value") (plane_color, block_name); + add_label "block_name_value" (plane_color, block_name); + + tooltips#set_tip plane_color#coerce ~text:"Flight time - Block time - Stage time - Block name"; (* battery gauge *) let gauge = GMisc.drawing_area ~height:60 ~show:true ~packing:(strip#attach ~top:1 ~bottom:(rows-1) ~left:0) () in @@ -105,9 +116,13 @@ let add config color select center_ac commit_moves mark = (** set a label *) let set_label strip name value = - let _eb, l = List.assoc (name^"_value") strip.labels in - if l#text <> value then - l#set_label value + try + let _eb, l = List.assoc (name^"_value") strip.labels in + if l#text <> value then + l#set_label value + with + Not_found -> + Printf.fprintf stderr "Strip.set_label: '%s' unknown\n%!" name (** set a label *) let set_color strip name color =