[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[paparazzi-commits] [6165] the up and down shortcuts of the strip are co
From: |
Gautier Hattenberger |
Subject: |
[paparazzi-commits] [6165] the up and down shortcuts of the strip are configurable from airframe file with : |
Date: |
Mon, 18 Oct 2010 15:34:40 +0000 |
Revision: 6165
http://svn.sv.gnu.org/viewvc/?view=rev&root=paparazzi&revision=6165
Author: gautier
Date: 2010-10-18 15:34:40 +0000 (Mon, 18 Oct 2010)
Log Message:
-----------
the up and down shortcuts of the strip are configurable from airframe file with:
<section name="GCS">
<define name="ALT_SHIFT_PLUS_PLUS" value="5"/>
<define name="ALT_SHIFT_PLUS" value="1"/>
<define name="ALT_SHIFT_MINUS" value="-1"/>
</section>
Modified Paths:
--------------
paparazzi3/trunk/sw/ground_segment/cockpit/gcs.glade
paparazzi3/trunk/sw/ground_segment/cockpit/live.ml
paparazzi3/trunk/sw/ground_segment/cockpit/strip.ml
paparazzi3/trunk/sw/ground_segment/cockpit/strip.mli
Modified: paparazzi3/trunk/sw/ground_segment/cockpit/gcs.glade
===================================================================
--- paparazzi3/trunk/sw/ground_segment/cockpit/gcs.glade 2010-10-18
14:27:50 UTC (rev 6164)
+++ paparazzi3/trunk/sw/ground_segment/cockpit/gcs.glade 2010-10-18
15:34:40 UTC (rev 6165)
@@ -724,12 +724,11 @@
</packing>
</child>
<child>
- <widget class="GtkButton"
id="button_minus_five">
+ <widget class="GtkButton"
id="button_down">
<property
name="visible">True</property>
<property
name="sensitive">False</property>
<property
name="can_focus">True</property>
<property
name="receives_default">False</property>
- <property name="tooltip"
translatable="yes">Altitude -5m</property>
<child>
<widget class="GtkImage"
id="image4">
<property
name="visible">True</property>
@@ -745,12 +744,11 @@
</packing>
</child>
<child>
- <widget class="GtkButton"
id="button_plus_five">
+ <widget class="GtkButton"
id="button_up">
<property
name="visible">True</property>
<property
name="sensitive">False</property>
<property
name="can_focus">True</property>
<property
name="receives_default">False</property>
- <property name="tooltip"
translatable="yes">Altitude +5m</property>
<child>
<widget class="GtkImage"
id="image11">
<property
name="visible">True</property>
@@ -835,12 +833,11 @@
</packing>
</child>
<child>
- <widget class="GtkButton"
id="button_plus_thirty">
+ <widget class="GtkButton"
id="button_up_up">
<property
name="visible">True</property>
<property
name="sensitive">False</property>
<property
name="can_focus">True</property>
<property
name="receives_default">False</property>
- <property name="tooltip"
translatable="yes">Altitude +30m</property>
<child>
<widget class="GtkImage"
id="image5">
<property
name="visible">True</property>
Modified: paparazzi3/trunk/sw/ground_segment/cockpit/live.ml
===================================================================
--- paparazzi3/trunk/sw/ground_segment/cockpit/live.ml 2010-10-18 14:27:50 UTC
(rev 6164)
+++ paparazzi3/trunk/sw/ground_segment/cockpit/live.ml 2010-10-18 15:34:40 UTC
(rev 6165)
@@ -337,8 +337,21 @@
fvalue "CATASTROPHIC_BAT_LEVEL" default_catastrophic_level, fvalue
"MAX_BAT_LEVEL" default_max_level
with _ -> (default_catastrophic_level, default_max_level)
+let get_alt_shift = fun af_xml ->
+ let default_plus_plus = 30.
+ and default_plus = 5.
+ and default_minus = -5. in
+ try
+ let gcs_section = ExtXml.child af_xml ~select:(fun x -> Xml.attrib x
"name" = "GCS") "section" in
+ let fvalue = fun name default ->
+ try ExtXml.float_attrib (ExtXml.child gcs_section ~select:(fun x ->
ExtXml.attrib x "name" = name) "define") "value" with _ -> default in
+ fvalue "ALT_SHIFT_PLUS_PLUS" default_plus_plus,
+ fvalue "ALT_SHIFT_PLUS" default_plus,
+ fvalue "ALT_SHIFT_MINUS" default_minus
+ with _ -> (default_plus_plus, default_plus, default_minus)
+
let key_press_event = fun keys do_action ev ->
try
let (modifiers, action) = List.assoc (GdkEvent.Key.keyval ev) keys in
@@ -422,7 +435,13 @@
(** Add a strip *)
let min_bat, max_bat = get_bat_levels af_xml in
- let strip = Strip.add config color min_bat max_bat in
+ let alt_shift_plus_plus, alt_shift_plus, alt_shift_minus = get_alt_shift
af_xml in
+ let param = { Strip.color = color; min_bat = min_bat; max_bat = max_bat;
+ alt_shift_plus_plus = alt_shift_plus_plus;
+ alt_shift_plus = alt_shift_plus;
+ alt_shift_minus = alt_shift_minus; } in
+ (*let strip = Strip.add config color min_bat max_bat in*)
+ let strip = Strip.add config param in
strip#connect (fun () -> select_ac acs_notebook ac_id);
strip#connect_mark (mark geomap ac_id track !Plugin.frame);
@@ -1241,7 +1260,14 @@
let get_alarm_tcas = fun a txt _sender vs ->
let ac = find_ac _sender in
let other_ac = get_ac vs in
- log_and_say a ac.ac_name (sprintf "%s : %s -> %s" txt ac.ac_name
other_ac.ac_name)
+ let resolve = try
+ match Pprz.int_assoc "resolve" vs with
+ 1 -> "=> LEVEL"
+ | 2 -> "=> CLIMB"
+ | 3 -> "=> DESCEND"
+ | _ -> ""
+ with _ -> "" in
+ log_and_say a ac.ac_name (sprintf "%s : %s -> %s %s" txt ac.ac_name
other_ac.ac_name resolve)
in
tele_bind "TCAS_TA" (get_alarm_tcas a "tcas TA");
tele_bind "TCAS_RA" (get_alarm_tcas a "TCAS RA")
Modified: paparazzi3/trunk/sw/ground_segment/cockpit/strip.ml
===================================================================
--- paparazzi3/trunk/sw/ground_segment/cockpit/strip.ml 2010-10-18 14:27:50 UTC
(rev 6164)
+++ paparazzi3/trunk/sw/ground_segment/cockpit/strip.ml 2010-10-18 15:34:40 UTC
(rev 6165)
@@ -51,6 +51,15 @@
hide_buttons : unit -> unit;
show_buttons : unit -> unit >
+type strip_param = {
+ color : string;
+ min_bat : float;
+ max_bat : float;
+ alt_shift_plus_plus : float;
+ alt_shift_plus : float;
+ alt_shift_minus : float; }
+
+
let agl_max = 150.
(** window for the strip panel *)
@@ -189,7 +198,15 @@
end
(** add a strip to the panel *)
-let add = fun config color min_bat max_bat ->
+(*let add = fun config color min_bat max_bat ->*)
+let add = fun config strip_param ->
+ let color = strip_param.color
+ and min_bat = strip_param.min_bat
+ and max_bat = strip_param.max_bat
+ and alt_shift_plus_plus = strip_param.alt_shift_plus_plus
+ and alt_shift_plus = strip_param.alt_shift_plus
+ and alt_shift_minus = strip_param.alt_shift_minus in
+
let strip_labels = ref [] in
let add_label = fun name value ->
strip_labels := (name, value) :: !strip_labels in
@@ -274,9 +291,9 @@
[ strip#button_launch, "launch.png";
strip#button_kill, "kill.png";
strip#button_resurrect, "resurrect.png";
- strip#button_minus_five, "down.png";
- strip#button_plus_five, "up.png";
- strip#button_plus_thirty, "upup.png";
+ strip#button_down, "down.png";
+ strip#button_up, "up.png";
+ strip#button_up_up, "upup.png";
strip#button_left, "left.png";
strip#button_center, "recenter.png";
strip#button_right, "right.png";
@@ -305,12 +322,19 @@
method set_label name value = set_label !strip_labels name value
method set_color name value = set_color !strip_labels name value
method add_widget w = strip#hbox_user#pack ~fill:false w
-
- method connect_shift_alt callback =
+
+ method connect_shift_alt callback =
+ let tooltips = GData.tooltips () in
+ let text = Printf.sprintf "Altitude %+.1fm" alt_shift_minus in
+ ignore (tooltips#set_tip strip#button_down#coerce ~text);
+ let text = Printf.sprintf "Altitude %+.1fm" alt_shift_plus in
+ ignore (tooltips#set_tip strip#button_up#coerce ~text);
+ let text = Printf.sprintf "Altitude %+.1fm" alt_shift_plus_plus in
+ ignore (tooltips#set_tip strip#button_up_up#coerce ~text);
connect_buttons callback
- [ strip#button_minus_five, -5.;
- strip#button_plus_five, 5.;
- strip#button_plus_thirty, 30.]
+ [ strip#button_down, alt_shift_minus;
+ strip#button_up, alt_shift_plus;
+ strip#button_up_up, alt_shift_plus_plus]
method connect_shift_lateral = fun callback ->
connect_buttons callback
Modified: paparazzi3/trunk/sw/ground_segment/cockpit/strip.mli
===================================================================
--- paparazzi3/trunk/sw/ground_segment/cockpit/strip.mli 2010-10-18
14:27:50 UTC (rev 6164)
+++ paparazzi3/trunk/sw/ground_segment/cockpit/strip.mli 2010-10-18
15:34:40 UTC (rev 6165)
@@ -52,8 +52,16 @@
connect : (unit -> unit) -> unit
>
+type strip_param = {
+ color : string;
+ min_bat : float;
+ max_bat : float;
+ alt_shift_plus_plus : float;
+ alt_shift_plus : float;
+ alt_shift_minus : float; }
+
val scrolled : GBin.scrolled_window
-val add : Pprz.values -> string -> float -> float -> t
-(** [add config color center_ac min_bat max_bat] *)
+val add : Pprz.values -> strip_param -> t
+(** [add config params] *)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [paparazzi-commits] [6165] the up and down shortcuts of the strip are configurable from airframe file with :,
Gautier Hattenberger <=