From 1bcb51baa820546fd8b7508fc8d34073130e8e8d Mon Sep 17 00:00:00 2001 From: James Turner Date: Fri, 18 Jan 2019 14:55:03 +0000 Subject: [PATCH] Further ISFD tweaks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - fix a nil value warning when the nav-radio isn’t valid yet - fix sizing of barometer setting text --- Aircraft/Instruments-3d/ISFD/ISFD.nas | 15 +++++++++++---- .../Instruments-3d/ISFD/ISFDGenericController.nas | 6 +++--- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Aircraft/Instruments-3d/ISFD/ISFD.nas b/Aircraft/Instruments-3d/ISFD/ISFD.nas index 39aa45682..69f30627b 100644 --- a/Aircraft/Instruments-3d/ISFD/ISFD.nas +++ b/Aircraft/Instruments-3d/ISFD/ISFD.nas @@ -579,7 +579,6 @@ createAltimeterSetting: func() { me._altimeterText = me.root.createChild('text', 'altimeter-setting-text'); me._altimeterText.setText('1013'); - me._altimeterText.setFontSize(44); me._altimeterText.setAlignment("right-center"); me._altimeterText.setFont("LiberationFonts/LiberationMono-Regular.ttf"); me._altimeterText.setColor('#00ff00'); @@ -742,11 +741,19 @@ update : func() # barometric if (me._controller.isSTDBarometricPressure()) { + me._altimeterText.setFontSize(44); me._altimeterText.setText('STD'); - } elsif (me._controller.isHPaBarometer()) { - me._altimeterText.setText(sprintf('%4d HPA', me._controller.getBarometricPressureSettingHPa())); } else { - me._altimeterText.setText(sprintf('%4.2f IN', me._controller.getBarometricPressureSettingInHg())); + var s = ''; + if (me._controller.isHPaBarometer()) { + s = sprintf('%4d HPA', me._controller.getBarometricPressureSettingHPa()); + } else { + s = sprintf('%4.2f IN', me._controller.getBarometricPressureSettingInHg()); + } + + # smaller text to fit + me._altimeterText.setFontSize(32); + me._altimeterText.setText(s); } # APProach mode diff --git a/Aircraft/Instruments-3d/ISFD/ISFDGenericController.nas b/Aircraft/Instruments-3d/ISFD/ISFDGenericController.nas index ed65c28c3..f5ccafb7b 100644 --- a/Aircraft/Instruments-3d/ISFD/ISFDGenericController.nas +++ b/Aircraft/Instruments-3d/ISFD/ISFDGenericController.nas @@ -92,17 +92,17 @@ var GenericController = setprop(me._altimeterProp ~ "setting-hpa", hpa); }, - isApproachMode: func { return me._approachMode; }, + isApproachMode: func { return (me._approachMode != 0); }, toggleApproachMode : func { me._approachMode = (me._approachMode == 0); }, isLocalizerValid: func { return getprop(me._navRadio ~ "in-range"); }, isGSValid: func { return getprop(me._navRadio ~ "gs-in-range");}, getLocalizerDeviationNorm: func { - return getprop(me._navRadio ~ "heading-needle-deflection-norm"); + return getprop(me._navRadio ~ "heading-needle-deflection-norm") or 0; }, getGSDeviationNorm: func { - return getprop(me._navRadio ~ "gs-needle-deflection-norm"); + return getprop(me._navRadio ~ "gs-needle-deflection-norm") or 0; }, } \ No newline at end of file