From c49c6a38c60fb7586a151300d85c1aa963bb53ea Mon Sep 17 00:00:00 2001 From: Stuart Buchanan Date: Wed, 18 Aug 2021 20:18:57 +0100 Subject: [PATCH] FG1000: GMA1347 Audio Interface and NAV/COM active The G1000 highlights the active NAV and COM radios in cyan. In the NAV case, this is the radio being used by the CDI. In the COM case, this is the COM radio selected on the audio panel. --- .../Instruments-3d/FG1000/GMA1347/GMA1347.xml | 172 ++++++++++------ .../Instruments-3d/FG1000/Nasal/Constants.nas | 23 +++ .../Nasal/Interfaces/GFC700Interface.nas | 2 +- .../Nasal/Interfaces/GMA1347Interface.nas | 189 ++++++++++++++++++ .../Interfaces/GenericInterfaceController.nas | 4 +- .../Interfaces/GenericNavComPublisher.nas | 10 +- .../Nasal/MFDPages/Surround/Surround.nas | 22 ++ 7 files changed, 351 insertions(+), 71 deletions(-) create mode 100644 Aircraft/Instruments-3d/FG1000/Nasal/Interfaces/GMA1347Interface.nas diff --git a/Aircraft/Instruments-3d/FG1000/GMA1347/GMA1347.xml b/Aircraft/Instruments-3d/FG1000/GMA1347/GMA1347.xml index a677a0af3..d85cefa70 100644 --- a/Aircraft/Instruments-3d/FG1000/GMA1347/GMA1347.xml +++ b/Aircraft/Instruments-3d/FG1000/GMA1347/GMA1347.xml @@ -100,8 +100,10 @@ false - property-toggle - controls/switches/mixer/com1mic + FG1000HardKeyPushed + 10 + COM1MIC + 0 @@ -110,7 +112,7 @@ material led.COM1MIC - /controls/switches/mixer/com1mic + instrumentation/audio-panel/com-mic[0] 1 1 1 @@ -124,18 +126,20 @@ false - - property-toggle - controls/switches/mixer/com1 - + + FG1000HardKeyPushed + 10 + COM1 + 0 + material led.COM1 - /controls/switches/mixer/com1 + instrumentation/audio-panel/com[0] 1 1 1 @@ -149,8 +153,10 @@ false - property-toggle - controls/switches/mixer/com2mic + FG1000HardKeyPushed + 10 + COM2MIC + 0 @@ -162,7 +168,7 @@ 1 1 1 - /controls/switches/mixer/com2mic + instrumentation/audio-panel/com-mic[1] @@ -173,8 +179,10 @@ false - property-toggle - controls/switches/mixer/com2 + FG1000HardKeyPushed + 10 + COM2 + 0 @@ -186,7 +194,7 @@ 1 1 1 - /controls/switches/mixer/com2 + instrumentation/audio-panel/com[1] @@ -197,8 +205,10 @@ false - property-toggle - controls/switches/mixer/com3mic + FG1000HardKeyPushed + 10 + COM3MIC + 0 @@ -210,7 +220,7 @@ 1 1 1 - /controls/switches/mixer/com3mic + instrumentation/audio-panel/com-mic[2] @@ -221,8 +231,10 @@ false - property-toggle - controls/switches/mixer/com3 + FG1000HardKeyPushed + 10 + COM3 + 0 @@ -234,7 +246,7 @@ 1 1 1 - /controls/switches/mixer/com3 + instrumentation/audio-panel/com[2] @@ -245,8 +257,10 @@ false - property-toggle - controls/switches/mixer/com12 + FG1000HardKeyPushed + 10 + COM12 + 0 @@ -258,7 +272,7 @@ 1 1 1 - /controls/switches/mixer/com12 + instrumentation/audio-panel/com12 @@ -269,8 +283,10 @@ false - property-toggle - controls/switches/mixer/tel + FG1000HardKeyPushed + 10 + TEL + 0 @@ -282,7 +298,7 @@ 1 1 1 - /controls/switches/mixer/tel + instrumentation/audio-panel/tel @@ -293,8 +309,10 @@ false - property-toggle - controls/switches/mixer/pa + FG1000HardKeyPushed + 10 + PA + 0 @@ -306,7 +324,7 @@ 1 1 1 - /controls/switches/mixer/pa + instrumentation/audio-panel/crew @@ -317,8 +335,10 @@ false - property-toggle - controls/switches/mixer/spkr + FG1000HardKeyPushed + 10 + SPKR + 0 @@ -330,7 +350,7 @@ 1 1 1 - /controls/switches/mixer/spkr + instrumentation/audio-panel/spkr @@ -341,8 +361,10 @@ false - property-toggle - controls/switches/mixer/mkrmute + FG1000HardKeyPushed + 10 + MKRMUTE + 0 @@ -354,7 +376,7 @@ 1 1 1 - /controls/switches/mixer/mkrmute + instrumentation/audio-panel/mkrmute @@ -365,8 +387,10 @@ false - property-toggle - controls/switches/mixer/hisens + FG1000HardKeyPushed + 10 + HISENS + 0 @@ -378,7 +402,7 @@ 1 1 1 - /controls/switches/mixer/hisens + instrumentation/audio-panel/hi @@ -389,8 +413,10 @@ false - property-toggle - controls/switches/mixer/dme + FG1000HardKeyPushed + 10 + DME + 0 @@ -402,7 +428,7 @@ 1 1 1 - /controls/switches/mixer/dme + /instrumentation/dme[0]/ident @@ -413,8 +439,10 @@ false - property-toggle - controls/switches/mixer/nav1 + FG1000HardKeyPushed + 10 + NAV1 + 0 @@ -426,7 +454,7 @@ 1 1 1 - /controls/switches/mixer/nav1 + /instrumentation/nav[0]/ident @@ -437,8 +465,10 @@ false - property-toggle - controls/switches/mixer/adf + FG1000HardKeyPushed + 10 + ADF + 0 @@ -450,7 +480,7 @@ 1 1 1 - /controls/switches/mixer/adf + instrumentation/adf[0]/ident-audible @@ -461,8 +491,10 @@ false - property-toggle - controls/switches/mixer/nav2 + FG1000HardKeyPushed + 10 + NAV2 + 0 @@ -474,7 +506,7 @@ 1 1 1 - /controls/switches/mixer/nav2 + instrumentation/nav[1]/ident @@ -485,8 +517,10 @@ false - property-toggle - controls/switches/mixer/aux + FG1000HardKeyPushed + 10 + AUX + 0 @@ -498,7 +532,7 @@ 1 1 1 - /controls/switches/mixer/aux + instrumentation/audio-panel/aux @@ -509,8 +543,10 @@ false - property-toggle - controls/switches/mixer/mansq + FG1000HardKeyPushed + 10 + MANSQ + 0 @@ -522,7 +558,7 @@ 1 1 1 - /controls/switches/mixer/mansq + instrumentation/audio-panel/mansq @@ -533,8 +569,10 @@ false - property-toggle - controls/switches/mixer/play + FG1000HardKeyPushed + 10 + PLAY + 0 @@ -546,7 +584,7 @@ 1 1 1 - /controls/switches/mixer/play + instrumentation/audio-panel/play @@ -557,8 +595,10 @@ false - property-toggle - controls/switches/mixer/pilot + FG1000HardKeyPushed + 10 + PILOT + 0 @@ -570,7 +610,7 @@ 1 1 1 - /controls/switches/mixer/pilot + instrumentation/audio-panel/pilot @@ -581,8 +621,10 @@ false - property-toggle - controls/switches/mixer/coplt + FG1000HardKeyPushed + 10 + COPLT + 0 @@ -594,7 +636,7 @@ 1 1 1 - /controls/switches/mixer/coplt + instrumentation/audio-panel/copilot diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/Constants.nas b/Aircraft/Instruments-3d/FG1000/Nasal/Constants.nas index 3e93ea50f..32329a548 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/Constants.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/Constants.nas @@ -154,6 +154,29 @@ var FASCIA = { # Useability helpers to avoid having to use the FMS knobs to spell airport IDs etc. KEY_INPUT : 47, STRING_INPUT: 48, + + # GMA 1347 buttons + COM1MIC: 49, + COM2MIC: 50, + COM3MIC: 51, + COM12 : 52, + PA : 53, + MKRMUTE: 54, + DME : 55, + ADF : 56, + AUX : 57, + MANSQ : 58, + PILOT : 59, + COM1 : 60, + COM2 : 61, + COM3 : 62, + TEL : 63, + SPKR : 64, + HISENS : 65, + NAV1 : 66, + NAV2 : 67, + PLAY : 68, + COPLT : 69 }; var SURFACE_TYPES = { diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/Interfaces/GFC700Interface.nas b/Aircraft/Instruments-3d/FG1000/Nasal/Interfaces/GFC700Interface.nas index 887d03312..394df4c95 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/Interfaces/GFC700Interface.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/Interfaces/GFC700Interface.nas @@ -84,7 +84,7 @@ handleNoseUpDown : func(value) { setAPNavSource : func(src) { setprop("/autopilot/settings/nav-mode-source", src); # Also need to do something to trigger a NAV change if we're in NAV mode already. - return emesary.Transmitter.ReceiptStatus_Finished; + return emesary.Transmitter.ReceiptStatus_OK; }, RegisterWithEmesary : func() diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/Interfaces/GMA1347Interface.nas b/Aircraft/Instruments-3d/FG1000/Nasal/Interfaces/GMA1347Interface.nas new file mode 100644 index 000000000..e861ff928 --- /dev/null +++ b/Aircraft/Instruments-3d/FG1000/Nasal/Interfaces/GMA1347Interface.nas @@ -0,0 +1,189 @@ +# Copyright 2021 Stuart Buchanan +# This file is part of FlightGear. +# +# FlightGear is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# FlightGear is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with FlightGear. If not, see . +# +# Emesary interface to interface with the GMA1347 audio panel. +# + +var GMA1347Interface = { + +new : func () +{ + var obj = { parents : [ GMA1347Interface ] }; + + # Emesary + obj._recipient = nil; + obj._transmitter = emesary.GlobalTransmitter; + obj._registered = 0; + + obj._com1 = globals.props.getNode("/instrumentation/audio-panel/com[0]", 1); + obj._com1mic = globals.props.getNode("/instrumentation/audio-panel/com-mic[0]", 1); + + obj._com2 = globals.props.getNode("/instrumentation/audio-panel/com[1]", 1); + obj._com2mic = globals.props.getNode("/instrumentation/audio-panel/com-mic[1]", 1); + + # The G1000 separates the selected COM radio (being modified) from the radio being listened to. + obj._com_selected = globals.props.getNode("/instrumentation/audio-panel/audio-com-selected", 1); + obj._com_selected.setIntValue(obj._com1mic.getBoolValue() ? 1 : 2); + + obj._nav1 = globals.props.getNode("/instrumentation/nav[0]/ident", 1); + obj._nav2 = globals.props.getNode("/instrumentation/nav[1]/ident", 1); + obj._dme = globals.props.getNode("/instrumentation/dme[0]/ident", 1); + obj._hisense = globals.props.getNode("/instrumentation/audio-panel/hi", 1); + obj._mkrmute = globals.props.getNode("/instrumentation/audio-panel/mkr", 1); + obj._spkr = globals.props.getNode("/instrumentation/audio-panel/spkr", 1); + + return obj; +}, + + +handleCOM1MIC : func(value) { + me._com_selected.setIntValue(1); + me._com1.setBoolValue(1); + me._com1mic.setBoolValue(1); + me._com2.setBoolValue(0); + me._com2mic.setBoolValue(0); + return emesary.Transmitter.ReceiptStatus_Finished; +}, + +handleCOM2MIC : func(value) { + me._com_selected.setIntValue(2); + me._com1.setBoolValue(0); + me._com1mic.setBoolValue(0); + me._com2.setBoolValue(1); + me._com2mic.setBoolValue(1); + return emesary.Transmitter.ReceiptStatus_Finished; +}, + +handleCOM3MIC : func(value) { return emesary.Transmitter.ReceiptStatus_NotProcessed; }, # Not used on Cessna Nav III +handleCOM12 : func(value) { return emesary.Transmitter.ReceiptStatus_NotProcessed; }, # Not used on Cessna Nav III +handlePA : func(value) { return emesary.Transmitter.ReceiptStatus_NotProcessed; }, # Not used on Cessna Nav III + +handleMKRMUTE : func(value) { + me._mkrmute.toggleBoolValue(); + return emesary.Transmitter.ReceiptStatus_Finished; +}, + +handleDME : func(value) { + me._dme.toggleBoolValue(); + return emesary.Transmitter.ReceiptStatus_Finished; +}, + +handleADF : func(value) { return emesary.Transmitter.ReceiptStatus_NotProcessed; }, # Not implemented - optional ADF is not implemented in FG1000 +handleAUX : func(value) { return emesary.Transmitter.ReceiptStatus_NotProcessed; }, # Not used on Cessna Nav III +handleMANSQ : func(value) { return emesary.Transmitter.ReceiptStatus_NotProcessed; }, # Not implemented +handlePILOT : func(value) { return emesary.Transmitter.ReceiptStatus_NotProcessed; }, # Not implemented + +handleCOM1 : func(value) { + me._com1.toggleBoolValue(); + return emesary.Transmitter.ReceiptStatus_Finished; +}, + +handleCOM2 : func(value) { + me._com2.toggleBoolValue(); + return emesary.Transmitter.ReceiptStatus_Finished; +}, + +handleCOM3 : func(value) { return emesary.Transmitter.ReceiptStatus_NotProcessed; }, # Not used on Cessna Nav III +handleTEL : func(value) { return emesary.Transmitter.ReceiptStatus_NotProcessed; }, # Not used on Cessna Nav III +handleSPKR : func(value) { + me._spkr.toggleBoolValue(); + return emesary.Transmitter.ReceiptStatus_Finished; +}, + +handleHISENS : func(value) { + me._hisense.toggleBoolValue(); + return emesary.Transmitter.ReceiptStatus_Finished; +}, + +handleNAV1 : func(value) { + me._nav1.toggleBoolValue(); + return emesary.Transmitter.ReceiptStatus_Finished; +}, + +handleNAV2 : func(value) { + me._nav2.toggleBoolValue(); + return emesary.Transmitter.ReceiptStatus_Finished; +}, + +handlePLAY : func(value) { return emesary.Transmitter.ReceiptStatus_NotProcessed; }, # Not implemented +handleCOPLT : func(value) { return emesary.Transmitter.ReceiptStatus_NotProcessed; }, # Not implemented + +RegisterWithEmesary : func() +{ + if (me._recipient == nil){ + me._recipient = emesary.Recipient.new("GMA1347Interface"); + var controller = me; + + # Note that unlike the various keys, this data isn't specific to a particular + # Device - it's shared by all. Hence we don't check for the notificaiton + # Device_Id. + me._recipient.Receive = func(notification) + { + + if (notification.NotificationType == notifications.PFDEventNotification.DefaultType and + notification.Event_Id == notifications.PFDEventNotification.HardKeyPushed and + notification.EventParameter != nil) + { + var id = notification.EventParameter.Id; + var value = notification.EventParameter.Value; + + if (id == fg1000.FASCIA.COM1MIC ) return controller.handleCOM1MIC(value); + if (id == fg1000.FASCIA.COM1MIC ) return controller.handleCOM1MIC(value); + if (id == fg1000.FASCIA.COM2MIC ) return controller.handleCOM2MIC(value); + if (id == fg1000.FASCIA.COM3MIC ) return controller.handleCOM3MIC(value); + if (id == fg1000.FASCIA.COM12 ) return controller.handleCOM12(value); + if (id == fg1000.FASCIA.PA ) return controller.handlePA(value); + if (id == fg1000.FASCIA.MKRMUTE ) return controller.handleMKRMUTE(value); + if (id == fg1000.FASCIA.DME ) return controller.handleDME(value); + if (id == fg1000.FASCIA.ADF ) return controller.handleADF(value); + if (id == fg1000.FASCIA.AUX ) return controller.handleAUX(value); + if (id == fg1000.FASCIA.MANSQ ) return controller.handleMANSQ(value); + if (id == fg1000.FASCIA.PILOT ) return controller.handlePILOT(value); + if (id == fg1000.FASCIA.COM1 ) return controller.handleCOM1(value); + if (id == fg1000.FASCIA.COM2 ) return controller.handleCOM2(value); + if (id == fg1000.FASCIA.COM3 ) return controller.handleCOM3(value); + if (id == fg1000.FASCIA.TEL ) return controller.handleTEL(value); + if (id == fg1000.FASCIA.SPKR ) return controller.handleSPKR(value); + if (id == fg1000.FASCIA.HISENS ) return controller.handleHISENS(value); + if (id == fg1000.FASCIA.NAV1 ) return controller.handleNAV1(value); + if (id == fg1000.FASCIA.NAV2 ) return controller.handleNAV2(value); + if (id == fg1000.FASCIA.PLAY ) return controller.handlePLAY(value); + if (id == fg1000.FASCIA.COPLT ) return controller.handleCOPLT(value); + } + + return emesary.Transmitter.ReceiptStatus_NotProcessed; + }; + } + + me._transmitter.Register(me._recipient); + me._registered = 1; +}, + +DeRegisterWithEmesary : func() +{ + # remove registration from transmitter; but keep the recipient once it is created. + if (me._registered == 1) me._transmitter.DeRegister(me._recipient); + me._registered = 0; +}, + +start : func() { + me.RegisterWithEmesary(); +}, +stop : func() { + me.DeRegisterWithEmesary(); +}, + +}; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/Interfaces/GenericInterfaceController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/Interfaces/GenericInterfaceController.nas index d71dd1574..5a07e06eb 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/Interfaces/GenericInterfaceController.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/Interfaces/GenericInterfaceController.nas @@ -35,7 +35,9 @@ var GenericInterfaceController = { { id:"GenericFuelInterface", path: nasal_dir ~ 'Interfaces/GenericFuelInterface.nas' }, { id:"GenericFuelPublisher", path: nasal_dir ~ 'Interfaces/GenericFuelPublisher.nas' }, { id:"GFC700Interface", path: nasal_dir ~ 'Interfaces/GFC700Interface.nas' }, - { id:"GFC700Publisher", path: nasal_dir ~ 'Interfaces/GFC700Publisher.nas' } + { id:"GFC700Publisher", path: nasal_dir ~ 'Interfaces/GFC700Publisher.nas' }, + { id:"GMA1347Interface", path: nasal_dir ~ 'Interfaces/GMA1347Interface.nas' }, + ], # Factory method diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/Interfaces/GenericNavComPublisher.nas b/Aircraft/Instruments-3d/FG1000/Nasal/Interfaces/GenericNavComPublisher.nas index 31f3b5065..80c0f3dcc 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/Interfaces/GenericNavComPublisher.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/Interfaces/GenericNavComPublisher.nas @@ -40,17 +40,18 @@ var GenericNavComPublisher = obj._periodicPublisher = PeriodicPropertyPublisher.new(notifications.PFDEventNotification.NavComData, period); # Hack to handle cases where there is no selected Com or NAV frequency or volume + if (getprop("/instrumentation/audio-panel/audio-com-selected") == nil) setprop("/instrumentation/audio-panel/audio-com-selected", 1); if (getprop("/instrumentation/com-selected") == nil) setprop("/instrumentation/com-selected", 1); if (getprop("/instrumentation/nav-selected") == nil) setprop("/instrumentation/nav-selected", 1); - if (getprop("/instrumentation/nav/volume") == nil) setprop("/instrumentation/nav/volume", 0.5); - if (getprop("/instrumentation/comm/volume") == nil) setprop("/instrumentation/comm/volume", 0.5); + if (getprop("/instrumentation/nav/volume-selected") == nil) setprop("/instrumentation/nav/volume-selected", 0.5); + if (getprop("/instrumentation/comm/volume-selected") == nil) setprop("/instrumentation/comm/volume-selected", 0.5); obj._triggeredPublisher.addPropMap("Comm1SelectedFreq", "/instrumentation/comm/frequencies/selected-mhz"); obj._triggeredPublisher.addPropMap("Comm1StandbyFreq", "/instrumentation/comm/frequencies/standby-mhz"); obj._triggeredPublisher.addPropMap("Comm1AirportID", "/instrumentation/comm/airport-id"); obj._triggeredPublisher.addPropMap("Comm1StationName", "/instrumentation/comm/station-name"); obj._triggeredPublisher.addPropMap("Comm1StationType", "/instrumentation/comm/station-type"); - obj._triggeredPublisher.addPropMap("Comm1Volume", "/instrumentation/comm/volume"); + obj._triggeredPublisher.addPropMap("Comm1Volume", "/instrumentation/comm/volume-selected"); obj._triggeredPublisher.addPropMap("Comm1Serviceable", "/instrumentation/comm/serviceable"); obj._triggeredPublisher.addPropMap("Comm2SelectedFreq", "/instrumentation/comm[1]/frequencies/selected-mhz"); @@ -61,6 +62,7 @@ var GenericNavComPublisher = obj._triggeredPublisher.addPropMap("Comm2Serviceable", "/instrumentation/comm[1]/serviceable"); obj._triggeredPublisher.addPropMap("CommSelected", "/instrumentation/com-selected"); + obj._triggeredPublisher.addPropMap("CommAudioSelected", "/instrumentation/audio-panel/audio-com-selected"); obj._triggeredPublisher.addPropMap("Nav1SelectedFreq", "/instrumentation/nav/frequencies/selected-mhz"); obj._triggeredPublisher.addPropMap("Nav1StandbyFreq", "/instrumentation/nav/frequencies/standby-mhz"); @@ -77,7 +79,7 @@ var GenericNavComPublisher = obj._periodicPublisher.addPropMap("Nav1GSInRange", "/instrumentation/nav/gs-in-range"); obj._periodicPublisher.addPropMap("Nav1From", "/instrumentation/nav/from-flag"); - obj._triggeredPublisher.addPropMap("Nav1Volume", "/instrumentation/nav/volume"); + obj._triggeredPublisher.addPropMap("Nav1Volume", "/instrumentation/nav/volume-selected"); obj._triggeredPublisher.addPropMap("Nav1AudioID", "/instrumentation/nav/audio-btn"); obj._triggeredPublisher.addPropMap("Nav1Serviceable", "/instrumentation/nav/operable"); diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/MFDPages/Surround/Surround.nas b/Aircraft/Instruments-3d/FG1000/Nasal/MFDPages/Surround/Surround.nas index e91f885eb..351606a8c 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/MFDPages/Surround/Surround.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/MFDPages/Surround/Surround.nas @@ -95,6 +95,16 @@ var FD_STATUS_STYLE = { NORMAL_TEXT_COLOR : "#00ff00", }; +# Style element for use by the NAV and COM frequencies. This is normally white text +# on a black background, but when the COM is enabled by the GMA1347, or the NAV is being +# used by the CDI, then it is green on a black background. +var NAVCOM_FREQ_STYLE = { + CURSOR_BLINK_PERIOD : 0.5, + HIGHLIGHT_COLOR : "#000000", + HIGHLIGHT_TEXT_COLOR : "#00ff00", + NORMAL_TEXT_COLOR : "#ffffff", +}; + var Surround = { new : func (mfd, myCanvas, device, svg, pfd=0) @@ -237,6 +247,11 @@ var Surround = } } + if (name == "CommAudioSelected") { + me.getTextElement("Comm1SelectedFreq").setColor(val == 1 ? NAVCOM_FREQ_STYLE.HIGHLIGHT_TEXT_COLOR : NAVCOM_FREQ_STYLE.NORMAL_TEXT_COLOR); + me.getTextElement("Comm2SelectedFreq").setColor(val == 2 ? NAVCOM_FREQ_STYLE.HIGHLIGHT_TEXT_COLOR : NAVCOM_FREQ_STYLE.NORMAL_TEXT_COLOR); + } + if (name == "Nav1SelectedFreq") me.setTextElement("Nav1SelectedFreq", sprintf("%0.03f", val)); if (name == "Nav1StandbyFreq") me.setTextElement("Nav1StandbyFreq", sprintf("%0.03f", val)); if (name == "Nav1Serviceable") { @@ -471,6 +486,13 @@ var Surround = } } } + + if (data["AutopilotNAVSource"] != nil) { + # Set highlighting of the NAV radios based on the NAV Source. + var src = data["AutopilotNAVSource"]; + me.getTextElement("Nav1SelectedFreq").setColor(src == "NAV1" ? NAVCOM_FREQ_STYLE.HIGHLIGHT_TEXT_COLOR : NAVCOM_FREQ_STYLE.NORMAL_TEXT_COLOR); + me.getTextElement("Nav2SelectedFreq").setColor(src == "NAV2" ? NAVCOM_FREQ_STYLE.HIGHLIGHT_TEXT_COLOR : NAVCOM_FREQ_STYLE.NORMAL_TEXT_COLOR); + } }, getCurrentPage : func()