mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-25 14:35:51 +08:00
[gcs] prevent speech spam with 'approaching'
only triggered when close enough but not too much, and flying a long segment fix #1833
This commit is contained in:
@@ -38,6 +38,9 @@ let (//) = Filename.concat
|
||||
let gcs_id = "GCS"
|
||||
|
||||
let approaching_alert_time = 3.
|
||||
let approaching_alert_dmin = 0.5
|
||||
let approaching_alert_slmin = 20.
|
||||
|
||||
let track_size = ref 500
|
||||
|
||||
let _auto_hide_fp = ref false
|
||||
@@ -961,12 +964,14 @@ let highlight_fp = fun ac b s ->
|
||||
end
|
||||
|
||||
|
||||
let check_approaching = fun ac geo alert ->
|
||||
let check_approaching = fun ac geo1 geo2 alert ->
|
||||
match ac.track#last with
|
||||
None -> ()
|
||||
| Some ac_pos ->
|
||||
let d = LL.wgs84_distance ac_pos geo in
|
||||
if d < ac.speed *. approaching_alert_time then
|
||||
let s_len = LL.wgs84_distance geo1 geo2 in (* length of the segment *)
|
||||
let d = LL.wgs84_distance ac_pos geo2 in (* distance to end of the segment *)
|
||||
(* only log_and_say "approaching" if close enough but not too much and when flying long segments *)
|
||||
if d < ac.speed *. approaching_alert_time && d > approaching_alert_dmin && s_len > approaching_alert_slmin then
|
||||
log_and_say alert ac.ac_name (sprintf "%s, approaching" ac.ac_speech_name)
|
||||
|
||||
|
||||
@@ -1266,7 +1271,7 @@ let listen_flight_params = fun geomap auto_center_new_ac alert alt_graph ->
|
||||
ac.track#draw_segment geo1 geo2;
|
||||
|
||||
(* Check if approaching the end of the segment *)
|
||||
check_approaching ac geo2 alert
|
||||
check_approaching ac geo1 geo2 alert
|
||||
in
|
||||
safe_bind "SEGMENT_STATUS" get_segment_status;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user