diff --git a/sw/lib/ocaml/pprz.ml b/sw/lib/ocaml/pprz.ml index 1b71b71a85..036327b4ee 100644 --- a/sw/lib/ocaml/pprz.ml +++ b/sw/lib/ocaml/pprz.ml @@ -40,6 +40,7 @@ type value = type field = { _type : _type; fformat : format; + alt_unit_coef : string option } type link_mode = Forwarded | Broadcasted @@ -156,7 +157,8 @@ let field_of_xml = fun xml -> let t = ExtXml.attrib xml "type" in let t = if is_array_type t then ArrayType (type_of_array_type t) else Scalar t in let f = try Xml.attrib xml "format" with _ -> default_format t in - (String.lowercase (ExtXml.attrib xml "name"), { _type = t; fformat = f }) + let auc = try Some (Xml.attrib xml "alt_unit_coef") with _ -> None in + (String.lowercase (ExtXml.attrib xml "name"), { _type = t; fformat = f; alt_unit_coef = auc }) let string_of_values = fun vs -> String.concat " " (List.map (fun (a,v) -> sprintf "%s=%s" a (string_of_value v)) vs) diff --git a/sw/lib/ocaml/pprz.mli b/sw/lib/ocaml/pprz.mli index 058f72665b..1ab0ca43df 100644 --- a/sw/lib/ocaml/pprz.mli +++ b/sw/lib/ocaml/pprz.mli @@ -36,7 +36,11 @@ type _type = type value = Int of int | Float of float | String of string | Int32 of int32 | Array of value array -type field = { _type : _type; fformat : format; } +type field = { + _type : _type; + fformat : format; + alt_unit_coef : string option + } type link_mode = Forwarded | Broadcasted type message = { name : string; diff --git a/sw/logalizer/plot.ml b/sw/logalizer/plot.ml index f77a437279..6953308296 100644 --- a/sw/logalizer/plot.ml +++ b/sw/logalizer/plot.ml @@ -453,14 +453,18 @@ let load_log = fun ?factor (plot:plot) (menubar:GMenu.menu_shell GMenu.factory) Hashtbl.iter (fun f v -> if not (List.mem f !l) then l := f :: !l) fields; - let l = List.map (fun f -> - let values = Hashtbl.find_all fields f in - let values = List.map (fun (t, v) -> (t, pprz_float v)) values in - let values = Array.of_list values in - Array.sort compare values; - (f, values)) - (List.sort compare !l) in - (msg.Pprz.name, l)) + let sorted_fields = List.sort compare !l in + + let field_values_assoc = + List.map + (fun f -> + let values = Hashtbl.find_all fields f in + let values = List.map (fun (t, v) -> (t, pprz_float v)) values in + let values = Array.of_list values in + Array.sort compare values; + (f, values)) + sorted_fields in + (msg.Pprz.name, field_values_assoc)) msgs in (* Store data for other windows *) @@ -508,6 +512,7 @@ let screenshot = fun frame -> end +(*****************************************************************************) let rec plot_window = fun init -> let plotter = GWindow.window ~allow_shrink:true ~title:"Log Plotter" () in plotter#set_icon (Some (GdkPixbuf.from_file Env.icon_file));