[generators] gen_airframe: don't force float if unit = code_unit

This commit is contained in:
Felix Ruess
2014-10-07 20:25:18 +02:00
parent a40222251a
commit 8232ce06b0
+2
View File
@@ -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