From 2b47c8ac61b71c32207a129c67d32197beb15da1 Mon Sep 17 00:00:00 2001 From: Stuart Buchanan Date: Thu, 2 Nov 2023 12:38:48 +0000 Subject: [PATCH] FG1000 - Make transponder more robust, VFR code Make transponder display more robust, and define VFR code in the ConfigStore. --- Aircraft/Instruments-3d/FG1000/Nasal/ConfigStore.nas | 2 ++ .../FG1000/Nasal/MFDPages/PFDInstruments/PFDInstruments.nas | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/ConfigStore.nas b/Aircraft/Instruments-3d/FG1000/Nasal/ConfigStore.nas index 654591b6c..12737563c 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/ConfigStore.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/ConfigStore.nas @@ -117,6 +117,8 @@ var ConfigStore = { "Vr-visible" : 1, "Vglide-visible" : 1, "Vne-visible": 1, + + "TransponderVFRCode": 1200, # Factory set Transponder code }, new : func() diff --git a/Aircraft/Instruments-3d/FG1000/Nasal/MFDPages/PFDInstruments/PFDInstruments.nas b/Aircraft/Instruments-3d/FG1000/Nasal/MFDPages/PFDInstruments/PFDInstruments.nas index cb628fb7e..70c2d1ad6 100644 --- a/Aircraft/Instruments-3d/FG1000/Nasal/MFDPages/PFDInstruments/PFDInstruments.nas +++ b/Aircraft/Instruments-3d/FG1000/Nasal/MFDPages/PFDInstruments/PFDInstruments.nas @@ -918,9 +918,10 @@ var PFDInstruments = # Update the Transponder display updateTransponder : func(mode, code, ident, edit=0) { - # Data validation on the mode + # Data validation on the mode and code itself if (mode < 0) mode = 0; if (mode > 5) mode = 5; + if ((code == nil) or (! isnum(code))) code = 0; # Ensure the code is a 4 digit string representation of a number. # Normally this means padding with 0's at the left e.g. 42 becomes 0042.