From d306e7ba100840f5c3909123a383b19f7e7d7540 Mon Sep 17 00:00:00 2001 From: Stuart Buchanan Date: Sat, 13 Jan 2018 19:17:58 +0000 Subject: [PATCH] Set standby COM frequency from Airport pages Support selecting a frequency from the Nearest Airport and Airport Information pages and pressing ENT. Nice. --- .../AirportInfo/AirportInfoController.nas | 4 ++- .../NearestAirportsController.nas | 7 ++++- .../Nasal/Surround/SurroundController.nas | 31 +++++++++++++++++++ 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/AirportInfo/AirportInfoController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/AirportInfo/AirportInfoController.nas index 40022d26f..9d886f961 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/AirportInfo/AirportInfoController.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/AirportInfo/AirportInfoController.nas @@ -115,7 +115,9 @@ var AirportInfoController = if (me.crsrToggle == 1) { var select = me.page.handleEnter(); 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; } else { diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/NearestAirports/NearestAirportsController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/NearestAirports/NearestAirportsController.nas index 133d6a791..1efb0b4c2 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/NearestAirports/NearestAirportsController.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/NearestAirports/NearestAirportsController.nas @@ -155,16 +155,21 @@ var NearestAirportsController = var apt_id = me.page.getSelectedAirportID(); var apt_info = airportinfo(apt_id); me.page.updateAirportData(apt_info); + return emesary.Transmitter.ReceiptStatus_Finished; } if (me._currentGroup == NearestAirportsController.UIGROUP.RNWY) { # No effect if runways are selected + return emesary.Transmitter.ReceiptStatus_Finished; } if (me._currentGroup == NearestAirportsController.UIGROUP.FREQ) { # TODO Select the current COM frequency. 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) { diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/Surround/SurroundController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/Surround/SurroundController.nas index 2ab2653a6..998da72bd 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/Surround/SurroundController.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/Surround/SurroundController.nas @@ -375,4 +375,35 @@ var SurroundController = 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); + }, };