1
0
Fork 0

FG1000: Reduce Emesary Notifications

Previously both PeriodicPropertyPublisher and TriggeredPropertyPublisher
published irrespective of the property value.

This change adds an optional epsilon value below which a
notification will not be made.  This significantly reduces the number
of Emesary notifications generated and therefore updates to the
displays.
This commit is contained in:
Stuart Buchanan 2023-12-07 11:06:46 +00:00
parent 1b81bc976b
commit b0dbba2944
6 changed files with 173 additions and 119 deletions

View file

@ -42,31 +42,31 @@ var GenericADCPublisher =
};
# Air data comes from the airspeed indicator as for a non-glass panel aircraft.
obj.addPropMap("ADCTrueAirspeed", "/instrumentation/airspeed-indicator/true-speed-kt");
obj.addPropMap("ADCIndicatedAirspeed", "/instrumentation/airspeed-indicator/indicated-speed-kt");
obj.addPropMap("ADCTrueAirspeed", "/instrumentation/airspeed-indicator/true-speed-kt", 1);
obj.addPropMap("ADCIndicatedAirspeed", "/instrumentation/airspeed-indicator/indicated-speed-kt", 0.2);
# Assume an accurate solid-state magnetometer
obj.addPropMap("ADCPitchDeg", "/orientation/pitch-deg");
obj.addPropMap("ADCRollDeg", "/orientation/roll-deg");
obj.addPropMap("ADCPitchDeg", "/orientation/pitch-deg", 0.2);
obj.addPropMap("ADCRollDeg", "/orientation/roll-deg", 0.2);
# TODO: Replace these with real values - shouldn't rely on steam-powered gauges.
obj.addPropMap("ADCTurnRate", "/instrumentation/turn-indicator/indicated-turn-rate");
obj.addPropMap("ADCSlipSkid", "/instrumentation/slip-skid-ball/indicated-slip-skid");
obj.addPropMap("ADCTurnRate", "/instrumentation/turn-indicator/indicated-turn-rate", 1);
obj.addPropMap("ADCSlipSkid", "/instrumentation/slip-skid-ball/indicated-slip-skid", 0.1);
# Assume an accurate solid-state magnetometer
obj.addPropMap("ADCHeadingMagneticDeg", "/orientation/heading-magnetic-deg");
obj.addPropMap("ADCMagneticVariationDeg", "/environment/magnetic-variation-deg");
obj.addPropMap("ADCHeadingMagneticDeg", "/orientation/heading-magnetic-deg", 1);
obj.addPropMap("ADCMagneticVariationDeg", "/environment/magnetic-variation-deg", 0.1);
obj.addPropMap("ADCAltitudeFT", "/instrumentation/altimeter/indicated-altitude-ft");
obj.addPropMap("ADCPressureSettingInHG", "/instrumentation/altimeter/setting-inhg");
obj.addPropMap("ADCAltitudeFT", "/instrumentation/altimeter/indicated-altitude-ft", 1);
obj.addPropMap("ADCPressureSettingInHG", "/instrumentation/altimeter/setting-inhg", 0.0);
obj.addPropMap("ADCVerticalSpeedFPM", "/instrumentation/vertical-speed-indicator/indicated-speed-fpm");
obj.addPropMap("ADCVerticalSpeedFPM", "/instrumentation/vertical-speed-indicator/indicated-speed-fpm", 10);
obj.addPropMap("ADCOutsideAirTemperatureC", "/environment/temperature-degc");
obj.addPropMap("ADCWindHeadingDeg", "/environment/wind-from-heading-deg");
obj.addPropMap("ADCWindSpeedKt", "/environment/wind-speed-kt");
obj.addPropMap("ADCTimeLocalSec", "/sim/time/local-day-seconds");
obj.addPropMap("ADCTimeUTCSec", "/sim/time/utc/day-seconds");
obj.addPropMap("ADCOutsideAirTemperatureC", "/environment/temperature-degc", 1);
obj.addPropMap("ADCWindHeadingDeg", "/environment/wind-from-heading-deg", 1);
obj.addPropMap("ADCWindSpeedKt", "/environment/wind-speed-kt", 1);
obj.addPropMap("ADCTimeLocalSec", "/sim/time/local-day-seconds", 1);
obj.addPropMap("ADCTimeUTCSec", "/sim/time/utc/day-seconds", 1);
return obj;
},
};

View file

@ -29,18 +29,18 @@ var GenericEISPublisher =
# Hack to handle most aircraft not having proper engine hours
if (getprop("/engines/engine[0]/hours") == nil) setprop("/engines/engine[0]/hours", 157.0);
obj.addPropMap("RPM", "/engines/engine[0]/rpm");
obj.addPropMap("Man", "/engines/engine[0]/mp-osi");
obj.addPropMap("MBusVolts", "/systems/electrical/volts");
obj.addPropMap("EBusVolts", "/systems/electrical/volts");
obj.addPropMap("MBattAmps", "/systems/electrical/amps");
obj.addPropMap("SBattAmps", "/systems/electrical/amps");
obj.addPropMap("EngineHours", "/engines/engine[0]/hours");
obj.addPropMap("FuelFlowGPH", "/engines/engine[0]/fuel-flow-gph");
obj.addPropMap("OilPressurePSI", "/engines/engine[0]/oil-pressure-psi");
obj.addPropMap("OilTemperatureF", "/engines/engine[0]/oil-temperature-degf");
obj.addPropMap("EGTNorm", "/engines/engine[0]/egt-norm");
obj.addPropMap("VacuumSuctionInHG", "/systems/vacuum/suction-inhg");
obj.addPropMap("RPM", "/engines/engine[0]/rpm", 10);
obj.addPropMap("Man", "/engines/engine[0]/mp-osi", 10);
obj.addPropMap("MBusVolts", "/systems/electrical/volts", 1);
obj.addPropMap("EBusVolts", "/systems/electrical/volts", 1);
obj.addPropMap("MBattAmps", "/systems/electrical/amps", 1);
obj.addPropMap("SBattAmps", "/systems/electrical/amps", 1);
obj.addPropMap("EngineHours", "/engines/engine[0]/hours", 1);
obj.addPropMap("FuelFlowGPH", "/engines/engine[0]/fuel-flow-gph", 0.25);
obj.addPropMap("OilPressurePSI", "/engines/engine[0]/oil-pressure-psi", 0.1);
obj.addPropMap("OilTemperatureF", "/engines/engine[0]/oil-temperature-degf", 1);
obj.addPropMap("EGTNorm", "/engines/engine[0]/egt-norm", 0.5);
obj.addPropMap("VacuumSuctionInHG", "/systems/vacuum/suction-inhg", 1);
return obj;
},

View file

@ -19,7 +19,7 @@
var GenericFMSPublisher =
{
new : func (period=0.5) {
new : func (period=1.0) {
var obj = {
parents : [
GenericFMSPublisher,
@ -36,8 +36,8 @@ var GenericFMSPublisher =
obj._triggeredPublisher = TriggeredPropertyPublisher.new(notifications.PFDEventNotification.FMSData);
obj._periodicPublisher = PeriodicPropertyPublisher.new(notifications.PFDEventNotification.FMSData, period);
obj._triggeredPublisher.addPropMap("FMSHeadingBug", "/autopilot/settings/heading-bug-deg");
obj._triggeredPublisher.addPropMap("FMSSelectedAlt", "/autopilot/settings/target-alt-ft");
obj._triggeredPublisher.addPropMap("FMSHeadingBug", "/autopilot/settings/heading-bug-deg", 1);
obj._triggeredPublisher.addPropMap("FMSSelectedAlt", "/autopilot/settings/target-alt-ft", 10);
obj._triggeredPublisher.addPropMap("FMSFlightPlanActive", "/autopilot/route-manager/active");
obj._triggeredPublisher.addPropMap("FMSFlightPlanCurrentWP", "/autopilot/route-manager/current-wp");
obj._triggeredPublisher.addPropMap("FMSFlightPlanSequenced", "/autopilot/route-manager/signals/sequenced");
@ -49,14 +49,15 @@ var GenericFMSPublisher =
obj._periodicPublisher.addPropMap("FMSLegValid", "/instrumentation/gps/wp/wp[1]/valid");
obj._periodicPublisher.addPropMap("FMSPreviousLegID", "/instrumentation/gps/wp/wp[0]/ID");
obj._periodicPublisher.addPropMap("FMSLegID", "/instrumentation/gps/wp/wp[1]/ID");
obj._periodicPublisher.addPropMap("FMSLegBearingMagDeg", "/instrumentation/gps/wp/wp[1]/bearing-mag-deg");
obj._periodicPublisher.addPropMap("FMSLegDistanceNM", "/instrumentation/gps/wp/wp[1]/distance-nm");
obj._periodicPublisher.addPropMap("FMSLegCourseError", "/instrumentation/gps/wp/wp[1]/course-error-nm");
obj._periodicPublisher.addPropMap("FMSLegDesiredTrack", "/instrumentation/gps/wp/wp[1]/desired-course-deg");
obj._periodicPublisher.addPropMap("FMSLegTrackErrorAngle", "/instrumentation/gps/wp/wp[1]/course-deviation-deg");
obj._periodicPublisher.addPropMap("FMSWayPointCourseError", "/instrumentation/gps/wp/wp[1]/course-error-nm");
obj._periodicPublisher.addPropMap("FMSLegBearingMagDeg", "/instrumentation/gps/wp/wp[1]/bearing-mag-deg", 1);
obj._periodicPublisher.addPropMap("FMSLegDistanceNM", "/instrumentation/gps/wp/wp[1]/distance-nm", 0.1);
obj._periodicPublisher.addPropMap("FMSLegCourseError", "/instrumentation/gps/wp/wp[1]/course-error-nm", 0.1);
obj._periodicPublisher.addPropMap("FMSLegDesiredTrack", "/instrumentation/gps/wp/wp[1]/desired-course-deg", 1);
obj._periodicPublisher.addPropMap("FMSLegTrackErrorAngle", "/instrumentation/gps/wp/wp[1]/course-deviation-deg", 1);
obj._periodicPublisher.addPropMap("FMSWayPointCourseError", "/instrumentation/gps/wp/wp[1]/course-error-nm", 0.1);
obj._periodicPublisher.addPropMap("FMSGroundspeed", "/instrumentation/gps/indicated-ground-speed-kt");
obj._periodicPublisher.addPropMap("FMSGroundspeed", "/instrumentation/gps/indicated-ground-speed-kt", 1);
obj._periodicPublisher.addPropMap("FMSNav1From", "/instrumentation/nav/from-flag");
obj._periodicPublisher.addPropMap("FMSNav2From", "/instrumentation/nav[1]/from-flag");
@ -67,7 +68,10 @@ var GenericFMSPublisher =
foreach (var propmap; me._propmaps) {
var name = propmap.getName();
gpsdata[name] = propmap.getValue();
if (propmap.hasChanged()) {
gpsdata[name] = propmap.getValue();
propmap.updateValue();
}
}
# Some GPS properties have odd values to indicate that nothing is set, so

View file

@ -66,18 +66,18 @@ var GenericNavComPublisher =
obj._triggeredPublisher.addPropMap("Nav1SelectedFreq", "/instrumentation/nav/frequencies/selected-mhz");
obj._triggeredPublisher.addPropMap("Nav1StandbyFreq", "/instrumentation/nav/frequencies/standby-mhz");
obj._triggeredPublisher.addPropMap("Nav1ID", "/instrumentation/nav/nav-id");
obj._periodicPublisher.addPropMap("Nav1InRange", "/instrumentation/nav/in-range");
obj._periodicPublisher.addPropMap("Nav1HeadingDeg", "/instrumentation/nav/heading-deg");
obj._periodicPublisher.addPropMap("Nav1RadialDeg", "/instrumentation/nav/radials/selected-deg");
obj._periodicPublisher.addPropMap("Nav1DistanceMeters", "/instrumentation/nav/nav-distance");
obj._periodicPublisher.addPropMap("Nav1CourseDeviationDeg", "/instrumentation/nav/crosstrack-heading-error-deg");
obj._periodicPublisher.addPropMap("Nav1CrosstrackErrorM", "/instrumentation/nav/crosstrack-error-m");
obj._periodicPublisher.addPropMap("Nav1Localizer", "/instrumentation/nav/nav-loc");
obj._periodicPublisher.addPropMap("Nav1Deflection", "/instrumentation/nav/heading-needle-deflection-norm");
obj._periodicPublisher.addPropMap("Nav1GSDeflection", "/instrumentation/nav/gs-needle-deflection-norm");
obj._periodicPublisher.addPropMap("Nav1GSInRange", "/instrumentation/nav/gs-in-range");
obj._periodicPublisher.addPropMap("Nav1From", "/instrumentation/nav/from-flag");
obj._triggeredPublisher.addPropMap("Nav1ID", "/instrumentation/nav/nav-id", "");
obj._periodicPublisher.addPropMap("Nav1InRange", "/instrumentation/nav/in-range", 0.1);
obj._periodicPublisher.addPropMap("Nav1HeadingDeg", "/instrumentation/nav/heading-deg", 1);
obj._periodicPublisher.addPropMap("Nav1RadialDeg", "/instrumentation/nav/radials/selected-deg", 1);
obj._periodicPublisher.addPropMap("Nav1DistanceMeters", "/instrumentation/nav/nav-distance", 100);
obj._periodicPublisher.addPropMap("Nav1CourseDeviationDeg", "/instrumentation/nav/crosstrack-heading-error-deg", 1);
obj._periodicPublisher.addPropMap("Nav1CrosstrackErrorM", "/instrumentation/nav/crosstrack-error-m", 100);
obj._periodicPublisher.addPropMap("Nav1Localizer", "/instrumentation/nav/nav-loc", 0.1);
obj._periodicPublisher.addPropMap("Nav1Deflection", "/instrumentation/nav/heading-needle-deflection-norm", 0.05);
obj._periodicPublisher.addPropMap("Nav1GSDeflection", "/instrumentation/nav/gs-needle-deflection-norm", 0.05);
obj._periodicPublisher.addPropMap("Nav1GSInRange", "/instrumentation/nav/gs-in-range", 0.1);
obj._periodicPublisher.addPropMap("Nav1From", "/instrumentation/nav/from-flag", 0.1);
obj._triggeredPublisher.addPropMap("Nav1Volume", "/instrumentation/nav/volume-selected");
obj._triggeredPublisher.addPropMap("Nav1AudioID", "/instrumentation/nav/audio-btn");
@ -85,25 +85,26 @@ var GenericNavComPublisher =
obj._triggeredPublisher.addPropMap("Nav2SelectedFreq", "/instrumentation/nav[1]/frequencies/selected-mhz");
obj._triggeredPublisher.addPropMap("Nav2StandbyFreq", "/instrumentation/nav[1]/frequencies/standby-mhz");
obj._periodicPublisher.addPropMap("Nav2ID", "/instrumentation/nav[1]/nav-id");
obj._periodicPublisher.addPropMap("Nav2InRange", "/instrumentation/nav[1]/in-range");
obj._periodicPublisher.addPropMap("Nav2HeadingDeg", "/instrumentation/nav[1]/heading-deg");
obj._periodicPublisher.addPropMap("Nav2RadialDeg", "/instrumentation/nav[1]/radials/selected-deg");
obj._periodicPublisher.addPropMap("Nav2DistanceMeters", "/instrumentation/nav[1]/nav-distance");
obj._periodicPublisher.addPropMap("Nav2CourseDeviationDeg", "/instrumentation/nav[1]/crosstrack-heading-error-deg");
obj._periodicPublisher.addPropMap("Nav2CrosstrackErrorM", "/instrumentation/nav[1]/crosstrack-error-m");
obj._periodicPublisher.addPropMap("Nav2Localizer", "/instrumentation/nav[1]/nav-loc");
obj._periodicPublisher.addPropMap("Nav2Deflection", "/instrumentation/nav[1]/heading-needle-deflection-norm");
obj._periodicPublisher.addPropMap("Nav2GSDeflection", "/instrumentation/nav[1]/gs-needle-deflection-norm");
obj._periodicPublisher.addPropMap("Nav2GSInRange", "/instrumentation/nav[1]/gs-in-range");
obj._periodicPublisher.addPropMap("Nav2From", "/instrumentation/nav/from-flag");
obj._periodicPublisher.addPropMap("Nav2ID", "/instrumentation/nav[1]/nav-id", "");
obj._periodicPublisher.addPropMap("Nav2InRange", "/instrumentation/nav[1]/in-range", 0.1);
obj._periodicPublisher.addPropMap("Nav2HeadingDeg", "/instrumentation/nav[1]/heading-deg", 1);
obj._periodicPublisher.addPropMap("Nav2RadialDeg", "/instrumentation/nav[1]/radials/selected-deg", 1);
obj._periodicPublisher.addPropMap("Nav2DistanceMeters", "/instrumentation/nav[1]/nav-distance", 100);
obj._periodicPublisher.addPropMap("Nav2CourseDeviationDeg", "/instrumentation/nav[1]/crosstrack-heading-error-deg", 1);
obj._periodicPublisher.addPropMap("Nav2CrosstrackErrorM", "/instrumentation/nav[1]/crosstrack-error-m", 100);
obj._periodicPublisher.addPropMap("Nav2Localizer", "/instrumentation/nav[1]/nav-loc", 0.1);
obj._periodicPublisher.addPropMap("Nav2Deflection", "/instrumentation/nav[1]/heading-needle-deflection-norm", 0.05);
obj._periodicPublisher.addPropMap("Nav2GSDeflection", "/instrumentation/nav[1]/gs-needle-deflection-norm", 0.05);
obj._periodicPublisher.addPropMap("Nav2GSInRange", "/instrumentation/nav[1]/gs-in-range", 0.1);
obj._periodicPublisher.addPropMap("Nav2From", "/instrumentation/nav/from-flag", 0.1);
obj._triggeredPublisher.addPropMap("Nav2AudioID", "/instrumentation/nav[1]/audio-btn");
obj._triggeredPublisher.addPropMap("Nav2Serviceable", "/instrumentation/nav[1]/operable");
obj._triggeredPublisher.addPropMap("ADFSelectedFreq", "/instrumentation/adf/frequencies/selected-khz");
obj._periodicPublisher.addPropMap("ADFInRange", "/instrumentation/adf/in-range");
obj._periodicPublisher.addPropMap("ADFHeadingDeg", "/instrumentation/adf/indicated-bearing-deg");
obj._periodicPublisher.addPropMap("ADFInRange", "/instrumentation/adf/in-range", 0.1);
obj._periodicPublisher.addPropMap("ADFHeadingDeg", "/instrumentation/adf/indicated-bearing-deg", 1);
obj._triggeredPublisher.addPropMap("ADFVolume", "/instrumentation/adf/volume-norm");
obj._triggeredPublisher.addPropMap("ADFServiceable", "/instrumentation/adf/operable");

View file

@ -25,11 +25,13 @@
#
var PropMap = {
new : func(name, property)
new : func(name, property, epsilon)
{
var obj = { parents : [ PropMap ] };
obj._name = name;
obj._prop = globals.props.getNode(property, 1);
obj._epsilon = epsilon;
obj._lastValue = nil;
return obj;
},
@ -40,6 +42,15 @@ var PropMap = {
if (val == nil) val = 0;
return val;
},
hasChanged : func() {
var val = me._prop.getValue();
if (me._epsilon == nil) return 1;
if ((me._lastValue == nil) and (val != nil)) return 1;
if (! isnum(val) and val != me._lastValue) return 1;
if (isnum(val) and abs(val - me._lastValue) > me._epsilon) return 1;
return 0;
},
updateValue : func() { me._lastValue = me.getValue(); },
getProp: func() { return me._prop; },
};
@ -58,25 +69,33 @@ var PeriodicPropertyPublisher =
return obj;
},
addPropMap : func(name, prop) {
append(me._propmaps, PropMap.new(name, prop));
addPropMap : func(name, prop, epsilon=nil) {
append(me._propmaps, PropMap.new(name, prop, epsilon));
},
publish : func() {
var data = {};
var names = "";
foreach (var propmap; me._propmaps) {
var name = propmap.getName();
data[name] = propmap.getValue();
if (propmap.hasChanged()) {
data[name] = propmap.getValue();
propmap.updateValue();
names = sprintf("%s %s", names, name);
}
}
var notification = notifications.PFDEventNotification.new(
"MFD",
1,
me._notification,
data);
if (size(data) > 0) {
var notification = notifications.PFDEventNotification.new(
"MFD",
1,
me._notification,
data);
me._transmitter.NotifyAll(notification);
me._transmitter.NotifyAll(notification);
#print(sprintf("NOTIFY total of %i properties changed out of %i: %s", size(data), size(me._propmaps), names));
}
},
start : func() {
@ -106,32 +125,35 @@ var TriggeredPropertyPublisher =
return obj;
},
addPropMap : func(name, prop) {
me._propmaps[prop] = name;
addPropMap : func(name, prop, epsilon=nil) {
me._propmaps[prop] = PropMap.new(name, prop, epsilon);
},
publish : func(propNode) {
var data = {};
var name = me._propmaps[propNode.getPath()];
assert(name != nil, "Unable to find property map for " ~ name);
data[name] = propNode.getValue();
var propmap = me._propmaps[propNode.getPath()];
assert(propmap != nil, "Unable to find property map for " ~ propNode.getPath());
if (propmap.hasChanged()) {
data[propmap._name] = propNode.getValue();
propmap.updateValue();
var notification = notifications.PFDEventNotification.new(
"MFD",
1,
me._notification,
data);
var notification = notifications.PFDEventNotification.new(
"MFD",
1,
me._notification,
data);
me._transmitter.NotifyAll(notification);
me._transmitter.NotifyAll(notification);
}
},
publishAll : func() {
var data = {};
foreach (var prop; keys(me._propmaps)) {
var name = me._propmaps[prop];
var value = props.globals.getNode(prop, 1).getValue();
data[name] = value;
var propmap = me._propmaps[prop];
data[propmap._name] = propmap.getValue();
propmap.updateValue();
}
var notification = notifications.PFDEventNotification.new(
@ -149,7 +171,8 @@ var TriggeredPropertyPublisher =
# Set up a listener triggering on create (to ensure all values are set at
# start of day) and only on changed values. These are the last two
# arguments to the setlistener call.
var listener = setlistener(prop, func(p) { me.publish(p); }, 1, 1);
var propmap = me._propmaps[prop];
var listener = setlistener(propmap.getPropPath(), func(p) { me.publish(p); }, 1, 1);
append(me._listeners, listener);
}

View file

@ -32,9 +32,14 @@ var PFDInstrumentsController =
_BRG1Source : 0,
_BRG2Source : 0,
_pitch : 0.0,
_roll: 0.0,
_slip: 0.0,
_last_ias_kt : 0,
_last_alt_ft : 0,
_last_trend : systime(),
_last_ias_trend : systime(),
_last_alt_trend : systime(),
_selected_alt_ft : 0,
_heading_magnetic_deg : 0,
_mag_var : 0,
@ -208,43 +213,64 @@ var PFDInstrumentsController =
getBRG2 : func() { return PFDInstrumentsController.BRG_SOURCE[me._BRG2Source]; },
# Handle update of the airdata information.
# ADC data is produced periodically as an entire set
# ADC data is produced periodically
handleADCData : func(data) {
var now = systime();
var ias = data["ADCIndicatedAirspeed"];
var alt = data["ADCAltitudeFT"];
# estimated speed and altitude in 6s
var now = systime();
var lookahead_ias_6sec = 6 * (ias - me._last_ias_kt) / (now - me._last_trend);
var lookahead_alt_6sec = .3 * (alt - me._last_alt_ft) / (now - me._last_trend); # scale = 1/20ft
me.page.updateIAS(ias, lookahead_ias_6sec);
me.page.updateALT(alt, lookahead_alt_6sec, me._selected_alt_ft);
me._last_ias_kt = ias;
me._last_alt_ft = alt;
me._last_trend = now;
var pitch = data["ADCPitchDeg"];
var roll = data["ADCRollDeg"];
var slip = data["ADCSlipSkid"];
me.page.updateAI(pitch, roll, slip);
me.page.updateFD((me._fd_enabled or me._ap_enabled), pitch, roll, me._fd_pitch, me._fd_roll);
# estimated speed and altitude in 6s if we have updated data
me.page.updateVSI(data["ADCVerticalSpeedFPM"]);
me.page.updateTAS(data["ADCTrueAirspeed"]);
me.page.updateBARO(data["ADCPressureSettingInHG"]);
if (ias != nil) {
var lookahead_ias_6sec = 6 * (ias - me._last_ias_kt) / (now - me._last_ias_trend);
me.page.updateIAS(ias, lookahead_ias_6sec);
me._last_ias_kt = ias;
me._last_ias_trend = now;
}
me.page.updateOAT(data["ADCOutsideAirTemperatureC"]);
me.page.updateHSI(data["ADCHeadingMagneticDeg"]);
me._heading_magnetic_deg = data["ADCHeadingMagneticDeg"];
me._mag_var = data["ADCMagneticVariationDeg"];
if (alt != nil) {
var lookahead_alt_6sec = .3 * (alt - me._last_alt_ft) / (now - me._last_alt_trend); # scale = 1/20ft
me.page.updateALT(alt, lookahead_alt_6sec, me._selected_alt_ft);
me._last_alt_ft = alt;
me._last_alt_trend = now;
}
if ((data["ADCPitchDeg"] != nil) or (data["ADCRollDeg"] != nil) or (data["ADCSlipSkid"] != nil)) {
# These all have to be updated together
if (data["ADCPitchDeg"] != nil) me._pitch = data["ADCPitchDeg"];
if (data["ADCRollDeg"] != nil) me._roll = data["ADCRollDeg"];
if (data["ADCSlipSkid"] != nil) me._slip = data["ADCSlipSkid"];
me.page.updateAI(me._pitch, me._roll, me._slip);
me.page.updateFD((me._fd_enabled or me._ap_enabled), me._pitch, me._roll, me._fd_pitch, me._fd_roll);
}
if (data["ADCVerticalSpeedFPM"] != nil) me.page.updateVSI(data["ADCVerticalSpeedFPM"]);
if (data["ADCTrueAirspeed"] != nil) me.page.updateTAS(data["ADCTrueAirspeed"]);
if (data["ADCPressureSettingInHG"] != nil) me.page.updateBARO(data["ADCPressureSettingInHG"]);
if (data["ADCOutsideAirTemperatureC"] != nil) me.page.updateOAT(data["ADCOutsideAirTemperatureC"]);
if (data["ADCHeadingMagneticDeg"] != nil) {
me.page.updateHSI(data["ADCHeadingMagneticDeg"]);
me._heading_magnetic_deg = data["ADCHeadingMagneticDeg"];
}
if (data["ADCMagneticVariationDeg"] != nil) me._mag_var = data["ADCMagneticVariationDeg"];
# If we're "flying" at < 10kts, then we won't have sufficient delta between
# airspeed and groundspeed to determine wind
me.page.updateWindData(
hdg : data["ADCHeadingMagneticDeg"],
wind_hdg : data["ADCWindHeadingDeg"],
wind_spd : data ["ADCWindSpeedKt"],
no_data: (data["ADCIndicatedAirspeed"] < 1.0)
);
if ((data["ADCHeadingMagneticDeg"] != nil) and
(data["ADCWindHeadingDeg"] != nil) and
(data["ADCWindSpeedKt"] != nil) and
(data["ADCIndicatedAirspeed"] != nil) )
{
me.page.updateWindData(
hdg : data["ADCHeadingMagneticDeg"],
wind_hdg : data["ADCWindHeadingDeg"],
wind_spd : data["ADCWindSpeedKt"],
no_data: (data["ADCIndicatedAirspeed"] < 1.0)
);
}
if ((data["ADCTimeLocalSec"] != nil) and (me._time_sec != data["ADCTimeLocalSec"])) {
me._time_sec = data["ADCTimeLocalSec"];