Env -> Env_conf

This commit is contained in:
Pascal Brisset
2005-02-23 16:28:58 +00:00
parent e03f7af52c
commit 532e76d492
13 changed files with 28 additions and 35 deletions
+1 -1
View File
@@ -23,7 +23,7 @@
OCAMLC=ocamlc -g -I +labltk -I +lablgtk2 -I ../lib/ocaml OCAMLC=ocamlc -g -I +labltk -I +lablgtk2 -I ../lib/ocaml
SRC = env.ml tty.ml varXml.ml console.ml tkXml.ml flasher.ml notebook.ml welcome.ml hardware.ml radio.ml servos.ml adc.ml infrared.ml attitude.ml autopilot.ml airframe.ml flightplan.ml upload.ml simulator.ml monitor.ml logalizer.ml main.ml SRC = env_conf.ml notebook.ml tty.ml varXml.ml console.ml tkXml.ml flasher.ml welcome.ml hardware.ml radio.ml servos.ml adc.ml infrared.ml attitude.ml autopilot.ml airframe.ml flightplan.ml upload.ml simulator.ml monitor.ml logalizer.ml main.ml
CMO = $(SRC:.ml=.cmo) CMO = $(SRC:.ml=.cmo)
all : configurator medit.out all : configurator medit.out
@@ -24,14 +24,7 @@
* *
*) *)
let pprz_dir = let abs = fun x -> Env.paparazzi_src ^ "/" ^ x
try
Sys.getenv "PAPARAZZI_DIR"
with
Not_found ->
Filename.concat (Filename.dirname Sys.argv.(0)) "../.."
let abs = fun x -> pprz_dir ^ "/" ^ x
let configurator_dir = abs "sw/configurator" let configurator_dir = abs "sw/configurator"
@@ -48,10 +41,3 @@ let tty_rate = Serial.B38400
(* Initialization very early for creation of Textvariables *) (* Initialization very early for creation of Textvariables *)
let _ = Tk.openTk () let _ = Tk.openTk ()
let select_one_file = fun ?(filter="*.xml") use ->
let action = function
[] -> ()
| [f] -> use f
| _ -> failwith "Env.select_one_file: unepected several files" in
Fileselect.f ~title:"File Selection" ~action ~filter ~file:"" ~multi:false ~sync:false
@@ -24,8 +24,6 @@
* *
*) *)
val pprz_dir : string
val configurator_dir : string val configurator_dir : string
val fbw_dir : string val fbw_dir : string
val ap_dir : string val ap_dir : string
@@ -36,6 +34,3 @@ val ap_tty : string
val modem_tty : string val modem_tty : string
val tty_rate : Serial.speed val tty_rate : Serial.speed
val select_one_file : ?filter:string -> (string -> unit) -> unit
(** File selector. Default [filter] is "*.xml" *)
+1 -1
View File
@@ -50,7 +50,7 @@ let warn =
let erase_AP = fun () -> let erase_AP = fun () ->
if switch Ap = 0 then if switch Ap = 0 then
let command = Printf.sprintf "cd %s; make erase" Env.ap_dir in let command = Printf.sprintf "cd %s; make erase" Env_conf.ap_dir in
Console.exec command; Console.exec command;
destroy () in destroy () in
+1 -1
View File
@@ -56,7 +56,7 @@ let create_sheet = fun sheets ->
let f = Frame.create sheets in let f = Frame.create sheets in
Notebook.create_sheet sheets "Flight Plan" f; Notebook.create_sheet sheets "Flight Plan" f;
let b = Button.create ~text:"Calibrate IGN tile" ~command:(fun () -> Env.select_one_file ~filter:"*.png" calibrate_ign_tile) f in let b = Button.create ~text:"Calibrate IGN tile" ~command:(fun () -> Notebook.select_one_file ~filter:"*.png" calibrate_ign_tile) f in
Tk.pack [b]; Tk.pack [b];
+6 -6
View File
@@ -27,22 +27,22 @@
module FbwMcu = struct module FbwMcu = struct
let name = "Fly by wire" let name = "Fly by wire"
let sort = Flasher.Fbw let sort = Flasher.Fbw
let path = Env.fbw_dir let path = Env_conf.fbw_dir
let default_tty = Env.fbw_tty let default_tty = Env_conf.fbw_tty
end end
module ApMcu = struct module ApMcu = struct
let name = "Autopilot" let name = "Autopilot"
let sort = Flasher.Ap let sort = Flasher.Ap
let path = Env.ap_dir let path = Env_conf.ap_dir
let default_tty = Env.ap_tty let default_tty = Env_conf.ap_tty
end end
module ModemMcu = struct module ModemMcu = struct
let name = "Ground Modem" let name = "Ground Modem"
let sort = Flasher.Modem let sort = Flasher.Modem
let path = Env.modem_dir let path = Env_conf.modem_dir
let default_tty = Env.modem_tty let default_tty = Env_conf.modem_tty
end end
module type MCU = sig module type MCU = sig
+8
View File
@@ -60,3 +60,11 @@ let create_sheet w name child =
let select_one_file = fun ?(filter="*.xml") use ->
let action = function
[] -> ()
| [f] -> use f
| _ -> failwith "Env.select_one_file: unepected several files" in
Fileselect.f ~title:"File Selection" ~action ~filter ~file:"" ~multi:false ~sync:false
+4
View File
@@ -26,3 +26,7 @@
val create_sheet : 'a Widget.widget -> string -> 'b Widget.widget -> unit val create_sheet : 'a Widget.widget -> string -> 'b Widget.widget -> unit
(** [create_sheet parent name frame] adds the new [frame] tab *) (** [create_sheet parent name frame] adds the new [frame] tab *)
val select_one_file : ?filter:string -> (string -> unit) -> unit
(** File selector. Default [filter] is "*.xml" *)
+1 -1
View File
@@ -139,7 +139,7 @@ let one_channel = fun parent i xml_channel ->
let program_board = fun w cs () -> let program_board = fun w cs () ->
Flasher.make Flasher.Fbw (Printf.sprintf "%s/test" Env.fbw_dir) "TARGET=rc_transmitter load"; Flasher.make Flasher.Fbw (Printf.sprintf "%s/test" Env_conf.fbw_dir) "TARGET=rc_transmitter load";
let tty = Hardware.Fbw.get_tty () in let tty = Hardware.Fbw.get_tty () in
Tty.connect tty; Tty.connect tty;
+1 -1
View File
@@ -112,7 +112,7 @@ let create_sheet = fun sheets airframe_xml ->
in in
let program = fun () -> let program = fun () ->
Flasher.make Flasher.Fbw (Printf.sprintf "%s/test" Env.fbw_dir) "TARGET=setup_servos load" in Flasher.make Flasher.Fbw (Printf.sprintf "%s/test" Env_conf.fbw_dir) "TARGET=setup_servos load" in
let legend = Frame.create channels let legend = Frame.create channels
and slider = Scale.create tf ~orient:`Horizontal ~min:min_min ~max:max_max ~digits:4 ~label:"micro-seconds" ~resolution:1. ~length:300 and slider = Scale.create tf ~orient:`Horizontal ~min:min_min ~max:max_max ~digits:4 ~label:"micro-seconds" ~resolution:1. ~length:300
+2 -2
View File
@@ -44,7 +44,7 @@ let create_display_frame = fun f xml appli ->
close_out f; close_out f;
destroy () in destroy () in
let save_button = Button.create ~text:"Save Config" ~command:(fun _ -> Env.select_one_file save) tf let save_button = Button.create ~text:"Save Config" ~command:(fun _ -> Notebook.select_one_file save) tf
and cancel_button = Button.create ~text:"Cancel" ~command:destroy tf in and cancel_button = Button.create ~text:"Cancel" ~command:destroy tf in
Tk.pack [l] ~side:`Left; Tk.pack [l] ~side:`Left;
@@ -66,7 +66,7 @@ let create = fun top appli ->
Console.write (Printf.sprintf "Reading from \"%s\"\n" file); Console.write (Printf.sprintf "Reading from \"%s\"\n" file);
create_display_frame f (VarXml.of_xml (Xml.parse_file file)) appli in create_display_frame f (VarXml.of_xml (Xml.parse_file file)) appli in
let load_button = Button.create ~text:"Load Config" ~command:(fun _ -> Env.select_one_file load) top in let load_button = Button.create ~text:"Load Config" ~command:(fun _ -> Notebook.select_one_file load) top in
Tk.pack [load_button]; Tk.pack [load_button];
Tk.pack [f] Tk.pack [f]
+1 -1
View File
@@ -42,7 +42,7 @@ let connect = fun tty ->
if Hashtbl.mem ttys tty then if Hashtbl.mem ttys tty then
deconnect tty; deconnect tty;
let buffer = String.create buffer_len in let buffer = String.create buffer_len in
let fd = Serial.opendev tty Env.tty_rate in let fd = Serial.opendev tty Env_conf.tty_rate in
let log = fun () -> let log = fun () ->
let n = Unix.read fd buffer 0 buffer_len in let n = Unix.read fd buffer 0 buffer_len in
let s = String.sub buffer 0 n in let s = String.sub buffer 0 n in
+1 -1
View File
@@ -30,7 +30,7 @@ let create_sheet = fun sheets ->
let l = Label.create ~text:"WELCOME TO THE PAPARAZZI CONFIGURATOR" welcome let l = Label.create ~text:"WELCOME TO THE PAPARAZZI CONFIGURATOR" welcome
in let img = Imagephoto.create() in in let img = Imagephoto.create() in
Imagephoto.configure img ~file:(Env.configurator_dir^"/penguin.gif") ~format:"gif"; Imagephoto.configure img ~file:(Env.paparazzi_src^"/data/pictures/penguin_logo.gif") ~format:"gif";
let l1 = Label.create ~image:img welcome let l1 = Label.create ~image:img welcome
in Tk.pack [l; l1]; in Tk.pack [l; l1];