2018-10-24 21:22:24 +00:00
|
|
|
|
|
|
|
|
|
|
|
var GenericController =
|
|
|
|
{
|
|
|
|
|
2019-01-17 09:46:04 +00:00
|
|
|
new : func (isfd)
|
2018-10-24 21:22:24 +00:00
|
|
|
{
|
|
|
|
var obj = {
|
|
|
|
parents : [GenericController],
|
2019-01-17 09:46:04 +00:00
|
|
|
_isfd: isfd,
|
|
|
|
_altimeterProp : "/instrumentation/altimeter/",
|
|
|
|
_airspeedProp : "/instrumentation/airspeed-indicator/",
|
|
|
|
_attitudeProp : "/instrumentation/attitude-indicator/",
|
|
|
|
_navRadio: "/instrumentation/nav[0]/",
|
|
|
|
_isSTDBaro : 0,
|
|
|
|
_approachMode : 0
|
2018-10-24 21:22:24 +00:00
|
|
|
};
|
|
|
|
|
2019-01-17 09:46:04 +00:00
|
|
|
return obj;
|
2018-10-24 21:22:24 +00:00
|
|
|
},
|
|
|
|
|
2019-01-17 09:46:04 +00:00
|
|
|
update : func
|
2018-10-24 21:22:24 +00:00
|
|
|
{
|
|
|
|
},
|
|
|
|
|
2019-01-17 09:46:04 +00:00
|
|
|
getAltitudeFt : func
|
2018-10-24 21:22:24 +00:00
|
|
|
{
|
2019-01-17 09:46:04 +00:00
|
|
|
return getprop(me._altimeterProp ~ "indicated-altitude-ft");
|
2018-10-24 21:22:24 +00:00
|
|
|
},
|
|
|
|
|
2019-01-17 09:46:04 +00:00
|
|
|
getIndicatedAirspeedKnots : func
|
2018-10-24 21:22:24 +00:00
|
|
|
{
|
2019-01-17 09:46:04 +00:00
|
|
|
return getprop(me._airspeedProp ~ "indicated-speed-kt");
|
2018-10-24 21:22:24 +00:00
|
|
|
},
|
|
|
|
|
2019-01-17 09:46:04 +00:00
|
|
|
getHeadingDeg : func
|
2018-10-24 21:22:24 +00:00
|
|
|
{
|
|
|
|
# compass / gyro source for this?
|
|
|
|
return getprop("/orientation/heading-deg");
|
|
|
|
},
|
|
|
|
|
2019-01-17 09:46:04 +00:00
|
|
|
getPitchDeg : func
|
2018-10-24 21:22:24 +00:00
|
|
|
{
|
2019-01-17 09:46:04 +00:00
|
|
|
return getprop(me._attitudeProp ~ "indicated-pitch-deg");
|
|
|
|
},
|
2018-10-24 21:22:24 +00:00
|
|
|
|
2019-01-17 09:46:04 +00:00
|
|
|
getBankAngleDeg : func
|
|
|
|
{
|
|
|
|
return getprop(me._attitudeProp ~ "indicated-roll-deg");
|
2018-10-24 21:22:24 +00:00
|
|
|
},
|
|
|
|
|
2019-01-17 09:46:04 +00:00
|
|
|
isSTDBarometricPressure : func
|
2018-10-24 21:22:24 +00:00
|
|
|
{
|
2019-01-17 09:46:04 +00:00
|
|
|
return me._isSTDBaro;
|
2018-10-24 21:22:24 +00:00
|
|
|
},
|
|
|
|
|
2019-01-17 09:46:04 +00:00
|
|
|
toggleSTDBarometricPressure : func
|
2018-10-24 21:22:24 +00:00
|
|
|
{
|
2019-01-17 09:46:04 +00:00
|
|
|
me._isSTDBaro = (me._isSTDBaro == 0);
|
|
|
|
},
|
2018-10-24 21:22:24 +00:00
|
|
|
|
2019-01-17 09:46:04 +00:00
|
|
|
isHPaBarometer : func
|
|
|
|
{
|
|
|
|
return me._isHPa;
|
|
|
|
},
|
2018-10-24 21:22:24 +00:00
|
|
|
|
2019-01-17 09:46:04 +00:00
|
|
|
toggleHPaBarometer : func
|
|
|
|
{
|
|
|
|
me._isHPa = (me._isHPa == 0);
|
|
|
|
},
|
|
|
|
|
|
|
|
getBarometricPressureSettingInHg : func
|
|
|
|
{
|
|
|
|
if (me._isSTDBaro) return 29.92;
|
|
|
|
return getprop(me._altimeterProp ~ "setting-inhg");
|
|
|
|
},
|
|
|
|
|
|
|
|
getBarometricPressureSettingHPa : func
|
|
|
|
{
|
|
|
|
if (me._isSTDBaro) return 1013;
|
|
|
|
return getprop(me._altimeterProp ~ "setting-hpa");
|
|
|
|
},
|
|
|
|
|
|
|
|
setBarometricPressureSettingInHg : func (inHg)
|
|
|
|
{
|
|
|
|
setprop(me._altimeterProp ~ "setting-inhg", inHg);
|
|
|
|
},
|
|
|
|
|
|
|
|
setBarometricPressureSettingHPa : func (hpa)
|
|
|
|
{
|
|
|
|
setprop(me._altimeterProp ~ "setting-hpa", hpa);
|
|
|
|
},
|
|
|
|
|
|
|
|
isApproachMode: func { return me._approachMode; },
|
|
|
|
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");
|
|
|
|
},
|
|
|
|
|
|
|
|
getGSDeviationNorm: func {
|
|
|
|
return getprop(me._navRadio ~ "gs-needle-deflection-norm");
|
|
|
|
},
|
2018-10-24 21:22:24 +00:00
|
|
|
}
|