[agl] use ground_alt from autopilot if no SRTM data available

This commit is contained in:
Gautier Hattenberger
2014-05-11 00:00:05 +02:00
parent 6fba4e4e39
commit ce3c21c428
10 changed files with 24 additions and 13 deletions
+3 -1
View File
@@ -74,6 +74,7 @@ object (self)
val label = new CL.widget ~name:name ~color:"white" s 0. wpt_group
val mutable name = name (* FIXME: already in label ! *)
val mutable alt = alt
val mutable ground_alt = 0.
val mutable moved = None
val mutable deleted = false
val mutable commit_cb = None
@@ -145,7 +146,7 @@ object (self)
ea#set_adjustment adj;
ea#set_value alt; (* this should be done by set_adjustment but seems to fail on ubuntu 13.10 (at least) *)
let agl = alt -. float (try Srtm.of_wgs84 initial_wgs84 with _ -> 0) in
let agl = alt -. (try float (Srtm.of_wgs84 initial_wgs84) with _ -> ground_alt) in
let agl_lab = GMisc.label ~text:(sprintf " AGL: %4.0fm" agl) ~packing:ha#add () in
let plus10= GButton.button ~label:"+10" ~packing:ha#add () in
let change_alt = fun x ->
@@ -282,6 +283,7 @@ object (self)
if update then updated ()
| (None, false) | (Some _, true) -> ()
| Some _, false -> self#reset_moved ()
method set_ground_alt ga = ground_alt <- ga
method delete () =
deleted <- true; (* BOF *)
wpt_group#destroy ()
+1
View File
@@ -52,6 +52,7 @@ class waypoint :
method move : float -> float -> unit
method name : string
method set : ?altitude:float -> ?update:bool -> Latlong.geographic -> unit
method set_ground_alt : float -> unit
method set_name : string -> unit
method xy : float * float
method zoom : float -> unit