diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/ConfigStore.nas b/Aircraft/Instruments-3d/FG1000/Nasal/ConfigStore.nas index bb4baa841..57bfd68e0 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/ConfigStore.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/ConfigStore.nas @@ -118,6 +118,7 @@ var ConfigStore = { "Vglide-visible" : 1, "Vne-visible": 1, + "TransponderVFRCode" : 1200, }, new : func() @@ -146,6 +147,8 @@ var ConfigStore = { obj._layerRanges[i] = ConfigStore.layerRanges[i]; } + obj.updateVFRTransponderCode(); + return obj; }, @@ -203,4 +206,10 @@ var ConfigStore = { me._layerRanges[layer].range = math.min(range, me._layerRanges[layer].max_range); }, + updateVFRTransponderCode : func() { + # Special case VFR transponder code + var vfr_default = props.globals.getNode("/instrumentation/transponder/factory-vfr-code", 1); + if (vfr_default.getValue()) me.set("TransponderVFRCode", vfr_default.getValue()); + }, + }; diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/MFDPages/PFDInstruments/PFDInstruments.nas b/Aircraft/Instruments-3d/FG1000/Nasal/MFDPages/PFDInstruments/PFDInstruments.nas index 7f6004916..06b1db3cf 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/MFDPages/PFDInstruments/PFDInstruments.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/MFDPages/PFDInstruments/PFDInstruments.nas @@ -305,8 +305,7 @@ var PFDInstruments = }, setVFR : func(device, pg, menuitem) { - # Set VFR Mode - 1200 - pg.getController().setTransponderCode(1200); + pg.getController().setVFRTransponderCode(); }, setIdent : func(device, pg, menuitem) { diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/MFDPages/PFDInstruments/PFDInstrumentsController.nas b/Aircraft/Instruments-3d/FG1000/Nasal/MFDPages/PFDInstruments/PFDInstrumentsController.nas index 1b9ec168a..7348172fb 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/MFDPages/PFDInstruments/PFDInstrumentsController.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/MFDPages/PFDInstruments/PFDInstrumentsController.nas @@ -96,7 +96,6 @@ var PFDInstrumentsController = _adf_heading_deg : 0.0, _transponder_mode : 0, - _transponder_code : "1200", # Current code _transponder_ident : 0, _transponder_edit : 0, # If we're currently editing the transponder code _transponder_edit_code : 0, # Current value being edited as transponder code @@ -106,6 +105,8 @@ var PFDInstrumentsController = _marker_beacon_inner : 0, }; + obj._transponder_code = page.mfd.ConfigStore.get("TransponderVFRCode"); + obj._current_flightplan = obj.getNavData("Flightplan"); if (obj._current_flightplan != nil) { obj._fp_current_wp = obj._current_flightplan.current; @@ -568,6 +569,10 @@ var PFDInstrumentsController = } }, + setVFRTransponderCode : func() { + me.sendNavComDataNotification({"TransponderCode" : me.page.mfd.ConfigStore.get("TransponderVFRCode")}); + }, + setTransponderCode : func(code) { me.sendNavComDataNotification({"TransponderCode" : code}); },