|
From: <fli...@li...> - 2017-10-31 17:28:37
|
Revision: 3069
http://sourceforge.net/p/flightgear/fgaddon/3069
Author: rleibner
Date: 2017-10-31 17:28:34 +0000 (Tue, 31 Oct 2017)
Log Message:
-----------
Improved comm1 checking
Modified Paths:
--------------
trunk/Addons/SpokenATC/voice.nas
Modified: trunk/Addons/SpokenATC/voice.nas
===================================================================
--- trunk/Addons/SpokenATC/voice.nas 2017-10-31 15:46:58 UTC (rev 3068)
+++ trunk/Addons/SpokenATC/voice.nas 2017-10-31 17:28:34 UTC (rev 3069)
@@ -36,26 +36,29 @@
~" or later.\n(You have " ~sprintf("%.2f", actPhrasVer)~").", 10);
return; }
-# 1) Get properties
+# 1) Check comm frequency
+if(! getprop("/instrumentation/comm/serviceable") or getprop("/instrumentation/comm/volume")<0.1 ) {
+ gui.popupTip("Turn Comm1 on. Set volume",3);
+ return ;
+ }
+
+var station = getprop("/instrumentation/comm/station-type");
+var tunned = getprop("/instrumentation/comm/frequencies/selected-mhz");
var icao = getprop("/instrumentation/comm/airport-id");
var info = airportinfo(icao);
+
+if(info.name==nil or getprop("/instrumentation/comm/signal-quality-norm")<0.01) {
+ # if invalid freq or out of range
+ gui.popupTip("Check comm freq.!",3);
+ return ;}
+
+# 2) Get properties
var aux1 = getprop("/instrumentation/comm/station-name");
var aux =(string.match(aux1,"* *"))? capit(aux1) : string.replace(info.name,"Intl","International") ;
setprop("/satc/station-name", aux);
getfreqs(info);
-# 2) Check comm frequency
-var station = getprop("/instrumentation/comm/station-type");
-var tunned = getprop("/instrumentation/comm/frequencies/selected-mhz");
-if(getprop("/instrumentation/comm/volume")<0.1) {
- gui.popupTip("Turn Comm1 on. Set volume",3);
- return ;
-} elsif(info.name==nil or getprop("/instrumentation/comm/signal-quality-norm")<0.01) {
- # if invalid freq or out of range
- gui.popupTip("Check comm freq.!",3);
- return ;}
-
# 3) Get env. values
var q_ = getprop("/environment/metar/pressure-sea-level-inhg");
var q = pnt(sprintf("%.2f",q_));
|