mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-06-04 22:17:01 +08:00
Env -> Env_conf
This commit is contained in:
@@ -23,7 +23,7 @@
|
||||
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)
|
||||
|
||||
all : configurator medit.out
|
||||
|
||||
@@ -24,14 +24,7 @@
|
||||
*
|
||||
*)
|
||||
|
||||
let pprz_dir =
|
||||
try
|
||||
Sys.getenv "PAPARAZZI_DIR"
|
||||
with
|
||||
Not_found ->
|
||||
Filename.concat (Filename.dirname Sys.argv.(0)) "../.."
|
||||
|
||||
let abs = fun x -> pprz_dir ^ "/" ^ x
|
||||
let abs = fun x -> Env.paparazzi_src ^ "/" ^ x
|
||||
|
||||
let configurator_dir = abs "sw/configurator"
|
||||
|
||||
@@ -48,10 +41,3 @@ let tty_rate = Serial.B38400
|
||||
|
||||
(* Initialization very early for creation of Textvariables *)
|
||||
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 fbw_dir : string
|
||||
val ap_dir : string
|
||||
@@ -36,6 +34,3 @@ val ap_tty : string
|
||||
val modem_tty : string
|
||||
|
||||
val tty_rate : Serial.speed
|
||||
|
||||
val select_one_file : ?filter:string -> (string -> unit) -> unit
|
||||
(** File selector. Default [filter] is "*.xml" *)
|
||||
@@ -50,7 +50,7 @@ let warn =
|
||||
|
||||
let erase_AP = fun () ->
|
||||
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;
|
||||
destroy () in
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ let create_sheet = fun sheets ->
|
||||
let f = Frame.create sheets in
|
||||
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];
|
||||
|
||||
|
||||
@@ -27,22 +27,22 @@
|
||||
module FbwMcu = struct
|
||||
let name = "Fly by wire"
|
||||
let sort = Flasher.Fbw
|
||||
let path = Env.fbw_dir
|
||||
let default_tty = Env.fbw_tty
|
||||
let path = Env_conf.fbw_dir
|
||||
let default_tty = Env_conf.fbw_tty
|
||||
end
|
||||
|
||||
module ApMcu = struct
|
||||
let name = "Autopilot"
|
||||
let sort = Flasher.Ap
|
||||
let path = Env.ap_dir
|
||||
let default_tty = Env.ap_tty
|
||||
let path = Env_conf.ap_dir
|
||||
let default_tty = Env_conf.ap_tty
|
||||
end
|
||||
|
||||
module ModemMcu = struct
|
||||
let name = "Ground Modem"
|
||||
let sort = Flasher.Modem
|
||||
let path = Env.modem_dir
|
||||
let default_tty = Env.modem_tty
|
||||
let path = Env_conf.modem_dir
|
||||
let default_tty = Env_conf.modem_tty
|
||||
end
|
||||
|
||||
module type MCU = sig
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -26,3 +26,7 @@
|
||||
|
||||
val create_sheet : 'a Widget.widget -> string -> 'b Widget.widget -> unit
|
||||
(** [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" *)
|
||||
|
||||
@@ -139,7 +139,7 @@ let one_channel = fun parent i xml_channel ->
|
||||
|
||||
|
||||
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
|
||||
Tty.connect tty;
|
||||
|
||||
@@ -112,7 +112,7 @@ let create_sheet = fun sheets airframe_xml ->
|
||||
in
|
||||
|
||||
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
|
||||
and slider = Scale.create tf ~orient:`Horizontal ~min:min_min ~max:max_max ~digits:4 ~label:"micro-seconds" ~resolution:1. ~length:300
|
||||
|
||||
@@ -44,7 +44,7 @@ let create_display_frame = fun f xml appli ->
|
||||
close_out f;
|
||||
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
|
||||
|
||||
Tk.pack [l] ~side:`Left;
|
||||
@@ -66,7 +66,7 @@ let create = fun top appli ->
|
||||
Console.write (Printf.sprintf "Reading from \"%s\"\n" file);
|
||||
|
||||
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 [f]
|
||||
|
||||
@@ -42,7 +42,7 @@ let connect = fun tty ->
|
||||
if Hashtbl.mem ttys tty then
|
||||
deconnect tty;
|
||||
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 n = Unix.read fd buffer 0 buffer_len in
|
||||
let s = String.sub buffer 0 n in
|
||||
|
||||
@@ -30,7 +30,7 @@ let create_sheet = fun sheets ->
|
||||
|
||||
let l = Label.create ~text:"WELCOME TO THE PAPARAZZI CONFIGURATOR" welcome
|
||||
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
|
||||
in Tk.pack [l; l1];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user