mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-13 02:52:13 +08:00
[generators] gen_airframe: don't force float if unit = code_unit
This commit is contained in:
@@ -83,6 +83,8 @@ let convert_value_with_code_unit_coef_of_xml = function xml ->
|
||||
(* if unit attribute is not specified don't even attempt to convert the units *)
|
||||
let u = try Xml.attrib xml "unit" with _ -> failwith "Unit conversion error" in
|
||||
let cu = ExtXml.attrib_or_default xml "code_unit" "" in
|
||||
(* if unit equals code unit, don't convert as that would always result in a float *)
|
||||
if u = cu then failwith "Not converting";
|
||||
(* default value for code_unit is rad[/s] when unit is deg[/s] *)
|
||||
let conv = try (Pprz.scale_of_units u cu) with
|
||||
| Pprz.Unit_conversion_error s -> prerr_endline (sprintf "Unit conversion error: %s" s); flush stderr; exit 1
|
||||
|
||||
Reference in New Issue
Block a user