1
0
Fork 0

Further ISFD tweaks

- fix a nil value warning when the nav-radio isn’t valid yet
- fix sizing of barometer setting text
This commit is contained in:
James Turner 2019-01-18 14:55:03 +00:00
parent 2e4193d3a1
commit 1bcb51baa8
2 changed files with 14 additions and 7 deletions

View file

@ -579,7 +579,6 @@ createAltimeterSetting: func()
{ {
me._altimeterText = me.root.createChild('text', 'altimeter-setting-text'); me._altimeterText = me.root.createChild('text', 'altimeter-setting-text');
me._altimeterText.setText('1013'); me._altimeterText.setText('1013');
me._altimeterText.setFontSize(44);
me._altimeterText.setAlignment("right-center"); me._altimeterText.setAlignment("right-center");
me._altimeterText.setFont("LiberationFonts/LiberationMono-Regular.ttf"); me._altimeterText.setFont("LiberationFonts/LiberationMono-Regular.ttf");
me._altimeterText.setColor('#00ff00'); me._altimeterText.setColor('#00ff00');
@ -742,11 +741,19 @@ update : func()
# barometric # barometric
if (me._controller.isSTDBarometricPressure()) { if (me._controller.isSTDBarometricPressure()) {
me._altimeterText.setFontSize(44);
me._altimeterText.setText('STD'); me._altimeterText.setText('STD');
} elsif (me._controller.isHPaBarometer()) {
me._altimeterText.setText(sprintf('%4d HPA', me._controller.getBarometricPressureSettingHPa()));
} else { } 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 # APProach mode

View file

@ -92,17 +92,17 @@ var GenericController =
setprop(me._altimeterProp ~ "setting-hpa", hpa); setprop(me._altimeterProp ~ "setting-hpa", hpa);
}, },
isApproachMode: func { return me._approachMode; }, isApproachMode: func { return (me._approachMode != 0); },
toggleApproachMode : func { me._approachMode = (me._approachMode == 0); }, toggleApproachMode : func { me._approachMode = (me._approachMode == 0); },
isLocalizerValid: func { return getprop(me._navRadio ~ "in-range"); }, isLocalizerValid: func { return getprop(me._navRadio ~ "in-range"); },
isGSValid: func { return getprop(me._navRadio ~ "gs-in-range");}, isGSValid: func { return getprop(me._navRadio ~ "gs-in-range");},
getLocalizerDeviationNorm: func { getLocalizerDeviationNorm: func {
return getprop(me._navRadio ~ "heading-needle-deflection-norm"); return getprop(me._navRadio ~ "heading-needle-deflection-norm") or 0;
}, },
getGSDeviationNorm: func { getGSDeviationNorm: func {
return getprop(me._navRadio ~ "gs-needle-deflection-norm"); return getprop(me._navRadio ~ "gs-needle-deflection-norm") or 0;
}, },
} }