mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-30 11:37:06 +08:00
[gcs] connect the 'back to nav' strip button
also remove some warnings since it seems to be more confusing than inactive buttons in the strip
This commit is contained in:
committed by
Felix Ruess
parent
426a83cf58
commit
5c28c13c84
@@ -4,12 +4,13 @@
|
|||||||
<dl_settings>
|
<dl_settings>
|
||||||
|
|
||||||
<dl_settings NAME="System">
|
<dl_settings NAME="System">
|
||||||
<dl_setting var="autopilot_mode_auto2" min="0" step="1" max="15" module="autopilot" shortname="auto2" values="KILL|Fail|HOME|Rate|Att|Rate_rcC|Att_rcC|Att_C|Rate_Z|Att_Z|Hover|Hover_C|Hover_Z|Nav|RC_D|CareFree"/>
|
<dl_setting var="autopilot_mode_auto2" min="0" step="1" max="15" module="autopilot" shortname="auto2" values="KILL|Fail|HOME|Rate|Att|Rate_rcC|Att_rcC|Att_C|Rate_Z|Att_Z|Hover|Hover_C|Hover_Z|Nav|RC_D|CareFree"/>
|
||||||
<dl_setting var="kill_throttle" min="0" step="1" max="1" module="autopilot" values="Resurrect|Kill" handler="KillThrottle"/>
|
<dl_setting var="kill_throttle" min="0" step="1" max="1" module="autopilot" values="Resurrect|Kill" handler="KillThrottle"/>
|
||||||
<dl_setting var="autopilot_power_switch" min="0" step="1" max="1" module="autopilot" values="OFF|ON" handler="SetPowerSwitch">
|
<dl_setting var="autopilot_power_switch" min="0" step="1" max="1" module="autopilot" values="OFF|ON" handler="SetPowerSwitch">
|
||||||
<strip_button name="POWER ON" icon="on.png" value="1" group="power_switch"/>
|
<strip_button name="POWER ON" icon="on.png" value="1" group="power_switch"/>
|
||||||
<strip_button name="POWER OFF" icon="off.png" value="0" group="power_switch"/>
|
<strip_button name="POWER OFF" icon="off.png" value="0" group="power_switch"/>
|
||||||
</dl_setting>
|
</dl_setting>
|
||||||
|
<dl_setting var="autopilot_mode" min="0" step="1" max="2" module="autopilot" shortname="mode" values="KILL|Fail|HOME"/>
|
||||||
</dl_settings>
|
</dl_settings>
|
||||||
|
|
||||||
</dl_settings>
|
</dl_settings>
|
||||||
|
|||||||
@@ -725,10 +725,12 @@ let create_ac = fun alert (geomap:G.widget) (acs_notebook:GPack.notebook) (ac_id
|
|||||||
fprintf stderr "Warning: %s not setable from GCS strip (i.e. not listed in the xml settings file)\n" setting_name in
|
fprintf stderr "Warning: %s not setable from GCS strip (i.e. not listed in the xml settings file)\n" setting_name in
|
||||||
|
|
||||||
connect "flight_altitude" (fun f -> ac.strip#connect_shift_alt (fun x -> f (ac.target_alt+.x)));
|
connect "flight_altitude" (fun f -> ac.strip#connect_shift_alt (fun x -> f (ac.target_alt+.x)));
|
||||||
connect "launch" ac.strip#connect_launch;
|
connect "launch" ~warning:false ac.strip#connect_launch;
|
||||||
connect "kill_throttle" ac.strip#connect_kill;
|
connect "kill_throttle" ac.strip#connect_kill;
|
||||||
connect "nav_shift" ac.strip#connect_shift_lateral;
|
(* try to connect either pprz_mode (fixedwing) or autopilot_mode (rotorcraft) *)
|
||||||
connect "pprz_mode" ac.strip#connect_mode;
|
connect "pprz_mode" ~warning:false (ac.strip#connect_mode 2.);
|
||||||
|
connect "autopilot_mode" ~warning:false (ac.strip#connect_mode 13.);
|
||||||
|
connect "nav_shift" ~warning:false ac.strip#connect_shift_lateral;
|
||||||
connect "autopilot_flight_time" ac.strip#connect_flight_time;
|
connect "autopilot_flight_time" ac.strip#connect_flight_time;
|
||||||
let get_ac_unix_time = fun () -> ac.last_unix_time in
|
let get_ac_unix_time = fun () -> ac.last_unix_time in
|
||||||
connect ~warning:false "snav_desired_tow" (ac.strip#connect_apt get_ac_unix_time);
|
connect ~warning:false "snav_desired_tow" (ac.strip#connect_apt get_ac_unix_time);
|
||||||
@@ -753,8 +755,7 @@ let create_ac = fun alert (geomap:G.widget) (acs_notebook:GPack.notebook) (ac_id
|
|||||||
let gps_reset_id = settings_tab#assoc "gps.reset" in
|
let gps_reset_id = settings_tab#assoc "gps.reset" in
|
||||||
gps_page#connect_reset
|
gps_page#connect_reset
|
||||||
(fun x -> dl_setting_callback gps_reset_id (float x))
|
(fun x -> dl_setting_callback gps_reset_id (float x))
|
||||||
with Not_found ->
|
with Not_found -> ()
|
||||||
prerr_endline "Warning: GPS reset not setable from GCS (i.e. 'gps.reset' not listed in the xml settings file)"
|
|
||||||
end
|
end
|
||||||
| None -> ()
|
| None -> ()
|
||||||
end;
|
end;
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ type t =
|
|||||||
connect_shift_lateral : (float -> unit) -> unit;
|
connect_shift_lateral : (float -> unit) -> unit;
|
||||||
connect_launch : (float -> unit) -> unit;
|
connect_launch : (float -> unit) -> unit;
|
||||||
connect_kill : (float -> unit) -> unit;
|
connect_kill : (float -> unit) -> unit;
|
||||||
connect_mode : (float -> unit) -> unit;
|
connect_mode : float -> (float -> unit) -> unit;
|
||||||
connect_mark : (unit -> unit) -> unit;
|
connect_mark : (unit -> unit) -> unit;
|
||||||
connect_flight_time : (float -> unit) -> unit;
|
connect_flight_time : (float -> unit) -> unit;
|
||||||
connect_apt : (unit -> float) -> (float -> unit) -> unit;
|
connect_apt : (unit -> float) -> (float -> unit) -> unit;
|
||||||
@@ -378,10 +378,10 @@ object
|
|||||||
connect_buttons callback
|
connect_buttons callback
|
||||||
[ strip#button_launch, 1. ]
|
[ strip#button_launch, 1. ]
|
||||||
|
|
||||||
method connect_mode = fun callback ->
|
method connect_mode = fun mode callback ->
|
||||||
let callback = fun _ -> (* Back in AUTO2 *)
|
let callback = fun _ -> (* Back in AUTO2 *)
|
||||||
match GToolbox.question_box ~title:"Back to auto" ~buttons:["AUTO"; "Cancel"] (sprintf "Restore AUTO mode for A/C %s ?" ac_name) with
|
match GToolbox.question_box ~title:"Back to auto" ~buttons:["AUTO"; "Cancel"] (sprintf "Restore AUTO mode for A/C %s ?" ac_name) with
|
||||||
1 -> callback 2.; true
|
1 -> callback mode; true
|
||||||
| _ -> true in
|
| _ -> true in
|
||||||
ignore(strip#eventbox_mode#event#connect#button_press ~callback)
|
ignore(strip#eventbox_mode#event#connect#button_press ~callback)
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ type t = <
|
|||||||
connect_shift_lateral : (float -> unit) -> unit;
|
connect_shift_lateral : (float -> unit) -> unit;
|
||||||
connect_launch : (float -> unit) -> unit;
|
connect_launch : (float -> unit) -> unit;
|
||||||
connect_kill : (float -> unit) -> unit;
|
connect_kill : (float -> unit) -> unit;
|
||||||
connect_mode : (float -> unit) -> unit;
|
connect_mode : float -> (float -> unit) -> unit;
|
||||||
connect_flight_time : (float -> unit) -> unit;
|
connect_flight_time : (float -> unit) -> unit;
|
||||||
|
|
||||||
connect_apt : (unit -> float) -> (float -> unit) -> unit;
|
connect_apt : (unit -> float) -> (float -> unit) -> unit;
|
||||||
|
|||||||
Reference in New Issue
Block a user