2018-02-09 18:55:53 +00:00
|
|
|
# Copyright 2018 Stuart Buchanan
|
|
|
|
# This file is part of FlightGear.
|
|
|
|
#
|
2018-05-28 19:15:57 +00:00
|
|
|
# FlightGear is free software: you can redistribute it and/or modify
|
2018-02-09 18:55:53 +00:00
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# FlightGear is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with FlightGear. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
#
|
2018-01-05 16:37:39 +00:00
|
|
|
# EIS Driver using Emesary for a single engined aircraft, e.g. Cessna 172.
|
|
|
|
var GenericEISPublisher =
|
|
|
|
{
|
|
|
|
|
2018-01-10 23:11:38 +00:00
|
|
|
new : func (frequency=0.25) {
|
2018-01-05 16:37:39 +00:00
|
|
|
var obj = {
|
2018-01-10 23:11:38 +00:00
|
|
|
parents : [
|
|
|
|
GenericEISPublisher,
|
|
|
|
PeriodicPropertyPublisher.new(notifications.PFDEventNotification.EngineData, frequency)
|
|
|
|
],
|
2018-01-05 16:37:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
# 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");
|
2018-04-07 12:22:01 +00:00
|
|
|
obj.addPropMap("Man", "/engines/engine[0]/mp-osi");
|
2018-01-05 16:37:39 +00:00
|
|
|
obj.addPropMap("MBusVolts", "/systems/electrical/volts");
|
|
|
|
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");
|
|
|
|
|
|
|
|
return obj;
|
|
|
|
},
|
|
|
|
|
2018-01-10 23:11:38 +00:00
|
|
|
# Custom publish method as we package the values into an array of engines,
|
|
|
|
# in this case, only one!
|
2018-01-05 16:37:39 +00:00
|
|
|
publish : func() {
|
|
|
|
var engineData0 = {};
|
|
|
|
|
|
|
|
foreach (var propmap; me._propmaps) {
|
|
|
|
var name = propmap.getName();
|
|
|
|
engineData0[name] = propmap.getValue();
|
|
|
|
}
|
|
|
|
|
|
|
|
var engineData = [];
|
|
|
|
append(engineData, engineData0);
|
|
|
|
|
2018-01-10 23:11:38 +00:00
|
|
|
var notification = notifications.PFDEventNotification.new(
|
|
|
|
"MFD",
|
|
|
|
1,
|
|
|
|
notifications.PFDEventNotification.EngineData,
|
2019-01-11 20:19:09 +00:00
|
|
|
{ Id: "EngineData", Value: engineData } );
|
2018-01-10 23:11:38 +00:00
|
|
|
|
|
|
|
me._transmitter.NotifyAll(notification);
|
2018-01-05 16:37:39 +00:00
|
|
|
},
|
|
|
|
};
|