Merge branch 'master' of github.com:paparazzi/paparazzi into hooperfly_updates

This commit is contained in:
Richard A Burton
2015-12-07 09:23:38 -08:00
2 changed files with 55 additions and 48 deletions
+1 -1
View File
@@ -35,7 +35,7 @@
</target> </target>
<target name="test_adc" board="elle0_1.2"/> <target name="test_adc" board="elle0_1.2"/>
<target name="test_uart" board="elle0_1.2"> <target name="test_uart" board="elle0_1.2">
<define name="USE_UART1"/> <define name="USE_UART2"/>
<define name="UART2_BAUD" value="B57600"/> <define name="UART2_BAUD" value="B57600"/>
<define name="USE_UART3"/> <define name="USE_UART3"/>
<define name="UART3_BAUD" value="B57600"/> <define name="UART3_BAUD" value="B57600"/>
+14 -7
View File
@@ -2,6 +2,7 @@
* Extraction of .log and .data file from a .TLM airborne SD file * Extraction of .log and .data file from a .TLM airborne SD file
* *
* Copyright (C) 2009 ENAC, Pascal Brisset * Copyright (C) 2009 ENAC, Pascal Brisset
* Copyright (C) 2015 Gautier Hattenberger <gautier.hattenberger@enac.fr>
* *
* This file is part of paparazzi. * This file is part of paparazzi.
* *
@@ -26,7 +27,7 @@ open Printf
module U = Unix module U = Unix
let (//) = Filename.concat let (//) = Filename.concat
let var_path = Env.paparazzi_home // "var" let var_path = Env.paparazzi_home // "var"
let logs_path = var_path // "logs" let default_logs_path = var_path // "logs"
let conf_xml = Xml.parse_file (Env.paparazzi_home // "conf" // "conf.xml") let conf_xml = Xml.parse_file (Env.paparazzi_home // "conf" // "conf.xml")
@@ -82,7 +83,7 @@ let string_of_message = fun log_msg ->
| x -> failwith (sprintf "Unexpected source:%d in log msg" x) | x -> failwith (sprintf "Unexpected source:%d in log msg" x)
let hex_of_array = function let hex_of_array = function
Pprz.Array array -> | Pprz.Array array ->
let n = Array.length array in let n = Array.length array in
(* One integer -> 2 chars *) (* One integer -> 2 chars *)
let s = String.create (2*n) in let s = String.create (2*n) in
@@ -119,7 +120,7 @@ let search_conf = fun md5 ->
loop 0 loop 0
let convert_file = fun file -> let convert_file = fun ?(output_dir=None) file ->
let tmp_file = Filename.temp_file "tlm_from_sd" "data" in let tmp_file = Filename.temp_file "tlm_from_sd" "data" in
let f_in = open_in file let f_in = open_in file
@@ -129,6 +130,11 @@ let convert_file = fun file ->
and md5 = ref "" and md5 = ref ""
and single_ac_id = ref (-1) in and single_ac_id = ref (-1) in
let logs_path = match output_dir with
| None -> default_logs_path
| Some x -> x
in
let use_payload = fun payload -> let use_payload = fun payload ->
try try
let log_msg = Logpprz.parse payload in let log_msg = Logpprz.parse payload in
@@ -180,7 +186,7 @@ let convert_file = fun file ->
(* Rename the file according to the GPS time *) (* Rename the file according to the GPS time *)
let start_time, mark = let start_time, mark =
match !start_unix_time with match !start_unix_time with
None -> | None ->
fprintf stderr "Warning: not time found in GPS messages; using current date\n"; fprintf stderr "Warning: not time found in GPS messages; using current date\n";
U.gettimeofday (), "_no_GPS" (* Not found, use now *) U.gettimeofday (), "_no_GPS" (* Not found, use now *)
| Some u -> u, "" in | Some u -> u, "" in
@@ -204,8 +210,7 @@ let convert_file = fun file ->
fprintf stderr "Not found...\n%!"; fprintf stderr "Not found...\n%!";
if !single_ac_id >= 0 then begin if !single_ac_id >= 0 then begin
fprintf stderr "Try to rebuild it for A/C %d ...\n%!" !single_ac_id; fprintf stderr "Try to rebuild it for A/C %d ...\n%!" !single_ac_id;
try log_xml !single_ac_id with try log_xml !single_ac_id with _ ->
_ ->
fprintf stderr "Failure: A/C %d not found\n%!" !single_ac_id; fprintf stderr "Failure: A/C %d not found\n%!" !single_ac_id;
Xml.PCData "" Xml.PCData ""
end else end else
@@ -231,7 +236,9 @@ let convert_file = fun file ->
let () = let () =
if Array.length Sys.argv = 2 then if Array.length Sys.argv = 2 then
convert_file Sys.argv.(1) convert_file Sys.argv.(1)
else if Array.length Sys.argv = 3 then
convert_file ~output_dir:(Some Sys.argv.(2)) Sys.argv.(1)
else begin else begin
fprintf stderr "Usage: %s <telemetry airborne file>\n" Sys.argv.(0); fprintf stderr "Usage: %s <telemetry airborne file> [<output directory (default in Paparazzi logs folder)>]\n" Sys.argv.(0);
exit 1; exit 1;
end end