1
0
Fork 0

Set standby COM frequency from Airport pages

Support selecting a frequency from the Nearest Airport
and Airport Information pages and pressing ENT.  Nice.
This commit is contained in:
Stuart Buchanan 2018-01-13 19:17:58 +00:00
parent cbb281759c
commit d306e7ba10
3 changed files with 40 additions and 2 deletions

View file

@ -115,7 +115,9 @@ var AirportInfoController =
if (me.crsrToggle == 1) { if (me.crsrToggle == 1) {
var select = me.page.handleEnter(); var select = me.page.handleEnter();
if (select.name == "AirportInfoID") me.setAirport(select.value); if (select.name == "AirportInfoID") me.setAirport(select.value);
if (substr(select.name, 0, 15) == "AirportInfoFreq") print("Enter pressed on frequency " ~ select.value); if (substr(select.name, 0, 15) == "AirportInfoFreq") {
me.page.mfd.SurroundController.setStandbyComFreq(select.value);
}
return emesary.Transmitter.ReceiptStatus_Finished; return emesary.Transmitter.ReceiptStatus_Finished;
} else { } else {

View file

@ -155,16 +155,21 @@ var NearestAirportsController =
var apt_id = me.page.getSelectedAirportID(); var apt_id = me.page.getSelectedAirportID();
var apt_info = airportinfo(apt_id); var apt_info = airportinfo(apt_id);
me.page.updateAirportData(apt_info); me.page.updateAirportData(apt_info);
return emesary.Transmitter.ReceiptStatus_Finished;
} }
if (me._currentGroup == NearestAirportsController.UIGROUP.RNWY) { if (me._currentGroup == NearestAirportsController.UIGROUP.RNWY) {
# No effect if runways are selected # No effect if runways are selected
return emesary.Transmitter.ReceiptStatus_Finished;
} }
if (me._currentGroup == NearestAirportsController.UIGROUP.FREQ) { if (me._currentGroup == NearestAirportsController.UIGROUP.FREQ) {
# TODO Select the current COM frequency. # TODO Select the current COM frequency.
var freq = me.page.getSelectedFreq(); var freq = me.page.getSelectedFreq();
if (freq != nil) print("NearestAirportController.handleEnter frequency selection " ~ freq); if (freq != nil) {
me.page.mfd.SurroundController.setStandbyComFreq(freq);
}
return emesary.Transmitter.ReceiptStatus_Finished;
} }
if (me._currentGroup == NearestAirportsController.UIGROUP.APR) { if (me._currentGroup == NearestAirportsController.UIGROUP.APR) {

View file

@ -375,4 +375,35 @@ var SurroundController =
me.transmitter = nil; me.transmitter = nil;
}, },
# Used by other pages to set the current standby COM frequency by pressing ENT
setStandbyComFreq : func(value) {
var data={};
if (value > fg1000.MAX_COM_FREQ) return;
if (value < fg1000.MIN_COM_FREQ) return;
if (me._comselected == 1) {
data["Comm1StandbyFreq"] = value;
} else {
data["Comm2StandbyFreq"] = value;
}
me.sendNavComDataNotification(data);
},
# Used by other pages to set the current standby NAV frequency by pressing ENT
setStandbyNavFreq : func(value) {
var data={};
if (value > fg1000.MAX_NAV_FREQ) return;
if (value < fg1000.MIN_NAV_FREQ) return;
if (me._navselected == 1) {
data["Nav1StandbyFreq"] = value;
} else {
data["Nav2StandbyFreq"] = value;
}
me.sendNavComDataNotification(data);
},
}; };