| 1 |
|
| 2 |
|
| 3 |
var GenericController = |
| 4 |
{ |
| 5 |
|
| 6 |
new : func (isfd) |
| 7 |
{ |
| 8 |
var obj = { |
| 9 |
parents : [GenericController], |
| 10 |
_isfd: isfd, |
| 11 |
_altimeterProp : "/instrumentation/altimeter/", |
| 12 |
_airspeedProp : "/instrumentation/airspeed-indicator/", |
| 13 |
_attitudeProp : "/instrumentation/attitude-indicator/", |
| 14 |
_navRadio: "/instrumentation/nav[0]/", |
| 15 |
_isSTDBaro : 0, |
| 16 |
_isHPa : 1, |
| 17 |
_approachMode : 0 |
| 18 |
}; |
| 19 |
|
| 20 |
return obj; |
| 21 |
}, |
| 22 |
|
| 23 |
update : func |
| 24 |
{ |
| 25 |
}, |
| 26 |
|
| 27 |
getAltitudeFt : func |
| 28 |
{ |
| 29 |
return getprop(me._altimeterProp ~ "indicated-altitude-ft"); |
| 30 |
}, |
| 31 |
|
| 32 |
getIndicatedAirspeedKnots : func |
| 33 |
{ |
| 34 |
return getprop(me._airspeedProp ~ "indicated-speed-kt"); |
| 35 |
}, |
| 36 |
|
| 37 |
getHeadingDeg : func |
| 38 |
{ |
| 39 |
# compass / gyro source for this? |
| 40 |
return getprop("/orientation/heading-deg"); |
| 41 |
}, |
| 42 |
|
| 43 |
getPitchDeg : func |
| 44 |
{ |
| 45 |
return getprop(me._attitudeProp ~ "indicated-pitch-deg"); |
| 46 |
}, |
| 47 |
|
| 48 |
getBankAngleDeg : func |
| 49 |
{ |
| 50 |
return getprop(me._attitudeProp ~ "indicated-roll-deg"); |
| 51 |
}, |
| 52 |
|
| 53 |
isSTDBarometricPressure : func |
| 54 |
{ |
| 55 |
return me._isSTDBaro; |
| 56 |
}, |
| 57 |
|
| 58 |
toggleSTDBarometricPressure : func |
| 59 |
{ |
| 60 |
me._isSTDBaro = (me._isSTDBaro == 0); |
| 61 |
}, |
| 62 |
|
| 63 |
isHPaBarometer : func |
| 64 |
{ |
| 65 |
return me._isHPa; |
| 66 |
}, |
| 67 |
|
| 68 |
toggleHPaBarometer : func |
| 69 |
{ |
| 70 |
me._isHPa = (me._isHPa == 0); |
| 71 |
}, |
| 72 |
|
| 73 |
getBarometricPressureSettingInHg : func |
| 74 |
{ |
| 75 |
if (me._isSTDBaro) return 29.92; |
| 76 |
return getprop(me._altimeterProp ~ "setting-inhg"); |
| 77 |
}, |
| 78 |
|
| 79 |
getBarometricPressureSettingHPa : func |
| 80 |
{ |
| 81 |
if (me._isSTDBaro) return 1013; |
| 82 |
return getprop(me._altimeterProp ~ "setting-hpa"); |
| 83 |
}, |
| 84 |
|
| 85 |
setBarometricPressureSettingInHg : func (inHg) |
| 86 |
{ |
| 87 |
setprop(me._altimeterProp ~ "setting-inhg", inHg); |
| 88 |
}, |
| 89 |
|
| 90 |
setBarometricPressureSettingHPa : func (hpa) |
| 91 |
{ |
| 92 |
setprop(me._altimeterProp ~ "setting-hpa", hpa); |
| 93 |
}, |
| 94 |
|
| 95 |
isApproachMode: func { return (me._approachMode != 0); }, |
| 96 |
toggleApproachMode : func { me._approachMode = (me._approachMode == 0); }, |
| 97 |
|
| 98 |
isLocalizerValid: func { return getprop(me._navRadio ~ "in-range"); }, |
| 99 |
isGSValid: func { return getprop(me._navRadio ~ "gs-in-range");}, |
| 100 |
|
| 101 |
getLocalizerDeviationNorm: func { |
| 102 |
return getprop(me._navRadio ~ "heading-needle-deflection-norm") or 0; |
| 103 |
}, |
| 104 |
|
| 105 |
getGSDeviationNorm: func { |
| 106 |
return getprop(me._navRadio ~ "gs-needle-deflection-norm") or 0; |
| 107 |
}, |
| 108 |
} |