New Version for DCS World Version 1.5.2 and Iakrus and DAC.

This Version ist without support for HT or HELIOS.
This commit is contained in:
mcmicha
2016-01-24 18:58:21 +01:00
parent 3e545e6c53
commit d6302f1e70
29 changed files with 7965 additions and 9955 deletions

View File

@@ -0,0 +1,43 @@
-- Ikarus and D.A.C. Export Script
-- Version 1.0.0 BETA
--
-- Config File
--
-- Copyright by Michael aka McMicha 2014
-- Contact dcs2arcaze.micha@farbpigmente.org
ExportScript.Config = {}
-- Ikarus a Glass Cockpit Software
ExportScript.Config.IkarusExport = true -- false for not use
ExportScript.Config.IkarusHost = "127.0.0.1" -- IP for Ikarus
ExportScript.Config.IkarusPort = 1625 -- Port Ikarus (1625)
ExportScript.Config.IkarusSeparator = ":"
-- D.A.C. (DCS Arcaze Connector)
ExportScript.Config.DACExport = true -- false for not use
ExportScript.Config.DAC = {}
-- first hardware
ExportScript.Config.DAC[1] = {}
ExportScript.Config.DAC[1].Host = "127.0.0.1" -- IP for hardware 1
ExportScript.Config.DAC[1].SendPort = 26026 -- Port for hardware 1
ExportScript.Config.DAC[1].Separator = ":"
-- secound to n hardware
--ExportScript.Config.DAC[2] = {}
--ExportScript.Config.DAC[2].Host = "127.0.0.1" -- IP for hardware 2
--ExportScript.Config.DAC[2].SendPort = 9092 -- Port for hardware 2
--ExportScript.Config.DAC[2].Separator = ":"
-- D.A.C. can data send
ExportScript.Config.DACListener = true -- false for not use
ExportScript.Config.DACListenerPort = 26027 -- Listener Port for D.A.C.
-- Other
ExportScript.Config.ExportInterval = 0.1
ExportScript.Config.ExportLowTickInterval = 1
ExportScript.Config.LogPath = lfs.writedir()..[[Logs\Export.log]]
ExportScript.Config.ExportModulePath = lfs.writedir()..[[Scripts\DCS-ExportScript\ExportsModules\]]
ExportScript.Config.Debug = false
ExportScript.Config.FirstNewDataSend = true
ExportScript.Config.FirstNewDataSendCount = 5
ExportScript.Config.genericRadioHardwareID = 1

View File

@@ -0,0 +1,277 @@
-- Ikarus and D.A.C. Export Script
-- Version 1.0.0 BETA
--
-- Copyright by Michael aka McMicha 2014
-- Contact dcs2arcaze.micha@farbpigmente.org
-- Main Table
ExportScript = {}
-- Simulation id
ExportScript.SimID = string.format("%08x*",os.time())
-- State data for export
ExportScript.PacketSize = 0
ExportScript.SendStrings = {}
ExportScript.LastData = {}
ExportScript.PacketSizeDAC = {}
ExportScript.SendStringsDAC = {}
ExportScript.LastDataDAC = {}
dofile(lfs.writedir()..[[Scripts\DCS-ExportScript\Config.lua]])
dofile(lfs.writedir()..[[Scripts\DCS-ExportScript\lib\Tools.lua]])
for i = 1, #ExportScript.Config.DAC, 1 do
ExportScript.PacketSizeDAC[i] = 0
ExportScript.SendStringsDAC[i] = {}
ExportScript.LastDataDAC[i] = {}
end
-- Frame counter for non important data
ExportScript.TickCount = 0
ExportScript.TickCountDAC = 0
-- Found DCS or FC Module
ExportScript.FoundDCSModule = false
ExportScript.FoundFCModule = false
ExportScript.FoundNoModul = true
---------------------------------------------
-- DCS Export API Function Implementations --
---------------------------------------------
function LuaExportStart()
-- Works once just before mission start.
-- (and before player selects their aircraft, if there is a choice!)
-- 2) Setup udp sockets to talk to GlassCockpit
package.path = package.path..";.\\LuaSocket\\?.lua"
package.cpath = package.cpath..";.\\LuaSocket\\?.dll"
ExportScript.socket = require("socket")
ExportScript.UDPsender = ExportScript.socket.udp()
ExportScript.UDPsender:setsockname("*", 0)
ExportScript.UDPsender:setoption('broadcast', true)
ExportScript.UDPsender:settimeout(.001) -- set the timeout for reading the socket
if ExportScript.Config.DACListener then
ExportScript.UDPListener = ExportScript.socket.udp()
ExportScript.UDPListener:setsockname("*", ExportScript.Config.DACListenerPort)
ExportScript.UDPListener:setoption('broadcast', true)
ExportScript.UDPListener:settimeout(.001) -- set the timeout for reading the socket
end
-- local lrename1, lrename2 = os.rename(ExportScript.Config.LogPath, ExportScript.Config.LogPath..".old")
ExportScript.logFile = io.open(ExportScript.Config.LogPath, "w+")
-- if lrenmae1 == nil then
-- ExportScript.Tools.WriteToLog("Rename Error: "..lrename2)
-- end
ExportScript.AF = {} -- Table for Auxiliary functions
ExportScript.AF.EventNumberOLD = 0 -- event number from previous event
ExportScript.Tools.SelectModule() -- point globals to Module functions and data.
end
function LuaExportBeforeNextFrame()
ExportScript.Tools.ProcessInput()
end
function LuaExportAfterNextFrame()
end
function LuaExportStop()
-- Works once just after mission stop.
ExportScript.Tools.SendDataDAC("DAC", "stop")
for i=1, #ExportScript.Config.DAC, 1 do
ExportScript.Tools.FlushDataDAC(i)
end
ExportScript.Tools.SendData("Ikarus", "stop")
ExportScript.Tools.FlushData()
ExportScript.UDPsender:close()
if ExportScript.Config.DACListener then
ExportScript.UDPListener:close()
end
ExportScript.ModuleName = nil
ExportScript.FoundNoModul = false
if ExportScript.logFile then
ExportScript.Tools.WriteToLog("====== Logfile close ======")
ExportScript.logFile:flush()
ExportScript.logFile:close()
ExportScript.logFile = nil
end
end
function LuaExportActivityNextEvent(t)
t = t + ExportScript.Config.ExportInterval
local coStatus
ExportScript.TickCount = ExportScript.TickCount + 1
local lMyInfo = LoGetSelfData()
if lMyInfo ~= nil then
if ExportScript.ModuleName ~= lMyInfo.Name then
ExportScript.Tools.SelectModule() -- point globals to Module functions and data.
end
lMyInfo = nil
end
local lDevice = GetDevice(0)
if type(lDevice) == "table" and ExportScript.FoundDCSModule then
lDevice:update_arguments()
if ExportScript.Config.Debug then
ExportScript.Tools.ProcessArguments(lDevice, ExportScript.EveryFrameArguments) -- Module arguments as appropriate
else
ExportScript.coProcessArguments_EveryFrame = coroutine.create(ExportScript.Tools.ProcessArguments)
coStatus = coroutine.resume( ExportScript.coProcessArguments_EveryFrame, lDevice, ExportScript.EveryFrameArguments)
end
if ExportScript.Config.IkarusExport then
if ExportScript.Config.Debug then
ExportScript.ProcessIkarusDCSHighImportance(lDevice) -- Module, as appropriate; determined in ExportScript.Tools.SelectModule()
else
ExportScript.coProcessIkarusDCSHighImportance = coroutine.create(ExportScript.ProcessIkarusDCSHighImportance)
coStatus = coroutine.resume( ExportScript.coProcessIkarusDCSHighImportance, lDevice)
end
end
if ExportScript.Config.DACExport then
if ExportScript.Config.Debug then
ExportScript.ProcessDACHighImportance(lDevice) -- Module, as appropriate; determined in ExportScript.Tools.SelectModule()
else
ExportScript.coProcessDACHighImportance = coroutine.create(ExportScript.ProcessDACHighImportance)
coStatus = coroutine.resume( ExportScript.coProcessDACHighImportance, lDevice)
end
end
if ExportScript.FirstNewDataSend and ExportScript.FirstNewDataSendCount == 0 then
if ExportScript.Config.DACExport then
ExportScript.Tools.ResetChangeValuesDAC()
end
if ExportScript.Config.IkarusExport then
ExportScript.Tools.ResetChangeValues()
end
ExportScript.FirstNewDataSend = false
else
ExportScript.FirstNewDataSendCount = ExportScript.FirstNewDataSendCount - 1
end
if ExportScript.TickCount >= ExportScript.Config.ExportLowTickInterval then
if ExportScript.Config.Debug then
ExportScript.Tools.ProcessArguments(lDevice, ExportScript.Arguments) -- Module arguments as appropriate
else
ExportScript.coProcessArguments_Arguments = coroutine.create(ExportScript.Tools.ProcessArguments)
coStatus = coroutine.resume( ExportScript.coProcessArguments_Arguments, lDevice, ExportScript.Arguments)
end
if ExportScript.Config.IkarusExport then
if ExportScript.Config.Debug then
ExportScript.ProcessIkarusDCSLowImportance(lDevice) -- Module as appropriate; determined in ExportScript.Tools.SelectModule()
else
ExportScript.coProcessIkarusDCSLowImportance = coroutine.create(ExportScript.ProcessIkarusDCSLowImportance)
coStatus = coroutine.resume( ExportScript.coProcessIkarusDCSLowImportance, lDevice)
end
end
if ExportScript.Config.DACExport then
if ExportScript.Config.Debug then
ExportScript.ProcessDACLowImportance(lDevice) -- Module, as appropriate; determined in ExportScript.Tools.SelectModule()
else
ExportScript.coProcessDACLowImportance = coroutine.create(ExportScript.ProcessDACLowImportance)
coStatus = coroutine.resume( ExportScript.coProcessDACLowImportance, lDevice)
end
ExportScript.TickCountDAC = ExportScript.TickCountDAC + 1
end
ExportScript.TickCount = 0
end
if ExportScript.Config.IkarusExport then
ExportScript.Tools.FlushData()
end
if ExportScript.Config.DACExport then
for i=1, #ExportScript.Config.DAC, 1 do
ExportScript.Tools.FlushDataDAC(i)
end
end
elseif ExportScript.FoundFCModule then -- Assume FC Aircraft
ExportScript.AF.EventNumber = os.clock() --tonumber(tostring(os.clock()):gsub(".", ""))
if ExportScript.Config.IkarusExport then
if ExportScript.Config.Debug then
ExportScript.ProcessIkarusFCHighImportance()
else
ExportScript.coProcessGlassCockpitFCHighImportance = coroutine.create(ExportScript.ProcessIkarusFCHighImportance)
coStatus = coroutine.resume( ExportScript.coProcessGlassCockpitFCHighImportance)
end
end
if ExportScript.Config.DACExport then
if ExportScript.Config.Debug then
ExportScript.ProcessDACHighImportance(lDevice)
else
ExportScript.coProcessDACHighImportance = coroutine.create(ExportScript.ProcessDACHighImportance)
coStatus = coroutine.resume( ExportScript.coProcessDACHighImportance, lDevice)
end
end
if ExportScript.FirstNewDataSend and ExportScript.FirstNewDataSendCount == 0 then
if ExportScript.Config.DACExport then
ExportScript.Tools.ResetChangeValuesDAC()
end
if ExportScript.Config.IkarusExport then
ExportScript.Tools.ResetChangeValues()
end
ExportScript.FirstNewDataSend = false
else
ExportScript.FirstNewDataSendCount = ExportScript.FirstNewDataSendCount - 1
end
if ExportScript.TickCount >= ExportScript.Config.ExportLowTickInterval then
if ExportScript.Config.IkarusExport then
if ExportScript.Config.Debug then
ExportScript.ProcessIkarusFCLowImportance()
else
ExportScript.coProcessIkarusFCLowImportance = coroutine.create(ExportScript.ProcessIkarusFCLowImportance)
coStatus = coroutine.resume( ExportScript.coProcessIkarusFCLowImportance)
end
end
if ExportScript.Config.DACExport then
if ExportScript.Config.Debug then
ExportScript.ProcessDACLowImportance(lDevice)
else
ExportScript.coProcessDACLowImportance = coroutine.create(ExportScript.ProcessDACLowImportance)
coStatus = coroutine.resume( ExportScript.coProcessDACLowImportance, lDevice)
end
ExportScript.TickCountDAC = ExportScript.TickCountDAC + 1
end
ExportScript.TickCount = 0
end
if ExportScript.Config.IkarusExport then
ExportScript.Tools.FlushData()
end
if ExportScript.Config.DACExport then
for i=1, #ExportScript.Config.DAC, 1 do
ExportScript.Tools.FlushDataDAC(i)
end
end
else -- No Module found
if ExportScript.FoundNoModul then
ExportScript.Tools.WriteToLog("No Module Found.")
ExportScript.Tools.SelectModule() -- point globals to Module functions and data.
end
end
return t
end

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,314 @@
-- Bf-109K-4 Kurfürst
-- Version 1.0.0 BETA
ExportScript.FoundDCSModule = true
ExportScript.ConfigEveryFrameArguments =
{
[1] = "%.4f", -- MW50 pressure {0.0, 3.0}kg/cm2 = {0.0, 1.0}
[2] = "%.4f", -- Airspeed Gauge {0, 100, 150, 200, 700, 750, 900, 1000} = {0.0, 0.1, 0.15, 0.2, 0.7, 0.75, 0.9, 1.0}
-- Artificial horizon Fl_22415
[3] = "%.4f", -- turn indicator {-1.0, 1.0}
[4] = "%.4f", -- Bank {1.0, -1.0}
[5] = "%.4f", -- Pitch {1.0, -1.0}
[6] = "%.4f", -- Slipball {-1.0, 1.0}
[7] = "%.4f", -- Caged {0.0, 1.0}
--Altitude Gauge
[8] = "%.4f", -- Altimeter_FinePtr {0.0, 1000.0} = {0.0, 1.0}
[9] = "%.4f", -- Altimeter_CoarsePtr {0.0, 13000.0} = {0.0, 1.0}
[10] = "%.4f", -- Altimeter_Pressure {712.56, 780.07} = {0.0, 1.0}
[11] = "%.4f", -- Pressure_Setter_Pinion {0.0, 1440.0} = {0.0, 1.0}
-- AN5730 remote compass
[13] = "%.4f", -- CompassHeading {0.0, 1.0}
[12] = "%.4f", -- CommandedCourse {0.0, 1.0}
-- AFN2 blind landing system
[14] = "%.4f", -- AFN2_Horizontal_Needle {-1.0, 1.0}
[15] = "%.4f", -- AFN2_Vertical_Needle {0.0, 1.0}
[16] = "%f", -- AFN2_Signal_Lamp {0.0, 1.0}
--Dual-Range Pressure Gauge
[25] = "%.4f", -- Fuel_Pressure {0.0, 2.0} -- kg/cm2 = {0.0, 1.0}
[26] = "%.4f", -- Oil_Pressure {0.0, 10.0} = {0, 1.0}
[27] = "%.4f", -- Coolant_Temperature {-1, 0, 130} = {-1, 0, 1}
[28] = "%.4f", -- Oil_Temperature {-1, 0, 130} = {-1, 0, 1}
[29] = "%.4f", -- Engine_RPM {400.0, 3600.0} = {0.0, 1.0}
-- propeller pitch indicator, changed 1hour every 6degrees of pitch change
[30] = "%.4f", -- Propeller_Pitch_Hour {0.0, 12.0} = {0.0, 1.0}
[31] = "%.4f", -- Propeller_Pitch_Minute {0.0, 60.0} = {0.0, 1.0}
-- Manifold_Pressure
[32] = "%.4f", -- Manifold_Pressure {0.6, 1.8} = {0.0, 1.0}
--fuel system
[33] = "%.4f", -- Fuel_Tank_Fuselage {-1.0, 0.0, 100.0, 150.0, 200.0, 250.0, 300.0, 350.0, 400.0} -- Liters = {-1.0, 0.0, 0.07, 0.175, 0.31, 0.52, 0.73, 0.88, 1.0}
--oxygen pressure indicator
[34] = "%.4f", -- Oxygen_Pressure {0.0, 250.0} = {0.0, 1.0}
--[35] = "%.1f", -- Oxygen_Flow_Blinker {0.0, 1.0}
-- Variometer
[36] = "%.2f", -- Variometer {-30, -10, -5, 0, 5, 10, 30} = {-0.3, -0.1, -0.05, 0.0, 0.05, 0.1, 0.3}
--Weapon gauges
[40] = "%.4f", -- MG131_0_Shell_Counter {0.0, 500.0} = {0.0, 1.0}
[41] = "%.4f", -- MG131_1_Shell_Counter {0.0, 500.0} = {0.0, 1.0}
--[42] = "%.4f", -- MG131_0_Klappanker {0.0, 60.0} = {0.0, 1.0}
--[43] = "%.4f", -- MG131_1_Klappanker {0.0, 60.0} = {0.0, 1.0}
[44] = "%.f", -- LeftWing_MG151_Control_Lamp {0.0, 1.0}
[45] = "%.f", -- RightWing_MG151_Control_Lamp {0.0, 1.0}
--REVI_16B_Gunsight
[46] = "%4.f", -- BodyState {0.0, 0.15,0.25, 1.0} = {0.0, 0.15,0.25, 1.0}
[47] = "%4.f", -- SmokedScreen {0.0, 1.0}
[48] = "%4.f", -- SightBrightness {0.0, 1.0}
-- Landing Gear Light
[56] = "%.f", -- LandingGearRedLight {0.0, 1.0}
[57] = "%.f", -- LandingGearGreenLightLeft {0.0, 1.0}
[58] = "%.f", -- LandingGearGreenLightRight {0.0, 1.0}
-- Fuel_Reserve_Lamp
[135] = "%.f" -- Fuel_Reserve_Lamp {0.0, 29.0} = {0.0, 1.0}
}
ExportScript.ConfigArguments =
{
-- FuseBox Controls - Electrical Switches
-- RH Fuse Box Circuit Breakers
-- Left Row
-- A 100 - Generator Cut-Off Relay
[114] = "%1d", -- Generator On {0, 1}
[151] = "%1d", -- Generator OFF {0, 1}
-- D 100 - Heating CB
[115] = "%1d", -- Pitot/Windscreen Heating On {0, 1}
[152] = "%1d", -- Pitot/Windscreen Heating OFF {0, 1}
-- C 100 - Navigation Lights CB
[116] = "%1d", -- Nav. Lights On {0, 1}
[153] = "%1d", -- Nav. Lights OFF {0, 1}
-- C 101 - Instrument Panel Illumination CB {0, 1}
[117] = "%1d", -- UV Lights On {0, 1}
[154] = "%1d", -- UV Lights Off {0, 1}
-- V 101 - Drop Ordnance & Optional Armament CB
[118] = "%1d", -- Wing / Drop Ordnance On {0, 1}
[155] = "%1d", -- Wing / Drop Ordnance Off {0, 1}
-- V 100 - Systematic & Ignition CB
[119] = "%1d", -- Ignition On {0, 1}
[156] = "%1d", -- Ignition Off {0, 1}
-- Spotlights CB - TODO implement when landing lights rustsatz is available
--[] = "%1d", -- Spotlights On {0, 1}
--[] = "%1d", -- Spotlights Off {0, 1}
-- Right Row
-- A 101 - Battery Cut-Off Relay
[120] = "%1d", -- Battery On {0, 1}
[157] = "%1d", -- Battery Off {0, 1}
-- F 135 - Radio CB - Labelled "FuG 16"
[121] = "%1d", -- Radio On {0, 1}
[158] = "%1d", -- Radio Off {0, 1}
-- F 211 - IFF CB - Labelled "FuG 25a"
[122] = "%1d", -- IFF On {0, 1}
[159] = "%1d", -- IFF Off {0, 1}
-- E 101 - Fuel Pump CB - Labelled "Tankpumpe"
[123] = "%1d", -- Fuel Pump On {0, 1}
[160] = "%1d", -- Fuel Pump Off {0, 1}
-- Ignition Controls and Starter and Motor-Related Switches
-- Magneto Selector
[59] = "%.1f", -- Magnetos (Off, M1, M2, M1+M2) {0.0, 0.1, 0.2, 0.3}
-- Starter Handle Cover
[51] = "%.1d", -- Starter Handle Cover {0, 1}
-- Starter Turn Handle
[52] = "%.1d", -- Starter {0, 1}
-- WM-Kommandgerat Toggle
[62] = "%.1d", -- Governor Automation {0, 1}
-- Dashboard and Secondary Switches
-- A 104 - Kill Switch
[49] = "%.1d", -- Kill Switch {0, 1}
-- Button T - Gun Camera Trigger
[149] = "%.1d", -- Button T {0, 1}
-- SZKK3 Weapons Control Master Switch
[37] = "%.1d", -- Weapons Master {0, 1}
-- LH SZ 500 Ammo Counter
[38] = "%.1f", -- Left Ammo Counter Setter Pinion (axis) {0.0 - 0.0}
-- RH SZ 500 Ammo Counter
[39] = "%.1f", -- Right Ammo Counter Setter Pinion (axis) {0.0 - 0.0}
-- MW50 Operational Toggle
[60] = "%.1d", -- MW50 Boost {0, 1}
-- Wing Cannons Toggle
[61] = "%.1d", -- Wing Cannons {0, 1}
-- MK 108 / Wing Guns Toggle
[62] = "%.1d", -- MK 108 / R 21 {0, 1}
-- R 101 ZSK 244 A Bomb Panel Master Switch
-- Operated internally via ZSK 244 A Mode Control
-- R 101 ZSK 244 A Mode Selector
[64] = "%.1f", -- Bomb Fusing Selector (DIVE (INSTANT), DIVE (DELAYED), OFF, LEVEL (DELAYED), LEVEL (INSTANT)) {0.0, 0.25, 0.5, 0.75, 1.0}
-- Illumination Controls
-- C 102 LH UV Lamp Rheostat
[80] = "%.1f", -- Left UV Lamp Brightness (axis) {0.0 - 0.5}
-- C 103 RH UV Lamp Rheostat
[82] = "%.1f", -- Right UV Lamp Brightness (axis) {0.0 - 0.5}
-- Oxygen Apparatus Controls
-- Apparatus Connecting Valve
[127] = "%.1d", -- Oxygen Operating Valve {0, 1}
[126] = "%.1d", -- Oxygen Emergency By-Pass {0, 1}
-- Main Panel Controls
-- Undercarriage Controls
-- U/C Plungers Cover
[53] = "%.1d", -- Undercarriage Controls Cover {0, 1}
[54] = "%.1d", -- Undercarriage Raise {1.0, 1.0}
[55] = "%.1d", -- Undercarriage Lower {1.0, 1.0}
[63] = "%.1d", -- Undercarriage Emergency Release
-- Fuel and MW50 Systems Controls
-- Fuel Primer Hand Pump
[140] = "%.1d", -- Fuel Priming Pump {0, 1}
-- Schnellstop Lever
[88] = "%.1d", -- Engine Stop {0, 1}
-- Booster Pumps Lever
[87] = "%.1f", -- Booster Pumps (Off, P1, P2, P1+P2) {0.0, 0.1, 0.2, 0.3}
-- Stoff-Kraftstoff Ventilbatterie Lever
[96] = "%.1d", -- MW / Fuel {0, 1}
-- Fuel Jettison Knob
[112] = "%.1d", -- "Fuel / MW Jettison {0, 1}
-- Coolant System Controls
-- Radiator Mode Lever {0, 1}
[113] = "%.1f", -- Radiators Mode (Drive Off, Open, Automatic, Close) {0.0, 0.1, 0.2, 0.3}
-- LH Radiator Hose Cut-Off Pull Handle
[90] = "%.1d", -- LH Radiator Cut-Off {0, 1}
-- RH Radiator Hose Cut-Off Pull Handle
[91] = "%.1d", -- RH Radiator Cut-Off {0, 1}
-- Navigation Instruments
-- Altimeter
[11] = "%.2f", -- Altimeter Pressure Set (axis) 1.0 in 0.04 steps
-- Artificial Horizon
[7] = "%.2f", -- Horizon Cage (axis) {0.0, 0.511} in 0.04 steps
-- Repeater Compass
[12] = "%.2f", -- Course Set (axis) 0.0 in 0.04 steps
-- Instruments
-- Clock Scale
[21] = "%.8f", -- Scale Set (axis) 0.0 in 0.01612434 steps
-- Clock Setter Pinion
[22] = "%.1f", -- Adjusting Knob (axis) 0.0 in 0.1 steps
-- Clock Freeze Lever
[23] = "%.1d", -- Time Setting Lever {0, 1}
-- Clock Stopwatch Button
[24] = "%.1d", -- Start/Stop/Reset Chronometer
-- P 112 Gun Sight Brightness Rheostat {0, 1}
[48] = "%.1f", -- Gun Sight Brightness (axis) 0.5 in 0.1 steps
-- P 112 Gun Sight Folding Controls
[139] = "%.1d", -- Gunsight Fold {0, 1}
-- P 112 Gun Sight Smoked Screen Controls
[47] = "%.1d", -- Gunsight Smoked Screen {0, 1}
-- Radio Controls
-- FUG16
[128] = "%.1f", -- FuG16ZY Preset Selector (1, 2, TR, SQ) {0.0, 0.1, 0.2, 0.3}
[129] = "%.2f", -- FuG16 ZY Fine Tune (axis) 0.5 in 0.05 steps
[130] = "%.2f", -- FuG16 ZY Volume (axis) 0.0 in 0.04 steps
[131] = "%.1d", -- "Mic. On/Off {0, 1}
-- FUG25
[132] = "%.1f", -- FuG25 Mode Selector (1, 2) {0.0, 1.0}
[133] = "%.1d", -- FuG25 Test {0, 1}
-- Left Wall Controls
-- Tail Wheel Lock Handle
[97] = "%.1d", -- Tail Wheel Lock {0, 1}
-- Cockpit Open/Close Control
[136] = "%.1d", -- Canopy (Open/Close) {0, 1}
[137] = "%.1d", -- Canopy (Open/Close) H {0, 1}
[138] = "%.1d", -- Canopy (Open/Close) S {0, 1}
-- Cockpit Jettison Pull Handle
[83] = "%.1d", -- Jettison Canopy {0, 1}
-- Trim Wheel
[141] = "%.1d", -- Stabilizer Trim Nose Up {0, 1}
[142] = "%.1d", -- Stabilizer Trim Nose Down {0, 1}
-- Flaps Wheel
[143] = "%.1d", -- Extend Flaps {0, 1}
[144] = "%.1d", -- Retract Flaps {0, 1}
-- Notwurf / Ordinance Dump
[92] = "%.1d", -- Ordinance Emergency Release
--[98] = "$.1d", -- Cockpit Left Vent {0, 1}
-- Right Wall Controls
-- RH Cockpit Vent
--[99] = "%.1d", -- Cockpit Right Vent {0, 1}
-- Flare Gun Trigger
[72] = "%.1d", -- Fire Flare Gun
-- Engine Controls & Quadrant
-- Propellor Control Rocker
[85] = "%.1f", -- Decrease RPM {1.0, -1.0}
-- Radio Transmit Button
[150] = "%.1d", -- Microphone On {0, 1}
-- E 103 Propellor Automation Switch
[89] = "%.1d", -- Governor Automation {0, 1}
-- Cold Weather Start Valve Handle
[86] = "%.1d" -- Cold Weather Start {0, 1}
}
-----------------------------
-- HIGH IMPORTANCE EXPORTS --
-- done every export event --
-----------------------------
-- Pointed to by ProcessIkarusDCSHighImportance
function ExportScript.ProcessIkarusDCSConfigHighImportance(mainPanelDevice)
ExportScript.Tools.SendData(35, string.format("%0.4f", mainPanelDevice:get_argument_value(35))) -- Oxygen_Flow_Blinker
ExportScript.Tools.SendData(42, string.format("%0.4f", mainPanelDevice:get_argument_value(42))) -- MG131_0_Klappanker
ExportScript.Tools.SendData(43, string.format("%0.4f", mainPanelDevice:get_argument_value(43))) -- MG131_1_Klappanker
end
function ExportScript.ProcessDACConfigHighImportance(mainPanelDevice)
-- Hier kommen alle Daten rein die ueber die Hardware in schneller folge ausgeben werden soll
-- In der Regel sind das die Statusanzeigen
-- ExportScript.Tools.SendDataDAC(), ist die Funktion zur Ausgabe der Werte an die Hardware
-- "178" ist die ID des Wertes die in der entsprechenden XML Datei festgelegt wird, sollte der DCS ID entsprechen
-- mainPanelDevice:get_argument_value() ist eine Funktion die die Werte der übergeben DCS ID aus dem Spiel ausliest
-- 178 ist die DCS ID von dem man die Werte haben will
-- Description
--ExportScript.Tools.SendDataDAC("178", mainPanelDevice:get_argument_value(178)) -- L_AILERON_EMER_DISENGAGE
--ExportScript.Tools.SendDataDAC("", mainPanelDevice:get_argument_value()) --
end
-----------------------------------------------------
-- LOW IMPORTANCE EXPORTS --
-- done every gExportLowTickInterval export events --
-----------------------------------------------------
-- Pointed to by ExportScript.ProcessIkarusDCSConfigLowImportance
function ExportScript.ProcessIkarusDCSConfigLowImportance(mainPanelDevice)
end
function ExportScript.ProcessDACConfigLowImportance(mainPanelDevice)
--[[
every frame export to hardware
Example from A-10C
Get Radio Frequencies
get data from device
local UHF_RADIO = GetDevice(54)
ExportScript.Tools.SendDataDAC("ExportID", "Format")
ExportScript.Tools.SendDataDAC("ExportID", "Format", HardwareConfigID)
ExportScript.Tools.SendDataDAC("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000))
ExportScript.Tools.SendDataDAC("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000), 2) -- export to Hardware '2' Config
]]
local lRADIO = GetDevice(14)
ExportScript.Tools.SendDataDAC("2000", string.format("%7.3f", lRADIO:get_frequency()/1000000))
-- Lamps
ExportScript.Tools.SendDataDAC("35", mainPanelDevice:get_argument_value(35) > 0.8 and 1 or 0) -- Oxygen_Flow_Blinker
ExportScript.Tools.SendDataDAC("42", mainPanelDevice:get_argument_value(42) > 0.8 and 1 or 0) -- MG131_0_Klappanker
ExportScript.Tools.SendDataDAC("43", mainPanelDevice:get_argument_value(43) > 0.8 and 1 or 0) -- MG131_1_Klappanker
--=====================================================================================
--[[
ExportScript.Tools.WriteToLog('list_cockpit_params(): '..ExportScript.Tools.dump(list_cockpit_params()))
ExportScript.Tools.WriteToLog('CMSP: '..ExportScript.Tools.dump(list_indication(7)))
local ltmp1 = 0
for ltmp2 = 0, 13, 1 do
ltmp1 = list_indication(ltmp2)
ExportScript.Tools.WriteToLog(ltmp2..': '..ExportScript.Tools.dump(ltmp1))
--ExportScript.Tools.WriteToLog(ltmp2..' (metatable): '..ExportScript.Tools.dump(getmetatable(ltmp1)))
end
]]
--[[
local ltmp1 = 0
for ltmp2 = 1, 16, 1 do
ltmp1 = GetDevice(ltmp2)
ExportScript.Tools.WriteToLog(ltmp2..': '..ExportScript.Tools.dump(ltmp1))
ExportScript.Tools.WriteToLog(ltmp2..' (metatable): '..ExportScript.Tools.dump(getmetatable(ltmp1)))
end
]]
end
-----------------------------
-- Custom functions --
-----------------------------
function ExportScript.genericRadio(key, value, hardware)
end

View File

@@ -0,0 +1,117 @@
-- modul name
-- Version
ExportScript.FoundDCSModule = true
ExportScript.ConfigEveryFrameArguments =
{
--[[
every frames arguments
based of "mainpanel_init.lua"
Example (http://www.lua.org/manual/5.1/manual.html#pdf-string.format)
[DeviceID] = "Format"
[4] = "%.4f", <- floating-point number with 4 digits after point
[19] = "%0.1f", <- floating-point number with 1 digit after point
[129] = "%1d", <- decimal number
[5] = "%.f", <- floating point number rounded to a decimal number
]]
}
ExportScript.ConfigArguments =
{
--[[
arguments for export in low tick interval
based on "clickabledata.lua"
]]
}
-----------------------------
-- HIGH IMPORTANCE EXPORTS --
-- done every export event --
-----------------------------
-- Pointed to by ProcessIkarusDCSHighImportance
function ExportScript.ProcessIkarusDCSConfigHighImportance(mainPanelDevice)
--[[
every frame export to Ikarus
Example from A-10C
Get Radio Frequencies
get data from device
local lUHFRadio = GetDevice(54)
ExportScript.Tools.SendData("ExportID", "Format")
ExportScript.Tools.SendData(2000, string.format("%7.3f", lUHFRadio:get_frequency()/1000000)) <- special function for get frequency data
]]
end
function ExportScript.ProcessDACConfigHighImportance(mainPanelDevice)
--[[
every frame export to DAC
Example from A-10C
Get Radio Frequencies
get data from device
local UHF_RADIO = GetDevice(54)
ExportScript.Tools.SendDataDAC("ExportID", "Format")
ExportScript.Tools.SendDataDAC("ExportID", "Format", HardwareConfigID)
ExportScript.Tools.SendDataDAC("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000))
ExportScript.Tools.SendDataDAC("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000), 2) -- export to Hardware '2' Config
]]
end
-----------------------------------------------------
-- LOW IMPORTANCE EXPORTS --
-- done every gExportLowTickInterval export events --
-----------------------------------------------------
-- Pointed to by ExportScript.ProcessIkarusDCSConfigLowImportance
function ExportScript.ProcessIkarusDCSConfigLowImportance(mainPanelDevice)
--[[
export in low tick interval to Ikarus
Example from A-10C
Get Radio Frequencies
get data from device
local lUHFRadio = GetDevice(54)
ExportScript.Tools.SendData("ExportID", "Format")
ExportScript.Tools.SendData(2000, string.format("%7.3f", lUHFRadio:get_frequency()/1000000)) <- special function for get frequency data
]]
end
function ExportScript.ProcessDACConfigLowImportance(mainPanelDevice)
--[[
export in low tick interval to DAC
Example from A-10C
Get Radio Frequencies
get data from device
local UHF_RADIO = GetDevice(54)
ExportScript.Tools.SendDataDAC("ExportID", "Format")
ExportScript.Tools.SendDataDAC("ExportID", "Format", HardwareConfigID)
ExportScript.Tools.SendDataDAC("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000))
ExportScript.Tools.SendDataDAC("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000), 2) -- export to Hardware '2' Config
]]
--=====================================================================================
--[[
ExportScript.Tools.WriteToLog('list_cockpit_params(): '..ExportScript.Tools.dump(list_cockpit_params()))
ExportScript.Tools.WriteToLog('CMSP: '..ExportScript.Tools.dump(list_indication(7)))
local ltmp1 = 0
for ltmp2 = 0, 13, 1 do
ltmp1 = list_indication(ltmp2)
ExportScript.Tools.WriteToLog(ltmp2..': '..ExportScript.Tools.dump(ltmp1))
--ExportScript.Tools.WriteToLog(ltmp2..' (metatable): '..ExportScript.Tools.dump(getmetatable(ltmp1)))
end
]]
--[[
local ltmp1 = 0
for ltmp2 = 1, 73, 1 do
ltmp1 = GetDevice(ltmp2)
ExportScript.Tools.WriteToLog(ltmp2..': '..ExportScript.Tools.dump(ltmp1))
ExportScript.Tools.WriteToLog(ltmp2..' (metatable): '..ExportScript.Tools.dump(getmetatable(ltmp1)))
end
]]
end
-----------------------------
-- Custom functions --
-----------------------------
function ExportScript.genericRadio(key, value, hardware)
end

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,384 @@
-- F-86 Export
-- Version 1.0.0 BETA
ExportScript.FoundDCSModule = true
ExportScript.ConfigEveryFrameArguments =
{
--[[
every frames arguments
based of "mainpanel_init.lua"
Example (http://www.lua.org/manual/5.1/manual.html#pdf-string.format)
[DeviceID] = "Format"
[4] = "%.4f", <- floating-point number with 4 digits after point
[19] = "%0.1f", <- floating-point number with 1 digit after point
[129] = "%1d", <- decimal number
[5] = "%.f", <- floating point number rounded to a decimal number
]]
-- Mechanic clock
[19] = "%.4f", -- CLOCK_currtime_hours {0.0, 12.0} = {0.0, 1.0}
[18] = "%.4f", -- CLOCK_currtime_minutes {0.0, 60.0} = {0.0, 1.0}
--[37] = "%.4f", -- CLOCK_currtime_seconds {0.0, 60.0} = {0.0, 1.0}
--[56] = "%.4f", -- CLOCK_flight_time_meter_status {0.0, 0.2} = {0.0, 1.0}
--[52] = "%.4f", -- CLOCK_flight_hours {0.0, 12.0} = {0.0, 1.0}
--[53] = "%.4f", -- CLOCK_flight_minutes {0.0, 60.0} = {0.0, 1.0}
[37] = "%.4f", -- CLOCK_seconds_meter_time_minutes {0.0, 60.0} = {0.0, 1.0}
[1006] = "%.4f", -- CLOCK_seconds_meter_time_seconds {0.0, 60.0} = {0.0, 1.0}
-- flight gauge
-- Airspeeed
[178] = "%.4f", -- Airspeeed {0.0, 25.7, 180.06, 334.4} = {0.0, 0.019, 0.494, 0.965}
[709] = "%.4f", -- AirspeeedDrum {0.0, 51.4444444} = {0.0, 1.0}
[8] = "%.4f", -- AirspeeedM1 {0.0, 25.7, 51.444, 308.67, 334.4} = {0.0, 0.02, 0.1, 0.6, 0.697}
-- Altimeter
[707] = "%.4f", -- Altimeter10000 {0 ,30480} = {0 ,1}
[523] = "%.4f", -- Altimeter1000 {0 ,3048} = {0 ,1}
[524] = "%.4f", -- Altimeter100 {0 ,304.8} = {0 ,1}
[700] = "%.4f", -- AltimeterHG {0 , 91.44} = {0 ,1}
-- Variometer
[24] = "%.4f", -- Variometer {-30.48, -10.16, -5.08, 0.0, 5.08, 10.16, 30.48} = {-1.0, -0.5, -0.29, 0.0, 0.29, 0.5, 1.0}
-- MachNumber
[179] = "%.4f", -- MachNumber {0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5} = {0.0515, 0.0855, 0.122, 0.161, 0.203, 0.248, 0.295, 0.342, 0.3915, 0.441, 0.493, 0.597, 0.699, 0.796, 0.883, 0.965}
-- TurnIndicator
[25] = "%.4f", -- TurnIndicator {-1.0, 1.0}
-- SlipIndicator
[31] = "%.4f", -- SlipIndicator {-1.0, 1.0}
-- Accelerometer
[6] = "%.4f", -- Accelerometer {-5, 0, 10} = {-0.5, 0, 1.0}
[1003] = "%.4f", -- AccelerometerMin {-5.0, 0.0} = {-0.5, 0.0}
[1002] = "%.4f", -- AccelerometerMax {0.0, 10} = {0.0, 1.0}
-- GyroCompass
[711] = "%.4f", -- GyroCompassNeedle {1.0, 0.0}
[712] = "%.4f", -- GyroCompassScale {0.0, 1.0}
-- AttitudeIndicator
[713] = "%.4f", -- AttitudeIndicatorOffFlag {0.0, 1.0} = {1.0, 0.0}
[605] = "%.4f", -- AttitudeIndicatorPitch {-0.27, 0.27}
[606] = "%.4f", -- AttitudeIndicatorBank {1.0, -1.0}
[81] = "%.4f", -- AttitudeIndicatorPitchSphere {-1.0, 1.0}
[1005] = "%.4f", -- AttitudeIndicatorBankNeedle {1.0, -1.0}
-- engine gauges
-- Tachometer
[16] = "%.4f", -- Tachometer {0.0, 0.5, 0.504, 1.1} = {0.012, 0.482, 0.5, 1.0}
-- ExhaustTemperature
[12] = "%.4f", -- ExhaustTemperature {0.0, 1000.0} = {0.0, 1.0}
-- OilPressure
[112] = "%.4f", -- OilPressure {0.0, 100.0} = {0.023, 1.0}
-- FuelFlow
[531] = "%.4f", -- FuelFlow {0.0, 1.2599} = {0.0, 1.0}
-- electric system
[601] = "%.4f", -- VoltageDC {0.0, 30.0} = {0.0, 0.3}
[602] = "%.4f", -- Loadmeter {0.0, 400.0} = {0.0, 1.0}
-- hydraulic system
[109] = "%.4f", -- HydPress {0.0, 1.0} = {0.0, 1.0}
-- fuel system
[22] = "%.4f", -- FuelQuantity {-500.0, 0.0, 45.36, 226.8, 453.6, 907.2, 1360.8, 1451.5} = {-1.0, 0.0, 0.012, 0.141, 0.31, 0.625, 0.938, 1.0}
-- oxygen system
[353] = "%.4f", -- OxygenPressure {0.0, 500.0} = {0, 1}
[705] = "%.1f", -- OxygenFlowBlinker {0.0, 1.0}
-- air system
[114] = "%.4f", -- CockpitAltimeter {0.0, 15240.0} = {0.0, 1.0}
-- radio compass
[804] = "%.4f", -- ARN6_Band {0.0, 3.0} = {0.0, 1.0}
[800] = "%.4f", -- ARN6_TuningMeter {0.0, 1.0}
[801] = "%.4f", -- ARN6_Tuning {0.0, 0.2} = {0.0, 1.0}
[600] = "%.4f", -- ARN6_Bearing {0.0, 1.0}
[814] = "%.4f", -- ARN6_Scale {1.0, 0.0}
[830] = "%.4f", -- ARN6_FreqScale {0.0, 1.0}
-- light system
[182] = "%.f", -- IlluminationLights {0.0, 1.0}
[825] = "%.f", -- StandByCompassLight {0.0, 1.0}
[180] = "%.f", -- PrimaryInstLights {0.0, 1.0}
[185] = "%.f", -- AuxiliaryInstrumentLights {0.0, 1.0}
--
[603] = "%.4f", -- LABS_roll_needle {-1.0, 1.0}
[604] = "%.4f", -- LABS_pitch_needle {-1.0, 1.0}
-- LAMPS
-- electric system
[617] = "%.f", -- lamp_ELEC_GenOff {-1.0, 1.0}
[610] = "%.f", -- lamp_ELEC_MainInstInverterOffSelectAlt {-1.0, 1.0}
[611] = "%.f", -- lamp_ELEC_BothInstInvertersOff {-1.0, 1.0}
[612] = "%.f", -- lamp_ELEC_MainRadarInverterOff {-1.0, 1.0}
-- hydraulic system
[614] = "%.f", -- lamp_HYDRO_AltFltContSysOper {-1.0, 1.0}
[39] = "%.f", -- lamp_HYDRO_LeftGear {-1.0, 1.0}
[41] = "%.f", -- lamp_HYDRO_RightGear {-1.0, 1.0}
[40] = "%.f", -- lamp_HYDRO_NoseGear {-1.0, 1.0}
-- fuel system
[625] = "%.f", -- lamp_FUEL_OutbdTanksEmpty {-1.0, 1.0}
-- fire detection system
[615] = "%.f", -- lamp_FIRE_DETECTION_FwdFireWarning {-1.0, 1.0}
[616] = "%.f", -- lamp_FIRE_DETECTION_AftFireWarning {-1.0, 1.0}
-- control system
[613] = "%.f", -- lamp_CONTROL_TakeOffPosInd {-1.0, 1.0}
-- air system
[614] = "%.f" -- lamp_WindshieldAntiIceOverheatWarning {-1.0, 1.0}
}
ExportScript.ConfigArguments =
{
--[[
arguments for export in low tick interval
based on "clickabledata.lua"
]]
-- cockpit mechanics
[718] = "%.1f", -- Canopy Switch, OPEN/OFF/CLOSE {-1.0, 1.0}
[818] = "%.1f", -- Emergency Jettison Handle, IN/OUT {0.0, 1.0}
[817] = "%.1f", -- Canopy Alternate Emergency Jettison Handle, IN/OUT {0.0, 1.0}
[816] = "%.1f", -- Canopy Declutch Handle, IN/OUT {0.0, 1.0}
-- electric
[653] = "%1d", -- Battery-Starter Switch, BATTERY/OFF/STARTER {-1, 1}
[643] = "%.1f", -- Instrument Power Switch, ALTERNATE/NORMAL {-1.0, 1.0}
[664] = "%.1f", -- Stop-Starter Button (Push to de-energize starter in case of malfunction) {0.0, 1.0}
[652] = "%1d", -- Engine Master Switch, ON/OFF {1}
[670] = "%.1f", -- Generator Switch, ON/OFF/RESET {1}
[687] = "%1d", -- Generator Warning Light (Push To Test) {1}
[680] = "%1d", -- Main Instrument (Three-phase) Inverter Failure Warning Light (Push to test) {1}
[681] = "%1d", -- Both Instrument (Main and alternate three-phase) Inverter Failure Warning Light (Push to test) {1}
[682] = "%1d", -- Main Radar (Single-phase) Inverter Failure Warning Light (Push to test) {1}
-- Circuit Breaker (left panel)
[760] = "%1d", -- Bomb Rocket Tank Salvo {0, 1}
[761] = "%1d", -- Bomb Sel. {0, 1}
[762] = "%1d", -- Gyr'Syn Compass {0, 1}
[763] = "%1d", -- 3f Inverter {0, 1}
[764] = "%1d", -- Turn Bank Ind. {0, 1}
[765] = "%1d", -- Rudder Trim & Take-Off Ind. {0, 1}
[766] = "%1d", -- Alt Ail. Trim {0, 1}
[767] = "%1d", -- Ail & Horiz. Trim & Alt Horiz. Trim {0, 1}
[768] = "%1d", -- LDG Light Control {0, 1}
[769] = "%1d", -- LDG Lights {0, 1}
[770] = "%1d", -- Fire Warn. {0, 1}
[771] = "%1d", -- Bus Tie-In Control {0, 1}
[772] = "%1d", -- Speed Brake {0, 1}
[773] = "%1d", -- Free Air & Oil Temp & Air Sel. {0, 1}
[774] = "%1d", -- LDG Gear Warn. {0, 1}
[775] = "%1d", -- LDG Gear Control {0, 1}
[776] = "%1d", -- LDG Gear Pos Ind. {0, 1}
[777] = "%1d", -- Fuel Booster AFT {0, 1}
[778] = "%1d", -- Alt Emerg. Hyd. Cont. & Hyd. Press Ind. {0, 1}
[779] = "%1d", -- Sight Power {0, 1}
[780] = "%1d", -- Sight Heater {0, 1}
[781] = "%1d", -- Sight A.C. Power Unit {0, 1}
[782] = "%1d", -- AN/ARN-6 Radio Compass {0, 1}
-- Circuit Breaker (right panel)
[783] = "%1d", -- Eng. Master Fuel Shut-Off {0, 1}
[784] = "%1d", -- Eng. Ign. {0, 1}
[785] = "%1d", -- Fuel Level {0, 1}
[786] = "%1d", -- Inv Gen. Failure Overvolt LTS Test {0, 1}
[787] = "%1d", -- Light Post IndCode {0, 1}
[788] = "%1d", -- Console & Ped LTS {0, 1}
[789] = "%1d", -- Fuel Boost FWD {0, 1}
[790] = "%1d", -- Wing Flap LH. {0, 1}
[791] = "%1d", -- Wing Flap RH. {0, 1}
[792] = "%1d", -- Light Fluor {0, 1}
[793] = "%1d", -- Sight Control {0, 1}
[794] = "%1d", -- AN/APC 3 Radio {0, 1}
[795] = "%1d", -- AN/APX-6 Radio IFF {0, 1}
-- Hydraulic Interface
[599] = "%1d", -- Landing Gear Handle, UP/DOWN {1, 0}
[710] = "%1d", -- Landing Gear Emergency-up Button (Ground-use only! Hold in until gear retracts completely) {1}
[631] = "%1d", -- Hydraulic Pressure Gage and Selector Switch, UTILITY/NORMAL/ALTERNATE {1}
[641] = "%1d", -- Speed Brake Emergency Lever {1, 0}
[684] = "%1d", -- Alternate-on Warning Light (Push to test) {1}
[706] = "%1d", -- Alternate Hydraulic Emergency Override Handle, IN/OUT {1, -1}
[647] = "%1d", -- Flight Control Switch, ALTERNATE ON/NORMAL/RESET {1}
[815] = "%1d", -- Landing Gear Warning Horn Cutout Button (Push to silence horn) {1}
-- Fuel Interface
[672] = "%1d", -- Fuel Densitometer Selection Switch, IN/OUT {2, -2}
[662] = "%.1f", -- Drop Tank Selector Switch {-0.1, 0.1}
[701] = "%1d", -- Drop Tank Jettison Button - Push to release drop tank(s) {1}
[695] = "%1d", -- Outboard Drop Tank Empty Indicator Light (Push to test) {1}
-- Oxygen Interface
[703] = "%1d", -- Oxygen Regulator Diluter Lever, NORMAL OXYGEN/100% OXYGEN {1, -1}
[704] = "%.4f", -- Oxygen Regulator Supply Lever (rotary) {0.0 to 1.0} in -0.5 steps
-- Fire Detection Interface
[635] = "%1d", -- Engine Fire Warning Light Test Button {1,- 1}
[685] = "%1d", -- Forward Engine Compartment Fire-warning Light (Push to test) {1}
[686] = "%1d", -- Aft Engine Compartment Fire-warning Light (Push to test) {1}
-- Air Interface
[650] = "%1d", -- Cockpit Pressure Control Switch, PRESS/RAM {2, -2}
[651] = "%1d", -- Cockpit Pressure Schedule Selector Switch, 5 PSI/2.75 PSI {2, -2}
[646] = "%1d", -- Pitot Heater Switch, ON/OFF {2, -2}
[740] = "%.4f", -- Cockpit Air Temperature Control Rheostat (rotary) {0.0, 1.0} in 0.3 steps
--[736] = "%1d", -- Cockpit Air Temperature Control Switch Cover {1, -1}
[737] = "%.1f", -- Cockpit Air Temperature Control Switch, AUTO/OFF/HOT/COLD {-1.0, 1.0}
[645] = "%.1f", -- Engine Anti-Ice & Screen Switch, EXTEND/RET./ANTI-ICE {-1.0, 1.0}
[741] = "%1d", -- Air Outlet Selector Lever, FLOOR/BOTH/DEFROST {-1, 1}
[691] = "%1d", -- Windshield Anti-Ice Overheat Warning Light
-- Light Interface
[654] = "%1d", -- Compass Light Switch, ON/OFF {2, -2}
[813] = "%.1f", -- Instrument Panel Primary Light Rheostat (rotary) {0.0, 1.0} in 0.5 steps
[811] = "%.1f", -- Instrument Panel Auxiliary Light Rheostat (rotary) {0.0, 1.0} in 0.5 steps
[812] = "%.1f", -- Console and Panel Light Rheostat (rotary) {0.0, 1.0} in 0.5 steps
-- Nav Lights Interface
[661] = "%.1f", -- Landing & Taxi Lights Switch, EXTEND&ON/OFF/RETRACT {-1.0, 0.0, 1.0}
[656] = "%.1f", -- Position and Fuselage Light Selector Switch, STEADY/OFF/FLASH {-1.0, 0.0, 1.0}
[655] = "%1d", -- Exterior Lighting Dimmer Switch, BRIGHT/DIM {2, -2}
-- Engine Interface
[630] = "%1d", -- Emergency Fuel Switch, ON/OFF {2, -2}
--[732] = "%1d", -- Emergency (In-air) Ignition Switch Cover {1, -1}
[733] = "%.1f", -- Emergency (In-air) Ignition Switch, ON/OFF {1.0, 1.0}
-- Control Interface
[649] = "%.1f", -- Lateral Alternate Trim Switch, NORMAL/OFF/LEFT/RIGHT {-0.1, 0.1}
[648] = "%.1f", -- Rudder Trim Switch, LEFT/OFF/RIGHT {1.0, -1.0}
--[738] = "%1d", -- Longitudinal Alternate Trim Switch Cover {1, -1}
[739] = "%.1f", -- Longitudinal Alternate Trim Switch, NORMAL GRIP CONT/OFF/NOSE UP/NOSE DOWN {-0.1, 0.0, 0.1}
[683] = "%1d", -- Take-off (Trim) Position Indicator Light (Push to test) {1}
[735] = "%1d", -- Wing Flaps Handle {-1, 1}
-- radio ARC-27
[806] = "%.4f", -- AN/ARC-27 UHF Audio Volume Knob (rotary) {0.1, 0.9} in 0.5 steps
[807] = "%.1f", -- AN/ARC-27 UHF Preset Channel Selector {0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8}
[805] = "%.1f", -- AN/ARC-27 UHF Power Switch, OFF/T/R/T/R + G REC/ADF {0.0, 0.1, 0.2, 0.3}
-- radio compass ARN-6
[802] = "%.4f", -- AN/ARN-6 Audio Volume Control (rotary) {0.1, 0.9} in 0.5 steps
[803] = "%.1f", -- AN/ARN-6 Frequency Band Switch {0.0, 0.1, 0.2, 0.3}
[667] = "%.1f", -- AN/ARN-6 Function Selector Switch, OFF/COMP/ANT./LOOP/CONT. {0.0, 0.1, 0.2, 0.3, 0.4}
[666] = "%.1f", -- AN/ARN-6 LOOP L-R Switch {-1.0, 0.0, 1.0}
--[null] = "%.4f", -- AN/ARN-6 Tuning Crank {0.0, 1.0} in 0.01 steps
[657] = "%.1f", -- AN/ARN-6 Scale Light Switch, HI/OFF/LO {-0.1, 0.0, 0.1}
[826] = "%.4f", -- AN/ARN-6 East/West Variation Knob (rotary) {0.0, 1.0} in 0.05 steps
-- IFF APX-6
[810] = "%.1f", -- AN/APX-6 IFF Master Switch, EMERGENCY/NORM/LOW/STDBY/OFF {0.0, 0.1, 0.2, 0.3, 0.4}
[659] = "%.1f", -- AN/APX-6 IFF Mode 2 Switch, MODE 2/OUT/I/P {-0.1, 0.0, 0.1}
[660] = "%.1f", -- AN/APX-6 IFF Mode 3 Switch, MODE 3/OUT {0.0, 0.1}
--[808] = "%1d", -- AN/APX-6 IFF Destruct Switch Cover {1, -1}
[809] = "%1d", -- AN/APX-6 IFF Destruct Switch, OFF/ON {0, -1}
-- baro altimeter
--[null] = "%.4f", -- Altimeter reference pressure adjusting knob (rotary) {0.0, 1.0} in 0.1 steps
-- gyromag compass
--[null] = "%.4f", -- Compass Correction (rotary) {0.0, 1.0} in 0.05 steps
[598] = "%.1f", -- Directional Indicator Fast Slaving Button {0.0, 1.0}
-- attitude indicator
[714] = "%.1f", -- Pull to Cage Knob {0.0, 1.0}
-- accelerometer
[1004] = "%.1f", -- Accelerometer Reset Button {0.0, 1.0}
-- CLOCK
--[null] = "%1d", -- Set Clock Knob
[831] = "%1d", -- Elapsed Time Mechanism Button {0, 1}
-- A4 Gun Sight
[716] = "%.4f", -- A-4 Sight Wing Span Adjustment Knob (rotary) {0.0, 1.0} in 0.1 steps
[715] = "%.4f", -- A-4 Sight Radar Range Sweep Rheostat (rotary) {0.0, 1.0} in 0.1 steps
[734] = "%.4f", -- A-4 Sight Reticle Dimmer Control (rotary) {0, 0.74} in -0.2 steps
[755] = "%1d", -- A-4 Sight Mechanical Caging Lever, CAGE/UNCAGE {0, 1}
[755] = "%.4f", -- A-4 Sight Mechanical Caging Lever, CAGE/UNCAGE (rotary) {0.001, 0.999}
[642] = "%1d", -- A-4 Sight Filament Selector Switch, SECONDARY/PRIMARY {2, -2}
[721] = "%.1f", -- Variable Sight Selector Unit - Sight Function Selector Lever, ROCKET/GUN/BOMB {0.0, 0.1, 0.2}
[720] = "%1d", -- Variable Sight Selector Unit - Target Speed Switch, HI/LO {1, -1}
[722] = "%.4f", -- Variable Sight Selector Unit - Rocket Depression Angle Selector (rotary) {0.0, 1.0} in 0.1 steps
[727] = "%.4f", -- Bomb-Target Wind Control Knob (rotary) {0.0, 1.0} in 0.6 steps
-- weapon system
[639] = "", -- Demolition Bomb Release Selector Switch, AUTO RELEASE/MANUAL RELEASE {2,-2}
[641] = "%.1f", -- Demolition Bomb Arming Switch (Fuze Selection), ARM NOSE&TAIL/OFF/TAIL ONLY {-1.0, 0.0, 1.0}
[752] = "%.1f", -- Demolition Bomb Sequence Selector Switch, ALL/OFF/LEFT/RIGHT {0.0, 0.1, 0.2, 0.3, 0.4, 0.5}
[638] = "%.1f", -- Rocket Fuze (Arming) Switch, DELAY/OFF/INSTANT {-1.0, 0.0, 1.0}
[637] = "%1d", -- Rocket Jettison Switch, READY/OFF {2, -2}
--[750] = "%1d", -- Rocket Release Selector Switch Cover {1, -1}
[751] = "%.1f", -- Rocket Release Selector Switch, SINGLE/OFF/AUTO {-1.0, 0.0, 1.0}
[668] = "%.1f", -- Gun Selector Switch {-0.2, 0.2}
[665] = "%.1f", -- Gun-Missile Selector Switch, OFF/SIGHT CAMERA & RADAR/GUNS/MISSILE {0, 0.3}
[636] = "%1d", -- Gun Heater Switch, HEATER/OFF {2,- 2}
[663] = "%1d", -- Manual Pip Control Switch, BOMB/NORMAL {2, -2}
[796] = "%.1f", -- Manual Pip Control Change Calibrated Dials (Presets) {0.0, 0.3, 0.6, 0.9}
[797] = "%.4f", -- Manual Pip Control Knob (rotary) {0.0, 1.0} in 0.1 steps
[729] = "%.4f", -- A-4 Sight Bombing Altimeter Target Altitude Knob (rotary) {0.0, 1.0} in 0.015 steps
[731] = "%.4f", -- A-4 Sight Bombing Altimeter Index Altitude Handle (rotary) {0.0, 1.0} in -0.015 steps
[632] = "%1d", -- LABS Gyro Caging Switch, UNCAGE/CAGE {2,- 2}
[633] = "%1d", -- LABS Start Switch, ON/OFF {2, -2}
[634] = "%1d", -- LABS Change-over Switch, LABS/A-4 {2, -2}
[702] = "%1d", -- Bomb-Rocket-Tank Jettison Button {0.0, 1.0}
[820] = "%.1f", -- Missile Control Switch, LH & RH/RH/SALVO {-1.0, 0.0, 1.0}
[821] = "%.4f", -- Tone Volume (rotary) {0.0, 1.0} in 0.1 steps
[822] = "%.1f", -- Safe Launch Button {0.0, 1.0}
[1001] = "%.1f" -- Rocket Intervalometer {0.0, 1.0}
}
-----------------------------
-- HIGH IMPORTANCE EXPORTS --
-- done every export event --
-----------------------------
-- Pointed to by ProcessIkarusDCSHighImportance
function ExportScript.ProcessIkarusDCSConfigHighImportance(mainPanelDevice)
--[[
every frame export to Ikarus
Example from A-10C
Get Radio Frequencies
get data from device
local lUHFRadio = GetDevice(54)
ExportScript.Tools.SendData("ExportID", "Format")
ExportScript.Tools.SendData(2000, string.format("%7.3f", lUHFRadio:get_frequency()/1000000)) <- special function for get frequency data
]]
end
function ExportScript.ProcessDACConfigHighImportance(mainPanelDevice)
--[[
every frame export to DAC
Example from A-10C
Get Radio Frequencies
get data from device
local UHF_RADIO = GetDevice(54)
ExportScript.Tools.SendDataDAC("ExportID", "Format")
ExportScript.Tools.SendDataDAC("ExportID", "Format", HardwareConfigID)
ExportScript.Tools.SendDataDAC("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000))
ExportScript.Tools.SendDataDAC("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000), 2) -- export to Hardware '2' Config
]]
end
-----------------------------------------------------
-- LOW IMPORTANCE EXPORTS --
-- done every gExportLowTickInterval export events --
-----------------------------------------------------
-- Pointed to by ExportScript.ProcessIkarusDCSConfigLowImportance
function ExportScript.ProcessIkarusDCSConfigLowImportance(mainPanelDevice)
--[[
export in low tick interval to Ikarus
Example from A-10C
Get Radio Frequencies
get data from device
local lUHFRadio = GetDevice(54)
ExportScript.Tools.SendData("ExportID", "Format")
ExportScript.Tools.SendData(2000, string.format("%7.3f", lUHFRadio:get_frequency()/1000000)) <- special function for get frequency data
]]
end
function ExportScript.ProcessDACConfigLowImportance(mainPanelDevice)
--[[
export in low tick interval to DAC
Example from A-10C
Get Radio Frequencies
get data from device
local UHF_RADIO = GetDevice(54)
ExportScript.Tools.SendDataDAC("ExportID", "Format")
ExportScript.Tools.SendDataDAC("ExportID", "Format", HardwareConfigID)
ExportScript.Tools.SendDataDAC("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000))
ExportScript.Tools.SendDataDAC("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000), 2) -- export to Hardware '2' Config
]]
--=====================================================================================
--[[
ExportScript.Tools.WriteToLog('list_cockpit_params(): '..ExportScript.Tools.dump(list_cockpit_params()))
ExportScript.Tools.WriteToLog('CMSP: '..ExportScript.Tools.dump(list_indication(7)))
local ltmp1 = 0
for ltmp2 = 0, 13, 1 do
ltmp1 = list_indication(ltmp2)
ExportScript.Tools.WriteToLog(ltmp2..': '..ExportScript.Tools.dump(ltmp1))
--ExportScript.Tools.WriteToLog(ltmp2..' (metatable): '..ExportScript.Tools.dump(getmetatable(ltmp1)))
end
]]
--[[
local ltmp1 = 0
for ltmp2 = 1, 73, 1 do
ltmp1 = GetDevice(ltmp2)
ExportScript.Tools.WriteToLog(ltmp2..': '..ExportScript.Tools.dump(ltmp1))
ExportScript.Tools.WriteToLog(ltmp2..' (metatable): '..ExportScript.Tools.dump(getmetatable(ltmp1)))
end
]]
end
-----------------------------
-- Custom functions --
-----------------------------
function ExportScript.genericRadio(key, value, hardware)
end

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,301 @@
-- FW-190D9 Dora
-- Version 1.0.0
ExportScript.FoundDCSModule = true
ExportScript.ConfigEveryFrameArguments =
{
--[[
every frames arguments
based of "mainpanel_init.lua"
Example (http://www.lua.org/manual/5.1/manual.html#pdf-string.format)
[DeviceID] = "Format"
[4] = "%.4f", <- floating-point number with 4 digits after point
[19] = "%0.1f", <- floating-point number with 1 digit after point
[129] = "%1d", <- decimal number
[5] = "%.f", <- floating point number rounded to a decimal number
]]
-- Flight Instruments
[36] = "%.4f", -- AirspeedNeedle {0, 100, 150, 200, 250, 300, 350, 400, 500, 600, 700, 750, 800, 850, 900} = {0.0, 0.038, 0.088, 0.150, 0.216, 0.278, 0.333, 0.395, 0.530, 0.660, 0.777,0.836, 0.892, 0.938, 0.988}
[42] = "%.4f", -- Variometer {-30, -20, -10, -5, 5, 10, 20, 30} = {-1, -0.770, -0.558, -0.338,0.338,0.558, 0.770, 1.0}
--TrimmNeedle
[76] = "%.4f", -- TrimmNeedle {-1.0, 1.0}
--ADF
[29] = "%.4f", -- ADF_Vertical {-1.0, 1.0}
[30] = "%.4f", -- ADF_Horizont {-1.0, 1.0}
-- Altimeter
[35] = "%.4f", -- Altimeter_km {0.0, 10.0} = {0.0, 1.0}
[32] = "%.4f", -- Altimeter_m {0.0, 1000.0} = {0.0, 1.0}
[33] = "%.4f", -- Altimeter_Pressure {712.56, 780.07} = {0.0, 1.0}
-- Artificial horizon
[37] = "%.4f", -- AHorizon_Pitch {0.33, -0.33}
[38] = "%.4f", -- AHorizon_Bank {1.0, -1.0}
[40] = "%.4f", -- TurnNeedle {-1.0, 1.0}
[41] = "%.4f", -- Slipball {-1.0, 1.0}
--oxygen pressure indicator
[112] = "%.4f", -- Oxygen_Pressure {0.0, 250.0} = {0.0, 1.0}
--[113] = "%.4f", -- Oxygen_Flow_Blinker {0.0, 1.0}
--Remote compass
[45] = "%.4f", -- CompassHeading {0.0, 1.0}
[44] = "%.4f", -- CommandedCourse {0.0, 1.0}
-- Engine
[46] = "%.4f", -- Manifold_Pressure {0.5, 2.5} = {0.0, 1.0}
[47] = "%.4f", -- Engine_RPM {0.0, 500.0, 1000.0, 1500, 2000, 2500, 3000, 3500, 3600.0} = {0.0, 0.032, 0.082, 0.206, 0.390, 0.601, 0.789, 0.961, 0.983}
[96] = "%.4f", -- Coolant_Temperature {10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0, 110.0, 120.0, 130.0} = {0.070, 0.131, 0.206, 0.289, 0.377, 0.468, 0.564, 0.655, 0.738, 0.811, 0.892, 0.946, 1.0}
[97] = "%.4f", -- Oil_Temperature {10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0, 110.0, 120.0, 130.0} = {0.070, 0.131, 0.206, 0.289, 0.377, 0.468, 0.564, 0.655, 0.738, 0.811, 0.892, 0.946, 1.0}
[95] = "%.4f", -- Oil_Pressure {0.0, 15.0} -- at = {0, 1.0}
[106] = "%.4f", -- MW50_Pressure {0.0, 0.1, 0.2, 0.3, 0.7, 0.8, 0.9, 1.0} -- at = {0.0, 0.068, 0.169, 0.273, 0.680, 0.780, 0.880, 1.0}
-- Fuel
[94] = "%.4f", -- Fuel_Pressure {0.0, 3.0} -- at = {0.0, 1.0}
[98] = "%.4f", -- FuelScaleUpper {0.0, 50.0, 100.0, 150.0, 200.0, 250.0, 300.0} = {0.0, 0.130, 0.308, 0.50, 0.7, 0.87, 1.0}
--???[98] = "%.4f", -- FuelScaleLower {0.0, 50.0, 100.0, 150.0, 200.0, 230.0, 250.0} = {0.0, 0.098, 0.328, 0.576, 0.833, 0.950, 1.0}
[100] = "%.4f", -- Fuel_Low_Fwd {0.0, 1.0}
[101] = "%.4f", -- Fuel_Low_Rear {0.0, 1.0}
[195] = "%.4f", -- Fluor_Light {0.0, 1.0}
--Clock
[21] = "%.4f", -- CLOCK_currtime_hours {0.0, 12.0} = {0.0, 1.0}
[22] = "%.4f", -- CLOCK_currtime_minutes {0.0, 60.0} = {0.0, 1.0}
[23] = "%.4f", -- CLOCK_currtime_seconds {0.0, 60.0} = {0.0, 1.0}
[27] = "%.4f", -- CLOCK_chrono_minutes {0.0, 15.0} = {0.0, 1.0}
--Ammon Counter
[52] = "%.4f", -- Ammo_Counter_1 {0.0, 500.0} = {0.0, 1.0}
[55] = "%.4f", -- Ammo_Counter_2 {0.0, 500.0} = {0.0, 1.0}
[58] = "%.4f", -- Ammo_Counter_3 {0.0, 500.0} = {0.0, 1.0}
[61] = "%.4f", -- Ammo_Counter_4 {0.0, 500.0} = {0.0, 1.0}
-- Gun_Fire
--[50] = "%.4f", -- Gun_Fire_1 {0.0, 1.0}
--[164] = "%.4f", -- Gun_Fire_2 {0.0, 1.0}
--[165] = "%.4f", -- Gun_Fire_3 {0.0, 1.0}
--[166] = "%.4f", -- Gun_Fire_4 {0.0, 1.0}
--Target System
[133] = "%.4f", -- TargetDist {0.0, 10.0, 100.0, 300.0, 600.0, 700.0, 800.0, 1000.0} = {0.0, 0.0, 0.323, 0.568, 0.709, 0.813, 0.917, 1.0}
--Bomb Lamps
[196] = "%.f", -- BombLamp_1 {0.0, 1.0}
[197] = "%.f", -- BombLamp_2 {0.0, 1.0}
[198] = "%.f", -- BombLamp_3 {0.0, 1.0}
[199] = "%.f", -- BombLamp_4 {0.0, 1.0}
[137] = "%.f", -- RocketEmCvr {0.0, 1.0}
--Gear Lamps
[68] = "%.f", -- L_GEAR_UP {0.0, 1.0}
[69] = "%.f", -- L_GEAR_DOWN {0.0, 1.0}
[70] = "%.f", -- R_GEAR_UP {0.0, 1.0}
[71] = "%.f", -- R_GEAR_DOWN {0.0, 1.0}
--Flaps Lamps
[72] = "%.f", -- FLAPS_UP {0.0, 1.0}
[73] = "%.f", -- FLAPS_START {0.0, 1.0}
[74] = "%1d" -- FLAPS_DOWN {0.0, 1.0}
}
ExportScript.ConfigArguments =
{
--[[
arguments for export in low tick interval
based on "clickabledata.lua"
]]
[159] = "%.2f", -- Radiator Flaps Control (axis) 1.0 in 0.4 steps
[160] = "%1d", -- Cold Start/Wind Screen Washer {0, 1}
--Engine Control Panel
[75] = "%.1f", -- Magneto Switch (Off, M1, M2, M1+M2) {0.0, 0.3, 0.6, 0.9}
[104] = "%1d", -- Starter Switch Cover {0, 1}
[105] = "%.1f", -- Starter Switch. Left Button - Starter Power. Right Button - Magnetic Clutch {0.0, 0.5, 1.0}
[91] = "%1d", -- MBG Emergency Mode Handle {0, 1}
[85] = "%1d", -- MW-50 Switch {0, 1}
--Fuel system
[90] = "%.1f", -- Fuel Tank Selector Valve (CLOSE/FORWARD/AFT/BOTH) {0.0, 0.1, 0.2, 0.3}
[99] = "%.1f", -- Fuel Gauge Selector (FORWARD/NONE/AFT) {0.0, 0.5, 1.0}
[161] = "%1d", -- MW-B4 Selector (Not Functional)
[162] = "%1d", -- Primer Pump {0, 1}
--electric system
[79] = "%1d", -- Electric Kill-switch
[163] = "%1d", -- Emergency Equipment Destruction {0, 1}
--Circuit Breakers
[138] = "%1d", -- Circuit Breakers Cover {0, 1}
[141] = "%1d", -- Flaps, Trimmer, Artificial Horizon Power On {0, 1}
[142] = "%1d", -- Flaps, Trimmer, Artificial Horizon Power Off {0, 1}
[143] = "%1d", -- Landing Gear Power On {0, 1}
[144] = "%1d", -- Landing Gear Power Off {0, 1}
[145] = "%1d", -- Pitot and Heating Cover On {0, 1}
[146] = "%1d", -- Pitot and Heating Cover Off {0, 1}
[147] = "%1d", -- FuG25a On {0, 1}
[148] = "%1d", -- FuG25a Off {0, 1}
[149] = "%1d", -- FuG16ZY On {0, 1}
[150] = "%1d", -- FuG16ZY Off {0, 1}
[151] = "%1d", -- Instrument Lights, Gun-sight, Indicators, Compass, Starter On {0, 1}
[152] = "%1d", -- Instrument Lights, Gun-sight, Indicators, Compass, Starter Off {0, 1}
[153] = "%1d", -- Generator On {0, 1}
[154] = "%1d", -- Generator Off {0, 1}
[155] = "%1d", -- Battery On {0, 1}
[156] = "%1d", -- Battery Off {0, 1}
--Circuit Breakers of additional panel
[121] = "%1d", -- Navigation Lights On {0, 1}
[120] = "%1d", -- Navigation Lights Off {0, 1}
[123] = "%1d", -- Forward Tank Pump On {0, 1}
[122] = "%1d", -- Forward Tank Pump Off {0, 1}
[125] = "%1d", -- Rear Tank Pump On {0, 1}
[124] = "%1d", -- Rear Tank Pump Off {0, 1}
[127] = "%1d", -- Auxiliary Tank Pump On {0, 1}
[126] = "%1d", -- Auxiliary Tank Pump Off {0, 1}
[129] = "%1d", -- MW-50 On {0, 1}
[128] = "%1d", -- MW-50 Off {0, 1}
--canopy
[115] = "%1d", -- Canopy Emergency Release Handle {0, 1}
[114] = "%.2f", -- Canopy Hand Crank (axis)
-- Throttle
[200] = "", -- Throttle Lock {0, 1}
--gauges
[34] = "%.2f", -- Altimeter Pressure Set (axis)
[39] = "%.2f", -- Horizon Cage (axis) {0.0 - 0.511 in 0.04 steps}
[43] = "%.2f", -- Course Set (axis)
--flaps
[62] = "%1d", -- Flaps Up {0, 1}
[63] = "%1d", -- Flaps Take Off {0, 1}
[64] = "%1d", -- Flaps Landing {0, 1}
--Landing Gears Retraction
[65] = "%1d", -- Landing Gears Retraction {0, 1}
[66] = "%1d", -- Landing Gears Retraction Cover {0, 1}
[67] = "%1d", -- Landing Gears Extending {0, 1}
[89] = "%1d", -- Landing Gear Emergency Release Handle {0, 1}
--Trimmer
[77] = "%1d", -- Stabilizer Trimmer Up/Down {-1, 0, 1}
--Clock
[24] = "%.2f", -- Turnable Bezel (axis) in 0.2 steps
[25] = "%.2f", -- Wind/Set Knob (axis) in 0.1 steps
[26] = "%1d", -- Start - Stop Button {0, 1}
[28] = "%1d", -- Stopwatch Button {0, 1}
--weapons
[48] = "%.2f", -- Master Arm
[51] = "%.2f", -- Set Gun 1 Ammunition Count (axis) in 0.4 steps
[54] = "%.2f", -- Set Gun 2 Ammunition Count (axis) in 0.4 steps
[57] = "%.2f", -- Set Gun 3 Ammunition Count (axis) in 0.4 steps
[60] = "%.2f", -- Set Gun 4 Ammunition Count (axis) in 0.4 steps
[107] = "%1d", -- Main Rocket Switch {0, 1}
[108] = "%1d", -- Rocket Emergency Release {0, 1}
[109] = "%.2f", -- Bomb Fusing Selector {0.0, 0.1, 0.2, 0.3, 0.4}
[92] = "%1d", -- Jettison Fuselage Stores {0, 1}
--Gunsight
[132] = "%1d", -- EZ42 Power Switch {0, 1}
[131] = "%.2f", -- Target Wingspan (axis) in 0.1 steps
[134] = "%1d", -- Gunsight Night Filter {0, 1}
[4] = "%.2f", -- Target Distance (axis) in 0.1 steps
[135] = "%.2f", -- Gunsight Brightness (axis) in 0.1 steps
[191] = "%.2f", -- Aiming correction 1 (axis) in 0.1 steps
--Instrument Lights Brightness
[78] = "", -- Instrument Lights Brightness (axis) in 0.4 steps
--Radio
[81] = "%.1f", -- Radio Channel Selector {0.0, 0.1, 0.2, 0.3}
[83] = "%.2f", -- Radio Volume (axis) in 0.04 steps
[84] = "%1d", -- FT FT / Y ZF Mode Switch {0, 1}
[82] = "%.2f", -- Radio Tuning (+/-30 kHz) (axis) in 0.04 steps
--Oxygen
[110] = "%.2f", -- Oxygen Flow Valve (axis) in 0.04 steps
[190] = "%1d", -- Oxygen Emergency Knob {0, 1}
--IFF
[86] = "%1d", -- IFF Channel Selector {-1, 0, 1}
[88] = "%1d" -- IFF Check {0, 1}
}
-----------------------------
-- HIGH IMPORTANCE EXPORTS --
-- done every export event --
-----------------------------
-- Pointed to by ProcessIkarusDCSHighImportance
function ExportScript.ProcessIkarusDCSConfigHighImportance(mainPanelDevice)
--[[
every frame export to Ikarus
Example from A-10C
Get Radio Frequencies
get data from device
local lUHFRadio = GetDevice(54)
ExportScript.Tools.SendData("ExportID", "Format")
ExportScript.Tools.SendData(2000, string.format("%7.3f", lUHFRadio:get_frequency()/1000000)) <- special function for get frequency data
]]
--[50] = "%.4f", -- Gun_Fire_1 {0.0, 1.0}
--[164] = "%.4f", -- Gun_Fire_2 {0.0, 1.0}
--[165] = "%.4f", -- Gun_Fire_3 {0.0, 1.0}
--[166] = "%.4f", -- Gun_Fire_4 {0.0, 1.0}
--[113] = "%.4f", -- Oxygen_Flow_Blinker {0.0, 1.0}
ExportScript.Tools.SendData(50, string.format("%.4f", mainPanelDevice:get_argument_value(50))) -- Gun_Fire_1 {0.0, 1.0}
ExportScript.Tools.SendData(164, string.format("%.4f", mainPanelDevice:get_argument_value(164))) -- Gun_Fire_2 {0.0, 1.0}
ExportScript.Tools.SendData(165, string.format("%.4f", mainPanelDevice:get_argument_value(165))) -- Gun_Fire_3 {0.0, 1.0}
ExportScript.Tools.SendData(166, string.format("%.4f", mainPanelDevice:get_argument_value(166))) -- Gun_Fire_4 {0.0, 1.0}
ExportScript.Tools.SendData(113, string.format("%.4f", mainPanelDevice:get_argument_value(113))) -- Oxygen_Flow_Blinker {0.0, 1.0}
end
function ExportScript.ProcessDACConfigHighImportance(mainPanelDevice)
--[[
every frame export to DAC
Example from A-10C
Get Radio Frequencies
get data from device
local UHF_RADIO = GetDevice(54)
ExportScript.Tools.SendDataDAC("ExportID", "Format")
ExportScript.Tools.SendDataDAC("ExportID", "Format", HardwareConfigID)
ExportScript.Tools.SendDataDAC("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000))
ExportScript.Tools.SendDataDAC("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000), 2) -- export to Hardware '2' Config
]]
ExportScript.Tools.SendData(50, mainPanelDevice:get_argument_value(50) > 0.3 and 1 or 0) -- Gun_Fire_1 {0.0, 1.0}
ExportScript.Tools.SendData(164, mainPanelDevice:get_argument_value(164) > 0.3 and 1 or 0) -- Gun_Fire_2 {0.0, 1.0}
ExportScript.Tools.SendData(165, mainPanelDevice:get_argument_value(165) > 0.3 and 1 or 0) -- Gun_Fire_3 {0.0, 1.0}
ExportScript.Tools.SendData(166, mainPanelDevice:get_argument_value(166) > 0.3 and 1 or 0) -- Gun_Fire_4 {0.0, 1.0}
ExportScript.Tools.SendData(113, mainPanelDevice:get_argument_value(113) > 0.3 and 1 or 0) -- Oxygen_Flow_Blinker {0.0, 1.0}
end
-----------------------------------------------------
-- LOW IMPORTANCE EXPORTS --
-- done every gExportLowTickInterval export events --
-----------------------------------------------------
-- Pointed to by ExportScript.ProcessIkarusDCSConfigLowImportance
function ExportScript.ProcessIkarusDCSConfigLowImportance(mainPanelDevice)
--[[
export in low tick interval to Ikarus
Example from A-10C
Get Radio Frequencies
get data from device
local lUHFRadio = GetDevice(54)
ExportScript.Tools.SendData("ExportID", "Format")
ExportScript.Tools.SendData(2000, string.format("%7.3f", lUHFRadio:get_frequency()/1000000)) <- special function for get frequency data
]]
end
function ExportScript.ProcessDACConfigLowImportance(mainPanelDevice)
--[[
export in low tick interval to DAC
Example from A-10C
Get Radio Frequencies
get data from device
local UHF_RADIO = GetDevice(54)
ExportScript.Tools.SendDataDAC("ExportID", "Format")
ExportScript.Tools.SendDataDAC("ExportID", "Format", HardwareConfigID)
ExportScript.Tools.SendDataDAC("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000))
ExportScript.Tools.SendDataDAC("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000), 2) -- export to Hardware '2' Config
]]
--=====================================================================================
--[[
ExportScript.Tools.WriteToLog('list_cockpit_params(): '..ExportScript.Tools.dump(list_cockpit_params()))
ExportScript.Tools.WriteToLog('CMSP: '..ExportScript.Tools.dump(list_indication(7)))
local ltmp1 = 0
for ltmp2 = 0, 13, 1 do
ltmp1 = list_indication(ltmp2)
ExportScript.Tools.WriteToLog(ltmp2..': '..ExportScript.Tools.dump(ltmp1))
--ExportScript.Tools.WriteToLog(ltmp2..' (metatable): '..ExportScript.Tools.dump(getmetatable(ltmp1)))
end
]]
--[[
local ltmp1 = 0
for ltmp2 = 1, 73, 1 do
ltmp1 = GetDevice(ltmp2)
ExportScript.Tools.WriteToLog(ltmp2..': '..ExportScript.Tools.dump(ltmp1))
ExportScript.Tools.WriteToLog(ltmp2..' (metatable): '..ExportScript.Tools.dump(getmetatable(ltmp1)))
end
]]
end
-----------------------------
-- Custom functions --
-----------------------------
function ExportScript.genericRadio(key, value, hardware)
end

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,368 @@
-- MiG-15Bis
-- Version 1.0.0 BETA
ExportScript.FoundDCSModule = true
ExportScript.ConfigEveryFrameArguments =
{
--[[
every frames arguments
based of "mainpanel_init.lua"
Example (http://www.lua.org/manual/5.1/manual.html#pdf-string.format)
[DeviceID] = "Format"
[4] = "%.4f", <- floating-point number with 4 digits after point
[19] = "%0.1f", <- floating-point number with 1 digit after point
[129] = "%1d", <- decimal number
[5] = "%.f", <- floating point number rounded to a decimal number
]]
[225] = "%.4f", -- Canopy
[223] = "%.4f", -- LeftCanopyLever
[222] = "%.4f", -- RightCanopyLever
[224] = "%.4f", -- AftCanopyLever
[14] = "%.4f", -- Variometer {-75.0,-60.0,-45.0,-30.0,-15.0,-10.0,-5.0,0.0,5.0,10.0,15.0,30.0,45.0,60.0,75.0} {0.0,0.075,0.151,0.24,0.352,0.401,0.448,0.5,0.553,0.6,0.649,0.76,0.848,0.925,1.0}
[28] = "%.4f", -- Altimeter_km {0.0, 10.0}{0.0, 1.0}
[29] = "%.4f", -- Altimeter_m {0.0, 1000.0}{0.0, 1.0}
[31] = "%.4f", -- Altimeter_Pressure {670, 790}{0.0, 1.0}
[15] = "%.4f", -- CLOCK_currtime_hours {0.0, 12.0}{0.0, 1.0}
[16] = "%.4f", -- CLOCK_currtime_minutes {0.0, 60.0}{0.0, 1.0}
[22] = "%.4f", -- CLOCK_flight_time_meter_status {0.0, 0.2}{0.5, 0.0}
[18] = "%.4f", -- CLOCK_flight_hours {0.0, 12.0}{0.0, 1.0}
[19] = "%.4f", -- CLOCK_flight_minutes {0.0, 60.0}{0.0, 1.0}
[20] = "%.4f", -- CLOCK_seconds_meter_time_minutes {0.0, 60.0}{0.0, 1.0}
[17] = "%.4f", -- CLOCK_seconds_meter_time_seconds {0.0, 60.0}{0.0, 1.0}
[4] = "%.4f", -- IAS {100.0, 1100.0}{0.0, 1.0}
[5] = "%.4f", -- TAS {100.0, 1100.0}{0.0, 1.0}
[27] = "%.4f", -- MACH {0.0,0.3,0.95}{0.12,0.215,1.0}
[6] = "%.4f", -- AGK_47B_roll {-1.0, 1.0}
[7] = "%.4f", -- AGK_47B_pitch {1.0, -1.0}
[11] = "%.4f", -- AGK_47B_failure_flag {0.0, 1.0}
[8] = "%.4f", -- AGK_47B_sideslip {-1.0, 1.0}
[9] = "%.4f", -- AGK_47B_turn {-1.0, 1.0}
[10] = "%.4f", -- AGK_47B_horizon {-1.0, 1.0}
[35] = "%.4f", -- PRV_46_RAlt {-10.0, 0.0, 1200.0}{-1.0, 0.0, 1.0}
[32] = "%.4f", -- PDK-45 HeadingScale {0.0, 1.0}
[33] = "%.4f", -- PDK-45 Heading {0.0, 1.0}
-- Weapon System
[95] = "%.4f", -- N37D_Ready_Lamp
[93] = "%.4f", -- NR23_TOP_Ready_Lamp
[94] = "%.4f", -- NR23_BOTTOM_Ready_Lamp
[100] = "%.4f", -- Tactical_Rel_Lamp
[98] = "%.4f", -- LEFT_BOMB_Lamp
[99] = "%.4f", -- RIGHT_BOMB_Lamp
-- electric system
[83] = "%.4f", -- VoltAmperMeter {-1.0, 0.0, 3.0}{-1.0, 0.0, 1.0}
[244] = "%.4f", -- lamps_lightness
-- hydraulic system
[168] = "%.4f", -- HydraulicPressureMain {0.0, 250.0}{0.0, 1.0}
[139] = "%.4f", -- HydraulicPressureGain {0.0, 150.0}{0.0, 1.0}
[169] = "%.4f", -- HydraulicPressureAirFlaps {0.0, 80.0}{0.0, 1.0}
[165] = "%.4f", -- HydraulicPressureAirGears {0.0, 80.0}{0.0, 1.0}
[172] = "%.4f", -- HydraulicPressureMainAir {0.0, 250.0}{0.0, 1.0}
-- gear system
[121] = "%.4f", -- LeftBrakePressure {0.0, 12.0}{0.0, 1.0}
[122] = "%.4f", -- RightBrakePressure {0.0, 12.0}{0.0, 1.0}
-- fuel system
[47] = "%.4f", -- FuelQuantity {-100.0,0.0,100.0,200.0,300.0,400.0,500.0,600.0,700.0,800.0,1050.0}{0.0,0.047,0.136,0.22,0.38,0.52,0.631,0.755,0.869,0.921,1.0}
-- air system
[188] = "%.4f", -- CanopyAirValveIndication
[39] = "%.4f", -- CockpitAltitude {0.0,8000.0} {0.008,1.0}
[40] = "%.4f", -- PressureDifference {-0.04,0.0,0.6} {0.0,0.243,1.0}
-- oxygen system
[48] = "%.4f", -- OxygenPressure {0.0,250.0} {0.0,1.0}
[60] = "%.4f", -- FlowBlinker
[49] = "%.4f", -- FlowPressure {0.0,150.0,170.0} {0.0,0.9,1.0}
-- Engine
[42] = "%.4f", -- EngineTachometer {0.0,15000.0} {0.0,1.0}
[41] = "%.4f", -- EngineTemperature {300.0,900.0} {0.0,1.0}
[45] = "%.4f", -- OilTemperature {-50.0,150.0} {0.0,1.0}
[44] = "%.4f", -- OilPressure {0.0, 10.0} {0.0,1.0}
[43] = "%.4f", -- EngineFuelPressure {0.0,100.0} {0.0,1.0}
[46] = "%.4f", -- FuelPressure {0.0,10.0} {0.0,1.0}
-- radio compass
[238] = "%.4f", -- ARC5_Band {0.0, 2.0} {0.0, 0.4}
[176] = "%.4f", -- ARC5_TuningMeter
[175] = "%.4f", -- ARC5_Tuning {0.0, 0.2} {0.0, 1.0}
[38] = "%.4f", -- ARC5_Bearing
[239] = "%.4f", -- ARC5_FreqScale {0.0,0.5,1.0,1.5,2.0,2.5,3.0} {0.0,0.0695,0.14,0.2865,0.43,0.7155,1.0}
-- Radio RSI-6K
[235] = "%.4f", -- RadioAntennaPower
[128] = "%.4f", -- RadioReceiverKnob {0.0, 0.2}{0.0, 1.0}
[127] = "%.4f", -- RadioReceiverInd {0.0, 1.0}{0.036, 0.961}
[144] = "%.4f", -- RadioReceiverGauge {0.0, 1.0}{0.026, 0.957}
[245] = "%.4f", -- ASP_3N_Range
-- Lamps
-- electric system
[57] = "%.f", -- lamp_GeneratorOff {-1.0, 1.0}{-1.0, 1.0}
[58] = "%.f", -- lamp_Ignition {-1.0, 1.0}{-1.0, 1.0}
-- power plant
[119] = "%.f", -- lamp_IsolatingValve {-1.0, 1.0}{-1.0, 1.0}
-- gear system
[75] = "%.f", -- lamp_LeftGearExt {-1.0, 1.0}{-1.0, 1.0}
[74] = "%.f", -- lamp_LeftGearRet {-1.0, 1.0}{-1.0, 1.0}
[79] = "%.f", -- lamp_RightGearExt {-1.0, 1.0}{-1.0, 1.0}
[78] = "%.f", -- lamp_RightGearRet {-1.0, 1.0}{-1.0, 1.0}
[77] = "%.f", -- lamp_NoseGearExt {-1.0, 1.0}{-1.0, 1.0}
[76] = "%.f", -- lamp_NoseGearRet {-1.0, 1.0}{-1.0, 1.0}
[53] = "%.f", -- lamp_ExtendGears {-1.0, 1.0}{-1.0, 1.0}
-- fuel system
[56] = "%.f", -- lamp_Remain300 {-1.0, 1.0}{-1.0, 1.0}
[50] = "%.f", -- lamp_AftEmpty {-1.0, 1.0}{-1.0, 1.0}
[52] = "%.f", -- lamp_DropTanks {-1.0, 1.0}{-1.0, 1.0}
[51] = "%.f", -- lamp_BoostPressure {-1.0, 1.0}{-1.0, 1.0}
-- control system
[113] = "%.f", -- lamp_TrimmerNeutral {-1.0, 1.0}{-1.0, 1.0}
[59] = "%.f", -- lamp_FlapsExt {-1.0, 1.0}{-1.0, 1.0}
[124] = "%.f", -- lamp_AirBrakeExt {-1.0, 1.0}{-1.0, 1.0}
-- fire extinguisher system
[135] = "%.f", -- lamp_FireDetected {-1.0, 1.0}{-1.0, 1.0}
-- ARC-5
[183] = "%.f", -- lamp_ARC_5 {-1.0, 1.0}{-1.0, 1.0}
[218] = "%.f", -- light_ARC_5_scale {-1.0, 1.0}{-1.0, 1.0}
-- MRP-48P
[54] = "%.f", -- lamp_Marker {-1.0, 1.0}{-1.0, 1.0}
-- Light System
[226] = "%.4f", -- light_LeftUV {-1.0, 1.0}{-1.0, 1.0}
[215] = "%.4f", -- light_CenterUV {-1.0, 1.0}{-1.0, 1.0}
[227] = "%.4f", -- light_RightUV {-1.0, 1.0}{-1.0, 1.0}
[217] = "%.4f", -- light_Panels {-1.0, 1.0}{-1.0, 1.0}
[216] = "%.4f", -- light_AuxLeftPanel {-1.0, 1.0}{-1.0, 1.0}
-- Gun Camera
[55] = "%.f" -- lamp_GunCamera {-1.0, 1.0}{-1.0, 1.0}
}
ExportScript.ConfigArguments =
{
--[[
arguments for export in low tick interval
based on "clickabledata.lua"
]]
-- Cockpit mechanics
[221] = "%.4f", -- Emergency Canopy Jettison - Pull to jettison
[223] = "%.4f", -- Left Canopy Lever, OPEN/CLOSE
[222] = "%.4f", -- Right Canopy Lever, OPEN/CLOSE
[224] = "%.4f", -- Aft Canopy Lever, OPEN/CLOSE
-- Control system
[114] = "%.4f", -- Elevator Trimmer Switch, PULL(CLIMB)/OFF/PUSH(DESCEND)
[142] = "%.4f", -- Aileron Trimmer Switch, LEFT/OFF/RIGHT
[207] = "%.4f", -- Wing Flaps Handle, RETRACT/NEUTRAL/20 degrees/55 degrees
[125] = "%.4f", -- Airbrake Switch, CLOSE/OPEN
[203] = "%.4f", -- Hydro Booster Lever, ON/OFF
[204] = "%.4f", -- Throttle Friction Lever
[198] = "%.4f", -- Airbrake Button, Hold to extend
-- Electric system
[84] = "%.4f", -- Ampere- & Voltmeter - Push to view Volts
[149] = "%.4f", -- Air Start Switch, ON/OFF
[81] = "%.4f", -- Pitot and Clock Heater Switch, ON/OFF
[200] = "%.4f", -- Engine Start Button - Push to start
[214] = "%.4f", -- Engine Start Button Cover
-- Circuit Breakers
[117] = "%.4f", -- Transfer Pump Switch, ON/OFF
[115] = "%.4f", -- Booster Pump Switch, ON/OFF
[120] = "%.4f", -- Ignition Switch, ON/OFF
[116] = "%.4f", -- Instruments and Lights Switch, ON/OFF
-- Right Panel
[152] = "%.4f", -- Accumulator Switch, ON/OFF
[153] = "%.4f", -- Generator Switch, ON/OFF
[151] = "%.4f", -- Nose Light Master Switch, ON/OFF
[154] = "%.4f", -- Trim Master Switch, ON/OFF
[155] = "%.4f", -- AGK-47B Artificial Horizon + DGMK-3 Switch, ON/OFF
[158] = "%.4f", -- Radio Switch, ON/OFF
[157] = "%.4f", -- Bombs Switch, ON/OFF
[156] = "%.4f", -- Emergency Drop Switch, ON/OFF
[159] = "%.4f", -- ARC Switch, ON/OFF
[160] = "%.4f", -- RV-2 Radio Altimeter Switch, ON/OFF
[161] = "%.4f", -- NR-23 Cannon Switch, ON/OFF
[162] = "%.4f", -- N-37D Cannon Switch, ON/OFF
[163] = "%.4f", -- ASP-3N Gunsight Switch, ON/OFF
[164] = "%.4f", -- S-13 Gun Camera Switch, ON/OFF
-- HydroSystem
[171] = "%.4f", -- Emergency Flaps Valve
[167] = "%.4f", -- Emergency Gears Valve
[170] = "%.4f", -- Emergency Flaps Valve Cover
[166] = "%.4f", -- Emergency Gears Valve Cover
[186] = "%.4f", -- Emergency System Filling Valve
[242] = "%.4f", -- Air Net Valve
[241] = "%.4f", -- Cockpit Filling Valve
-- Gear System
[71] = "%.4f", -- Landing Gear Handle, UP/DOWN
[72] = "%.4f", -- Gear Lamps Test Button - Push to test
[210] = "%.4f", -- Right Emergency Gear Release Handle
[209] = "%.4f", -- Left Emergency Gear Release Handle
[85] = "%.4f", -- Landing Gear Handle Lock, Lock/Unlock
-- Fuel System
[82] = "%.4f", -- Drop Tank Signal Switch, ON/OFF
[141] = "%.4f", -- Oxygen Supply Valve
[143] = "%.4f", -- Air Valve
[243] = "%.4f", -- Oxygen Emergency Valve
-- Conditioning and Heating System
[187] = "%.4f", -- Cockpit Air Valve
[86] = "%.4f", -- Ventilation Valve
-- Internal Lights System
[184] = "%.4f", -- Left UV Light Rheostat
[185] = "%.4f", -- Right UV Light Rheostat
[220] = "%.4f", -- Panels Light Rheostat
-- Nav Lights System
[111] = "%.4f", -- External Lights Switch, ON/OFF
[80] = "%.4f", -- Nose Light Switch, ON/OFF
-- Power Plant
[208] = "%.4f", -- Engine Stop, CLOSE/OPEN
[118] = "%.4f", -- Isolating Valve Switch, ON/OFF
-- Fire Extinguisher System
[136] = "%.4f", -- Engine Fire Extinguisher Button Cover
[137] = "%.4f", -- Engine Fire Extinguisher Button
[138] = "%.4f", -- Engine Fire Warning Light Test Button - Push to test
-- Signal Flares
[129] = "%.4f", -- Signal Flare Switch, ON/OFF
[130] = "%.4f", -- Signal Flare Yellow Button
[131] = "%.4f", -- Signal Flare Green Button
[132] = "%.4f", -- Signal Flare Red Button
[133] = "%.4f", -- Signal Flare White Button
----------------------------------------------------
-- Devices
-- AGK-47B
[12] = "%.4f", -- AGK-47B Artificial Horizon Cage - Pull to cage
[13] = "%.4f", -- AGK-47B Artificial Horizon Zero Pitch Trim Knob
--VD-15
[30] = "%.4f", -- Barometric Pressure QFE Knob
--PRV-46
[36] = "%.4f", -- PRV-46 Radar Altimeter Indicator Range Switch, 120m/1200m AGL
[37] = "%.4f", -- PRV-46 Radar Altimeter Indicator Power Switch, ON/OFF
--PDK-45
[34] = "%.4f", -- Heading Knob
[61] = "%.4f", -- Fast Slave Button
-- CLOCK
[23] = "%.4f", -- AChS-1 Cockpit Chronograph Left Knob (button)
[24] = "%.4f", -- AChS-1 Cockpit Chronograph Left Knob (rotary)
[25] = "%.4f", -- AChS-1 Cockpit Chronograph Right Knob (button)
[26] = "%.4f", -- AChS-1 Cockpit Chronograph Right Knob (rotary)
-- Weapon System
[92] = "%.4f", -- N-37D Cannon Reload Button
[90] = "%.4f", -- NR-23 (Top) Cannon Reload Button
[91] = "%.4f", -- NR-23 (Bottom) Cannon Reload Button
[96] = "%.4f", -- Tactical Release Switch, ON/OFF
[97] = "%.4f", -- Emergency Release Button
[104] = "%.4f", -- Emergency Release Button Cover
--ASP-3N Gunsight
[101] = "%.4f", -- ASP-3N Gunsight Mode, GYRO/FIXED
[106] = "%.4f", -- ASP-3N Gunsight Fixed Reticle Mask Lever
[103] = "%.4f", -- ASP-3N Gunsight Fixed Reticle Mask Lever (rotary)
[102] = "%.4f", -- ASP-3N Gunsight Brightness Knob (rotary)
[201] = "%.4f", -- ASP-3N Gunsight Target Distance (rotary)
[105] = "%.4f", -- ASP-3N Gunsight Color Filter, ON/OFF
-- ARC-5 radio compass
[180] = "%.4f", -- ARC-5 Audio Volume Control (rotary)
[177] = "%.4f", -- ARC-5 Frequency Band Switch
[174] = "%.4f", -- ARC-5 Function Selector Switch, OFF/COMP/ANT./LOOP
[178] = "%.4f", -- ARC-5 LOOP L-R Switch
--[] = "%.4f", -- ARC-5 Tuning Crank (rotary)
[181] = "%.4f", -- ARC-5 Scale Light Control (rotary)
[173] = "%.4f", -- ARC-5 TLG-TLF Switch
[182] = "%.4f", -- ARC-5 Take Control Button
[123] = "%.4f", -- ARC-5 Near/Far NDB Switch
[146] = "%.4f", -- ARC-5 NDB 1 Switch
[147] = "%.4f", -- ARC-5 NDB 2 Switch
[148] = "%.4f", -- ARC-5 NDB 3 Switch
-- RSI-6K radio
[126] = "%.4f", -- RSI-6K Audio Volume Control (rotary)
[232] = "%.4f", -- RSI-6K Wave Control (rotary)
[230] = "%.4f", -- RSI-6K Antenna Control (rotary)
[231] = "%.4f", -- RSI-6K Wave Lock
[233] = "%.4f", -- RSI-6K Antenna Lock
[128] = "%.4f", -- RSI-6K Receiver Tuning (rotary)
[140] = "%.4f", -- RSI-6K Receive/ARC
[240] = "%.4f", -- RSI-6K Forced Mode, ON/OFF
[202] = "%.4f", -- Microphone Button
}
-----------------------------
-- HIGH IMPORTANCE EXPORTS --
-- done every export event --
-----------------------------
-- Pointed to by ProcessIkarusDCSHighImportance
function ExportScript.ProcessIkarusDCSConfigHighImportance(mainPanelDevice)
--[[
every frame export to Ikarus
Example from A-10C
Get Radio Frequencies
get data from device
local lUHFRadio = GetDevice(54)
ExportScript.Tools.SendData("ExportID", "Format")
ExportScript.Tools.SendData(2000, string.format("%7.3f", lUHFRadio:get_frequency()/1000000)) <- special function for get frequency data
]]
end
function ExportScript.ProcessDACConfigHighImportance(mainPanelDevice)
--[[
every frame export to DAC
Example from A-10C
Get Radio Frequencies
get data from device
local UHF_RADIO = GetDevice(54)
ExportScript.Tools.SendDataDAC("ExportID", "Format")
ExportScript.Tools.SendDataDAC("ExportID", "Format", HardwareConfigID)
ExportScript.Tools.SendDataDAC("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000))
ExportScript.Tools.SendDataDAC("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000), 2) -- export to Hardware '2' Config
]]
end
-----------------------------------------------------
-- LOW IMPORTANCE EXPORTS --
-- done every gExportLowTickInterval export events --
-----------------------------------------------------
-- Pointed to by ExportScript.ProcessIkarusDCSConfigLowImportance
function ExportScript.ProcessIkarusDCSConfigLowImportance(mainPanelDevice)
--[[
export in low tick interval to Ikarus
Example from A-10C
Get Radio Frequencies
get data from device
local lUHFRadio = GetDevice(54)
ExportScript.Tools.SendData("ExportID", "Format")
ExportScript.Tools.SendData(2000, string.format("%7.3f", lUHFRadio:get_frequency()/1000000)) <- special function for get frequency data
]]
end
function ExportScript.ProcessDACConfigLowImportance(mainPanelDevice)
--[[
every frame export to hardware
Example from A-10C
Get Radio Frequencies
get data from device
local UHF_RADIO = GetDevice(54)
ExportScript.Tools.SendDataDAC("ExportID", "Format")
ExportScript.Tools.SendDataDAC("ExportID", "Format", HardwareConfigID)
ExportScript.Tools.SendDataDAC("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000))
ExportScript.Tools.SendDataDAC("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000), 2) -- export to Hardware '2' Config
]]
--=====================================================================================
--[[
ExportScript.Tools.WriteToLog('list_cockpit_params(): '..ExportScript.Tools.dump(list_cockpit_params()))
ExportScript.Tools.WriteToLog('CMSP: '..ExportScript.Tools.dump(list_indication(7)))
local ltmp1 = 0
for ltmp2 = 0, 13, 1 do
ltmp1 = list_indication(ltmp2)
ExportScript.Tools.WriteToLog(ltmp2..': '..ExportScript.Tools.dump(ltmp1))
--ExportScript.Tools.WriteToLog(ltmp2..' (metatable): '..ExportScript.Tools.dump(getmetatable(ltmp1)))
end
]]
--[[
local ltmp1 = 0
for ltmp2 = 1, 73, 1 do
ltmp1 = GetDevice(ltmp2)
ExportScript.Tools.WriteToLog(ltmp2..': '..ExportScript.Tools.dump(ltmp1))
ExportScript.Tools.WriteToLog(ltmp2..' (metatable): '..ExportScript.Tools.dump(getmetatable(ltmp1)))
end
]]
end
-----------------------------
-- Custom functions --
-----------------------------
function ExportScript.genericRadio(key, value, hardware)
end

View File

@@ -0,0 +1,675 @@
-- MiG-21Bis Export
-- Version 1.0.0 BETA
ExportScript.FoundDCSModule = true
ExportScript.ConfigEveryFrameArguments =
{
--[[
every frames arguments
based of "mainpanel_init.lua"
Example (http://www.lua.org/manual/5.1/manual.html#pdf-string.format)
[DeviceID] = "Format"
[4] = "%.4f", <- floating-point number with 4 digits after point
[19] = "%0.1f", <- floating-point number with
[5] = "%.f", <- floating point number rounded to a decimal number
]]
[239] = "%.1f", -- CANOPY_anti_ice
--ALCOHOL, COMPRESSED_AIR other similar stuff == == == == == == == == == == == == == == == == == == == == == == =
[411] = "%.1f", -- ALCOHOL
[413] = "%.1f", -- COMPRESSED_AIR_main
[414] = "%.1f", -- COMPRESSED_AIR_aux
-- OXYGENE SYSTEM (pilot only, engine O2 separated) == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == ==
[59] = "%.1f", -- OXYGENE_instrument_IK52
[60] = "%.1f", -- OXYGENE_instrument_IK52_blinking_lungs
[58] = "%.1f", -- OXYGENE_instrument_M2000
--GEAR LIGHTS == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == ==
[9] = "%.f", -- GEAR_NOSE_UP_LIGHT
[12] = "%.f", -- GEAR_NOSE_DOWN_LIGHT
[10] = "%.f", -- GEAR_LEFT_UP_LIGHT
[13] = "%.f", -- GEAR_LEFT_DOWN_LIGHT
[11] = "%.f", -- GEAR_RIGHT_UP_LIGHT
[14] = "%.f", -- GEAR_RIGHT_DOWN_LIGHT
-- AIRBRAKES == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == ==
[316] = "%.1f", -- AIRBRAKES_button
[7] = "%.1f", -- AIRBRAKES_3D
-- INSTRUMENTS == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == ==
[100] = "%.4f", -- IAS_indicator
[101] = "%.4f", -- TAS_indicator
[102] = "%.4f", -- M_indicator
-- Baro altimeter subgroup --------------------------------------------------------------------------------------------------------------------------
[104] = "%.4f", -- H_indicator_needle_m
[112] = "%.4f", -- H_indicator_needle_km
--/N/ KSI subgroup (NPP) --------------------------------------------------------------------------------------------------------------------------
[178] = "%.1f", -- KSI_switch
[258] = "%.1f", -- KSI_adjust_button
[111] = "%.4f", -- KSI_course_indicator
[68] = "%.4f", -- KSI_course_set_needle
-- RSBN subgroup ------------------------------------------------------------------------------------------------------------------------------------------------
[176] = "%.1f", -- RSBN_switch
[548] = "%.1f", -- RSBN_azimut_korekcija_LIGHT
[549] = "%.1f", -- RSBN_dalnost_korekcija_LIGHT
[417] = "%.1f", -- RSBN_distance_meter
[355] = "%.1f", -- RSBN_distance_meter_Hundreds
[356] = "%.1f", -- RSBN_distance_meter_Tens
[357] = "%.1f", -- RSBN_distance_meter_Singles
[587] = "%.1f", -- RSBN_NPP_kurs_blinker
[588] = "%.1f", -- RSBN_NPP_glisada_blinker
[590] = "%.4f", -- RSBN_NPP_kurs_needle
[589] = "%.4f", -- RSBN_NPP_glisada_needle
[567] = "%.1f", -- RSBN_KPP_kren_blinker
[568] = "%.1f", -- RSBN_KPP_tangaz_blinker
--[565] = "%.4f", -- RSBN_KPP_kurs_director
--[566] = "%.4f", -- RSBN_KPP_glisada_director
--/N/ ARK subgroup ---------------------------------------------------------------------------------------------------------------------------------
[174] = "%.1f", -- ARK_switch
[254] = "%.1f", -- ARK_dal_bliz_selector
--[36] = "%.4f", -- ARK_RSBN_needle
-- Radio-altimeter subgroup ------------------------------------------------------------------------------------------------------------------------------------------------------
[175] = "%.1f", -- RADIO_ALTIMETER_MARKER_switch
[103] = "%.4f", -- RADIO_ALTIMETER_indicator
[500] = "%.f", -- LOW_ALT_LIGHT
-- UUA and SUA subgroup -----------------------------------------------------------------------------------------------------------------------------------------------------------
[105] = "%.4f", -- UUA_indicator
[537] = "%.f", -- AOA_WARNING_LIGHT
-- DA-200 subgroup ---------------------------------------------------------------------------------------------------------------------------------------------------------
[107] = "%.6f", -- DA200_TurnNeedle
[106] = "%.4f", -- DA200_VerticalVelocity
[31] = "%.1f", -- DA200_Slipball
[177] = "%.1f", -- KPP_switch
[259] = "%.1f", -- KPP_ARRETIR
[535] = "%.1f", -- KPP_ARRETIR_light
[108] = "%.4f", -- KPP_Bank
[109] = "%.4f", -- KPP_Pitch
-- ACCELEROMETER == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == ==
[110] = "%.4f", -- ACCELEROMETER
[228] = "%.4f", -- RESET_G_needle
[113] = "%.4f", -- MAX_G_needle
[114] = "%.4f", -- MIN_G_needle
--TRIMMER == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == =
[172] = "%.1f", -- TRIMMER_switch
[519] = "%.f", -- TRIMMER_light
--PITOT TUBES == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == ==
[229] = "%.1f", -- PITOT_TUBES_SELECTOR
[279] = "%.1f", -- PITOT_TUBES_HEATING_main
[280] = "%.1f", -- PITOT_TUBES_HEATING_aux
[406] = "%.1f", -- PITOT_TUBES_STATUS
-- FREEZING EFFECTS == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == =
[410] = "%.1f", -- FREEZING_level_absolute
[543] = "%.1f", -- FREEZING_EFFECTS_canopy
--/N/ DC bus == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == ==
[124] = "%.4f", -- DC_BUS_V_needle
[165] = "%.1f", -- DC_BUS_battery
[155] = "%.1f", -- DC_BUS_battery_heat
[510] = "%.f", -- DC_GENERATOR_LIGHT
[16666] = "%.1f", -- DC_GENERATOR
[563] = "%.1f", -- DC_BUS
[55] = "%.1f", -- DC_BUS_ISA_K
--/N/ AC bus == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == ==
[564] = "%.1f", -- AC_BUS
[15366] = "%.1f", -- AC_BUS_PO7501
[15466] = "%.1f", -- AC_BUS_PO7502
[16466] = "%.1f", -- AC_BUS_Emerg_Inverter
[16966] = "%.1f", -- AC_GENERATOR
[511] = "%.f", -- AC_GENERATOR_LIGHT
--/N/ FUEL PUMPS & FUEL SYSTEM == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == =
[159] = "%.1f", -- FUEL_PUMP_3
[160] = "%.1f", -- FUEL_PUMP_1
[161] = "%.1f", -- FUEL_PUMP_RASHOD
[402] = "%.4f", -- FUEL_PRESSURE { 0, 45 } ????
[52] = "%.1f", -- FUEL_METER
--FUEL LIGHTS (in connection with previous) == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == =
[501] = "%.f", -- FUEL_LIGHT_FUELPODC
[502] = "%.f", -- FUEL_LIGHT_1GR
[503] = "%.f", -- FUEL_LIGHT_450
[504] = "%.f", -- FUEL_LIGHT_3GR
[505] = "%.f", -- FUEL_LIGHT_FUELPODW
[506] = "%.f", -- FUEL_LIGHT_RASHOD
--ENGINE START DEVICE == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == =
[403] = "%.1f", -- ENGINE_START_DEVICE_STATUS { -1, 0, 1, 2 }
[509] = "%.f", -- START_DEVICE_ZAZIG_LIGHT
[415] = "%.1f", -- ENGINE_OXYGENE_STATUS
[61] = "%.4f", -- ENGINE_OXYGENE_manometer
-- ENGINE and THROTTLE == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == ==
[624] = "%.1f", -- SPS_state
[625] = "%.4f", -- KONUS_efficiency
[626] = "%.4f", -- SOPLO_efficiency
[50] = "%.4f", -- ENGINE_RPM
[670] = "%.4f", -- ENGINE_RPM2
[51] = "%.4f", -- ENGINE_TEMP
[404] = "%.4f", -- ENGINE_STRESS
[507] = "%.f", -- FORSAZ_1_LIGHT
[508] = "%.f", -- FORSAZ_2_LIGHT
[512] = "%.f", -- NOZZLE_LIGHT
[517] = "%.f", -- KONUS_LIGHT
[513] = "%.f", -- OIL_LIGHT
[627] = "%.4f", -- OIL_PRESSURE
[534] = "%.f", -- FIRE_LIGHT
[405] = "%.1f", -- ENGINE_SURGE_DOORS_POZITION { -1, 0, 1 }
-- GIDRO == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == ==
[418] = "%.4f", -- PRIMARY_GIDRO_Pressure
[419] = "%.4f", -- SECONDARY_GIDRO_Pressure
[126] = "%.4f", -- PRIMARY_GIDRO_Pressure_needle
[125] = "%.4f", -- SECONDARY_GIDRO_Pressure_needle
[171] = "%.1f", -- GIDRO_NR27_switch
[319] = "%.1f", -- GIDRO_ailerones_busters_switch
[515] = "%.f", -- HYDRAULIC_LIGHT
[514] = "%.f", -- BUSTER_LIGHT
--HELMET == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == =
[306] = "%.1f", -- HELMET_heat_man_auto_switch
[310] = "%.1f", -- HELMET_quick_heat_button
[595] = "%.1f", -- HELMET_visor_switch
--AIR CONDITIONING == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == =
[412] = "%.4f", -- AIR_CONDITION_cockpit_temperature
-- WARNING LIGHTS == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == ==
[541] = "%.f", -- CANOPY_WARNING_LIGHT
[542] = "%.f", -- SORC_LIGHT
[407] = "%.f", -- WARNING_LIGHTS_CHECK_STATE
[516] = "%.f", -- MARKER_LIGHT
[518] = "%.f", -- STABILISATOR_LIGHT
[520] = "%.f", -- CHECK_GEAR_LIGHT
[521] = "%.f", -- FLAPS_LIGHT
[522] = "%.f", -- AIRBRAKE_LIGHT
[523] = "%.f", -- CENTRAL_PYLON_LIGHT
[524] = "%.f", -- RATO_L_LIGHT
[525] = "%.f", -- RATO_R_LIGHT
[526] = "%.f", -- PYLON_1_ON_LIGHT
[527] = "%.f", -- PYLON_2_ON_LIGHT
[528] = "%.f", -- PYLON_3_ON_LIGHT
[529] = "%.f", -- PYLON_4_ON_LIGHT
[530] = "%.f", -- PYLON_1_OFF_LIGHT
[531] = "%.f", -- PYLON_2_OFF_LIGHT
[532] = "%.f", -- PYLON_3_OFF_LIGHT
[533] = "%.f", -- PYLON_4_OFF_LIGHT
-- GIRO DEVICES == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == ==
[536] = "%.1f", -- GIRO_ARRETIR
[408] = "%.1f", -- GIRO_AGD_KSI_SAU_RLS_STATE
[409] = "%.1f", -- GIRO_DA200_KSI_SAU_RLS_STATE
[162] = "%.1f", -- GIRO_AGD_KSI_SAU_RLS_switch
[163] = "%.1f", -- GIRO_DA200_KSI_SAU_RLS_switch
-- ASP == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == =
[539] = "%.1f", -- ASP_TGT_ACQUIRED_LIGHT
[538] = "%.1f", -- ASP_LAUNCH
[540] = "%.1f", -- ASP_DISENGAGE
[67] = "%.1f", -- GUN_camera_3D
[551] = "%.1f", -- ASP_DISTANCE
[552] = "%.4f", -- ASP_DISTANCE_MISSILE
[553] = "%.1f", -- RADAR_ERROR
[554] = "%.1f", -- RADAR_LOW_ALT
[555] = "%.1f", -- RADAR_FIX_BEAM
[556] = "%.1f", -- ASP_SCALE_BASE
[557] = "%.1f", -- ASP_SCALE_ANGLE
[558] = "%.1f", -- RADAR_LAUNCH
[559] = "%.1f", -- RADAR_MISSILE_HEAD_RDY
[560] = "%.1f", -- RADAR_JAMMED
[561] = "%.1f", -- RADAR_BROKEN
[562] = "%.1f", -- RADAR_DISENGAGE
[571] = "%.1f", -- RADAR_19A_1
[572] = "%.1f", -- RADAR_19A_2
[573] = "%.1f", -- RADAR_19A_3
[574] = "%.1f", -- RADAR_19A_4
[575] = "%.1f", -- RADAR_19A_5
[576] = "%.1f", -- RADAR_19A_6
[577] = "%.1f", -- RADAR_19A_7
[578] = "%.1f", -- RADAR_19A_8
[579] = "%.1f", -- SEAT_HEIGHT
[580] = "%.1f", -- IAB_BOX
[581] = "%.1f", -- IAB_LIGHT_1
[582] = "%.1f", -- IAB_LIGHT_2
[583] = "%.1f", -- IAB_LIGHT_3
[584] = "%.1f", -- MISSILE_55_1
[585] = "%.1f", -- MISSILE_55_2
[586] = "%.1f", -- MISSILE_62
[63] = "%.1f", -- TACTICAL_DROP_ARMED
[591] = "%.1f", -- SPS_BOX
[592] = "%.1f", -- SPS_HIGH
[593] = "%.1f", -- SPS_ILLUMINATION
[594] = "%.1f", -- SPS_LAUNCH
[598] = "%.1f", -- GUV_BOX
[701] = "%.1f", -- GUV_LAUNCH
-- SARPP == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == =
[193] = "%.1f", -- SARPP_switch
-- SAU == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == ==
[546] = "%.f", -- SAU_stabilization_LIGHT
[547] = "%.f", -- SAU_privedenie_LIGHT
[544] = "%.f", -- SAU_landing_COMMAND_LIGHT
[545] = "%.f", -- SAU_landing_AUTO_LIGHT
-- ARU == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == =
[64] = "%.1f", -- ARU_3G_instrument
-- KONUS == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == =
[66] = "%.1f", -- KONUS_UPES_3_instrument
-- DRAG CHUTE == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == ==
[550] = "%.f", -- GUN_GOTOVN_LIGHT
-- SPO == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == =
[601] = "%.f", -- SPO_L_F
[602] = "%.f", -- SPO_R_F
[603] = "%.f", -- SPO_R_B
[604] = "%.f", -- SPO_L_B
[605] = "%.f", -- SPO_MUTED
-- SOD == == == == == == == == == == == == == == == == == == == == == == == == == == == == == ==
[606] = "%.1f", -- SOD_ANSWER
[607] = "%.1f", -- SRZO_ON
[608] = "%.1f", -- SRZO_CODE
[609] = "%.1f", -- SRZO_CIPH
[611] = "%.1f", -- SRZO_ERROR
[613] = "%.1f", -- ASP_BACKLIGHT_ON
[614] = "%.1f", -- ASP_BACKLIGHT_INTENSITY
[618] = "%.1f", -- NEEDLES_PHOSPHOR_LIGHT
[152] = "%.1f", -- RED_PANELLIGHT
[619] = "%.1f", -- RED_FLOODLIGHT
[620] = "%.1f", -- WHITE_PANELLIGHT
[621] = "%.1f", -- RED_INSTRUMENT
[622] = "%.1f", -- ASP_GLASS_LIGHT_INTENSITY
[652] = "%.4f", -- H_indicator_needle_max
[655] = "%.4f", -- COCKPIT_PRESSURE_ALTIMETER
[656] = "%.4f", -- COCKPIT_PRESSURE
-- Clock == == == == == == == == == == == == == == == == == == == == == == == == == == == == == ==
-- currtimeHours; currtimeMinutes; currtimeSeconds; flightTimeMeterStatus;
-- flightHours;flightMinutes; secondsMeterTimeMinutes; secondsMeterTimeSeconds;
-- 115; 116; 117; 118; 119; 120; 121; 122;
[115] = "%.4f", -- currtimeHours
[116] = "%.4f", -- currtimeMinutes
[117] = "%.4f", -- currtimeSeconds
[118] = "%.4f", -- flightTimeMeterStatus
[119] = "%.4f", -- flightHours
[120] = "%.4f", -- flightMinutes
[121] = "%.4f", -- secondsMeterTimeMinutes
[122] = "%.4f", -- secondsMeterTimeSeconds
}
ExportScript.ConfigArguments =
{
--[[
arguments for export in low tick interval
based on "clickabledata.lua"
]]
-- cockpit mechanics
--[718] = "%.1f", -- Canopy Switch, OPEN/OFF/CLOSE {-1.0, 1.0}
--[818] = "%.1f", -- Emergency Jettison Handle, IN/OUT {0.0, 1.0}
-- DC & AC buses & giro devices
[165] = "%.1f", -- Battery On/Off
[155] = "%.1f", -- Battery Heat On/Off
[166] = "%.1f", -- DC Generator On/Off
[169] = "%.1f", -- AC Generator On/Off
[153] = "%.1f", -- PO-750 Inverter #1 On/Off
[154] = "%.1f", -- PO-750 Inverter #2 On/Off
[164] = "%.1f", -- Emergency Inverter
-- GIRO
[162] = "%.1f", -- Giro, NPP, SAU, RLS Signal, KPP Power On/Off
[163] = "%.1f", -- DA-200 Signal, Giro, NPP, RLS, SAU Power On/Off
-- FUEL_PUMPS & FUEL_SYSTEM (merged)
[159] = "%.1f", -- Fuel Tanks 3rd Group, Fuel Pump
[160] = "%.1f", -- Fuel Tanks 1st Group, Fuel Pump
[161] = "%.1f", -- Drain Fuel Tank, Fuel Pump
[274] = "%.1f", -- Fuel Quantity Set
-- ENGINE START DEVICE
[302] = "%.1f", -- APU On/Off
[288] = "%.1f", -- Engine Cold / Normal Start
[289] = "%.1f", -- Start Engine
[301] = "%.1f", -- Engine Emergency Air Start
[616] = "%.1f", -- Engine Stop/Lock
-- ACCELEROMETER
[228] = "%.1f", -- Accelerometer Reset
-- PITOT TUBES and related things that use dc bus for heating
[229] = "%.1f", -- Pitot tube Selector Main/Emergency
[279] = "%.1f", -- Pitot tube/Periscope/Clock Heat
[280] = "%.1f", -- Secondary Pitot Tube Heat
-- DA-200
[261] = "%.1f", -- Variometer Set
-- ENGINE
[308] = "%.1f", -- Anti surge doors - Auto/Manual
[300] = "%.1f", -- Afterburner/Maximum Off/On
[320] = "%.1f", -- Emergency Afterburner Off/On
-- FIRE EXTINGUISHER
[303] = "%.1f", -- Fire Extinguisher Off/On
[324] = "%.1f", -- Fire Extinguisher Cover
[325] = "%.1f", -- Fire Extinguisher
-- LIGHTS
[612] = "%.1f", -- Cockpit Texts Back-light default_axis
[156] = "%.1f", -- Instruments Back-light default_axis
[157] = "%.1f", -- Main Red Lights default_axis
[222] = "%.1f", -- Main White Lights default_axis
[194] = "%.1f", -- Navigation Lights Off/Min/Med/Max
[323] = "%.1f", -- Landing Lights Off/Taxi/Land
-- LIGHTS WARNING
[195] = "%.1f", -- CheckWarningLights11
[196] = "%.1f", -- CheckWarningLights21
[273] = "%.1f", -- CheckWarningLights31
[282] = "%.1f", -- CheckWarningLights41
[283] = "%.1f", -- CheckWarningLights51
[322] = "%.1f", -- CheckWarningLights61
[657] = "%.1f", -- SORC
-- Radio
[173] = "%.1f", -- Radio System On/Off
[208] = "%.1f", -- Radio / Compass
[209] = "%.1f", -- Squelch On/Off
[210] = "%.1f", -- Radio Volume
[211] = "%.1f", -- Radio Channel
[315] = "%.1f", -- Radio PTT
-- ARK
[174] = "%.1f", -- ARK On/Off
[198] = "%.1f", -- ARK Sound
[212] = "%.1f", -- ARK Change
[189] = "%.1f", -- ARK Zone
[197] = "%.1f", -- ARK Mode - Antenna / Compass
[254] = "%.1f", -- Marker Far/Near
-- RSBN
[176] = "%.1f", -- RSBN On/Off
[240] = "%.1f", -- RSBN Mode Land/Navigation/Descend
[340] = "%.1f", -- RSBN / ARK
[294] = "%.1f", -- RSBN Identify
[347] = "%.1f", -- RSBN self-test
--RSBN Panel
[345] = "%.1f", -- RSBN Sound
[351] = "%.1f", -- RSBN Navigation
[352] = "%.1f", -- PRMG Landing
[366] = "%.1f", -- RSBN Reset
[367] = "%.1f", -- RSBN Bearing
[368] = "%.1f", -- RSBN Distance
-- SAU
[179] = "%.1f", -- SAU On/Off
[180] = "%.1f", -- SAU Pitch On/Off
[343] = "%.1f", -- SAU - Stabilize
[376] = "%.1f", -- SAU cancel current mode
[377] = "%.1f", -- SAU - Recovery
[344] = "%.1f", -- SAU Preset - Limit Altitude
[341] = "%.1f", -- SAU - Landing - Command
[342] = "%.1f", -- SAU - Landing - Auto
[348] = "%.1f", -- SAU Reset/Off
-- SPO
[202] = "%.1f", -- SPO-10 RWR On/Off
[226] = "%.1f", -- SPO-10 Test
[227] = "%.1f", -- SPO-10 Night / Day
[225] = "%.1f", -- SPO-10 Volume
-- SRZO IFF
[188] = "%.1f", -- SRZO IFF Coder/Decoder On/Off
[192] = "%.1f", -- SRZO Codes
[346] = "%.1f", -- IFF System 'Type 81' On/Off
[190] = "%.1f", -- Emergency Transmitter Cover
[191] = "%.1f", -- Emergency Transmitter On/Off
[427] = "%.1f", -- SRZO Self Destruct Cover
[428] = "%.1f", -- SRZO Self Destruct
-- SOD
[200] = "%.1f", -- SOD IFF On/Off
[199] = "%.1f", -- SOD Identify
[201] = "%.1f", -- SOD Wave Selector 3/1/2
[204] = "%.1f", -- SOD Modes
-- RADAR
[205] = "%.1f", -- Radar Off/Prep/On
[206] = "%.1f", -- Low Altitude Off/Comp/On
[207] = "%.1f", -- Locked Beam On/Off
[266] = "%.1f", -- Radar Screen Magnetic Reset
[330] = "%.1f", -- Radar Interferes - Continues
[331] = "%.1f", -- Radar Interferes - Temporary
[332] = "%.1f", -- Radar Interferes - Passive
[333] = "%.1f", -- Radar Interferes - Weather
[334] = "%.1f", -- Radar Interferes - IFF
[335] = "%.1f", -- Radar Interferes - Low Speed
[336] = "%.1f", -- Radar Interferes - Self-test
[337] = "%.1f", -- Radar Interferes - Reset
[378] = "%.1f", -- Lock Target
[623] = "%.1f", -- Radar Polar Filter
-- SPRD
[167] = "%.1f", -- SPRD (RATO) System On/Off
[168] = "%.1f", -- SPRD (RATO) Drop System On/Off
[252] = "%.1f", -- SPRD (RATO) Start Cover
[253] = "%.1f", -- SPRD (RATO) Start
[317] = "%.1f", -- SPRD (RATO)t Drop Cover
[318] = "%.1f", -- SPRD (RATO) Drop
-- CONTROL SYSTEM ------------- subsystems --------------------------------------------
-- SPS
[293] = "%.1f", -- SPS System Off/On
-- ARU
[295] = "%.1f", -- ARU System - Manual/Auto
[296] = "%.1f", -- ARU System - Low Speed/Neutral/High Speed
-- Airbrake
[316] = "%.1f", -- Airbrake - Out/In
-- Gear brakes
[299] = "%.1f", -- ABS Off/On
[238] = "%.1f", -- Nosegear Brake Off/On
[237] = "%.1f", -- Emergency Brake
-- Gears
[326] = "%.1f", -- Gear Handle Fixator
[327] = "%.1f", -- Gear Up/Neutral/Down
[223] = "%.1f", -- Main Gears Emergency Release Handle
[281] = "%.1f", -- Nose Gear Emergency Release Handle
-- Flaps
[311] = "%.1f", -- Flaps Neutral
[312] = "%.1f", -- Flaps Take-Off
[313] = "%.1f", -- Flaps Landing
[314] = "%.1f", -- Flaps Reset buttons
-- Drag chute
[298] = "%.1f", -- Release Drag Chute
[304] = "%.1f", -- Drop Drag Chute Cover
[305] = "%.1f", -- Drop Drag Chute
--TRIMMER
[172] = "%.1f", -- Trimmer On/Off
[379] = "%.1f", -- Trimmer Pitch Up/Down
-- KONUS
[170] = "%.1f", -- Nosecone On/Off
[309] = "%.1f", -- Nosecone Control - Manual/Auto
[236] = "%.1f", -- Nosecone manual position controller
-- SOPLO
[291] = "%.1f", -- Engine Nozzle 2 Position Emergency Control
--MAIN_HYDRO and BUSTER_HYDRO == == == == == == == == == == == == == == == == == == == TEMPORARY MERGED == == == == == == == == == == == == == == == == == == == == == ==
[171] = "%.1f", -- Emergency Hydraulic Pump On/Off
[319] = "%.1f", -- Aileron Booster - Off/On
--KPP
[177] = "%.1f", -- KPP Main/Emergency
[259] = "%.1f", -- KPP Cage
[260] = "%.1f", -- KPP Set
--IAS / TAS / KSI (NPP)
[178] = "%.1f", -- NPP On/Off
[258] = "%.1f", -- NPP Adjust
[263] = "%.1f", -- NPP Course set
-- ALTIMETER and radioALTIMETER
[175] = "%.1f", -- Radio Altimeter/Marker On/Off
[284] = "%.1f", -- Dangerous Altitude Warning Set
[262] = "%.1f", -- Altimeter pressure knob
-- OXYGENE_SYSTEM
[285] = "%.1f", -- Helmet Air Condition Off/On
[286] = "%.1f", -- Emergency Oxygen Off/On
[287] = "%.1f", -- Mixture/Oxygen
-- CANOPY
[328] = "%.1f", -- Hermetize Canopy
[329] = "%.1f", -- Secure Canopy
[375] = "%.1f", -- Canopy Open
[385] = "%.1f", -- Canopy Close
[239] = "%.1f", -- Canopy Anti Ice
[224] = "%.1f", -- Canopy Emergency Release Handle
[649] = "%.1f", -- Canopy Ventilation System
-- ASP Gunsight
[186] = "%.1f", -- ASP Optical sight On/Off
[241] = "%.1f", -- ASP Main Mode - Manual/Auto
[242] = "%.1f", -- ASP Mode - Bombardment/Shooting
[243] = "%.1f", -- ASP Mode - Missiles-Rockets/Gun
[244] = "%.1f", -- ASP Mode - Giro/Missile
[249] = "%.1f", -- Pipper On/Off
[250] = "%.1f", -- Fix net On/Off
[245] = "%.1f", -- Target Size
[246] = "%.1f", -- Intercept Angle
[247] = "%.1f", -- Scale Backlights control
[248] = "%.1f", -- Pipper light control
[251] = "%.1f", -- Fix Net light control
[384] = "%.1f", -- TDC Range / Pipper Span control
-- WEAPON_CONTROL
[181] = "%.1f", -- Missiles - Rockets Heat On/Off
[182] = "%.1f", -- Missiles - Rockets Launch On/Off
[183] = "%.1f", -- Pylon 1-2 Power On/Off
[184] = "%.1f", -- Pylon 3-4 Power On/Off
[185] = "%.1f", -- GS-23 Gun On/Off
[187] = "%.1f", -- Guncam On/Off
[277] = "%.1f", -- Tactical Drop Cover
[278] = "%.1f", -- Tactical Drop
[275] = "%.1f", -- Emergency Missile/Rocket Launcher Cover
[276] = "%.1f", -- Emergency Missile/Rocket Launcher
[256] = "%.1f", -- Drop Wing Fuel Tanks Cover
[257] = "%.1f", -- Drop Wing Fuel Tanks
[386] = "%.1f", -- Drop Center Fuel Tank
[269] = "%.1f", -- Drop Payload - Outer Pylons Cover
[270] = "%.1f", -- Drop Payload - Outer Pylons
[271] = "%.1f", -- Drop Payload - Inner Pylons Cover
[272] = "%.1f", -- Drop Payload - Inner Pylons
[230] = "%.1f", -- Weapon Mode - Air/Ground
[231] = "%.1f", -- Weapon Mode - IR Missile/Neutral/SAR Missile
[232] = "%.1f", -- Activate Gun Loading Pyro - 1
[233] = "%.1f", -- Activate Gun Loading Pyro - 2
[234] = "%.1f", -- Activate Gun Loading Pyro - 3
[235] = "%.1f", -- Weapon Selector
[297] = "%.1f", -- Missile Seeker Sound
[381] = "%.1f", -- Fire Gun
[382] = "%.1f", -- Release Weapon
[383] = "%.1f", -- Release Weapon Cover
-- HELMET_VISOR
[306] = "%.1f", -- Helmet Heat - Manual/Auto
[310] = "%.1f", -- Helmet Quick Heat
[369] = "%.1f", -- Helmet visor - off/on
-- AIR CONDITIONING
[292] = "%.1f", -- Cockpit Air Condition Off/Cold/Auto/Warm
-- SARPP
[193] = "%.1f", -- SARPP-12 Flight Data Recorder On/Off
-- Flight Control
-- Dummy buttons/switches
[632] = "%.1f", -- Radar emission - Cover
[633] = "%.1f", -- Radar emission - Combat/Training
[634] = "%.1f", -- G-Suit Max/Min valve
[635] = "%.1f", -- Electric Bus Nr.1 - Cover
[636] = "%.1f", -- Electric Bus Nr.1
[637] = "%.1f", -- Electric Bus Nr.2
[638] = "%.1f", -- 1.7 Mach Test Button - Cover
[639] = "%.1f", -- 1.7 Mach Test Button
[640] = "%.1f", -- BU-45 Buster System Separation
[642] = "%.1f", -- SOD Control PBU-1
[641] = "%.1f", -- SOD Control PBU-2
[643] = "%.1f", -- Eject
[644] = "%.1f", -- Ejection Seat Emergency Oxygen
[645] = "%.1f", -- UK-2M Mic Amplifier M/L
[646] = "%.1f", -- UK-2M Mic Amplifier GS/KM
[647] = "%.1f", -- Suit Ventilation
[648] = "%.1f", -- Harness Separation
[650] = "%.1f", -- Harness Loose/Tight
[651] = "%.1f", -- Throttle Fixation
-- IAB PBK-3
[387] = "%.1f", -- Emergency Jettison
[388] = "%.1f", -- Emergency Jettison Armed / Not Armed
[389] = "%.1f", -- Tactical Jettison
[390] = "%.1f", -- Special AB / Missile-Rocket-Bombs-Cannon
[391] = "%.1f", -- Brake Chute
[392] = "%.1f", -- Detonation Air / Ground
-- SPS 141-100
[393] = "%.1f", -- "On / Off"
[394] = "%.1f", -- Transmit / Receive
[395] = "%.1f", -- Program I / II
[396] = "%.1f", -- Continuous / Impuls
[397] = "%.1f", -- Test
[398] = "%.1f", -- Dispenser Auto / Manual
[399] = "%.1f", -- Off / Parallel / Full
[400] = "%.1f", -- Manual Activation button - Cover
[401] = "%.1f", -- Manual Activation button
-- GUV Control Box -/N/ GUV is useless, it's mostly anti-infantry weapon
[420] = "%.1f", -- On / Off
[421] = "%.1f", -- MAIN GUN / UPK Guns
[422] = "%.1f", -- LOAD 1
[425] = "%.1f", -- LOAD 2
[424] = "%.1f", -- LOAD 3
}
-----------------------------
-- HIGH IMPORTANCE EXPORTS --
-- done every export event --
-----------------------------
-- Pointed to by ProcessIkarusDCSHighImportance
function ExportScript.ProcessIkarusDCSConfigHighImportance(mainPanelDevice)
--[[
every frame export to Ikarus
Example from A-10C
Get Radio Frequencies
get data from device
local lUHFRadio = GetDevice(54)
ExportScript.Tools.SendData("ExportID", "Format")
ExportScript.Tools.SendData(2000, string.format("%7.3f", lUHFRadio:get_frequency()/1000000)) <- special function for get frequency data
]]
-- ADI/KPP correction
ExportScript.Tools.SendData(565, string.format("%.4f", (mainPanelDevice:get_argument_value(565) * 3))) -- RSBN_KPP_kurs_director
ExportScript.Tools.SendData(566, string.format("%.4f", (mainPanelDevice:get_argument_value(566) * 3))) -- RSBN_KPP_glisada_director
-- HSI/NPP correction
ExportScript.Tools.SendData(36, string.format("%.4f", (mainPanelDevice:get_argument_value(36) - 0.5)))
end
function ExportScript.ProcessDACConfigHighImportance(mainPanelDevice)
--[[
every frame export to DAC
Example from A-10C
Get Radio Frequencies
get data from device
local UHF_RADIO = GetDevice(54)
ExportScript.Tools.SendDataDAC("ExportID", "Format")
ExportScript.Tools.SendDataDAC("ExportID", "Format", HardwareConfigID)
ExportScript.Tools.SendDataDAC("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000))
ExportScript.Tools.SendDataDAC("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000), 2) -- export to Hardware '2' Config
]]
end
-----------------------------------------------------
-- LOW IMPORTANCE EXPORTS --
-- done every gExportLowTickInterval export events --
-----------------------------------------------------
-- Pointed to by ExportScript.ProcessIkarusDCSConfigLowImportance
function ExportScript.ProcessIkarusDCSConfigLowImportance(mainPanelDevice)
--[[
export in low tick interval to Ikarus
Example from A-10C
Get Radio Frequencies
get data from device
local lUHFRadio = GetDevice(54)
ExportScript.Tools.SendData("ExportID", "Format")
ExportScript.Tools.SendData(2000, string.format("%7.3f", lUHFRadio:get_frequency()/1000000)) <- special function for get frequency data
]]
end
function ExportScript.ProcessDACConfigLowImportance(mainPanelDevice)
--[[
every frame export to hardware
Example from A-10C
Get Radio Frequencies
get data from device
local UHF_RADIO = GetDevice(54)
ExportScript.Tools.SendDataDAC("ExportID", "Format")
ExportScript.Tools.SendDataDAC("ExportID", "Format", HardwareConfigID)
ExportScript.Tools.SendDataDAC("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000))
ExportScript.Tools.SendDataDAC("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000), 2) -- export to Hardware '2' Config
]]
--=====================================================================================
--[[
ExportScript.Tools.WriteToLog('list_cockpit_params(): '..ExportScript.Tools.dump(list_cockpit_params()))
ExportScript.Tools.WriteToLog('CMSP: '..ExportScript.Tools.dump(list_indication(7)))
local ltmp1 = 0
for ltmp2 = 0, 13, 1 do
ltmp1 = list_indication(ltmp2)
ExportScript.Tools.WriteToLog(ltmp2..': '..ExportScript.Tools.dump(ltmp1))
--ExportScript.Tools.WriteToLog(ltmp2..' (metatable): '..ExportScript.Tools.dump(getmetatable(ltmp1)))
end
]]
--[[
local ltmp1 = 0
for ltmp2 = 1, 73, 1 do
ltmp1 = GetDevice(ltmp2)
ExportScript.Tools.WriteToLog(ltmp2..': '..ExportScript.Tools.dump(ltmp1))
ExportScript.Tools.WriteToLog(ltmp2..' (metatable): '..ExportScript.Tools.dump(getmetatable(ltmp1)))
end
]]
end
-----------------------------
-- Custom functions --
-----------------------------
function ExportScript.genericRadio(key, value, hardware)
end

View File

@@ -0,0 +1,841 @@
-- MiG-29A Export
-- Version 0.9.9 BETA
gES_FoundFCModule = true
-- auxiliary function
dofile(gES_ExportModulePath.."FC_AuxiliaryFuntions.lua")
-----------------------------------------
-- FLAMING CLIFFS AIRCRAFT / MiG-29A --
-- FC aircraft don't support GetDevice --
-----------------------------------------
function ProcessGlassCockpitFCHighImportanceConfig()
local myData = LoGetSelfData()
if (myData) then
local lLatitude = myData.LatLongAlt.Lat -- LATITUDE
local lLongitude = myData.LatLongAlt.Long -- LONGITUDE
local lBasicAtmospherePressure = LoGetBasicAtmospherePressure() -- BAROMETRIC PRESSURE
local lAltBar = LoGetAltitudeAboveSeaLevel() -- ALTITUDE SEA LEVEL (Meter)
local lAltRad = LoGetAltitudeAboveGroundLevel() -- ALTITUDE GROUND LEVEL (Meter)
--local lTrueAirSpeed = LoGetTrueAirSpeed() -- TRUE AIRSPEED (Meter/Second)
local lPitch, lBank, lYaw = LoGetADIPitchBankYaw() -- PITCH, BANK, YAW (Radian)
local lHeading = myData.Heading -- HEADING (Radian)
local lVVI = LoGetVerticalVelocity() -- VERTICAL SPEED (Meter/Second)
local lIAS = LoGetIndicatedAirSpeed() -- INDICATED AIRSPEED (Meter/Second)
local lMachNumber = LoGetMachNumber() -- MACH
local lAoA = LoGetAngleOfAttack() -- ANGLE OF ATTACK AoA (Radian)
local lGlide = LoGetGlideDeviation() -- VOR1 HORIZONTAL DEFLECTION (-1 +1)
local lSide = LoGetSideDeviation() -- VOR1 VERTICAL DEFLECTION (-1 +1)
--local lSlipBallPosition = LoGetSlipBallPosition() -- SLIP BALL (-1 +1)
--local lAccelerationUnits = LoGetAccelerationUnits().y -- G-LOAD
--local lNavInfoPitch = LoGetNavigationInfo().Requirements.pitch -- AP REQUIRED PITCH (Radian)
--local lNavInfoRoll = LoGetNavigationInfo().Requirements.roll -- AP REQUIRED BANK (Radian)
--local lNavInfoSpeed = LoGetNavigationInfo().Requirements.speed -- AP SPEED (Meter/Second)
--local lNavInfoAltitude = LoGetNavigationInfo().Requirements.altitude -- AP ALTITUDE (Meter)
--local lNavInfoVerticalSpeed = LoGetNavigationInfo().Requirements.vertical_speed -- AP VERTICAL SPEED (Meter/Second)
--local lControlPanel_HSI = LoGetControlPanel_HSI() -- HSI Data
local lHSI_RMI = LoGetControlPanel_HSI().RMI_raw -- VOR1 OBS (Radian)
local lHSI_ADF = LoGetControlPanel_HSI().ADF_raw -- ADF OBS (Radian)
--local lHSI_Heading = LoGetControlPanel_HSI().Heading_raw -- Heading (Radian)
local lEngineRPMleft = LoGetEngineInfo().RPM.left -- ENG1 RPM %
local lEngineRPMright = LoGetEngineInfo().RPM.right -- ENG2 RPM %
local lEngineTempLeft = LoGetEngineInfo().Temperature.left -- ENG1 EGT ºC
local lEngineTempRight = LoGetEngineInfo().Temperature.right -- ENG2 EGT ºC
--local lEngineFuelInternal = LoGetEngineInfo().fuel_internal -- TANK1 (INT) (KG)
--local lEngineFuelExternal = LoGetEngineInfo().fuel_external -- TANK2 (EXT) (KG)
--local lMechInfo = LoGetMechInfo() -- mechanical components, e.g. Flaps, Wheelbrakes,...
--local lPayloadInfo = LoGetPayloadInfo() -- Paylod, e.g. bombs, guns, rockets, fuel tanks,...
local lDistanceToWay = 999
local lRoute = LoGetRoute()
if (myData and lRoute) then -- if neither are nil
local myLoc = LoGeoCoordinatesToLoCoordinates(lLongitude, lLatitude)
--lDistanceToWay = math.sqrt((myLoc.x - lRoute.goto_point.world_point.x)^2 + (myLoc.y - lRoute.goto_point.world_point.y)^2)
lDistanceToWay = math.sqrt((myLoc.x - lRoute.goto_point.world_point.x)^2 + (myLoc.z - lRoute.goto_point.world_point.z)^2)
end
if gES_GlassCockpitType == 1 then
-- HELIOS Version 1.3
-- customizing for HELOS
lPitch = math.deg(lPitch) -- PITCH, (Radian to Grad)
lBank = math.deg(lBank) -- BANK (Radian to Grad)
lYaw = math.deg(lYaw) -- YAW (Radian to Grad)
lHSI_RMI = math.deg(lHSI_RMI) -- VOR1 OBS (Radian to Grad)
lHSI_ADF = math.deg(lHSI_ADF) -- ADF OBS (Radian to Grad)
lAoA = math.deg(lAoA) -- ANGLE OF ATTACK AoA (Radian to Grad)
lHeading = math.deg(lHeading) -- Heading (Radian to Grad)
lHSI_ADF = (360 - lHSI_ADF) + (360 - lHeading)
lHSI_RMI = 360 - lHSI_RMI
lIAS = lIAS * 3.6 -- change from m/s to km/h
SendData("1", string.format("%.2f", lPitch) )
SendData("2", string.format("%.2f", lBank) )
SendData("3", string.format("%.2f", lYaw) )
SendData("4", string.format("%.2f", lAltBar) )
SendData("5", string.format("%.2f", lAltRad) )
SendData("6", string.format("%.2f", lHSI_ADF) )
SendData("7", string.format("%.2f", lHSI_RMI) )
SendData("8", string.format("%.2f", lHeading) )
SendData("9", string.format("%.2f", lEngineRPMleft) )
SendData("10", string.format("%.2f", lEngineRPMright) )
SendData("11", string.format("%.2f", lEngineTempLeft) )
SendData("12", string.format("%.2f", lEngineTempRight) )
SendData("13", string.format("%.2f", lVVI) )
SendData("14", string.format("%.2f", lIAS) )
SendData("15", string.format("%.2f", lDistanceToWay) )
SendData("16", string.format("%.2f", lAoA) )
SendData("17", string.format("%.2f", lGlide) )
SendData("18", string.format("%.2f", lSide) )
elseif gES_GlassCockpitType == 2 then
-- HawgTouch version 1.6
local lRadToDCSsignd = math.pi
local lRadToDCSunsignd = math.pi * 2
local lDefaultNull = 0.0
local lDefaultOne = 1.0
-- IAS Indicator (IAS, Thousend) {"%.4f;%.4f"}
FC_Russian_AirSpeed_1000hkm(1)
-- AOA Indicator and Accelerometer (AOA, GLoad)
FC_Russian_AOA_MiG29(3)
-- ADI
FC_Russian_ADI_Old(4)
-- HSI
FC_Russian_HSI(lDistanceToWay, 5)
-- Vertical Velocity Indicator (VVI) (VVI, TurnIndicator, SlipBallPosition)
FC_Russian_VVI_Old(6)
-- Radar Altimeter (AltRad, MinAltitude, WarningFlag, MinAltitudeLamp) {"%.4f;%.4f;%.1f;%.1f"} (below 100m is warning light on)
FC_Russian_RadarAltimeter_1000m(100, 7)
-- Barometric Altimeter (AltBar, BasicAtmospherePressure)
FC_Russian_BarometricAltimeter_30000(8)
-- Tachometer (RPM) (EngineRPMleft, EngineRPMright) {"%.4f;%.4f"}
FC_Russian_EngineRPM(9)
-- Left Jet Engine Turbine Temperature Indicator (EngineTemp) {"%.4f"}
FC_Russian_EGT_1000gc(lEngineTempLeft + 80, 10) -- differenc fromtechnical temperature to showing temperature
-- Right Jet Engine Turbine Temperature Indicator (EngineTemp) {"%.4f"}
FC_Russian_EGT_1000gc(lEngineTempRight + 80, 11)
-- Clock from Ka-50 {CurrentHours, CurrentMinutes, CurrentSeconds, 0, FlightTimeHours, FlightTimeMinutes, 0, 0) {"%.4f;%.4f;%.4f;%.1f;%.4f;%.4f;%.4f;%.4f"}
FC_Russian_Clock_ACS1(12)
-- Mach {max, Mach}
local lMachTmp = 0
--[[
y_min = 0.0 -- minimaler Ausgabewert
y_max = 1.0 -- maximaler Ausgabewert
x_min = 0.0 -- minimaler Eingangswert
x_max = 3.0 -- maximaler Eingangswert
x = 1.65 -- aktueller Eingangswert
d_y = 1.0 -- Delta Ausgabewerte (y_max - y_min)
d_x = 3.0 -- Delta Eingangswerte (x_max - x_min)
m = 0.33333333333333333333333333333333 -- Steigung der linearen Funktion (d_y / d_x)
n = 0.00000000000000000000000000000001 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max)
y = 0.55 -- Ergebnis (m * x + n)
]]
lMachTmp = 0.33333333333333333333333333333333 * lMachNumber + 0.00000000000000000000000000000001
SendData("13", string.format("%0.4f;%0.4f", lMachTmp, 0.0))
end
else
WriteToLog("Unknown FC Error, no LoGetSelfData.")
end
end
function ProcessHARDWAREConfigHighImportance(mainPanelDevice)
end
function ProcessGlassCockpitFCLowImportanceConfig()
if gES_GlassCockpitType == 1 then
-- HELIOS Version 1.3
elseif gES_GlassCockpitType == 2 then
-- HawgTouch version 1.6
FC_RadarWarning_SPO15(14)
-- Fuel Quantity Indicator
local lEngineInfo = LoGetEngineInfo()
if lEngineInfo ~= nil then
--WriteToLog('lEngineInfo: '..dump(lEngineInfo))
--[[
[fuel_external] = number: "0"
[Temperature] = {
[left] = number: "626.99444580078"
[right] = number: "626.99444580078"
}
[RPM] = {
[left] = number: "87.453765869141"
[right] = number: "87.453758239746"
}
[FuelConsumption] = {
[left] = number: "0.1500396137767"
[right] = number: "0.1500396137767"
}
[fuel_internal] = number: "3773.2749023438"
[EngineStart] = {
[left] = number: "0"
[right] = number: "0"
}
[HydraulicPressure] = {
[left] = number: "210"
[right] = number: "210"
}
lPayloadInfo.Stations[8].CLSID == E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF -- ext 800l Fuel Tank
]]
local lTotalFuel = lEngineInfo.fuel_internal + lEngineInfo.fuel_external
--local lTotalFuel = string.format("%3d", math.round((lEngineInfo.fuel_internal / 10), 0, "ceil") * 10)
--local lTotalFuel = string.format("%4d", lEngineInfo.fuel_internal) -- total fuel in kg
--local lTotalFuel = string.format("%4d", lEngineInfo.fuel_external) -- external fuel in kg
local lTotalFuel_7_5 = 0
local lTotalFuel_5_0 = 0
if lTotalFuel < 7500 then
if lTotalFuel > 5000 then
--[[
y_min = 0.0 -- minimaler Ausgabewert
y_max = 1.0 -- maximaler Ausgabewert
x_min = 5000 -- minimaler Eingangswert
x_max = 7500 -- maximaler Eingangswert
x = 6000 -- aktueller Eingangswert
d_y = 1 -- Delta Ausgabewerte (y_max - y_min)
d_x = 2500 -- Delta Eingangswerte (x_max - x_min)
m = 0.0004 -- Steigung der linearen Funktion (d_y / d_x)
n = -2.0 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max)
y = 0.4 -- Ergebnis (m * x + n)
]]
lTotalFuel_7_5 = 0.0004 * lTotalFuel + -2.0
else
lTotalFuel_7_5 = 0.0
end
else
lTotalFuel_7_5 = 1.0
end
if lTotalFuel < 5000 then
--[[
y_min = 0.04 -- minimaler Ausgabewert
y_max = 1.0 -- maximaler Ausgabewert
x_min = 0 -- minimaler Eingangswert
x_max = 5000 -- maximaler Eingangswert
x = 3000 -- aktueller Eingangswert
d_y = 0.96 -- Delta Ausgabewerte (y_max - y_min)
d_x = 5000 -- Delta Eingangswerte (x_max - x_min)
m = 0.000192 -- Steigung der linearen Funktion (d_y / d_x)
n = 0.04 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max)
y = 0.616 -- Ergebnis (m * x + n)
]]
lTotalFuel_5_0 = 0.000192 * lTotalFuel + 0.04
else
lTotalFuel_5_0 = 1.0
end
-- TotalFuel_5_0
-- TotalFuel_7_5
-- Light1
-- Light2
-- Light3
-- Light4
-- BingoLight
SendData("15", string.format("%0.4f;%0.4f;%d;%d;%d;%d;%d",
lTotalFuel_5_0,
lTotalFuel_7_5,
0,
(lEngineInfo.fuel_internal < 3200.0 and 1 or 0), -- Tank warning 1
(lEngineInfo.fuel_internal < 2800.0 and 1 or 0), -- Tank warning 2
(lEngineInfo.fuel_internal < 1400.0 and 1 or 0), -- Tank warning 3
(lEngineInfo.fuel_internal < 800.0 and 1 or 0))) -- Tank warning 4
-- Hydraulic Pressure Left
FC_OneNeedleGauge(lEngineInfo.HydraulicPressure.left, 240, 17)
-- Hydraulic Pressure Right
FC_OneNeedleGauge(lEngineInfo.HydraulicPressure.right, 240, 18)
end
-- EKRAN Message
FC_EKRAN(16)
-- Mechanical Configuration Indicator (GearWarningLight, NoseGear, LeftGear, RightGear, Airbreaks, Flaps1, Flaps2) {"%.1f;%d;%d;%d;%d;%d;%d"}
local lMechInfo = LoGetMechInfo() -- mechanical components, e.g. Flaps, Wheelbrakes,...
if lMechInfo ~= nil then
--WriteToLog('lMechInfo: '..dump(lMechInfo))
local lWarningLight = 0.0
local lTrueAirSpeed = LoGetTrueAirSpeed()
if lTrueAirSpeed ~= nil then
--WriteToLog('lTrueAirSpeed: '..dump(lTrueAirSpeed))
lWarningLight = ((lMechInfo.flaps.value > 0.93 and lTrueAirSpeed > 340) and 1.0 or 0.0) -- Speed Warning for Flaps, same light as gear warning light, but blinking light
lWarningLight = (((lMechInfo.gear.status == 1 and lMechInfo.gear.value < 1) or (lMechInfo.gear.status == 0 and lMechInfo.gear.value > 0)) and 1.0 or lWarningLight ) -- gear warning light
end
-- WarningLight {0.0 = Off, 0.1 = blinking light, 0.2 = on}
-- WarningLight {0.0 = Off, no blinking light, 1.0 = on}
-- left gear {0, 1}
-- right gear {0, 1}
-- nose gear {0, 1}
-- WarningLight
-- Flap 1
-- Flap 2
-- Nose Flap
-- Speedbreakes on {0, 1}
SendData("2", string.format("%.1f;%d;%d;%d;%d;%d;%d",
(lMechInfo.gear.value > 0.95 and 1 or 0), -- left gear
(lMechInfo.gear.value == 1 and 1 or 0), -- right gear
(lMechInfo.gear.value > 0.85 and 1 or 0), -- nose gear
lWarningLight,
-- (lMechInfo.flaps.value > 0.47 and 1 or 0), -- flap 1
-- (lMechInfo.flaps.value > 0.93 and 1 or 0), -- flap 2
(lMechInfo.flaps.status == 1 and 1 or 0), -- flap 1
(lMechInfo.flaps.status == 2 and 1 or 0), -- flap 2
(lMechInfo.noseflap.value > 0.1 and 1 or 0), -- noseflap
(lMechInfo.speedbrakes.status == 1 and 1 or 0))) -- speedbreakes on > 0.1 (0 - 1)
-- Wheelbrakes Hydraulic Pressure Left
FC_OneNeedleGauge(lMechInfo.wheelbrakes.value, 240, 19)
-- Wheelbrakes Hydraulic Pressure Right
FC_OneNeedleGauge(lMechInfo.wheelbrakes.value, 240, 20)
end
-- Airintake
FC_Russian_AirIntake(21)
end
--(x < 0 and 'negative' or 'non-negative')
--[[
local lPayloadInfo = LoGetPayloadInfo()
WriteToLog('lPayloadInfo: '..dump(lPayloadInfo))
local lSnares = LoGetSnares() -- Flare and Chaff
WriteToLog('lSnares: '..dump(lSnares))
local lSightingSystemInfo = LoGetSightingSystemInfo()
WriteToLog('lSightingSystemInfo: '..dump(lSightingSystemInfo))
local lTWSInfo = LoGetTWSInfo() -- SPO Informationen, z.B. Radarwarner F15C
WriteToLog('lTWSInfo: '..dump(lTWSInfo))
local lTargetInformation = LoGetTargetInformation() -- detalierte Radar Infos z.B. F15C
WriteToLog('lTargetInformation: '..dump(lTargetInformation))
local lLockedTargetInformation = LoGetLockedTargetInformation()
WriteToLog('lLockedTargetInformation: '..dump(lLockedTargetInformation))
local lF15_TWS_Contacs = LoGetF15_TWS_Contacts() -- the same information but only for F-15 in TWS mode
WriteToLog('lF15_TWS_Contacs: '..dump(lF15_TWS_Contacs))
local lMechInfo = LoGetMechInfo() -- mechanical components, e.g. Flaps, Wheelbrakes,...
WriteToLog('lMechInfo: '..dump(lMechInfo))
local lMCPState = LoGetMCPState() -- Warnlichter
WriteToLog('lMCPState: '..dump(lMCPState))
local lControlPanel_HSI = LoGetControlPanel_HSI()
WriteToLog('lControlPanel_HSI: '..dump(lControlPanel_HSI))
local lRadioBeaconsStatus = LoGetRadioBeaconsStatus()
WriteToLog('lRadioBeaconsStatus: '..dump(lRadioBeaconsStatus))
local lEngineInfo = LoGetEngineInfo()
WriteToLog('lEngineInfo: '..dump(lEngineInfo))
]]
-- Weapon Control System
--local lNameByType = LoGetNameByType () -- args 4 (number : level1,level2,level3,level4), result string
-- values from LoGetTargetInformation().type
--WriteToLog('lNameByType: '..dump(lNameByType))
end
function ProcessHARDWAREConfigLowImportance(mainPanelDevice)
-- where necessary, specify HardwareID, example WeaponStatusPanel(2)
WeaponStatusPanel()
MechanicalDevicesIndicator()
StatusLamp()
FuelQuantityIndicator()
SightingSystem()
SPO15RWR()
FlareChaff()
end
-----------------------------
-- Custom functions --
-----------------------------
function SightingSystem(hardware)
local lHardware = hardware or 1
local lSightingSystemInfo = LoGetSightingSystemInfo()
if lSightingSystemInfo == nil then
return
end
--WriteToLog('lSightingSystemInfo: '..dump(lSightingSystemInfo)9
--[[
[PRF] = {
[selection] = string: "ILV"
[current] = string: "MED"
}
[laser_on] = boolean: "false"
[scale] = {
[azimuth] = number: "0.52359873056412"
[distance] = number: "10000"
}
[radar_on] = boolean: "false"
[optical_system_on] = boolean: "false"
[LaunchAuthorized] = boolean: "false"
[ECM_on] = boolean: "false"
[Manufacturer] = string: "RUS"
[TDC] = {
[y] = number: "0"
[x] = number: "0"
}
[ScanZone] = {
[coverage_H] = {
[min] = number: "0"
[max] = number: "20000"
}
[size] = {
[azimuth] = number: "1.0471974611282"
[elevation] = number: "0.17453290522099"
}
[position] = {
[exceeding_manual] = number: "0"
[distance_manual] = number: "0"
[azimuth] = number: "0"
[elevation] = number: "0"
}
}
]]
SendDataHW("600", lSightingSystemInfo.ECM_on == true and 1 or 0, lHardware )
SendDataHW("601", lSightingSystemInfo.laser_on == true and 1 or 0, lHardware )
SendDataHW("602", lSightingSystemInfo.optical_system_on == true and 1 or 0, lHardware )
SendDataHW("603", lSightingSystemInfo.LaunchAuthorized == true and 1 or 0, lHardware )
SendDataHW("604", lSightingSystemInfo.radar_on == true and 1 or 0, lHardware )
end
function FlareChaff(hardware)
local lHardware = hardware or 1
local lSnares = LoGetSnares() -- Flare and Chaff
--WriteToLog('lSnares: '..dump(lSnares))
--[chaff] = number: "30"
--[flare] = number: "30"
SendDataHW("800", lSnares.chaff + lSnares.flare, lHardware )
end
function StatusLamp(hardware)
local lHardware = hardware or 1
local lMCPState = LoGetMCPState() -- Warnlichter
if lMCPState == nil then
return
end
--WriteToLog('lMCPState: '..dump(lMCPState))
--[[
[RightTailPlaneFailure] = boolean: "false"
[EOSFailure] = boolean: "false"
[ECMFailure] = boolean: "false"
[RightAileronFailure] = boolean: "false"
[MasterWarning] = boolean: "false"
[RightEngineFailure] = boolean: "false"
[CannonFailure] = boolean: "false"
[MLWSFailure] = boolean: "false"
[ACSFailure] = boolean: "false"
[RadarFailure] = boolean: "false"
[HelmetFailure] = boolean: "false"
[HUDFailure] = boolean: "false"
[LeftMainPumpFailure] = boolean: "false"
[RightWingPumpFailure] = boolean: "false"
[LeftWingPumpFailure] = boolean: "false"
[MFDFailure] = boolean: "false"
[RWSFailure] = boolean: "false"
[GearFailure] = boolean: "false"
[HydraulicsFailure] = boolean: "false"
[AutopilotFailure] = boolean: "true"
[FuelTankDamage] = boolean: "false"
[LeftAileronFailure] = boolean: "false"
[CanopyOpen] = boolean: "false"
[RightMainPumpFailure] = boolean: "false"
[StallSignalization] = boolean: "false"
[LeftEngineFailure] = boolean: "false"
[AutopilotOn] = boolean: "false"
[LeftTailPlaneFailure] = boolean: "false"
]]
SendDataHW("700", lMCPState.LeftTailPlaneFailure == true and 1 or 0, lHardware )
SendDataHW("701", lMCPState.RightTailPlaneFailure == true and 1 or 0, lHardware )
SendDataHW("702", lMCPState.MasterWarning == true and 1 or 0, lHardware )
SendDataHW("703", lMCPState.LeftEngineFailure == true and 1 or 0, lHardware )
SendDataHW("704", lMCPState.RightEngineFailure == true and 1 or 0, lHardware )
SendDataHW("705", lMCPState.LeftAileronFailure == true and 1 or 0, lHardware )
SendDataHW("706", lMCPState.RightAileronFailure == true and 1 or 0, lHardware )
SendDataHW("707", lMCPState.LeftMainPumpFailure == true and 1 or 0, lHardware )
SendDataHW("708", lMCPState.RightMainPumpFailure == true and 1 or 0, lHardware )
SendDataHW("709", lMCPState.LeftWingPumpFailure == true and 1 or 0, lHardware )
SendDataHW("710", lMCPState.RightWingPumpFailure == true and 1 or 0, lHardware )
SendDataHW("711", lMCPState.EOSFailure == true and 1 or 0, lHardware )
SendDataHW("712", lMCPState.ECMFailure == true and 1 or 0, lHardware )
SendDataHW("713", lMCPState.CannonFailure == true and 1 or 0, lHardware )
SendDataHW("714", lMCPState.MLWSFailure == true and 1 or 0, lHardware )
SendDataHW("715", lMCPState.ACSFailure == true and 1 or 0, lHardware )
SendDataHW("716", lMCPState.RadarFailure == true and 1 or 0, lHardware )
SendDataHW("717", lMCPState.HelmetFailure == true and 1 or 0, lHardware )
SendDataHW("718", lMCPState.HUDFailure == true and 1 or 0, lHardware )
SendDataHW("719", lMCPState.MFDFailure == true and 1 or 0, lHardware )
SendDataHW("720", lMCPState.RWSFailure == true and 1 or 0, lHardware )
SendDataHW("721", lMCPState.GearFailure == true and 1 or 0, lHardware )
SendDataHW("722", lMCPState.HydraulicsFailure == true and 1 or 0, lHardware )
SendDataHW("723", lMCPState.AutopilotFailure == true and 1 or 0, lHardware )
SendDataHW("724", lMCPState.FuelTankDamage == true and 1 or 0, lHardware )
SendDataHW("725", lMCPState.CanopyOpen == true and 1 or 0, lHardware )
SendDataHW("726", lMCPState.StallSignalization == true and 1 or 0, lHardware )
SendDataHW("727", lMCPState.AutopilotOn == true and 1 or 0, lHardware )
local lEngineInfo = LoGetEngineInfo()
if lEngineInfo ~= nil then
--WriteToLog('lEngineInfo: '..dump(lEngineInfo))
SendDataHW("728", lEngineInfo.EngineStart.left, lHardware ) -- lamp start left engine 1 (0|1)
SendDataHW("729", lEngineInfo.EngineStart.right, lHardware ) -- lamp start right engine 1 (0|1)
SendDataHW("730", (lEngineInfo.RPM.left > 100.0 and 1 or 0), lHardware ) -- lamp after burner left engine
SendDataHW("731", (lEngineInfo.RPM.right > 100.0 and 1 or 0), lHardware ) -- lam after burner right engine
end
local lAccelerationUnits = LoGetAccelerationUnits()
if lAccelerationUnits ~= nil then
--WriteToLog('lAccelerationUnits: '..dump(lAccelerationUnits))
SendDataHW("732", (lAccelerationUnits.y > 8.0 and 1 or 0), lHardware ) -- lamp Over-G warning
end
end
function WeaponStatusPanel(hardware)
local lHardware = hardware or 1
-- The weapon status panel, quantity and readiness of the currently selected weapon and the remaining gun ammunition are indicated.
gES_PayloadInfo = LoGetPayloadInfo()
if gES_PayloadInfo == nil then
return
end
--WriteToLog('gES_PayloadInfo: '..dump(gES_PayloadInfo))
--[[ exsample
[Stations] = {
[1] = {
[CLSID] = string: "{FBC29BFE-3D24-4C64-B81D-941239D12249}"
[container] = boolean: "false"
[count] = number: "1"
[weapon] = {
[level3] = number: "7"
[level1] = number: "4"
[level4] = number: "18"
[level2] = number: "4"
}
}
[2] = {
[CLSID] = string: "{FBC29BFE-3D24-4C64-B81D-941239D12249}"
[container] = boolean: "false"
[count] = number: "1"
[weapon] = {
[level3] = number: "7"
[level1] = number: "4"
[level4] = number: "18"
[level2] = number: "4"
}
}
[3] = {
[CLSID] = string: "{B4C01D60-A8A3-4237-BD72-CA7655BC0FE9}"
[container] = boolean: "false"
[count] = number: "1"
[weapon] = {
[level3] = number: "7"
[level1] = number: "4"
[level4] = number: "19"
[level2] = number: "4"
}
}
[4] = {
[CLSID] = string: "{B4C01D60-A8A3-4237-BD72-CA7655BC0FE9}"
[container] = boolean: "false"
[count] = number: "1"
[weapon] = {
[level3] = number: "7"
[level1] = number: "4"
[level4] = number: "19"
[level2] = number: "4"
}
}
[5] = {
[CLSID] = string: "{B4C01D60-A8A3-4237-BD72-CA7655BC0FE9}"
[container] = boolean: "false"
[count] = number: "1"
[weapon] = {
[level3] = number: "7"
[level1] = number: "4"
[level4] = number: "19"
[level2] = number: "4"
}
}
[6] = {
[CLSID] = string: "{B4C01D60-A8A3-4237-BD72-CA7655BC0FE9}"
[container] = boolean: "false"
[count] = number: "1"
[weapon] = {
[level3] = number: "7"
[level1] = number: "4"
[level4] = number: "19"
[level2] = number: "4"
}
}
[7] = {
[CLSID] = string: "{2BEC576B-CDF5-4B7F-961F-B0FA4312B841}"
[container] = boolean: "false"
[count] = number: "1"
[weapon] = {
[level3] = number: "43"
[level1] = number: "1"
[level4] = number: "17"
[level2] = number: "3"
}
}
}
[CurrentStation] = number: "3"
[Cannon] = {
[shells] = number: "150"
}
]]
--[[
Weapon Panel
|
-------------------------------
| | | | | | |
1 2 3 C 4 5 6
]]
-- Payload Info
-- weapon stations (panel) 1 (left) - 10 (right), no lamp for center station
SendDataHW("100", gES_PayloadInfo.Cannon.shells ) -- count cannon shells
SendDataHW("101", (gES_PayloadInfo.Stations[1].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 1)
SendDataHW("111", (gES_PayloadInfo.Stations[2].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 6)
SendDataHW("102", (gES_PayloadInfo.Stations[3].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 2)
SendDataHW("103", (gES_PayloadInfo.Stations[4].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 5)
SendDataHW("104", (gES_PayloadInfo.Stations[5].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 3)
SendDataHW("105", (gES_PayloadInfo.Stations[6].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 4)
--SendDataHW("106", (gES_PayloadInfo.Stations[7].count > 0 and 1 or 0) ) -- weapon presend > 0 center station, not visible
--SendDataHW("CurrentStation", gES_PayloadInfo.CurrentStation )
-- defination
gES_TmpStationToPanel = {}
gES_TmpStationToPanel[1] = {Panel = 1, StationID = 101, CurrentID = 201, HardwareID = lHardware } -- left
gES_TmpStationToPanel[2] = {Panel = 6, StationID = 106, CurrentID = 206, HardwareID = lHardware } -- right
gES_TmpStationToPanel[3] = {Panel = 2, StationID = 102, CurrentID = 202, HardwareID = lHardware }
gES_TmpStationToPanel[4] = {Panel = 5, StationID = 103, CurrentID = 203, HardwareID = lHardware }
gES_TmpStationToPanel[5] = {Panel = 3, StationID = 104, CurrentID = 204, HardwareID = lHardware }
gES_TmpStationToPanel[6] = {Panel = 4, StationID = 105, CurrentID = 205, HardwareID = lHardware }
if gES_PayloadInfo.CurrentStation ~= 0 then -- gegebenenfalls prüfen ob sich CurrentStation geändert hat
SendDataHW(gES_TmpStationToPanel[gES_PayloadInfo.CurrentStation].CurrentID, 1, lHardware) -- eigentliche Auswahl
table.foreach(gES_PayloadInfo.Stations, WeaponStatusPanel_selectCurrentPayloadStation) -- zugehörige Stationen
end
end
function FuelQuantityIndicator(hardware)
local lHardware = hardware or 1
-- Fuel quantity shows the fuel remaining in all tanks
local lEngineInfo = LoGetEngineInfo()
if lEngineInfo == nil then
return
end
--WriteToLog('lEngineInfo: '..dump(lEngineInfo))
--[[
[fuel_external] = number: "0"
[Temperature] = {
[left] = number: "626.99444580078"
[right] = number: "626.99444580078"
}
[RPM] = {
[left] = number: "87.453765869141"
[right] = number: "87.453758239746"
}
[FuelConsumption] = {
[left] = number: "0.1500396137767"
[right] = number: "0.1500396137767"
}
[fuel_internal] = number: "3773.2749023438"
[EngineStart] = {
[left] = number: "0"
[right] = number: "0"
}
[HydraulicPressure] = {
[left] = number: "210"
[right] = number: "210"
}
lPayloadInfo.Stations[7].CLSID == 2BEC576B-CDF5-4B7F-961F-B0FA4312B841 -- ext 1500l Fuel Tank
]]
SendDataHW("300", string.format("%d", math.round(((lEngineInfo.fuel_internal + lEngineInfo.fuel_external) / 10), 0, "ceil") * 10), lHardware ) -- total fuel in kg
--SendDataHW("301", string.format("%d", lEngineInfo.fuel_internal)) -- internal fuel in kg
--SendDataHW("302", string.format("%d", lEngineInfo.fuel_external)) -- external fuel in kg
--[[
local lPayloadInfo = LoGetPayloadInfo()
if lPayloadInfo ~= nil then
--WriteToLog('lPayloadInfo: '..dump(lPayloadInfo))
if lPayloadInfo.Stations[7].CLSID == "{2BEC576B-CDF5-4B7F-961F-B0FA4312B841}" then -- center tanks presend and full
SendDataHW("303", ((lEngineInfo.fuel_external < 1200.0 ) and 1 or 0), lHardware )
else
SendDataHW("303", 1, lHardware )
end
if lPayloadInfo.Stations[3].CLSID == "{C0FF4842-FBAC-11d5-9190-00A0249B6F00}" or
lPayloadInfo.Stations[4].CLSID == "{C0FF4842-FBAC-11d5-9190-00A0249B6F00}" then -- external tank presend and full (panel 2 and 5)
SendDataHW("304", ((lEngineInfo.fuel_internal < 2830.0 ) and 1 or 0), lHardware )
else
SendDataHW("304", 1, lHardware )
end
else
SendDataHW("303", 1, lHardware )
SendDataHW("304", 1, lHardware )
end]]
SendDataHW("304", (lEngineInfo.fuel_internal < 3200.0 and 1 or 0), lHardware ) -- Tank warning 1
SendDataHW("305", (lEngineInfo.fuel_internal < 2800.0 and 1 or 0), lHardware ) -- Tank warning 2
SendDataHW("306", (lEngineInfo.fuel_internal < 1390.0 and 1 or 0), lHardware ) -- Tank warning 3
SendDataHW("307", (lEngineInfo.fuel_internal < 760.0 and 1 or 0), lHardware ) -- Tank warning 4
--SendDataHW("308", (lEngineInfo.fuel_internal < 600.0 and 1 or 0), lHardware ) -- Bingo Fuel
end
function MechanicalDevicesIndicator(hardware)
local lHardware = hardware or 1
-- The mechanical devices indicator shows the position of the landing gear, flaps, leading edge flaps and airbrake
local lMechInfo = LoGetMechInfo() -- mechanical components, e.g. Flaps, Wheelbrakes,...
if lMechInfo == nil then
return
end
--[[
[hook] = {
[status] = number: "0"
[value] = number: "0"
}
[parachute] = {
[status] = number: "0"
[value] = number: "0"
}
[controlsurfaces] = {
[eleron] = {
[left] = number: "0"
[right] = number: "-0.21084336936474"
}
[elevator] = {
[left] = number: "-0"
[right] = number: "-0"
}
[rudder] = {
[left] = number: "0"
[right] = number: "0"
}
}
[airintake] = {
[status] = number: "0"
[value] = number: "0"
}
[canopy] = {
[status] = number: "0"
[value] = number: "0"
}
[refuelingboom] = {
[status] = number: "0"
[value] = number: "0"
}
[wing] = {
[status] = number: "0"
[value] = number: "0"
}
[noseflap] = {
[status] = number: "0"
[value] = number: "0"
}
[gear] = {
[value] = number: "0"
[nose] = {
[rod] = number: "0"
}
[main] = {
[left] = {
[rod] = number: "0"
}
[right] = {
[rod] = number: "0"
}
}
[status] = number: "0"
}
[speedbrakes] = {
[status] = number: "0"
[value] = number: "0"
}
[wheelbrakes] = {
[status] = number: "0"
[value] = number: "0"
}
[flaps] = {
[status] = number: "0"
[value] = number: "0"
}]]
--SendDataHW("500", lMechInfo.gear.status )
--SendDataHW("501", lMechInfo.gear.value )
--SendDataHW("502", lMechInfo.gear.nose.rod ) -- zeigt an wie weit das Fahrwerk einsackt wenn das Flugzeug auf dem Boden ist
--SendDataHW("503", lMechInfo.gear.main.left.rod ) -- zeigt an wie weit das Fahrwerk einsackt wenn das Flugzeug auf dem Boden ist
--SendDataHW("504", lMechInfo.gear.main.right.rod ) -- zeigt an wie weit das Fahrwerk einsackt wenn das Flugzeug auf dem Boden ist
--SendDataHW("500", ((lMechInfo.gear.status == 1 and lMechInfo.gear.value < 1) and 1 or 0 ) ) -- gear warning light, go up
--SendDataHW("500", ((lMechInfo.gear.status == 0 and lMechInfo.gear.value > 0) and 1 or 0 ) ) -- gear warning light, go down
SendDataHW("500", (((lMechInfo.gear.status == 1 and lMechInfo.gear.value < 1) or (lMechInfo.gear.status == 0 and lMechInfo.gear.value > 0)) and 1 or 0 ), lHardware ) -- gear warning light
SendDataHW("501", (lMechInfo.gear.value > 0.85 and 1 or 0), lHardware ) -- nose gear
SendDataHW("502", (lMechInfo.gear.value > 0.95 and 1 or 0), lHardware ) -- left gear
SendDataHW("503", (lMechInfo.gear.value == 1 and 1 or 0), lHardware ) -- right gear
--SendDataHW("510", lMechInfo.speedbrakes.status ) -- speedbreakes on 1 (0|1)
SendDataHW("510", (lMechInfo.speedbrakes.value > 0.1 and 1 or 0), lHardware ) -- speedbreakes on > 0.1 (0 - 1)
--SendDataHW("520", lMechInfo.wheelbrakes.status ) -- not in use
--SendDataHW("521", lMechInfo.wheelbrakes.value ) -- not in use
local lGetTrueAirSpeed = LoGetTrueAirSpeed()
--SendDataHW("530", lMechInfo.flaps.status ) -- flap switch off 0, 1. position 1, 2. position 2 (0|1|2)
--SendDataHW("531", lMechInfo.flaps.value ) -- flap 1. position > 0.25, 2. position > 0.93 (0 - 1)
SendDataHW("531", (lMechInfo.flaps.value > 0.25 and 1 or 0), lHardware ) -- flap 1. position
SendDataHW("532", (lMechInfo.flaps.value > 0.93 and 1 or 0), lHardware ) -- flap 2. position
SendDataHW("533", ((lMechInfo.flaps.value > 0.93 and lGetTrueAirSpeed > 340) and 1 or 0), lHardware ) -- Speed Warning for Flaps, same light as gear warning light, but blinking light
SendDataHW("534", (lMechInfo.gear.status > 1.0 and 1 or 0), lHardware ) -- Intake FOD shields
--SendDataHW("540", lMechInfo.parachute.status )
SendDataHW("541", (lMechInfo.parachute.value < 0.5 and 1 or 0), lHardware )
--SendDataHW("550", lMechInfo.noseflap.status )
SendDataHW("551", (lMechInfo.noseflap.value > 20.0 and 1 or 0), lHardware )
SendDataHW("560", lMechInfo.airintake.status, lHardware )
--SendDataHW("561", lMechInfo.airintake.value )
end

View File

@@ -0,0 +1,840 @@
-- MiG-29S Export
-- Version 0.9.9 BETA
gES_FoundFCModule = true
-- auxiliary function
dofile(gES_ExportModulePath.."FC_AuxiliaryFuntions.lua")
-----------------------------------------
-- FLAMING CLIFFS AIRCRAFT / MiG-29S --
-- FC aircraft don't support GetDevice --
-----------------------------------------
function ProcessGlassCockpitFCHighImportanceConfig()
local myData = LoGetSelfData()
if (myData) then
local lLatitude = myData.LatLongAlt.Lat -- LATITUDE
local lLongitude = myData.LatLongAlt.Long -- LONGITUDE
local lBasicAtmospherePressure = LoGetBasicAtmospherePressure() -- BAROMETRIC PRESSURE
local lAltBar = LoGetAltitudeAboveSeaLevel() -- ALTITUDE SEA LEVEL (Meter)
local lAltRad = LoGetAltitudeAboveGroundLevel() -- ALTITUDE GROUND LEVEL (Meter)
--local lTrueAirSpeed = LoGetTrueAirSpeed() -- TRUE AIRSPEED (Meter/Second)
local lPitch, lBank, lYaw = LoGetADIPitchBankYaw() -- PITCH, BANK, YAW (Radian)
local lHeading = myData.Heading -- HEADING (Radian)
local lVVI = LoGetVerticalVelocity() -- VERTICAL SPEED (Meter/Second)
local lIAS = LoGetIndicatedAirSpeed() -- INDICATED AIRSPEED (Meter/Second)
local lMachNumber = LoGetMachNumber() -- MACH
local lAoA = LoGetAngleOfAttack() -- ANGLE OF ATTACK AoA (Radian)
local lGlide = LoGetGlideDeviation() -- VOR1 HORIZONTAL DEFLECTION (-1 +1)
local lSide = LoGetSideDeviation() -- VOR1 VERTICAL DEFLECTION (-1 +1)
--local lSlipBallPosition = LoGetSlipBallPosition() -- SLIP BALL (-1 +1)
--local lAccelerationUnits = LoGetAccelerationUnits().y -- G-LOAD
--local lNavInfoPitch = LoGetNavigationInfo().Requirements.pitch -- AP REQUIRED PITCH (Radian)
--local lNavInfoRoll = LoGetNavigationInfo().Requirements.roll -- AP REQUIRED BANK (Radian)
--local lNavInfoSpeed = LoGetNavigationInfo().Requirements.speed -- AP SPEED (Meter/Second)
--local lNavInfoAltitude = LoGetNavigationInfo().Requirements.altitude -- AP ALTITUDE (Meter)
--local lNavInfoVerticalSpeed = LoGetNavigationInfo().Requirements.vertical_speed -- AP VERTICAL SPEED (Meter/Second)
--local lControlPanel_HSI = LoGetControlPanel_HSI() -- HSI Data
local lHSI_RMI = LoGetControlPanel_HSI().RMI_raw -- VOR1 OBS (Radian)
local lHSI_ADF = LoGetControlPanel_HSI().ADF_raw -- ADF OBS (Radian)
--local lHSI_Heading = LoGetControlPanel_HSI().Heading_raw -- Heading (Radian)
local lEngineRPMleft = LoGetEngineInfo().RPM.left -- ENG1 RPM %
local lEngineRPMright = LoGetEngineInfo().RPM.right -- ENG2 RPM %
local lEngineTempLeft = LoGetEngineInfo().Temperature.left -- ENG1 EGT ºC
local lEngineTempRight = LoGetEngineInfo().Temperature.right -- ENG2 EGT ºC
--local lEngineFuelInternal = LoGetEngineInfo().fuel_internal -- TANK1 (INT) (KG)
--local lEngineFuelExternal = LoGetEngineInfo().fuel_external -- TANK2 (EXT) (KG)
--local lMechInfo = LoGetMechInfo() -- mechanical components, e.g. Flaps, Wheelbrakes,...
--local lPayloadInfo = LoGetPayloadInfo() -- Paylod, e.g. bombs, guns, rockets, fuel tanks,...
local lDistanceToWay = 999
local lRoute = LoGetRoute()
if (myData and lRoute) then -- if neither are nil
local myLoc = LoGeoCoordinatesToLoCoordinates(lLongitude, lLatitude)
--lDistanceToWay = math.sqrt((myLoc.x - lRoute.goto_point.world_point.x)^2 + (myLoc.y - lRoute.goto_point.world_point.y)^2)
lDistanceToWay = math.sqrt((myLoc.x - lRoute.goto_point.world_point.x)^2 + (myLoc.z - lRoute.goto_point.world_point.z)^2)
end
if gES_GlassCockpitType == 1 then
-- HELIOS Version 1.3
-- customizing for HELOS
lPitch = math.deg(lPitch) -- PITCH, (Radian to Grad)
lBank = math.deg(lBank) -- BANK (Radian to Grad)
lYaw = math.deg(lYaw) -- YAW (Radian to Grad)
lHSI_RMI = math.deg(lHSI_RMI) -- VOR1 OBS (Radian to Grad)
lHSI_ADF = math.deg(lHSI_ADF) -- ADF OBS (Radian to Grad)
lAoA = math.deg(lAoA) -- ANGLE OF ATTACK AoA (Radian to Grad)
lHeading = math.deg(lHeading) -- Heading (Radian to Grad)
lHSI_ADF = (360 - lHSI_ADF) + (360 - lHeading)
lHSI_RMI = 360 - lHSI_RMI
lIAS = lIAS * 3.6 -- change from m/s to km/h
SendData("1", string.format("%.2f", lPitch) )
SendData("2", string.format("%.2f", lBank) )
SendData("3", string.format("%.2f", lYaw) )
SendData("4", string.format("%.2f", lAltBar) )
SendData("5", string.format("%.2f", lAltRad) )
SendData("6", string.format("%.2f", lHSI_ADF) )
SendData("7", string.format("%.2f", lHSI_RMI) )
SendData("8", string.format("%.2f", lHeading) )
SendData("9", string.format("%.2f", lEngineRPMleft) )
SendData("10", string.format("%.2f", lEngineRPMright) )
SendData("11", string.format("%.2f", lEngineTempLeft) )
SendData("12", string.format("%.2f", lEngineTempRight) )
SendData("13", string.format("%.2f", lVVI) )
SendData("14", string.format("%.2f", lIAS) )
SendData("15", string.format("%.2f", lDistanceToWay) )
SendData("16", string.format("%.2f", lAoA) )
SendData("17", string.format("%.2f", lGlide) )
SendData("18", string.format("%.2f", lSide) )
elseif gES_GlassCockpitType == 2 then
-- HawgTouch version 1.6
local lRadToDCSsignd = math.pi
local lRadToDCSunsignd = math.pi * 2
local lDefaultNull = 0.0
local lDefaultOne = 1.0
-- IAS Indicator (IAS, Thousend) {"%.4f;%.4f"}
FC_Russian_AirSpeed_1000hkm(1)
-- AOA Indicator and Accelerometer (AOA, GLoad)
FC_Russian_AOA_MiG29(3)
-- ADI
FC_Russian_ADI_Old(4)
-- HSI
FC_Russian_HSI(lDistanceToWay, 5)
-- Vertical Velocity Indicator (VVI) (VVI, TurnIndicator, SlipBallPosition)
FC_Russian_VVI_Old(6)
-- Radar Altimeter (AltRad, MinAltitude, WarningFlag, MinAltitudeLamp) {"%.4f;%.4f;%.1f;%.1f"} (below 100m is warning light on)
FC_Russian_RadarAltimeter_1000m(100, 7)
-- Barometric Altimeter (AltBar, BasicAtmospherePressure)
FC_Russian_BarometricAltimeter_30000(8)
-- Tachometer (RPM) (EngineRPMleft, EngineRPMright) {"%.4f;%.4f"}
FC_Russian_EngineRPM(9)
-- Left Jet Engine Turbine Temperature Indicator (EngineTemp) {"%.4f"}
FC_Russian_EGT_1000gc(lEngineTempLeft + 80, 10) -- differenc fromtechnical temperature to showing temperature
-- Right Jet Engine Turbine Temperature Indicator (EngineTemp) {"%.4f"}
FC_Russian_EGT_1000gc(lEngineTempRight + 80, 11)
-- Clock from Ka-50 {CurrentHours, CurrentMinutes, CurrentSeconds, 0, FlightTimeHours, FlightTimeMinutes, 0, 0) {"%.4f;%.4f;%.4f;%.1f;%.4f;%.4f;%.4f;%.4f"}
FC_Russian_Clock_ACS1(12)
-- Mach {max, Mach}
local lMachTmp = 0
--[[
y_min = 0.0 -- minimaler Ausgabewert
y_max = 1.0 -- maximaler Ausgabewert
x_min = 0.0 -- minimaler Eingangswert
x_max = 3.0 -- maximaler Eingangswert
x = 1.65 -- aktueller Eingangswert
d_y = 1.0 -- Delta Ausgabewerte (y_max - y_min)
d_x = 3.0 -- Delta Eingangswerte (x_max - x_min)
m = 0.33333333333333333333333333333333 -- Steigung der linearen Funktion (d_y / d_x)
n = 0.00000000000000000000000000000001 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max)
y = 0.55 -- Ergebnis (m * x + n)
]]
lMachTmp = 0.33333333333333333333333333333333 * lMachNumber + 0.00000000000000000000000000000001
SendData("13", string.format("%0.4f;%0.4f", lMachTmp, 0.0))
end
else
WriteToLog("Unknown FC Error, no LoGetSelfData.")
end
end
function ProcessHARDWAREConfigHighImportance(mainPanelDevice)
end
function ProcessGlassCockpitFCLowImportanceConfig()
if gES_GlassCockpitType == 1 then
-- HELIOS Version 1.3
elseif gES_GlassCockpitType == 2 then
-- HawgTouch version 1.6
FC_RadarWarning_SPO15(14)
-- Fuel Quantity Indicator
local lEngineInfo = LoGetEngineInfo()
if lEngineInfo ~= nil then
--WriteToLog('lEngineInfo: '..dump(lEngineInfo))
--[[
[fuel_external] = number: "0"
[Temperature] = {
[left] = number: "626.99444580078"
[right] = number: "626.99444580078"
}
[RPM] = {
[left] = number: "87.453765869141"
[right] = number: "87.453758239746"
}
[FuelConsumption] = {
[left] = number: "0.1500396137767"
[right] = number: "0.1500396137767"
}
[fuel_internal] = number: "3773.2749023438"
[EngineStart] = {
[left] = number: "0"
[right] = number: "0"
}
[HydraulicPressure] = {
[left] = number: "210"
[right] = number: "210"
}
lPayloadInfo.Stations[8].CLSID == E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF -- ext 800l Fuel Tank
]]
local lTotalFuel = lEngineInfo.fuel_internal + lEngineInfo.fuel_external
--local lTotalFuel = string.format("%3d", math.round((lEngineInfo.fuel_internal / 10), 0, "ceil") * 10)
--local lTotalFuel = string.format("%4d", lEngineInfo.fuel_internal) -- total fuel in kg
--local lTotalFuel = string.format("%4d", lEngineInfo.fuel_external) -- external fuel in kg
local lTotalFuel_7_5 = 0
local lTotalFuel_5_0 = 0
if lTotalFuel < 7500 then
if lTotalFuel > 5000 then
--[[
y_min = 0.0 -- minimaler Ausgabewert
y_max = 1.0 -- maximaler Ausgabewert
x_min = 5000 -- minimaler Eingangswert
x_max = 7500 -- maximaler Eingangswert
x = 6000 -- aktueller Eingangswert
d_y = 1 -- Delta Ausgabewerte (y_max - y_min)
d_x = 2500 -- Delta Eingangswerte (x_max - x_min)
m = 0.0004 -- Steigung der linearen Funktion (d_y / d_x)
n = -2.0 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max)
y = 0.4 -- Ergebnis (m * x + n)
]]
lTotalFuel_7_5 = 0.0004 * lTotalFuel + -2.0
else
lTotalFuel_7_5 = 0.0
end
else
lTotalFuel_7_5 = 1.0
end
if lTotalFuel < 5000 then
--[[
y_min = 0.04 -- minimaler Ausgabewert
y_max = 1.0 -- maximaler Ausgabewert
x_min = 0 -- minimaler Eingangswert
x_max = 5000 -- maximaler Eingangswert
x = 3000 -- aktueller Eingangswert
d_y = 0.96 -- Delta Ausgabewerte (y_max - y_min)
d_x = 5000 -- Delta Eingangswerte (x_max - x_min)
m = 0.000192 -- Steigung der linearen Funktion (d_y / d_x)
n = 0.04 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max)
y = 0.616 -- Ergebnis (m * x + n)
]]
lTotalFuel_5_0 = 0.000192 * lTotalFuel + 0.04
else
lTotalFuel_5_0 = 1.0
end
-- TotalFuel_5_0
-- TotalFuel_7_5
-- Light1
-- Light2
-- Light3
-- Light4
-- BingoLight
SendData("15", string.format("%0.4f;%0.4f;%d;%d;%d;%d;%d",
lTotalFuel_5_0,
lTotalFuel_7_5,
0,
(lEngineInfo.fuel_internal < 3200.0 and 1 or 0), -- Tank warning 1
(lEngineInfo.fuel_internal < 2800.0 and 1 or 0), -- Tank warning 2
(lEngineInfo.fuel_internal < 1400.0 and 1 or 0), -- Tank warning 3
(lEngineInfo.fuel_internal < 800.0 and 1 or 0))) -- Tank warning 4
-- Hydraulic Pressure Left
FC_OneNeedleGauge(lEngineInfo.HydraulicPressure.left, 240, 17)
-- Hydraulic Pressure Right
FC_OneNeedleGauge(lEngineInfo.HydraulicPressure.right, 240, 18)
end
-- EKRAN Message
FC_EKRAN(16)
-- Mechanical Configuration Indicator (GearWarningLight, NoseGear, LeftGear, RightGear, Airbreaks, Flaps1, Flaps2) {"%.1f;%d;%d;%d;%d;%d;%d"}
local lMechInfo = LoGetMechInfo() -- mechanical components, e.g. Flaps, Wheelbrakes,...
if lMechInfo ~= nil then
--WriteToLog('lMechInfo: '..dump(lMechInfo))
local lWarningLight = 0.0
local lTrueAirSpeed = LoGetTrueAirSpeed()
if lTrueAirSpeed ~= nil then
--WriteToLog('lTrueAirSpeed: '..dump(lTrueAirSpeed))
lWarningLight = ((lMechInfo.flaps.value > 0.93 and lTrueAirSpeed > 340) and 1.0 or 0.0) -- Speed Warning for Flaps, same light as gear warning light, but blinking light
lWarningLight = (((lMechInfo.gear.status == 1 and lMechInfo.gear.value < 1) or (lMechInfo.gear.status == 0 and lMechInfo.gear.value > 0)) and 1.0 or lWarningLight ) -- gear warning light
end
-- WarningLight {0.0 = Off, 0.1 = blinking light, 0.2 = on}
-- WarningLight {0.0 = Off, no blinking light, 1.0 = on}
-- left gear {0, 1}
-- right gear {0, 1}
-- nose gear {0, 1}
-- WarningLight
-- Flap 1
-- Flap 2
-- Nose Flap
-- Speedbreakes on {0, 1}
SendData("2", string.format("%.1f;%d;%d;%d;%d;%d;%d",
(lMechInfo.gear.value > 0.95 and 1 or 0), -- left gear
(lMechInfo.gear.value == 1 and 1 or 0), -- right gear
(lMechInfo.gear.value > 0.85 and 1 or 0), -- nose gear
lWarningLight,
-- (lMechInfo.flaps.value > 0.47 and 1 or 0), -- flap 1
-- (lMechInfo.flaps.value > 0.93 and 1 or 0), -- flap 2
(lMechInfo.flaps.status == 1 and 1 or 0), -- flap 1
(lMechInfo.flaps.status == 2 and 1 or 0), -- flap 2
(lMechInfo.noseflap.value > 0.1 and 1 or 0), -- noseflap
(lMechInfo.speedbrakes.status == 1 and 1 or 0))) -- speedbreakes on > 0.1 (0 - 1)
-- Wheelbrakes Hydraulic Pressure Left
FC_OneNeedleGauge(lMechInfo.wheelbrakes.value, 240, 19)
-- Wheelbrakes Hydraulic Pressure Right
FC_OneNeedleGauge(lMechInfo.wheelbrakes.value, 240, 20)
end
-- Airintake
FC_Russian_AirIntake(21)
end
--(x < 0 and 'negative' or 'non-negative')
--[[
local lPayloadInfo = LoGetPayloadInfo()
WriteToLog('lPayloadInfo: '..dump(lPayloadInfo))
local lSnares = LoGetSnares() -- Flare and Chaff
WriteToLog('lSnares: '..dump(lSnares))
local lSightingSystemInfo = LoGetSightingSystemInfo()
WriteToLog('lSightingSystemInfo: '..dump(lSightingSystemInfo))
local lTWSInfo = LoGetTWSInfo() -- SPO Informationen, z.B. Radarwarner F15C
WriteToLog('lTWSInfo: '..dump(lTWSInfo))
local lTargetInformation = LoGetTargetInformation() -- detalierte Radar Infos z.B. F15C
WriteToLog('lTargetInformation: '..dump(lTargetInformation))
local lLockedTargetInformation = LoGetLockedTargetInformation()
WriteToLog('lLockedTargetInformation: '..dump(lLockedTargetInformation))
local lF15_TWS_Contacs = LoGetF15_TWS_Contacts() -- the same information but only for F-15 in TWS mode
WriteToLog('lF15_TWS_Contacs: '..dump(lF15_TWS_Contacs))
local lMechInfo = LoGetMechInfo() -- mechanical components, e.g. Flaps, Wheelbrakes,...
WriteToLog('lMechInfo: '..dump(lMechInfo))
local lMCPState = LoGetMCPState() -- Warnlichter
WriteToLog('lMCPState: '..dump(lMCPState))
local lControlPanel_HSI = LoGetControlPanel_HSI()
WriteToLog('lControlPanel_HSI: '..dump(lControlPanel_HSI))
local lRadioBeaconsStatus = LoGetRadioBeaconsStatus()
WriteToLog('lRadioBeaconsStatus: '..dump(lRadioBeaconsStatus))
local lEngineInfo = LoGetEngineInfo()
WriteToLog('lEngineInfo: '..dump(lEngineInfo))
]]
-- Weapon Control System
--local lNameByType = LoGetNameByType () -- args 4 (number : level1,level2,level3,level4), result string
-- values from LoGetTargetInformation().type
--WriteToLog('lNameByType: '..dump(lNameByType))
end
function ProcessHARDWAREConfigLowImportance(mainPanelDevice)
-- where necessary, specify HardwareID, example WeaponStatusPanel(2)
WeaponStatusPanel()
MechanicalDevicesIndicator()
StatusLamp()
FuelQuantityIndicator()
SightingSystem()
SPO15RWR()
FlareChaff()
end
-----------------------------
-- Custom functions --
-----------------------------
function SightingSystem(hardware)
local lHardware = hardware or 1
local lSightingSystemInfo = LoGetSightingSystemInfo()
if lSightingSystemInfo == nil then
return
end
--WriteToLog('lSightingSystemInfo: '..dump(lSightingSystemInfo)9
--[[
[PRF] = {
[selection] = string: "ILV"
[current] = string: "MED"
}
[laser_on] = boolean: "false"
[scale] = {
[azimuth] = number: "0.52359873056412"
[distance] = number: "10000"
}
[radar_on] = boolean: "false"
[optical_system_on] = boolean: "false"
[LaunchAuthorized] = boolean: "false"
[ECM_on] = boolean: "false"
[Manufacturer] = string: "RUS"
[TDC] = {
[y] = number: "0"
[x] = number: "0"
}
[ScanZone] = {
[coverage_H] = {
[min] = number: "0"
[max] = number: "20000"
}
[size] = {
[azimuth] = number: "1.0471974611282"
[elevation] = number: "0.17453290522099"
}
[position] = {
[exceeding_manual] = number: "0"
[distance_manual] = number: "0"
[azimuth] = number: "0"
[elevation] = number: "0"
}
}
]]
SendDataHW("600", lSightingSystemInfo.ECM_on == true and 1 or 0, lHardware )
SendDataHW("601", lSightingSystemInfo.laser_on == true and 1 or 0, lHardware )
SendDataHW("602", lSightingSystemInfo.optical_system_on == true and 1 or 0, lHardware )
SendDataHW("603", lSightingSystemInfo.LaunchAuthorized == true and 1 or 0, lHardware )
SendDataHW("604", lSightingSystemInfo.radar_on == true and 1 or 0, lHardware )
end
function FlareChaff(hardware)
local lHardware = hardware or 1
local lSnares = LoGetSnares() -- Flare and Chaff
--WriteToLog('lSnares: '..dump(lSnares))
--[chaff] = number: "30"
--[flare] = number: "30"
SendDataHW("800", lSnares.chaff + lSnares.flare, lHardware )
end
function StatusLamp(hardware)
local lHardware = hardware or 1
local lMCPState = LoGetMCPState() -- Warnlichter
if lMCPState == nil then
return
end
--WriteToLog('lMCPState: '..dump(lMCPState))
--[[
[RightTailPlaneFailure] = boolean: "false"
[EOSFailure] = boolean: "false"
[ECMFailure] = boolean: "false"
[RightAileronFailure] = boolean: "false"
[MasterWarning] = boolean: "false"
[RightEngineFailure] = boolean: "false"
[CannonFailure] = boolean: "false"
[MLWSFailure] = boolean: "false"
[ACSFailure] = boolean: "false"
[RadarFailure] = boolean: "false"
[HelmetFailure] = boolean: "false"
[HUDFailure] = boolean: "false"
[LeftMainPumpFailure] = boolean: "false"
[RightWingPumpFailure] = boolean: "false"
[LeftWingPumpFailure] = boolean: "false"
[MFDFailure] = boolean: "false"
[RWSFailure] = boolean: "false"
[GearFailure] = boolean: "false"
[HydraulicsFailure] = boolean: "false"
[AutopilotFailure] = boolean: "true"
[FuelTankDamage] = boolean: "false"
[LeftAileronFailure] = boolean: "false"
[CanopyOpen] = boolean: "false"
[RightMainPumpFailure] = boolean: "false"
[StallSignalization] = boolean: "false"
[LeftEngineFailure] = boolean: "false"
[AutopilotOn] = boolean: "false"
[LeftTailPlaneFailure] = boolean: "false"
]]
SendDataHW("700", lMCPState.LeftTailPlaneFailure == true and 1 or 0, lHardware )
SendDataHW("701", lMCPState.RightTailPlaneFailure == true and 1 or 0, lHardware )
SendDataHW("702", lMCPState.MasterWarning == true and 1 or 0, lHardware )
SendDataHW("703", lMCPState.LeftEngineFailure == true and 1 or 0, lHardware )
SendDataHW("704", lMCPState.RightEngineFailure == true and 1 or 0, lHardware )
SendDataHW("705", lMCPState.LeftAileronFailure == true and 1 or 0, lHardware )
SendDataHW("706", lMCPState.RightAileronFailure == true and 1 or 0, lHardware )
SendDataHW("707", lMCPState.LeftMainPumpFailure == true and 1 or 0, lHardware )
SendDataHW("708", lMCPState.RightMainPumpFailure == true and 1 or 0, lHardware )
SendDataHW("709", lMCPState.LeftWingPumpFailure == true and 1 or 0, lHardware )
SendDataHW("710", lMCPState.RightWingPumpFailure == true and 1 or 0, lHardware )
SendDataHW("711", lMCPState.EOSFailure == true and 1 or 0, lHardware )
SendDataHW("712", lMCPState.ECMFailure == true and 1 or 0, lHardware )
SendDataHW("713", lMCPState.CannonFailure == true and 1 or 0, lHardware )
SendDataHW("714", lMCPState.MLWSFailure == true and 1 or 0, lHardware )
SendDataHW("715", lMCPState.ACSFailure == true and 1 or 0, lHardware )
SendDataHW("716", lMCPState.RadarFailure == true and 1 or 0, lHardware )
SendDataHW("717", lMCPState.HelmetFailure == true and 1 or 0, lHardware )
SendDataHW("718", lMCPState.HUDFailure == true and 1 or 0, lHardware )
SendDataHW("719", lMCPState.MFDFailure == true and 1 or 0, lHardware )
SendDataHW("720", lMCPState.RWSFailure == true and 1 or 0, lHardware )
SendDataHW("721", lMCPState.GearFailure == true and 1 or 0, lHardware )
SendDataHW("722", lMCPState.HydraulicsFailure == true and 1 or 0, lHardware )
SendDataHW("723", lMCPState.AutopilotFailure == true and 1 or 0, lHardware )
SendDataHW("724", lMCPState.FuelTankDamage == true and 1 or 0, lHardware )
SendDataHW("725", lMCPState.CanopyOpen == true and 1 or 0, lHardware )
SendDataHW("726", lMCPState.StallSignalization == true and 1 or 0, lHardware )
SendDataHW("727", lMCPState.AutopilotOn == true and 1 or 0, lHardware )
local lEngineInfo = LoGetEngineInfo()
if lEngineInfo ~= nil then
--WriteToLog('lEngineInfo: '..dump(lEngineInfo))
SendDataHW("728", lEngineInfo.EngineStart.left, lHardware ) -- lamp start left engine 1 (0|1)
SendDataHW("729", lEngineInfo.EngineStart.right, lHardware ) -- lamp start right engine 1 (0|1)
SendDataHW("730", (lEngineInfo.RPM.left > 100.0 and 1 or 0), lHardware ) -- lamp after burner left engine
SendDataHW("731", (lEngineInfo.RPM.right > 100.0 and 1 or 0), lHardware ) -- lam after burner right engine
end
local lAccelerationUnits = LoGetAccelerationUnits()
if lAccelerationUnits ~= nil then
--WriteToLog('lAccelerationUnits: '..dump(lAccelerationUnits))
SendDataHW("732", (lAccelerationUnits.y > 8.0 and 1 or 0), lHardware ) -- lamp Over-G warning
end
end
function WeaponStatusPanel(hardware)
local lHardware = hardware or 1
-- The weapon status panel, quantity and readiness of the currently selected weapon and the remaining gun ammunition are indicated.
gES_PayloadInfo = LoGetPayloadInfo()
if gES_PayloadInfo == nil then
return
end
--WriteToLog('gES_PayloadInfo: '..dump(gES_PayloadInfo))
--[[ exsample
[Stations] = {
[1] = {
[CLSID] = string: "{FBC29BFE-3D24-4C64-B81D-941239D12249}"
[container] = boolean: "false"
[count] = number: "1"
[weapon] = {
[level3] = number: "7"
[level1] = number: "4"
[level4] = number: "18"
[level2] = number: "4"
}
}
[2] = {
[CLSID] = string: "{FBC29BFE-3D24-4C64-B81D-941239D12249}"
[container] = boolean: "false"
[count] = number: "1"
[weapon] = {
[level3] = number: "7"
[level1] = number: "4"
[level4] = number: "18"
[level2] = number: "4"
}
}
[3] = {
[CLSID] = string: "{B4C01D60-A8A3-4237-BD72-CA7655BC0FE9}"
[container] = boolean: "false"
[count] = number: "1"
[weapon] = {
[level3] = number: "7"
[level1] = number: "4"
[level4] = number: "19"
[level2] = number: "4"
}
}
[4] = {
[CLSID] = string: "{B4C01D60-A8A3-4237-BD72-CA7655BC0FE9}"
[container] = boolean: "false"
[count] = number: "1"
[weapon] = {
[level3] = number: "7"
[level1] = number: "4"
[level4] = number: "19"
[level2] = number: "4"
}
}
[5] = {
[CLSID] = string: "{B4C01D60-A8A3-4237-BD72-CA7655BC0FE9}"
[container] = boolean: "false"
[count] = number: "1"
[weapon] = {
[level3] = number: "7"
[level1] = number: "4"
[level4] = number: "19"
[level2] = number: "4"
}
}
[6] = {
[CLSID] = string: "{B4C01D60-A8A3-4237-BD72-CA7655BC0FE9}"
[container] = boolean: "false"
[count] = number: "1"
[weapon] = {
[level3] = number: "7"
[level1] = number: "4"
[level4] = number: "19"
[level2] = number: "4"
}
}
[7] = {
[CLSID] = string: "{2BEC576B-CDF5-4B7F-961F-B0FA4312B841}"
[container] = boolean: "false"
[count] = number: "1"
[weapon] = {
[level3] = number: "43"
[level1] = number: "1"
[level4] = number: "17"
[level2] = number: "3"
}
}
}
[CurrentStation] = number: "3"
[Cannon] = {
[shells] = number: "150"
}
]]
--[[
Weapon Panel
|
-------------------------------
| | | | | | |
1 2 3 C 4 5 6
]]
-- Payload Info
-- weapon stations (panel) 1 (left) - 10 (right), no lamp for center station
SendDataHW("100", gES_PayloadInfo.Cannon.shells ) -- count cannon shells
SendDataHW("101", (gES_PayloadInfo.Stations[1].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 1)
SendDataHW("111", (gES_PayloadInfo.Stations[2].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 6)
SendDataHW("102", (gES_PayloadInfo.Stations[3].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 2)
SendDataHW("103", (gES_PayloadInfo.Stations[4].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 5)
SendDataHW("104", (gES_PayloadInfo.Stations[5].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 3)
SendDataHW("105", (gES_PayloadInfo.Stations[6].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 4)
--SendDataHW("106", (gES_PayloadInfo.Stations[7].count > 0 and 1 or 0) ) -- weapon presend > 0 center station, not visible
--SendDataHW("CurrentStation", gES_PayloadInfo.CurrentStation )
-- defination
gES_TmpStationToPanel = {}
gES_TmpStationToPanel[1] = {Panel = 1, StationID = 101, CurrentID = 201, HardwareID = lHardware } -- left
gES_TmpStationToPanel[2] = {Panel = 6, StationID = 106, CurrentID = 206, HardwareID = lHardware } -- right
gES_TmpStationToPanel[3] = {Panel = 2, StationID = 102, CurrentID = 202, HardwareID = lHardware }
gES_TmpStationToPanel[4] = {Panel = 5, StationID = 103, CurrentID = 203, HardwareID = lHardware }
gES_TmpStationToPanel[5] = {Panel = 3, StationID = 104, CurrentID = 204, HardwareID = lHardware }
gES_TmpStationToPanel[6] = {Panel = 4, StationID = 105, CurrentID = 205, HardwareID = lHardware }
if gES_PayloadInfo.CurrentStation ~= 0 then -- gegebenenfalls prüfen ob sich CurrentStation geändert hat
SendDataHW(gES_TmpStationToPanel[gES_PayloadInfo.CurrentStation].CurrentID, 1, lHardware) -- eigentliche Auswahl
table.foreach(gES_PayloadInfo.Stations, WeaponStatusPanel_selectCurrentPayloadStation) -- zugehörige Stationen
end
end
function FuelQuantityIndicator(hardware)
local lHardware = hardware or 1
-- Fuel quantity shows the fuel remaining in all tanks
local lEngineInfo = LoGetEngineInfo()
if lEngineInfo == nil then
return
end
--WriteToLog('lEngineInfo: '..dump(lEngineInfo))
--[[
[fuel_external] = number: "0"
[Temperature] = {
[left] = number: "626.99444580078"
[right] = number: "626.99444580078"
}
[RPM] = {
[left] = number: "87.453765869141"
[right] = number: "87.453758239746"
}
[FuelConsumption] = {
[left] = number: "0.1500396137767"
[right] = number: "0.1500396137767"
}
[fuel_internal] = number: "3773.2749023438"
[EngineStart] = {
[left] = number: "0"
[right] = number: "0"
}
[HydraulicPressure] = {
[left] = number: "210"
[right] = number: "210"
}
lPayloadInfo.Stations[7].CLSID == 2BEC576B-CDF5-4B7F-961F-B0FA4312B841 -- ext 1500l Fuel Tank
]]
SendDataHW("300", string.format("%d", math.round(((lEngineInfo.fuel_internal + lEngineInfo.fuel_external) / 10), 0, "ceil") * 10), lHardware ) -- total fuel in kg
--SendDataHW("301", string.format("%d", lEngineInfo.fuel_internal)) -- internal fuel in kg
--SendDataHW("302", string.format("%d", lEngineInfo.fuel_external)) -- external fuel in kg
--[[
local lPayloadInfo = LoGetPayloadInfo()
if lPayloadInfo ~= nil then
--WriteToLog('lPayloadInfo: '..dump(lPayloadInfo))
if lPayloadInfo.Stations[7].CLSID == "{2BEC576B-CDF5-4B7F-961F-B0FA4312B841}" then -- center tanks presend and full
SendDataHW("303", ((lEngineInfo.fuel_external < 1200.0 ) and 1 or 0), lHardware )
else
SendDataHW("303", 1, lHardware )
end
if lPayloadInfo.Stations[3].CLSID == "{C0FF4842-FBAC-11d5-9190-00A0249B6F00}" or
lPayloadInfo.Stations[4].CLSID == "{C0FF4842-FBAC-11d5-9190-00A0249B6F00}" then -- external tank presend and full (panel 2 and 5)
SendDataHW("304", ((lEngineInfo.fuel_internal < 2830.0 ) and 1 or 0), lHardware )
else
SendDataHW("304", 1, lHardware )
end
else
SendDataHW("303", 1, lHardware )
SendDataHW("304", 1, lHardware )
end]]
SendDataHW("304", (lEngineInfo.fuel_internal < 3200.0 and 1 or 0), lHardware ) -- Tank warning 1
SendDataHW("305", (lEngineInfo.fuel_internal < 2800.0 and 1 or 0), lHardware ) -- Tank warning 2
SendDataHW("306", (lEngineInfo.fuel_internal < 1390.0 and 1 or 0), lHardware ) -- Tank warning 3
SendDataHW("307", (lEngineInfo.fuel_internal < 760.0 and 1 or 0), lHardware ) -- Tank warning 4
--SendDataHW("308", (lEngineInfo.fuel_internal < 600.0 and 1 or 0), lHardware ) -- Bingo Fuel
end
function MechanicalDevicesIndicator(hardware)
local lHardware = hardware or 1
-- The mechanical devices indicator shows the position of the landing gear, flaps, leading edge flaps and airbrake
local lMechInfo = LoGetMechInfo() -- mechanical components, e.g. Flaps, Wheelbrakes,...
if lMechInfo == nil then
return
end
--[[
[hook] = {
[status] = number: "0"
[value] = number: "0"
}
[parachute] = {
[status] = number: "0"
[value] = number: "0"
}
[controlsurfaces] = {
[eleron] = {
[left] = number: "0"
[right] = number: "-0.21084336936474"
}
[elevator] = {
[left] = number: "-0"
[right] = number: "-0"
}
[rudder] = {
[left] = number: "0"
[right] = number: "0"
}
}
[airintake] = {
[status] = number: "0"
[value] = number: "0"
}
[canopy] = {
[status] = number: "0"
[value] = number: "0"
}
[refuelingboom] = {
[status] = number: "0"
[value] = number: "0"
}
[wing] = {
[status] = number: "0"
[value] = number: "0"
}
[noseflap] = {
[status] = number: "0"
[value] = number: "0"
}
[gear] = {
[value] = number: "0"
[nose] = {
[rod] = number: "0"
}
[main] = {
[left] = {
[rod] = number: "0"
}
[right] = {
[rod] = number: "0"
}
}
[status] = number: "0"
}
[speedbrakes] = {
[status] = number: "0"
[value] = number: "0"
}
[wheelbrakes] = {
[status] = number: "0"
[value] = number: "0"
}
[flaps] = {
[status] = number: "0"
[value] = number: "0"
}]]
--SendDataHW("500", lMechInfo.gear.status )
--SendDataHW("501", lMechInfo.gear.value )
--SendDataHW("502", lMechInfo.gear.nose.rod ) -- zeigt an wie weit das Fahrwerk einsackt wenn das Flugzeug auf dem Boden ist
--SendDataHW("503", lMechInfo.gear.main.left.rod ) -- zeigt an wie weit das Fahrwerk einsackt wenn das Flugzeug auf dem Boden ist
--SendDataHW("504", lMechInfo.gear.main.right.rod ) -- zeigt an wie weit das Fahrwerk einsackt wenn das Flugzeug auf dem Boden ist
--SendDataHW("500", ((lMechInfo.gear.status == 1 and lMechInfo.gear.value < 1) and 1 or 0 ) ) -- gear warning light, go up
--SendDataHW("500", ((lMechInfo.gear.status == 0 and lMechInfo.gear.value > 0) and 1 or 0 ) ) -- gear warning light, go down
SendDataHW("500", (((lMechInfo.gear.status == 1 and lMechInfo.gear.value < 1) or (lMechInfo.gear.status == 0 and lMechInfo.gear.value > 0)) and 1 or 0 ), lHardware ) -- gear warning light
SendDataHW("501", (lMechInfo.gear.value > 0.85 and 1 or 0), lHardware ) -- nose gear
SendDataHW("502", (lMechInfo.gear.value > 0.95 and 1 or 0), lHardware ) -- left gear
SendDataHW("503", (lMechInfo.gear.value == 1 and 1 or 0), lHardware ) -- right gear
--SendDataHW("510", lMechInfo.speedbrakes.status ) -- speedbreakes on 1 (0|1)
SendDataHW("510", (lMechInfo.speedbrakes.value > 0.1 and 1 or 0), lHardware ) -- speedbreakes on > 0.1 (0 - 1)
--SendDataHW("520", lMechInfo.wheelbrakes.status ) -- not in use
--SendDataHW("521", lMechInfo.wheelbrakes.value ) -- not in use
local lGetTrueAirSpeed = LoGetTrueAirSpeed()
--SendDataHW("530", lMechInfo.flaps.status ) -- flap switch off 0, 1. position 1, 2. position 2 (0|1|2)
--SendDataHW("531", lMechInfo.flaps.value ) -- flap 1. position > 0.25, 2. position > 0.93 (0 - 1)
SendDataHW("531", (lMechInfo.flaps.value > 0.25 and 1 or 0), lHardware ) -- flap 1. position
SendDataHW("532", (lMechInfo.flaps.value > 0.93 and 1 or 0), lHardware ) -- flap 2. position
SendDataHW("533", ((lMechInfo.flaps.value > 0.93 and lGetTrueAirSpeed > 340) and 1 or 0), lHardware ) -- Speed Warning for Flaps, same light as gear warning light, but blinking light
--SendDataHW("540", lMechInfo.parachute.status )
SendDataHW("541", (lMechInfo.parachute.value < 0.5 and 1 or 0), lHardware )
--SendDataHW("550", lMechInfo.noseflap.status )
SendDataHW("551", (lMechInfo.noseflap.value > 20.0 and 1 or 0), lHardware )
SendDataHW("560", lMechInfo.airintake.status, lHardware )
--SendDataHW("561", lMechInfo.airintake.value )
end

View File

@@ -0,0 +1,331 @@
-- P-51D Export
-- Version 1.0.0 BETA
ExportScript.FoundDCSModule = true
ExportScript.ConfigEveryFrameArguments =
{
--[[
every frames arguments
based of "mainpanel_init.lua"
Example (http://www.lua.org/manual/5.1/manual.html#pdf-string.format)
[DeviceID] = "Format"
[4] = "%.4f", <- floating-point number with 4 digits after point
[19] = "%0.1f", <- floating-point number with 1 digit after point
[129] = "%1d", <- decimal number
[5] = "%.f", <- floating point number rounded to a decimal number
]]
-- Flight Instruments
[11] = "%.4f", -- AirspeedNeedle {0,50,100,150,200,250,300,350,400,450,500,550,600,650,700} {0.0,0.05,0.10,0.15,0.2,0.25,0.3,0.35,0.4,0.45,0.5,0.55,0.6,0.65,0.7}
[29] = "%.4f", -- Variometer {-6000,-4000,-2000,2000,4000,6000} {-0.6,-0.4,-0.2,0.2,0.4,0.6}
-- Altimeter
[97] = "%.4f", -- Altimeter_Pressure {28.1, 31.0}{0.0, 1.0}
[96] = "%.41f", -- Altimeter_10000_footPtr {0.0, 100000.0}{0.0, 1.0}
[24] = "%.4f", -- Altimeter_1000_footPtr {0.0, 10000.0}{0.0, 1.0}
[25] = "%.4f", -- Altimeter_100_footPtr{0.0, 1000.0}{0.0, 1.0}
-- Artificial horizon
[15] = "%.4f", -- AHorizon_Pitch {1.0, -1.0}
[14] = "%.4f", -- AHorizon_Bank {1.0, -1.0}
[16] = "%.1f", -- AHorizon_PitchShift {-1.0, 1.0}
[20] = "%.1f", -- AHorizon_Caged {0.0, 1.0}
-- directional gyro
[12] = "%.4f", -- GyroHeading
-- turn indicator
[27] = "%.4f", -- TurnNeedle {-1.0, 1.0}
[28] = "%.4f", -- Slipball {-1.0, 1.0}
-- oxygen pressure indicator
[34] = "%.4f", -- Oxygen_Pressure {0.0, 500.0} {0.0, 1.0}
[33] = "%.4f", -- Oxygen_Flow_Blinker
-- fuel system
[155] = "%.4f", -- Fuel_Tank_Left {0.0,5.0,15.0,30.0,45.0,60.0,75.0,92.0} {0.0,0.2,0.36,0.52,0.65,0.77,0.92,1.0}
[156] = "%.4f", -- Fuel_Tank_Right {0.0,5.0,15.0,30.0,45.0,60.0,75.0,92.0} {0.0,0.2,0.36,0.52,0.65,0.77,0.92,1.0}
[160] = "%.4f", -- Fuel_Tank_Fuselage {0.0,10.0,20.0,30.0,40.0,50.0,60.0,70.0,80.0,85.0} {0.0,0.12,0.28,0.40,0.51,0.62,0.72,0.83,0.96,1.0}
[32] = "%.4f", -- Fuel_Pressure {0.0, 25.0} {0.0, 1.0}
-- A-11 clock
[4] = "%.4f", -- CLOCK_currtime_hours {0.0, 12.0}{0.0, 1.0}
[5] = "%.4f", -- CLOCK_currtime_minutes {0.0, 60.0}{0.0, 1.0}
[6] = "%.4f", -- CLOCK_currtime_seconds {0.0, 60.0}{0.0, 1.0}
-- AN5730 remote compass
[1] = "%.4f", -- CompassHeading
[2] = "%.4f", -- CommandedCourse
[3] = "%.4f", -- CommandedCourseKnob
-- TailRadarWarning
[161] = "%.f", -- Lamp TailRadarWarning
-- SCR-522A Control panel
[122] = "%.f", -- A_channel_light
[123] = "%.f", -- B_channel_light
[124] = "%.f", -- C_channel_light
[125] = "%.f", -- D_channel_light
[126] = "%.f", -- Transmit_light
-- hydraulic pressure
[78] = "%.4f", -- Hydraulic_Pressure {0.0, 2000.0} {0.0, 1.0}
-- Landing gears handle
[150] = "%.4f", -- Landing_Gear_Handle
[151] = "%.4f", -- Landing_Gear_Handle_Indoor
[80] = "%.f", -- LandingGearGreenLight
[82] = "%.f", -- LandingGearRedLight
-- gauges
[10] = "%.4f", -- Manifold_Pressure {10.0, 75.0} {0.0, 1.0}
[23] = "%.4f", -- Engine_RPM {0.0, 4500.0} {0.0, 1.0}
[9] = "%.4f", -- Vacuum_Suction {0.0, 10.0} {0.0, 1.0}
[21] = "%.4f", -- Carb_Temperature {-80, 150} {-0, 1}
[22] = "%.4f", -- Coolant_Temperature {-80, 150} {-0, 1}
[30] = "%.4f", -- Oil_Temperature {0.0, 100.0} {0, 1.0}
[31] = "%.4f", -- Oil_Pressure {0.0, 200.0} {0, 1.0}
[164] = "%.1f", -- Left_Fluor_Light
[165] = "%.1f", -- Right_Fluor_Light
[59] = "%.f", -- Hight_Blower_Lamp
-- Trimmer
[170] = "%.4f", -- Aileron_Trimmer {-1.0, 1.0}
[172] = "%.4f", -- Rudder_Trimmer {-1.0, 1.0}
[171] = "%.4f", -- Elevator_Trimmer {-1.0, 1.0}
[174] = "%.4f", -- Control_Lock_Bracket
[175] = "%.4f", -- Accelerometer_main {-5.0, 12.0} {0.0, 1.0}
[177] = "%.4f", -- Accelerometer_min {-5.0, 12.0} {0.0, 1.0}
[178] = "%.4f", -- Accelerometer_max {-5.0, 12.0} {0.0, 1.0}
[101] = "%.4f", -- Ammeter {0.0, 150.0} {0.0, 1.0}
-- light
[185] = "%.1f", -- Left_cockpit_light
[186] = "%.1f", -- Right_cockpit_light
[190] = "%.4f", -- warEmergencyPowerLimWire
-------------
--[181] = "%.4f", -- Panel_Shake_Z
--[180] = "%.4f", -- Panel_Shake_Y
--[189] = "%.4f", -- Panel_Rot_X
--[162] = "%.1f", -- Canopy_Trucks
--[163] = "%.1f", -- Canopy_Visibility
-- Stick
--[50] = "%.4f", -- StickPitch
--[51] = "%.4f", -- StickBank
-- RudderPedals
--[54] = "%.4f", -- RudderPedals
--[55] = "%.4f", -- Left_Wheel_Brake
--[56] = "%.4f", -- Right_Wheel_Brake
-- K-14 gunsight
[36] = "%.4f", -- sightRange
--[188] = "%.4f", -- K_14_Shake_Z
--[187] = "%.4f", -- K_14_Shake_Y
-------------
--[45] = "%.4f", -- ThrottleTwistGrip
-------------
[77] = "%.4f", -- Rocket_Counter
-------------
--[413] = "%.1f", -- WindShieldDamages
--[412] = "%.1f", -- WindShieldOil
}
ExportScript.ConfigArguments =
{
--[[
arguments for export in low tick interval
based on "clickabledata.lua"
]]
-- Right Swich Panel
[102] = "%d", -- Generator Connect/Disconnect
[103] = "%d", -- Battery Connect/Disconnect
[104] = "%d", -- Gun Heating ON/OFF
[105] = "%d", -- Pitot Heating ON/OFF
[106] = "%d", -- Wing Position Lights Bright/Off/Dim
[107] = "%d", -- Tail Position Lights Bright/Off/Dim
[108] = "%d", -- Red Recognition Light Key/Off/Steady
[109] = "%d", -- Green Recognition Light Key/Off/Steady
[110] = "%d", -- Amber Recognition Light Key/Off/Steady
[111] = "%d", -- Recognition Lights Key
[112] = "%d", -- Circuit Protectors Reset
[100] = "%.4f", -- Right Fluorescent Light (rotary)
[90] = "%.4f", -- Left Fluorescent Light (rotary)
-- Flight Instrument panel
[3] = "%.4f", -- Course Set (rotary)
[13] = "%.4f", -- Heading Set/Cage (rotary)
[179] = "%d", -- Heading Set/Cage Button
[17] = "%.4f", -- Pitch Adjustment (rotary)
[18] = "%.4f", -- Cage (rotary)
[19] = "%d", -- Cage Button
[8] = "%d", -- Winding/Adjustment Clock Button
[7] = "%.4f", -- Winding/Adjustment Clock (rotary)
[26] = "%.4f", -- Set Pressure (rotary)
-- SCR-522A Control panel
[117] = "%d", -- Radio ON/OFF
[118] = "%d", -- A Channel Activate
[119] = "%d", -- B Channel Activate
[120] = "%d", -- C Channel Activate
[121] = "%d", -- D Channel Activate
[127] = "%.4f", -- Radio Lights Dimmer (rotary)
[116] = "%.4f", -- Radio Audio Volume (rotary)
[44] = "%d", -- Microphone On
[200] = "%d", -- Arm rest
[129] = "%d", -- Switch Locking Lever
[128] = "%d", -- Radio Mode Transmit/Receive/Remote
-------------
[71] = "%.4f", -- Cockpit Lights (rotary)
[66] = "%0.1f", -- Ignition Off/Right/Left/Both
[67] = "%d", -- Gun control Gun And Camera On/Gun And Camera OFF/Camera On
[72] = "%d", -- Silence Landing Gear Warning Horn Cut Off
-- Bomb Arm/Chemical
[69] = "%d", -- Left Bomb Arm/Chemical
[70] = "%d", -- Right Bomb Arm/Chemical
-- Release Mode
[68] = "%0.1f", -- Release Mode, Bombs and Rockets Safe/Bombs Train Release/Bombs Both Release/Rockets Arm
[73] = "%0.1f", -- Rockets Release Mode Off/Single/Auto
[74] = "%d", -- Rockets Delay Switch Delay/Int
[75] = "%0.4f", -- Rockets Counter Control
-- Engine Control Panel
[58] = "%d", -- Supercharger Switch Cover
[57] = "%0.1f", -- Supercharger AUTO/LOW/HIGH
[60] = "%d", -- High Blower Lamp Test
[61] = "%d", -- Fuel Booster On/Off
[62] = "%d", -- Oil Dilute Activate
[63] = "%d", -- Starter Activate
[64] = "%d", -- Starter Switch Cover
[65] = "%d", -- Primer Activate
-- Oxygen Regulator
[131] = "%d", -- Auto-Mix On-Off
[130] = "%0.4f", -- Oxygen Emergency By-pass
-- Fuel system
[85] = "%0.1f", -- Fuel Selector Valve, Select Right Combat Tank/Select Left Main Tank/Select Fuselage Tank/Select Right Main Tank/Select Left Combat Tank
[86] = "%d", -- Fuel Shut-Off Valve ON/OFF
-- AN/APS-13
[114] = "%d", -- ail Warning Radar Power ON/OFF
[115] = "%d", -- Tail Warning Radar Test
[113] = "%.4f", -- Tail Warning Radar Light Control (rotary)
-------------
[79] = "%d", -- Hydraulic Release Knob
[94] = "%.4f", -- Flaps Control Handle (rotary)
[84] = "%d", -- Parking Brake Handle
[81] = "%d", -- Safe Landing Gear Light Test
[83] = "%d", -- Unsafe Landing Gear Light Test
-- Detrola receiver
[137] = "%.4f", -- Detrola Frequency Selector (rotary)
[138] = "%.4f", -- Detrola Volume (rotary)
-- canopy
[147] = "%.4f", -- Canopy Hand Crank (rotary)
[149] = "%d", -- Canopy Emergency Release Handle
-- AN/ARA-8
[152] = "%0.1f", -- Homing Adapter Mode TRANSMIT/COMM./HOMING
[153] = "%d", -- Homing Adapter Power On/Off
[154] = "%d", -- Homing Adapter's Circuit Breaker
-- SCR-695
[139] = "%0.1f", -- IFF Code Selector Code 1/2/3/4/5/6
[140] = "%d", -- IFF Power On/Off
[141] = "%d", -- IFF TIME/OFF/ON
[142] = "%d", -- IFF Detonator Circuit On/Off
[143] = "%d", -- IFF Distress Signal On/Off
[145] = "%d", -- IFF Detonator Left
[146] = "%d", -- IFF Detonator Right
-- Trimmers
[91] = "%.4f", -- Aileron Trim (rotary)
[92] = "%.4f", -- Elevator Trim (rotary)
[93] = "%.4f", -- Rudder Trim (rotary)
-------------
[157] = "%.4f", -- Defroster (rotary)
[158] = "%.4f", -- Cold Air (rotary)
[159] = "%.4f", -- Hot Air (rotary)
-------------
[89] = "%d", -- Landing Light On/Off
[168] = "%d", -- Coolant Control Cover
[87] = "%0.1f", -- Close Coolant Control/Automatic Coolant Control/Open Coolant Control
[169] = "%d", -- Oil Control Cover
[88] = "%0.1f", -- Close Oil Control/Automatic Oil Control/Open Oil Control
[134] = "%0.1f", -- Carburetor Cold Air Control (rotary)
[135] = "%0.1f", -- Carburetor Warm Air Control (rotary)
[47] = "%0.1f", -- Mixture Control Select IDLE CUT OFF/RUN/EMERGENCY FULL RICH
[43] = "%.4f", -- Throttle (rotary)
[46] = "%.4f", -- Propeller RPM (rotary)
[173] = "%d", -- Surface Control Lock Plunger. Left Button - Lock Stick in the Forward Position', Right Button - Lock Stick in the Neutral Position
[48] = "%.4f", -- Lock Throttle (rotary)
[49] = "%.4f", -- Lock Propeller & Mixture (rotary)
[176] = "%d", -- G-meter reset
[183] = "%d", -- Mirror
}
-----------------------------
-- HIGH IMPORTANCE EXPORTS --
-- done every export event --
-----------------------------
-- Pointed to by ProcessIkarusDCSHighImportance
function ExportScript.ProcessIkarusDCSConfigHighImportance(mainPanelDevice)
--[[
every frame export to Ikarus
Example from A-10C
Get Radio Frequencies
get data from device
local lUHFRadio = GetDevice(54)
ExportScript.Tools.SendData("ExportID", "Format")
ExportScript.Tools.SendData(2000, string.format("%7.3f", lUHFRadio:get_frequency()/1000000)) <- special function for get frequency data
]]
end
function ExportScript.ProcessDACConfigHighImportance(mainPanelDevice)
--[[
every frame export to DAC
Example from A-10C
Get Radio Frequencies
get data from device
local UHF_RADIO = GetDevice(54)
ExportScript.Tools.SendDataDAC("ExportID", "Format")
ExportScript.Tools.SendDataDAC("ExportID", "Format", HardwareConfigID)
ExportScript.Tools.SendDataDAC("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000))
ExportScript.Tools.SendDataDAC("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000), 2) -- export to Hardware '2' Config
]]
end
-----------------------------------------------------
-- LOW IMPORTANCE EXPORTS --
-- done every gExportLowTickInterval export events --
-----------------------------------------------------
-- Pointed to by ExportScript.ProcessIkarusDCSConfigLowImportance
function ExportScript.ProcessIkarusDCSConfigLowImportance(mainPanelDevice)
--[[
export in low tick interval to Ikarus
Example from A-10C
Get Radio Frequencies
get data from device
local lUHFRadio = GetDevice(54)
ExportScript.Tools.SendData("ExportID", "Format")
ExportScript.Tools.SendData(2000, string.format("%7.3f", lUHFRadio:get_frequency()/1000000)) <- special function for get frequency data
]]
end
function ExportScript.ProcessDACConfigLowImportance(mainPanelDevice)
--[[
every frame export to hardware
Example from A-10C
Get Radio Frequencies
get data from device
local UHF_RADIO = GetDevice(54)
ExportScript.Tools.SendDataDAC("ExportID", "Format")
ExportScript.Tools.SendDataDAC("ExportID", "Format", HardwareConfigID)
ExportScript.Tools.SendDataDAC("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000))
ExportScript.Tools.SendDataDAC("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000), 2) -- export to Hardware '2' Config
]]
--=====================================================================================
--[[
ExportScript.Tools.WriteToLog('list_cockpit_params(): '..ExportScript.Tools.dump(list_cockpit_params()))
ExportScript.Tools.WriteToLog('CMSP: '..ExportScript.Tools.dump(list_indication(7)))
local ltmp1 = 0
for ltmp2 = 0, 13, 1 do
ltmp1 = list_indication(ltmp2)
ExportScript.Tools.WriteToLog(ltmp2..': '..ExportScript.Tools.dump(ltmp1))
--ExportScript.Tools.WriteToLog(ltmp2..' (metatable): '..ExportScript.Tools.dump(getmetatable(ltmp1)))
end
]]
--[[
local ltmp1 = 0
for ltmp2 = 1, 73, 1 do
ltmp1 = GetDevice(ltmp2)
ExportScript.Tools.WriteToLog(ltmp2..': '..ExportScript.Tools.dump(ltmp1))
ExportScript.Tools.WriteToLog(ltmp2..' (metatable): '..ExportScript.Tools.dump(getmetatable(ltmp1)))
end
]]
end
-----------------------------
-- Custom functions --
-----------------------------
function ExportScript.genericRadio(key, value, hardware)
end

View File

@@ -0,0 +1,948 @@
-- Su-25A Export
-- Version 0.9.9 BETA
gES_FoundFCModule = true
-- auxiliary function
dofile(gES_ExportModulePath.."FC_AuxiliaryFuntions.lua")
-----------------------------------------
-- FLAMING CLIFFS AIRCRAFT / Su-25A --
-- FC aircraft don't support GetDevice --
-----------------------------------------
function ProcessGlassCockpitFCHighImportanceConfig()
local myData = LoGetSelfData()
if (myData) then
local lLatitude = myData.LatLongAlt.Lat -- LATITUDE
local lLongitude = myData.LatLongAlt.Long -- LONGITUDE
local lBasicAtmospherePressure = LoGetBasicAtmospherePressure() -- BAROMETRIC PRESSURE
local lAltBar = LoGetAltitudeAboveSeaLevel() -- ALTITUDE SEA LEVEL (Meter)
local lAltRad = LoGetAltitudeAboveGroundLevel() -- ALTITUDE GROUND LEVEL (Meter)
--local lTrueAirSpeed = LoGetTrueAirSpeed() -- TRUE AIRSPEED (Meter/Second)
local lPitch, lBank, lYaw = LoGetADIPitchBankYaw() -- PITCH, BANK, YAW (Radian)
local lHeading = myData.Heading -- HEADING (Radian)
local lVVI = LoGetVerticalVelocity() -- VERTICAL SPEED (Meter/Second)
local lIAS = LoGetIndicatedAirSpeed() -- INDICATED AIRSPEED (Meter/Second)
local lMachNumber = LoGetMachNumber() -- MACH
local lAoA = LoGetAngleOfAttack() -- ANGLE OF ATTACK AoA (Radian)
local lGlide = LoGetGlideDeviation() -- VOR1 HORIZONTAL DEFLECTION (-1 +1)
local lSide = LoGetSideDeviation() -- VOR1 VERTICAL DEFLECTION (-1 +1)
--local lSlipBallPosition = LoGetSlipBallPosition() -- SLIP BALL (-1 +1)
--local lAccelerationUnits = LoGetAccelerationUnits().y -- G-LOAD
--local lNavInfoPitch = LoGetNavigationInfo().Requirements.pitch -- AP REQUIRED PITCH (Radian)
--local lNavInfoRoll = LoGetNavigationInfo().Requirements.roll -- AP REQUIRED BANK (Radian)
--local lNavInfoSpeed = LoGetNavigationInfo().Requirements.speed -- AP SPEED (Meter/Second)
--local lNavInfoAltitude = LoGetNavigationInfo().Requirements.altitude -- AP ALTITUDE (Meter)
--local lNavInfoVerticalSpeed = LoGetNavigationInfo().Requirements.vertical_speed -- AP VERTICAL SPEED (Meter/Second)
--local lControlPanel_HSI = LoGetControlPanel_HSI() -- HSI Data
local lHSI_RMI = LoGetControlPanel_HSI().RMI_raw -- VOR1 OBS (Radian)
local lHSI_ADF = LoGetControlPanel_HSI().ADF_raw -- ADF OBS (Radian)
--local lHSI_Heading = LoGetControlPanel_HSI().Heading_raw -- Heading (Radian)
local lEngineRPMleft = LoGetEngineInfo().RPM.left -- ENG1 RPM %
local lEngineRPMright = LoGetEngineInfo().RPM.right -- ENG2 RPM %
local lEngineTempLeft = LoGetEngineInfo().Temperature.left -- ENG1 EGT ºC
local lEngineTempRight = LoGetEngineInfo().Temperature.right -- ENG2 EGT ºC
--local lEngineFuelInternal = LoGetEngineInfo().fuel_internal -- TANK1 (INT) (KG)
--local lEngineFuelExternal = LoGetEngineInfo().fuel_external -- TANK2 (EXT) (KG)
--local lMechInfo = LoGetMechInfo() -- mechanical components, e.g. Flaps, Wheelbrakes,...
--local lPayloadInfo = LoGetPayloadInfo() -- Paylod, e.g. bombs, guns, rockets, fuel tanks,...
local lDistanceToWay = 999
local lRoute = LoGetRoute()
if (myData and lRoute) then -- if neither are nil
local myLoc = LoGeoCoordinatesToLoCoordinates(lLongitude, lLatitude)
--lDistanceToWay = math.sqrt((myLoc.x - lRoute.goto_point.world_point.x)^2 + (myLoc.y - lRoute.goto_point.world_point.y)^2)
lDistanceToWay = math.sqrt((myLoc.x - lRoute.goto_point.world_point.x)^2 + (myLoc.z - lRoute.goto_point.world_point.z)^2)
end
if gES_GlassCockpitType == 1 then
-- HELIOS Version 1.3
-- customizing for HELOS
lPitch = math.deg(lPitch) -- PITCH, (Radian to Grad)
lBank = math.deg(lBank) -- BANK (Radian to Grad)
lYaw = math.deg(lYaw) -- YAW (Radian to Grad)
lHSI_RMI = math.deg(lHSI_RMI) -- VOR1 OBS (Radian to Grad)
lHSI_ADF = math.deg(lHSI_ADF) -- ADF OBS (Radian to Grad)
lAoA = math.deg(lAoA) -- ANGLE OF ATTACK AoA (Radian to Grad)
lHeading = math.deg(lHeading) -- Heading (Radian to Grad)
lHSI_ADF = (360 - lHSI_ADF) + (360 - lHeading)
lHSI_RMI = 360 - lHSI_RMI
lIAS = lIAS * 3.6 -- change from m/s to km/h
SendData("1", string.format("%.2f", lPitch) )
SendData("2", string.format("%.2f", lBank) )
SendData("3", string.format("%.2f", lYaw) )
SendData("4", string.format("%.2f", lAltBar) )
SendData("5", string.format("%.2f", lAltRad) )
SendData("6", string.format("%.2f", lHSI_ADF) )
SendData("7", string.format("%.2f", lHSI_RMI) )
SendData("8", string.format("%.2f", lHeading) )
SendData("9", string.format("%.2f", lEngineRPMleft) )
SendData("10", string.format("%.2f", lEngineRPMright) )
SendData("11", string.format("%.2f", lEngineTempLeft) )
SendData("12", string.format("%.2f", lEngineTempRight) )
SendData("13", string.format("%.2f", lVVI) )
SendData("14", string.format("%.2f", lIAS) )
SendData("15", string.format("%.2f", lDistanceToWay) )
SendData("16", string.format("%.2f", lAoA) )
SendData("17", string.format("%.2f", lGlide) )
SendData("18", string.format("%.2f", lSide) )
elseif gES_GlassCockpitType == 2 then
-- HawgTouch version 1.6
local lRadToDCSsignd = math.pi
local lRadToDCSunsignd = math.pi * 2
local lDefaultNull = 0.0
local lDefaultOne = 1.0
-- IAS-TAS Indicator (IAS, TAS) {"%.4f;%.4f"}
FC_Russian_AirSpeed_1100hkm(1)
-- AOA Indicator and Accelerometer (AOA, GLoad)
FC_Russian_AOA_Su25(3)
-- ADI
FC_Russian_ADI_Old(4)
-- HSI
FC_Russian_HSI_old(5)
-- Vertical Velocity Indicator (VVI) (VVI, TurnIndicator, SlipBallPosition)
FC_Russian_VVI_Old(6)
-- Radar Altimeter (AltRad, MinAltitude, WarningFlag, MinAltitudeLamp) {"%.4f;%.4f;%.1f;%.1f"} (below 100m is warning light on)
FC_Russian_RadarAltimeter_1500m(100, 7)
-- Barometric Altimeter (AltBar, BasicAtmospherePressure)
FC_Russian_BarometricAltimeter_late(8)
-- Tachometer (RPM) (EngineRPMleft, EngineRPMright) {"%.4f;%.4f"}
FC_Russian_EngineRPM(9)
-- Left Jet Engine Turbine Temperature Indicator (EngineTemp) {"%.4f"}
FC_Russian_EGT_1000gc(lEngineTempLeft, 10)
-- Right Jet Engine Turbine Temperature Indicator (EngineTemp) {"%.4f"}
FC_Russian_EGT_1000gc(lEngineTempRight, 11)
-- Clock from Ka-50 {CurrentHours, CurrentMinutes, CurrentSeconds, 0, FlightTimeHours, FlightTimeMinutes, 0, 0) {"%.4f;%.4f;%.4f;%.1f;%.4f;%.4f;%.4f;%.4f"}
FC_Russian_Clock_late(12)
-- HSI Distance
FC_Russian_HSI_Distance_old(lDistanceToWay, 21)
-- Mach {max, Mach}
local lMachTmp = 0
if lMachNumber > 0.475 then
--[[
y_min = 0.0 -- minimaler Ausgabewert
y_max = 1.0 -- maximaler Ausgabewert
x_min = 0.475 -- minimaler Eingangswert
x_max = 1.0 -- maximaler Eingangswert
x = 0.65 -- aktueller Eingangswert
d_y = 1 -- Delta Ausgabewerte (y_max - y_min)
d_x = 0.525 -- Delta Eingangswerte (x_max - x_min)
m = 1.9047619047619047619047619047619 -- Steigung der linearen Funktion (d_y / d_x)
n = -0.9047619047619047619047619047619 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max)
y = 0,333333333333333333333333333334 -- Ergebnis (m * x + n)
]]
lMachTmp = 1.9047619047619047619047619047619 * lMachNumber + -0.9047619047619047619047619047619
else
lMachTmp = 0
end
SendData("22", string.format("%0.4f;%0.4f", 0.665, lMachTmp))
end
else
WriteToLog("Unknown FC Error, no LoGetSelfData.")
end
end
function ProcessHARDWAREConfigHighImportance()
end
function ProcessGlassCockpitFCLowImportanceConfig()
if gES_GlassCockpitType == 1 then
-- HELIOS Version 1.3
elseif gES_GlassCockpitType == 2 then
-- HawgTouch version 1.6
FC_WeaponPanel_SU25(13)
FC_RadarWarning_SPO15(14)
-- Fuel Quantity Indicator
local lEngineInfo = LoGetEngineInfo()
if lEngineInfo ~= nil then
--WriteToLog('lEngineInfo: '..dump(lEngineInfo))
--[[
[fuel_external] = number: "0"
[Temperature] = {
[left] = number: "626.99444580078"
[right] = number: "626.99444580078"
}
[RPM] = {
[left] = number: "87.453765869141"
[right] = number: "87.453758239746"
}
[FuelConsumption] = {
[left] = number: "0.1500396137767"
[right] = number: "0.1500396137767"
}
[fuel_internal] = number: "3773.2749023438"
[EngineStart] = {
[left] = number: "0"
[right] = number: "0"
}
[HydraulicPressure] = {
[left] = number: "210"
[right] = number: "210"
}
lPayloadInfo.Stations[8].CLSID == E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF -- ext 800l Fuel Tank
]]
local lTotalFuel = lEngineInfo.fuel_internal
local lFuel_leftbar = 1.0
local lFuel_rightbar = 1.0
local lExtTank1 = 1.0 -- external tanks
local lExtTank2 = 1.0 -- inner tanks
if lTotalFuel < 5000 then
if lTotalFuel > 1500 then
--[[
y_min = 0.0 -- minimaler Ausgabewert
y_max = 1.0 -- maximaler Ausgabewert
x_min = 1500 -- minimaler Eingangswert
x_max = 5000 -- maximaler Eingangswert
x = 3500 -- aktueller Eingangswert
d_y = 1 -- Delta Ausgabewerte (y_max - y_min)
d_x = 3500 -- Delta Eingangswerte (x_max - x_min)
m = 2.8571428571428571428571428571429e-4 -- Steigung der linearen Funktion (d_y / d_x)
n = -0.42857142857142857142857142857143 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max)
y = 0,57142857142857142857142857142857 -- Ergebnis (m * x + n)
]]
lFuel_leftbar = 2.8571428571428571428571428571429e-4 * lTotalFuel + -0.42857142857142857142857142857143
else
lFuel_leftbar = 0.0
end
else
lFuel_leftbar = 1.0
end
if lTotalFuel < 1200 then
lFuel_rightbar = lTotalFuel / 1200
else
lFuel_rightbar = 1.0
end
local lPayloadInfo = LoGetPayloadInfo()
if lPayloadInfo ~= nil then
--WriteToLog('lPayloadInfo: '..dump(lPayloadInfo))
if lPayloadInfo.Stations[10].CLSID == "{E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF}" or
lPayloadInfo.Stations[9].CLSID == "{E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF}" then -- external tanks presend and full (panel 6 and 5)
lExtTank1 = ((lEngineInfo.fuel_external < 1240.0 ) and 1.0 or 0.0)
end
if lPayloadInfo.Stations[5].CLSID == "{E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF}" or
lPayloadInfo.Stations[6].CLSID == "{E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF}" then-- inner tanks presend and full (panel 3 and 8)
lExtTank2 = ((lEngineInfo.fuel_external < 1.0 ) and 1.0 or 0.0)
end
end
-- Fuel_leftbar
-- Fuel_rightbar
-- Light1
-- Light2
-- Light3
-- Light4
-- Light5
-- BingoLight
SendData("15", string.format("%0.4f;%0.4f;%d;%d;%d;%d;%d",
lFuel_leftbar,
lFuel_rightbar,
lExtTank1, -- external tanks
lExtTank2, -- inner tanks
(lEngineInfo.fuel_internal < 2790.0 and 1 or 0), -- Interne Flügeltanks
(lEngineInfo.fuel_internal < 1840.0 and 1 or 0), -- Interne Rumpftanks
(lEngineInfo.fuel_internal < 600.0 and 1 or 0))) -- Bingo Fuel
-- Hydraulic Pressure Left
FC_OneNeedleGauge(lEngineInfo.HydraulicPressure.left, 240, 17)
-- Hydraulic Pressure Right
FC_OneNeedleGauge(lEngineInfo.HydraulicPressure.right, 240, 18)
end
-- EKRAN Message
FC_EKRAN(16)
-- Mechanical Configuration Indicator (GearWarningLight, NoseGear, LeftGear, RightGear, Airbreaks, Flaps1, Flaps2) {"%.1f;%d;%d;%d;%d;%d;%d"}
FC_Russian_MDI_SU25(2)
local lMechInfo = LoGetMechInfo() -- mechanical components, e.g. Flaps, Wheelbrakes,...
if lMechInfo ~= nil then
-- Wheelbrakes Hydraulic Pressure Left
FC_OneNeedleGauge(lMechInfo.wheelbrakes.value, 240, 19)
-- Wheelbrakes Hydraulic Pressure Right
FC_OneNeedleGauge(lMechInfo.wheelbrakes.value, 240, 20)
end
end
--(x < 0 and 'negative' or 'non-negative')
--[[
local lPayloadInfo = LoGetPayloadInfo()
WriteToLog('lPayloadInfo: '..dump(lPayloadInfo))
local lSnares = LoGetSnares() -- Flare and Chaff
WriteToLog('lSnares: '..dump(lSnares))
local lSightingSystemInfo = LoGetSightingSystemInfo()
WriteToLog('lSightingSystemInfo: '..dump(lSightingSystemInfo))
local lTWSInfo = LoGetTWSInfo() -- SPO Informationen, z.B. Radarwarner F15C
WriteToLog('lTWSInfo: '..dump(lTWSInfo))
local lTargetInformation = LoGetTargetInformation() -- detalierte Radar Infos z.B. F15C
WriteToLog('lTargetInformation: '..dump(lTargetInformation))
local lLockedTargetInformation = LoGetLockedTargetInformation()
WriteToLog('lLockedTargetInformation: '..dump(lLockedTargetInformation))
local lF15_TWS_Contacs = LoGetF15_TWS_Contacts() -- the same information but only for F-15 in TWS mode
WriteToLog('lF15_TWS_Contacs: '..dump(lF15_TWS_Contacs))
local lMechInfo = LoGetMechInfo() -- mechanical components, e.g. Flaps, Wheelbrakes,...
WriteToLog('lMechInfo: '..dump(lMechInfo))
local lMCPState = LoGetMCPState() -- Warnlichter
WriteToLog('lMCPState: '..dump(lMCPState))
local lControlPanel_HSI = LoGetControlPanel_HSI()
WriteToLog('lControlPanel_HSI: '..dump(lControlPanel_HSI))
local lRadioBeaconsStatus = LoGetRadioBeaconsStatus()
WriteToLog('lRadioBeaconsStatus: '..dump(lRadioBeaconsStatus))
local lEngineInfo = LoGetEngineInfo()
WriteToLog('lEngineInfo: '..dump(lEngineInfo))
]]
-- Weapon Control System
--local lNameByType = LoGetNameByType () -- args 4 (number : level1,level2,level3,level4), result string
-- values from LoGetTargetInformation().type
--WriteToLog('lNameByType: '..dump(lNameByType))
end
function ProcessHARDWAREConfigLowImportance()
-- where necessary, specify HardwareID, example WeaponStatusPanel(2)
WeaponStatusPanel()
MechanicalDevicesIndicator()
StatusLamp()
FuelQuantityIndicator()
SightingSystem()
SPO15RWR()
end
-----------------------------
-- Custom functions --
-----------------------------
function SightingSystem(hardware)
local lHardware = hardware or 1
local lSightingSystemInfo = LoGetSightingSystemInfo()
if lSightingSystemInfo == nil then
return
end
--WriteToLog('lSightingSystemInfo: '..dump(lSightingSystemInfo)9
--[[
[PRF] = {
[selection] = string: "ILV"
[current] = string: "MED"
}
[laser_on] = boolean: "false"
[scale] = {
[azimuth] = number: "0.52359873056412"
[distance] = number: "10000"
}
[radar_on] = boolean: "false"
[optical_system_on] = boolean: "false"
[LaunchAuthorized] = boolean: "false"
[ECM_on] = boolean: "false"
[Manufacturer] = string: "RUS"
[TDC] = {
[y] = number: "0"
[x] = number: "0"
}
[ScanZone] = {
[coverage_H] = {
[min] = number: "0"
[max] = number: "20000"
}
[size] = {
[azimuth] = number: "1.0471974611282"
[elevation] = number: "0.17453290522099"
}
[position] = {
[exceeding_manual] = number: "0"
[distance_manual] = number: "0"
[azimuth] = number: "0"
[elevation] = number: "0"
}
}
]]
SendDataHW("600", lSightingSystemInfo.ECM_on == true and 1 or 0, lHardware )
SendDataHW("601", lSightingSystemInfo.laser_on == true and 1 or 0, lHardware )
--SendDataHW("602", lSightingSystemInfo.optical_system_on == true and 1 or 0, lHardware )
SendDataHW("603", lSightingSystemInfo.LaunchAuthorized == true and 1 or 0, lHardware )
--SendDataHW("604", lSightingSystemInfo.radar_on == true and 1 or 0, lHardware )
end
function FlareChaff(hardware)
local lHardware = hardware or 1
local lSnares = LoGetSnares() -- Flare and Chaff
if lSnares == nil then
return
end
--WriteToLog('lSnares: '..dump(lSnares))
--[chaff] = number: "128"
--[flare] = number: "128"
end
function StatusLamp(hardware)
local lHardware = hardware or 1
local lMCPState = LoGetMCPState() -- Warning Lights
if lMCPState == nil then
return
end
--WriteToLog('lMCPState: '..dump(lMCPState))
--[[
[RightTailPlaneFailure] = boolean: "false"
[EOSFailure] = boolean: "false"
[ECMFailure] = boolean: "false"
[RightAileronFailure] = boolean: "false"
[MasterWarning] = boolean: "false"
[RightEngineFailure] = boolean: "false"
[CannonFailure] = boolean: "false"
[MLWSFailure] = boolean: "false"
[ACSFailure] = boolean: "false"
[RadarFailure] = boolean: "false"
[HelmetFailure] = boolean: "false"
[HUDFailure] = boolean: "false"
[LeftMainPumpFailure] = boolean: "false"
[RightWingPumpFailure] = boolean: "false"
[LeftWingPumpFailure] = boolean: "false"
[MFDFailure] = boolean: "false"
[RWSFailure] = boolean: "false"
[GearFailure] = boolean: "false"
[HydraulicsFailure] = boolean: "false"
[AutopilotFailure] = boolean: "true"
[FuelTankDamage] = boolean: "false"
[LeftAileronFailure] = boolean: "false"
[CanopyOpen] = boolean: "false"
[RightMainPumpFailure] = boolean: "false"
[StallSignalization] = boolean: "false"
[LeftEngineFailure] = boolean: "false"
[AutopilotOn] = boolean: "false"
[LeftTailPlaneFailure] = boolean: "false"
]]
SendDataHW("700", lMCPState.LeftTailPlaneFailure == true and 1 or 0, lHardware )
SendDataHW("701", lMCPState.RightTailPlaneFailure == true and 1 or 0, lHardware )
SendDataHW("702", lMCPState.MasterWarning == true and 1 or 0, lHardware )
SendDataHW("703", lMCPState.LeftEngineFailure == true and 1 or 0, lHardware )
SendDataHW("704", lMCPState.RightEngineFailure == true and 1 or 0, lHardware )
SendDataHW("705", lMCPState.LeftAileronFailure == true and 1 or 0, lHardware )
SendDataHW("706", lMCPState.RightAileronFailure == true and 1 or 0, lHardware )
SendDataHW("707", lMCPState.LeftMainPumpFailure == true and 1 or 0, lHardware )
SendDataHW("708", lMCPState.RightMainPumpFailure == true and 1 or 0, lHardware )
SendDataHW("709", lMCPState.LeftWingPumpFailure == true and 1 or 0, lHardware )
SendDataHW("710", lMCPState.RightWingPumpFailure == true and 1 or 0, lHardware )
SendDataHW("711", lMCPState.EOSFailure == true and 1 or 0, lHardware )
SendDataHW("712", lMCPState.ECMFailure == true and 1 or 0, lHardware )
SendDataHW("713", lMCPState.CannonFailure == true and 1 or 0, lHardware )
SendDataHW("714", lMCPState.MLWSFailure == true and 1 or 0, lHardware )
SendDataHW("715", lMCPState.ACSFailure == true and 1 or 0, lHardware )
SendDataHW("716", lMCPState.RadarFailure == true and 1 or 0, lHardware )
SendDataHW("717", lMCPState.HelmetFailure == true and 1 or 0, lHardware )
SendDataHW("718", lMCPState.HUDFailure == true and 1 or 0, lHardware )
SendDataHW("719", lMCPState.MFDFailure == true and 1 or 0, lHardware )
SendDataHW("720", lMCPState.RWSFailure == true and 1 or 0, lHardware )
SendDataHW("721", lMCPState.GearFailure == true and 1 or 0, lHardware )
SendDataHW("722", lMCPState.HydraulicsFailure == true and 1 or 0, lHardware )
SendDataHW("723", lMCPState.AutopilotFailure == true and 1 or 0, lHardware )
SendDataHW("724", lMCPState.FuelTankDamage == true and 1 or 0, lHardware )
SendDataHW("725", lMCPState.CanopyOpen == true and 1 or 0, lHardware )
SendDataHW("726", lMCPState.StallSignalization == true and 1 or 0, lHardware )
SendDataHW("727", lMCPState.AutopilotOn == true and 1 or 0, lHardware )
local lEngineInfo = LoGetEngineInfo()
if lEngineInfo ~= nil then
--WriteToLog('lEngineInfo: '..dump(lEngineInfo))
SendDataHW("728", lEngineInfo.EngineStart.left, lHardware ) -- lamp start left engine 1 (0|1)
SendDataHW("729", lEngineInfo.EngineStart.right, lHardware ) -- lamp start right engine 1 (0|1)
end
local lAoA = LoGetAngleOfAttack()
if lAoA ~= nil then
lAoA = lAoA * 57.3
SendDataHW("730", (lAoA > 20.0 and 1 or 0), lHardware ) -- lamp start AOA warning (0|1)
end
end
function WeaponStatusPanel(hardware)
-- The weapon status panel, quantity and readiness of the currently selected weapon and the remaining gun ammunition are indicated.
local lHardware = hardware or 1
gES_PayloadInfo = LoGetPayloadInfo()
if gES_PayloadInfo == nil then
return
end
--WriteToLog('gES_PayloadInfo: '..dump(gES_PayloadInfo))
--[[ exsample
[Stations] = {
[1] = {
[CLSID] = string: "{682A481F-0CB5-4693-A382-D00DD4A156D7}"
[container] = boolean: "false"
[count] = number: "1"
[weapon] = {
[level3] = number: "7"
[level1] = number: "4"
[level4] = number: "10"
[level2] = number: "4"
}
}
[2] = {
[CLSID] = string: "{682A481F-0CB5-4693-A382-D00DD4A156D7}"
[container] = boolean: "false"
[count] = number: "1"
[weapon] = {
[level3] = number: "7"
[level1] = number: "4"
[level4] = number: "10"
[level2] = number: "4"
}
}
[3] = {
[wstype] = {
[level3] = number: "32"
[level1] = number: "4"
[level4] = number: "6"
[level2] = number: "7"
}
[count] = number: "20"
[CLSID] = string: "{F72F47E5-C83A-4B85-96ED-D3E46671EE9A}"
[adapter] = {
[level3] = number: "0"
[level1] = number: "0"
[level4] = number: "0"
[level2] = number: "0"
}
[container] = boolean: "true"
[weapon] = {
[level3] = number: "33"
[level1] = number: "4"
[level4] = number: "32"
[level2] = number: "7"
}
}
[4] = {
[wstype] = {
[level3] = number: "32"
[level1] = number: "4"
[level4] = number: "6"
[level2] = number: "7"
}
[count] = number: "20"
[CLSID] = string: "{F72F47E5-C83A-4B85-96ED-D3E46671EE9A}"
[adapter] = {
[level3] = number: "0"
[level1] = number: "0"
[level4] = number: "0"
[level2] = number: "0"
}
[container] = boolean: "true"
[weapon] = {
[level3] = number: "33"
[level1] = number: "4"
[level4] = number: "32"
[level2] = number: "7"
}
}
[5] = {
[wstype] = {
[level3] = number: "32"
[level1] = number: "4"
[level4] = number: "99"
[level2] = number: "4"
}
[count] = number: "1"
[CLSID] = string: "{79D73885-0801-45a9-917F-C90FE1CE3DFC}"
[adapter] = {
[level3] = number: "0"
[level1] = number: "0"
[level4] = number: "0"
[level2] = number: "0"
}
[container] = boolean: "true"
[weapon] = {
[level3] = number: "8"
[level1] = number: "4"
[level4] = number: "45"
[level2] = number: "4"
}
}
[6] = {
[wstype] = {
[level3] = number: "32"
[level1] = number: "4"
[level4] = number: "99"
[level2] = number: "4"
}
[count] = number: "1"
[CLSID] = string: "{79D73885-0801-45a9-917F-C90FE1CE3DFC}"
[adapter] = {
[level3] = number: "0"
[level1] = number: "0"
[level4] = number: "0"
[level2] = number: "0"
}
[container] = boolean: "true"
[weapon] = {
[level3] = number: "8"
[level1] = number: "4"
[level4] = number: "45"
[level2] = number: "4"
}
}
[7] = {
[wstype] = {
[level3] = number: "32"
[level1] = number: "4"
[level4] = number: "47"
[level2] = number: "4"
}
[count] = number: "8"
[CLSID] = string: "{F789E86A-EE2E-4E6B-B81E-D5E5F903B6ED}"
[adapter] = {
[level3] = number: "0"
[level1] = number: "0"
[level4] = number: "0"
[level2] = number: "0"
}
[container] = boolean: "true"
[weapon] = {
[level3] = number: "8"
[level1] = number: "4"
[level4] = number: "58"
[level2] = number: "4"
}
}
[8] = {
[wstype] = {
[level3] = number: "32"
[level1] = number: "4"
[level4] = number: "47"
[level2] = number: "4"
}
[count] = number: "8"
[CLSID] = string: "{F789E86A-EE2E-4E6B-B81E-D5E5F903B6ED}"
[adapter] = {
[level3] = number: "0"
[level1] = number: "0"
[level4] = number: "0"
[level2] = number: "0"
}
[container] = boolean: "true"
[weapon] = {
[level3] = number: "8"
[level1] = number: "4"
[level4] = number: "58"
[level2] = number: "4"
}
}
[9] = {
[CLSID] = string: "{D5435F26-F120-4FA3-9867-34ACE562EF1B}"
[container] = boolean: "false"
[count] = number: "1"
[weapon] = {
[level3] = number: "38"
[level1] = number: "4"
[level4] = number: "20"
[level2] = number: "5"
}
}
[10] = {
[CLSID] = string: "{D5435F26-F120-4FA3-9867-34ACE562EF1B}"
[container] = boolean: "false"
[count] = number: "1"
[weapon] = {
[level3] = number: "38"
[level1] = number: "4"
[level4] = number: "20"
[level2] = number: "5"
}
}
[11] = {
[CLSID] = string: ""
[container] = boolean: "false"
[count] = number: "0"
[weapon] = {
[level3] = number: "0"
[level1] = number: "0"
[level4] = number: "0"
[level2] = number: "0"
}
}
}
[CurrentStation] = number: "0"
[Cannon] = {
[shells] = number: "250"
}
]]
--[[
Weapon Panel
|
---------------------------------------------------
| | | | | | | | | | |
1 2 3 4 5 C 6 7 8 9 10
]]
-- Payload Info
-- weapon stations (panel) 1 (left) - 10 (right), no lamp for center station
SendDataHW("100", gES_PayloadInfo.Cannon.shells, lHardware ) -- count cannon shells
SendDataHW("101", (gES_PayloadInfo.Stations[1].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 1)
SendDataHW("110", (gES_PayloadInfo.Stations[2].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 10)
SendDataHW("102", (gES_PayloadInfo.Stations[3].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 2)
SendDataHW("109", (gES_PayloadInfo.Stations[4].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 9)
SendDataHW("103", (gES_PayloadInfo.Stations[5].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 3)
SendDataHW("108", (gES_PayloadInfo.Stations[6].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 8)
SendDataHW("104", (gES_PayloadInfo.Stations[7].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 4)
SendDataHW("107", (gES_PayloadInfo.Stations[8].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 7)
SendDataHW("105", (gES_PayloadInfo.Stations[9].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 5)
SendDataHW("106", (gES_PayloadInfo.Stations[10].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 6)
--SendDataHW("110", (gES_PayloadInfo.Stations[11].count > 0 and 1 or 0) ) -- weapon presend > 0 center station, not visible
--SendDataHW("CurrentStation", gES_PayloadInfo.CurrentStation, lHardware )
-- air-to-air missils panel 1 and 11, air combat modus, CurrentStation = 1, panel 1 and 11 on
-- CurrentStation 5, panel 3
-- CurrentStation 3, panel 2
-- CurrentStation 7, panel 4
-- CurrentStation 4, panel 9
-- CurrentStation 9, panel 5
-- CurrentStation 10, panel 6
-- CurrentStation 8, panel 7
-- CurrentStation 6, panel 8
-- wenn die Waffenstationen gleichmässig belegt sind, hat bei Auswahl CurrentStation immer den Wert der linken Station
-- bei ungleichmäßiger Belegung, hat CurrentStation immer den Wert der jeweiligen Station
-- Waffenbezeichnung als UUID, gES_PayloadInfo.Stations[X].CLSID
-- defination
if gES_CurrentStationTmp == nil then
gES_CurrentStationTmp = -1
end
if gES_PayloadInfo.CurrentStation > 0 and
gES_CurrentStationTmp ~= gES_PayloadInfo.CurrentStation then
gES_CurrentStationTmp = gES_PayloadInfo.CurrentStation
gES_TmpStationToPanel = {}
gES_TmpStationToPanel[1] = {Panel = 1, StationID = 101, CurrentID = 201, HardwareID = lHardware } -- left
gES_TmpStationToPanel[2] = {Panel = 10, StationID = 110, CurrentID = 210, HardwareID = lHardware } -- right
gES_TmpStationToPanel[3] = {Panel = 2, StationID = 102, CurrentID = 202, HardwareID = lHardware }
gES_TmpStationToPanel[4] = {Panel = 9, StationID = 109, CurrentID = 209, HardwareID = lHardware }
gES_TmpStationToPanel[5] = {Panel = 3, StationID = 103, CurrentID = 203, HardwareID = lHardware }
gES_TmpStationToPanel[6] = {Panel = 8, StationID = 108, CurrentID = 208, HardwareID = lHardware }
gES_TmpStationToPanel[7] = {Panel = 4, StationID = 104, CurrentID = 204, HardwareID = lHardware }
gES_TmpStationToPanel[8] = {Panel = 7, StationID = 107, CurrentID = 207, HardwareID = lHardware }
gES_TmpStationToPanel[9] = {Panel = 5, StationID = 105, CurrentID = 205, HardwareID = lHardware }
gES_TmpStationToPanel[10] = {Panel = 6, StationID = 106, CurrentID = 206, HardwareID = lHardware }
WeaponStatusPanel_Reset(201, 210, lHardware)
if gES_TmpStationToPanel[gES_PayloadInfo.CurrentStation] ~= nil then
SendDataHW(gES_TmpStationToPanel[gES_PayloadInfo.CurrentStation].CurrentID, 1, lHardware ) -- eigentliche Auswahl
table.foreach(gES_PayloadInfo.Stations, WeaponStatusPanel_selectCurrentPayloadStation) -- zugehörige Stationen
end
end
end
function FuelQuantityIndicator(hardware)
-- Fuel quantity shows the fuel remaining in all tanks
local lHardware = hardware or 1
local lEngineInfo = LoGetEngineInfo()
if lEngineInfo == nil then
return
end
--WriteToLog('lEngineInfo: '..dump(lEngineInfo))
--[[
[fuel_external] = number: "0"
[Temperature] = {
[left] = number: "626.99444580078"
[right] = number: "626.99444580078"
}
[RPM] = {
[left] = number: "87.453765869141"
[right] = number: "87.453758239746"
}
[FuelConsumption] = {
[left] = number: "0.1500396137767"
[right] = number: "0.1500396137767"
}
[fuel_internal] = number: "3773.2749023438"
[EngineStart] = {
[left] = number: "0"
[right] = number: "0"
}
[HydraulicPressure] = {
[left] = number: "210"
[right] = number: "210"
}
lPayloadInfo.Stations[8].CLSID == E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF -- ext 800l Fuel Tank
]]
SendDataHW("300", string.format("%d", math.round((lEngineInfo.fuel_internal / 10), 0, "ceil") * 10), lHardware ) -- total fuel in kg
--SendDataHW("301", string.format("%d", lEngineInfo.fuel_internal)) -- total fuel in kg
--SendDataHW("302", string.format("%d", lEngineInfo.fuel_external)) -- external fuel in kg
local lPayloadInfo = LoGetPayloadInfo()
if lPayloadInfo ~= nil then
--WriteToLog('lPayloadInfo: '..dump(lPayloadInfo))
if lPayloadInfo.Stations[10].CLSID == "{E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF}" or
lPayloadInfo.Stations[9].CLSID == "{E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF}" then -- external tanks presend and full (panel 6 and 5)
SendDataHW("303", ((lEngineInfo.fuel_external < 1240.0 ) and 1 or 0), lHardware )
else
SendDataHW("303", 1, lHardware )
end
if lPayloadInfo.Stations[5].CLSID == "{E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF}" or
lPayloadInfo.Stations[6].CLSID == "{E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF}" then-- inner tank presend and full (panel 3 and 8)
SendDataHW("304", ((lEngineInfo.fuel_external < 1.0 ) and 1 or 0), lHardware )
else
SendDataHW("304", 1, lHardware )
end
else
SendDataHW("303", 1, lHardware )
SendDataHW("304", 1, lHardware )
end
SendDataHW("305", (lEngineInfo.fuel_internal < 2790.0 and 1 or 0), lHardware ) -- Interne Flügeltanks
SendDataHW("306", (lEngineInfo.fuel_internal < 1840.0 and 1 or 0), lHardware ) -- Interne Rumpftanks
--SendDataHW("307", (lEngineInfo.fuel_internal < 1.0 and 1 or 0), lHardware ) -- Zentraler Rumpftanks
SendDataHW("308", (lEngineInfo.fuel_internal < 600.0 and 1 or 0), lHardware ) -- Bingo Fuel
end
function MechanicalDevicesIndicator(hardware)
-- The mechanical devices indicator shows the position of the landing gear, flaps, leading edge flaps and airbrake
local lHardware = hardware or 1
local lMechInfo = LoGetMechInfo() -- mechanical components, e.g. Flaps, Wheelbrakes,...
if lMechInfo == nil then
return
end
--[[
[hook] = {
[status] = number: "0"
[value] = number: "0"
}
[parachute] = {
[status] = number: "0"
[value] = number: "0"
}
[controlsurfaces] = {
[eleron] = {
[left] = number: "0"
[right] = number: "-0.21084336936474"
}
[elevator] = {
[left] = number: "-0"
[right] = number: "-0"
}
[rudder] = {
[left] = number: "0"
[right] = number: "0"
}
}
[airintake] = {
[status] = number: "0"
[value] = number: "0"
}
[canopy] = {
[status] = number: "0"
[value] = number: "0"
}
[refuelingboom] = {
[status] = number: "0"
[value] = number: "0"
}
[wing] = {
[status] = number: "0"
[value] = number: "0"
}
[noseflap] = {
[status] = number: "0"
[value] = number: "0"
}
[gear] = {
[value] = number: "0"
[nose] = {
[rod] = number: "0"
}
[main] = {
[left] = {
[rod] = number: "0"
}
[right] = {
[rod] = number: "0"
}
}
[status] = number: "0"
}
[speedbrakes] = {
[status] = number: "0"
[value] = number: "0"
}
[wheelbrakes] = {
[status] = number: "0"
[value] = number: "0"
}
[flaps] = {
[status] = number: "0"
[value] = number: "0"
}]]
--SendDataHW("500", lMechInfo.gear.status )
--SendDataHW("501", lMechInfo.gear.value )
--SendDataHW("502", lMechInfo.gear.nose.rod ) -- zeigt an wie weit das Fahrwerk einsackt wenn das Flugzeug auf dem Boden ist
--SendDataHW("503", lMechInfo.gear.main.left.rod ) -- zeigt an wie weit das Fahrwerk einsackt wenn das Flugzeug auf dem Boden ist
--SendDataHW("504", lMechInfo.gear.main.right.rod ) -- zeigt an wie weit das Fahrwerk einsackt wenn das Flugzeug auf dem Boden ist
--SendDataHW("500", ((lMechInfo.gear.status == 1 and lMechInfo.gear.value < 1) and 1 or 0 ) ) -- gear warning light, go up
--SendDataHW("500", ((lMechInfo.gear.status == 0 and lMechInfo.gear.value > 0) and 1 or 0 ) ) -- gear warning light, go down
SendDataHW("500", (((lMechInfo.gear.status == 1 and lMechInfo.gear.value < 1) or (lMechInfo.gear.status == 0 and lMechInfo.gear.value > 0)) and 1 or 0 ), lHardware ) -- gear warning light
SendDataHW("501", (lMechInfo.gear.value > 0.85 and 1 or 0), lHardware ) -- nose gear
SendDataHW("502", (lMechInfo.gear.value > 0.95 and 1 or 0), lHardware ) -- left gear
SendDataHW("503", (lMechInfo.gear.value == 1 and 1 or 0), lHardware ) -- right gear
--SendDataHW("510", lMechInfo.speedbrakes.status ) -- speedbreakes on 1 (0|1)
SendDataHW("510", (lMechInfo.speedbrakes.value > 0.1 and 1 or 0), lHardware ) -- speedbreakes on > 0.1 (0 - 1)
--SendDataHW("520", lMechInfo.wheelbrakes.status, lHardware ) -- not in use
--SendDataHW("521", lMechInfo.wheelbrakes.value, lHardware ) -- not in use
local lTrueAirSpeed = LoGetTrueAirSpeed()
--SendDataHW("530", lMechInfo.flaps.status ) -- flap switch off 0, 1. position 1, 2. position 2 (0|1|2)
--SendDataHW("531", lMechInfo.flaps.value ) -- flap 1. position > 0.25, 2. position > 0.93 (0 - 1)
SendDataHW("531", (lMechInfo.flaps.value > 0.25 and 1 or 0), lHardware ) -- flap 1. position
SendDataHW("532", (lMechInfo.flaps.value > 0.93 and 1 or 0), lHardware ) -- flap 2. position
SendDataHW("533", ((lMechInfo.flaps.value > 0.93 and lTrueAirSpeed > 340) and 1 or 0), lHardware ) -- Speed Warning for Flaps, same light as gear warning light, but blinking light
end

View File

@@ -0,0 +1,904 @@
-- Su-25T Export
-- Version 1.0.0 BETA
ExportScript.FoundFCModule = true
-- auxiliary function
dofile(ExportScript.Config.ExportModulePath.."FC_AuxiliaryFuntions.lua")
-----------------------------------------
-- FLAMING CLIFFS AIRCRAFT / Su-25T --
-- FC aircraft don't support GetDevice --
-----------------------------------------
function ExportScript.ProcessIkarusFCHighImportanceConfig()
local lFunctionTyp = "Ikarus" -- function type for shared function
local myData = nil -- = LoGetSelfData()
if (myData) then
local lLatitude = myData.LatLongAlt.Lat -- LATITUDE
local lLongitude = myData.LatLongAlt.Long -- LONGITUDE
local lBasicAtmospherePressure = LoGetBasicAtmospherePressure() -- BAROMETRIC PRESSURE
local lAltBar = LoGetAltitudeAboveSeaLevel() -- ALTITUDE SEA LEVEL (Meter)
local lAltRad = LoGetAltitudeAboveGroundLevel() -- ALTITUDE GROUND LEVEL (Meter)
--local lTrueAirSpeed = LoGetTrueAirSpeed() -- TRUE AIRSPEED (Meter/Second)
local lPitch, lBank, lYaw = LoGetADIPitchBankYaw() -- PITCH, BANK, YAW (Radian)
local lHeading = myData.Heading -- HEADING (Radian)
local lVVI = LoGetVerticalVelocity() -- VERTICAL SPEED (Meter/Second)
local lIAS = LoGetIndicatedAirSpeed() -- INDICATED AIRSPEED (Meter/Second)
--local lMachNumber = LoGetMachNumber -- MACH
local lAoA = LoGetAngleOfAttack() -- ANGLE OF ATTACK AoA (Radian)
local lGlide = LoGetGlideDeviation() -- VOR1 HORIZONTAL DEFLECTION (-1 +1)
local lSide = LoGetSideDeviation() -- VOR1 VERTICAL DEFLECTION (-1 +1)
--local lSlipBallPosition = LoGetSlipBallPosition() -- SLIP BALL (-1 +1)
--local lAccelerationUnits = LoGetAccelerationUnits().y -- G-LOAD
--local lNavInfoPitch = LoGetNavigationInfo().Requirements.pitch -- AP REQUIRED PITCH (Radian)
--local lNavInfoRoll = LoGetNavigationInfo().Requirements.roll -- AP REQUIRED BANK (Radian)
--local lNavInfoSpeed = LoGetNavigationInfo().Requirements.speed -- AP SPEED (Meter/Second)
--local lNavInfoAltitude = LoGetNavigationInfo().Requirements.altitude -- AP ALTITUDE (Meter)
--local lNavInfoVerticalSpeed = LoGetNavigationInfo().Requirements.vertical_speed -- AP VERTICAL SPEED (Meter/Second)
--local lControlPanel_HSI = LoGetControlPanel_HSI() -- HSI Data
local lHSI_RMI = LoGetControlPanel_HSI().RMI_raw -- VOR1 OBS (Radian)
local lHSI_ADF = LoGetControlPanel_HSI().ADF_raw -- ADF OBS (Radian)
--local lHSI_Heading = LoGetControlPanel_HSI().Heading_raw -- Heading (Radian)
local lEngineRPMleft = LoGetEngineInfo().RPM.left -- ENG1 RPM %
local lEngineRPMright = LoGetEngineInfo().RPM.right -- ENG2 RPM %
local lEngineTempLeft = LoGetEngineInfo().Temperature.left -- ENG1 EGT ºC
local lEngineTempRight = LoGetEngineInfo().Temperature.right -- ENG2 EGT ºC
--local lEngineFuelInternal = LoGetEngineInfo().fuel_internal -- TANK1 (INT) (KG)
--local lEngineFuelExternal = LoGetEngineInfo().fuel_external -- TANK2 (EXT) (KG)
--local lMechInfo = LoGetMechInfo() -- mechanical components, e.g. Flaps, Wheelbrakes,...
--local lPayloadInfo = LoGetPayloadInfo() -- Paylod, e.g. bombs, guns, rockets, fuel tanks,...
local lDistanceToWay = 999
local lRoute = LoGetRoute()
if (myData and lRoute) then -- if neither are nil
local myLoc = LoGeoCoordinatesToLoCoordinates(lLongitude, lLatitude)
--lDistanceToWay = math.sqrt((myLoc.x - lRoute.goto_point.world_point.x)^2 + (myLoc.y - lRoute.goto_point.world_point.y)^2)
lDistanceToWay = math.sqrt((myLoc.x - lRoute.goto_point.world_point.x)^2 + (myLoc.z - lRoute.goto_point.world_point.z)^2)
end
if gES_GlassCockpitType == 1 then
-- HELIOS Version 1.3
-- customizing for HELOS
lPitch = math.deg(lPitch) -- PITCH, (Radian to Grad)
lBank = math.deg(lBank) -- BANK (Radian to Grad)
lYaw = math.deg(lYaw) -- YAW (Radian to Grad)
lHSI_RMI = math.deg(lHSI_RMI) -- VOR1 OBS (Radian to Grad)
lHSI_ADF = math.deg(lHSI_ADF) -- ADF OBS (Radian to Grad)
lAoA = math.deg(lAoA) -- ANGLE OF ATTACK AoA (Radian to Grad)
lHeading = math.deg(lHeading) -- Heading (Radian to Grad)
lHSI_ADF = (360 - lHSI_ADF) + (360 - lHeading)
lHSI_RMI = 360 - lHSI_RMI
lIAS = lIAS * 3.6 -- change from m/s to km/h
SendData("1", string.format("%.2f", lPitch) )
SendData("2", string.format("%.2f", lBank) )
SendData("3", string.format("%.2f", lYaw) )
SendData("4", string.format("%.2f", lAltBar) )
SendData("5", string.format("%.2f", lAltRad) )
SendData("6", string.format("%.2f", lHSI_ADF) )
SendData("7", string.format("%.2f", lHSI_RMI) )
SendData("8", string.format("%.2f", lHeading) )
SendData("9", string.format("%.2f", lEngineRPMleft) )
SendData("10", string.format("%.2f", lEngineRPMright) )
SendData("11", string.format("%.2f", lEngineTempLeft) )
SendData("12", string.format("%.2f", lEngineTempRight) )
SendData("13", string.format("%.2f", lVVI) )
SendData("14", string.format("%.2f", lIAS) )
SendData("15", string.format("%.2f", lDistanceToWay) )
SendData("16", string.format("%.2f", lAoA) )
SendData("17", string.format("%.2f", lGlide) )
SendData("18", string.format("%.2f", lSide) )
elseif gES_GlassCockpitType == 2 then
-- HawgTouch version 1.6
local lRadToDCSsignd = math.pi
local lRadToDCSunsignd = math.pi * 2
local lDefaultNull = 0.0
local lDefaultOne = 1.0
-- IAS-TAS Indicator (IAS, TAS) {"%.4f;%.4f"}
FC_Russian_AirSpeed_1100hkm(1)
-- AOA Indicator and Accelerometer (AOA, GLoad)
FC_Russian_AOA_Su25(3)
-- ADI
FC_Russian_ADI_Old(4)
-- HSI
FC_Russian_HSI(lDistanceToWay, 5)
-- Vertical Velocity Indicator (VVI) (VVI, TurnIndicator, SlipBallPosition)
FC_Russian_VVI_Old(6)
-- Radar Altimeter (AltRad, MinAltitude, WarningFlag, MinAltitudeLamp) {"%.4f;%.4f;%.1f;%.1f"} (below 100m is warning light on)
FC_Russian_RadarAltimeter_1500m(100, 7)
-- Barometric Altimeter (AltBar, BasicAtmospherePressure)
FC_Russian_BarometricAltimeter_late(8)
-- Tachometer (RPM) (EngineRPMleft, EngineRPMright) {"%.4f;%.4f"}
FC_Russian_EngineRPM(9)
-- Left Jet Engine Turbine Temperature Indicator (EngineTemp) {"%.4f"}
FC_Russian_EGT_1000gc(lEngineTempLeft, 10)
-- Right Jet Engine Turbine Temperature Indicator (EngineTemp) {"%.4f"}
FC_Russian_EGT_1000gc(lEngineTempRight, 11)
-- Clock from Ka-50 {CurrentHours, CurrentMinutes, CurrentSeconds, 0, FlightTimeHours, FlightTimeMinutes, 0, 0) {"%.4f;%.4f;%.4f;%.1f;%.4f;%.4f;%.4f;%.4f"}
FC_Russian_Clock_late(12)
end
else
--WriteToLog("Unknown FC Error, no LoGetSelfData.")
end
end
function ExportScript.ProcessDACConfigHighImportance()
local lFunctionTyp = "DAC" -- function type for shared function
end
function ExportScript.ProcessIkarusFCLowImportanceConfig()
local lFunctionTyp = "Ikarus" -- function type for shared function
ExportScript.AF.SPO15RWR(lFunctionTyp)
ExportScript.AF.WeaponPanel_SU25(lFunctionTyp)
if gES_GlassCockpitType == 1 then
-- HELIOS Version 1.3
elseif gES_GlassCockpitType == 2 then
-- HawgTouch version 1.6
FC_WeaponPanel_SU25(13)
FC_RadarWarning_SPO15(14)
-- Fuel Quantity Indicator
local lEngineInfo = LoGetEngineInfo()
if lEngineInfo ~= nil then
--WriteToLog('lEngineInfo: '..dump(lEngineInfo))
--[[
[fuel_external] = number: "0"
[Temperature] = {
[left] = number: "626.99444580078"
[right] = number: "626.99444580078"
}
[RPM] = {
[left] = number: "87.453765869141"
[right] = number: "87.453758239746"
}
[FuelConsumption] = {
[left] = number: "0.1500396137767"
[right] = number: "0.1500396137767"
}
[fuel_internal] = number: "3773.2749023438"
[EngineStart] = {
[left] = number: "0"
[right] = number: "0"
}
[HydraulicPressure] = {
[left] = number: "210"
[right] = number: "210"
}
lPayloadInfo.Stations[8].CLSID == E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF -- ext 800l Fuel Tank
]]
local lTotalFuel = lEngineInfo.fuel_internal
--local lTotalFuel = string.format("%3d", math.round((lEngineInfo.fuel_internal / 10), 0, "ceil") * 10)
--local lTotalFuel = string.format("%4d", lEngineInfo.fuel_internal) -- total fuel in kg
--local lTotalFuel = string.format("%4d", lEngineInfo.fuel_external) -- external fuel in kg
local lFuelCounter = {[0] = 0.0, [1] = 0.11, [2] = 0.22, [3] = 0.33, [4] = 0.44, [5] = 0.55, [6] = 0.66, [7] = 0.77, [8] = 0.88, [9] = 0.99}
lTotalFuel = string.format("%03d", math.round((lEngineInfo.fuel_internal / 10), 0, "ceil")) -- auf drei stellen bringen
local lExtTank1 = 1.0 -- external tanks
local lExtTank2 = 1.0 -- inner tanks
local lPayloadInfo = LoGetPayloadInfo()
if lPayloadInfo ~= nil then
--WriteToLog('lPayloadInfo: '..dump(lPayloadInfo))
if lPayloadInfo.Stations[10].CLSID == "{E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF}" or
lPayloadInfo.Stations[9].CLSID == "{E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF}" then -- external tanks presend and full (panel 6 and 5)
lExtTank1 = ((lEngineInfo.fuel_external < 1240.0 ) and 1.0 or 0.0)
end
if lPayloadInfo.Stations[5].CLSID == "{E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF}" or
lPayloadInfo.Stations[6].CLSID == "{E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF}" then-- inner tanks presend and full (panel 3 and 8)
lExtTank2 = ((lEngineInfo.fuel_external < 1.0 ) and 1.0 or 0.0)
end
end
-- TotalFuel_100
-- TotalFuel_10
-- TotalFuel_1
-- Light1
-- Light2
-- Light3
-- Light4
-- Light5
-- BingoLight
SendData("15", string.format("%0.2f;%0.2f;%0.2f;%d;%d;%d;%d;%d;%d",
lFuelCounter[tonumber(string.sub(lTotalFuel, 1, 1))],
lFuelCounter[tonumber(string.sub(lTotalFuel, 2, 2))],
lFuelCounter[tonumber(string.sub(lTotalFuel, 3, 3))],
lExtTank1, -- external tanks
lExtTank2, -- inner tanks
(lEngineInfo.fuel_internal < 2800.0 and 1 or 0), -- Interne Flügeltanks
(lEngineInfo.fuel_internal < 1840.0 and 1 or 0), -- Interne Rumpftanks
(lEngineInfo.fuel_internal < 1.0 and 1 or 0), -- Zentraler Rumpftanks
(lEngineInfo.fuel_internal < 600.0 and 1 or 0))) -- Bingo Fuel
-- Hydraulic Pressure Left
FC_OneNeedleGauge(lEngineInfo.HydraulicPressure.left, 240, 17)
-- Hydraulic Pressure Right
FC_OneNeedleGauge(lEngineInfo.HydraulicPressure.right, 240, 18)
end
-- EKRAN Message
FC_EKRAN(16)
-- Mechanical Configuration Indicator (GearWarningLight, NoseGear, LeftGear, RightGear, Airbreaks, Flaps1, Flaps2) {"%.1f;%d;%d;%d;%d;%d;%d"}
FC_Russian_MDI_SU25(2)
local lMechInfo = LoGetMechInfo() -- mechanical components, e.g. Flaps, Wheelbrakes,...
if lMechInfo ~= nil then
-- Wheelbrakes Hydraulic Pressure Left
FC_OneNeedleGauge(lMechInfo.wheelbrakes.value, 240, 19)
-- Wheelbrakes Hydraulic Pressure Right
FC_OneNeedleGauge(lMechInfo.wheelbrakes.value, 240, 20)
end
end
--(x < 0 and 'negative' or 'non-negative')
--[[
local lPayloadInfo = LoGetPayloadInfo()
WriteToLog('lPayloadInfo: '..dump(lPayloadInfo))
local lSnares = LoGetSnares() -- Flare and Chaff
WriteToLog('lSnares: '..dump(lSnares))
local lSightingSystemInfo = LoGetSightingSystemInfo()
WriteToLog('lSightingSystemInfo: '..dump(lSightingSystemInfo))
local lTWSInfo = LoGetTWSInfo() -- SPO Informationen, z.B. Radarwarner F15C
WriteToLog('lTWSInfo: '..dump(lTWSInfo))
local lTargetInformation = LoGetTargetInformation() -- detalierte Radar Infos z.B. F15C
WriteToLog('lTargetInformation: '..dump(lTargetInformation))
local lLockedTargetInformation = LoGetLockedTargetInformation()
WriteToLog('lLockedTargetInformation: '..dump(lLockedTargetInformation))
local lF15_TWS_Contacs = LoGetF15_TWS_Contacts() -- the same information but only for F-15 in TWS mode
WriteToLog('lF15_TWS_Contacs: '..dump(lF15_TWS_Contacs))
local lMechInfo = LoGetMechInfo() -- mechanical components, e.g. Flaps, Wheelbrakes,...
WriteToLog('lMechInfo: '..dump(lMechInfo))
local lMCPState = LoGetMCPState() -- Warnlichter
WriteToLog('lMCPState: '..dump(lMCPState))
local lControlPanel_HSI = LoGetControlPanel_HSI()
WriteToLog('lControlPanel_HSI: '..dump(lControlPanel_HSI))
local lRadioBeaconsStatus = LoGetRadioBeaconsStatus()
WriteToLog('lRadioBeaconsStatus: '..dump(lRadioBeaconsStatus))
local lEngineInfo = LoGetEngineInfo()
WriteToLog('lEngineInfo: '..dump(lEngineInfo))
]]
-- Weapon Control System
--local lNameByType = LoGetNameByType () -- args 4 (number : level1,level2,level3,level4), result string
-- values from LoGetTargetInformation().type
--WriteToLog('lNameByType: '..dump(lNameByType))
end
function ExportScript.ProcessDACConfigLowImportance()
local lFunctionTyp = "DAC" -- function type for shared function
-- WeaponStatusPanel()
-- MechanicalDevicesIndicator()
-- StatusLamp()
-- FuelQuantityIndicator()
-- SightingSystem()
-- SPO15RWR()
end
-----------------------------
-- Custom functions --
-----------------------------
function SightingSystem(hardware)
local lHardware = hardware or 1
local lSightingSystemInfo = LoGetSightingSystemInfo()
if lSightingSystemInfo == nil then
return
end
--WriteToLog('lSightingSystemInfo: '..dump(lSightingSystemInfo)9
--[[
[PRF] = {
[selection] = string: "ILV"
[current] = string: "MED"
}
[laser_on] = boolean: "false"
[scale] = {
[azimuth] = number: "0.52359873056412"
[distance] = number: "10000"
}
[radar_on] = boolean: "false"
[optical_system_on] = boolean: "false"
[LaunchAuthorized] = boolean: "false"
[ECM_on] = boolean: "false"
[Manufacturer] = string: "RUS"
[TDC] = {
[y] = number: "0"
[x] = number: "0"
}
[ScanZone] = {
[coverage_H] = {
[min] = number: "0"
[max] = number: "20000"
}
[size] = {
[azimuth] = number: "1.0471974611282"
[elevation] = number: "0.17453290522099"
}
[position] = {
[exceeding_manual] = number: "0"
[distance_manual] = number: "0"
[azimuth] = number: "0"
[elevation] = number: "0"
}
}
]]
SendDataHW("600", lSightingSystemInfo.ECM_on == true and 1 or 0, lHardware )
SendDataHW("601", lSightingSystemInfo.laser_on == true and 1 or 0, lHardware )
SendDataHW("602", lSightingSystemInfo.optical_system_on == true and 1 or 0, lHardware )
SendDataHW("603", lSightingSystemInfo.LaunchAuthorized == true and 1 or 0, lHardware )
--SendDataHW("604", lSightingSystemInfo.radar_on == true and 1 or 0, lHardware )
end
function FlareChaff(hardware)
local lHardware = hardware or 1
local lSnares = LoGetSnares() -- Flare and Chaff
if lSnares == nil then
return
end
--WriteToLog('lSnares: '..dump(lSnares))
--[chaff] = number: "128"
--[flare] = number: "128"
end
function StatusLamp(hardware)
local lHardware = hardware or 1
local lMCPState = LoGetMCPState() -- Warning Lights
if lMCPState == nil then
return
end
--WriteToLog('lMCPState: '..dump(lMCPState))
--[[
[RightTailPlaneFailure] = boolean: "false"
[EOSFailure] = boolean: "false"
[ECMFailure] = boolean: "false"
[RightAileronFailure] = boolean: "false"
[MasterWarning] = boolean: "false"
[RightEngineFailure] = boolean: "false"
[CannonFailure] = boolean: "false"
[MLWSFailure] = boolean: "false"
[ACSFailure] = boolean: "false"
[RadarFailure] = boolean: "false"
[HelmetFailure] = boolean: "false"
[HUDFailure] = boolean: "false"
[LeftMainPumpFailure] = boolean: "false"
[RightWingPumpFailure] = boolean: "false"
[LeftWingPumpFailure] = boolean: "false"
[MFDFailure] = boolean: "false"
[RWSFailure] = boolean: "false"
[GearFailure] = boolean: "false"
[HydraulicsFailure] = boolean: "false"
[AutopilotFailure] = boolean: "true"
[FuelTankDamage] = boolean: "false"
[LeftAileronFailure] = boolean: "false"
[CanopyOpen] = boolean: "false"
[RightMainPumpFailure] = boolean: "false"
[StallSignalization] = boolean: "false"
[LeftEngineFailure] = boolean: "false"
[AutopilotOn] = boolean: "false"
[LeftTailPlaneFailure] = boolean: "false"
]]
SendDataHW("700", lMCPState.LeftTailPlaneFailure == true and 1 or 0, lHardware )
SendDataHW("701", lMCPState.RightTailPlaneFailure == true and 1 or 0, lHardware )
SendDataHW("702", lMCPState.MasterWarning == true and 1 or 0, lHardware )
SendDataHW("703", lMCPState.LeftEngineFailure == true and 1 or 0, lHardware )
SendDataHW("704", lMCPState.RightEngineFailure == true and 1 or 0, lHardware )
SendDataHW("705", lMCPState.LeftAileronFailure == true and 1 or 0, lHardware )
SendDataHW("706", lMCPState.RightAileronFailure == true and 1 or 0, lHardware )
SendDataHW("707", lMCPState.LeftMainPumpFailure == true and 1 or 0, lHardware )
SendDataHW("708", lMCPState.RightMainPumpFailure == true and 1 or 0, lHardware )
SendDataHW("709", lMCPState.LeftWingPumpFailure == true and 1 or 0, lHardware )
SendDataHW("710", lMCPState.RightWingPumpFailure == true and 1 or 0, lHardware )
SendDataHW("711", lMCPState.EOSFailure == true and 1 or 0, lHardware )
SendDataHW("712", lMCPState.ECMFailure == true and 1 or 0, lHardware )
SendDataHW("713", lMCPState.CannonFailure == true and 1 or 0, lHardware )
SendDataHW("714", lMCPState.MLWSFailure == true and 1 or 0, lHardware )
SendDataHW("715", lMCPState.ACSFailure == true and 1 or 0, lHardware )
SendDataHW("716", lMCPState.RadarFailure == true and 1 or 0, lHardware )
SendDataHW("717", lMCPState.HelmetFailure == true and 1 or 0, lHardware )
SendDataHW("718", lMCPState.HUDFailure == true and 1 or 0, lHardware )
SendDataHW("719", lMCPState.MFDFailure == true and 1 or 0, lHardware )
SendDataHW("720", lMCPState.RWSFailure == true and 1 or 0, lHardware )
SendDataHW("721", lMCPState.GearFailure == true and 1 or 0, lHardware )
SendDataHW("722", lMCPState.HydraulicsFailure == true and 1 or 0, lHardware )
SendDataHW("723", lMCPState.AutopilotFailure == true and 1 or 0, lHardware )
SendDataHW("724", lMCPState.FuelTankDamage == true and 1 or 0, lHardware )
SendDataHW("725", lMCPState.CanopyOpen == true and 1 or 0, lHardware )
SendDataHW("726", lMCPState.StallSignalization == true and 1 or 0, lHardware )
SendDataHW("727", lMCPState.AutopilotOn == true and 1 or 0, lHardware )
local lEngineInfo = LoGetEngineInfo()
if lEngineInfo ~= nil then
--WriteToLog('lEngineInfo: '..dump(lEngineInfo))
SendDataHW("728", lEngineInfo.EngineStart.left, lHardware ) -- lamp start left engine 1 (0|1)
SendDataHW("729", lEngineInfo.EngineStart.right, lHardware ) -- lamp start right engine 1 (0|1)
end
local lAoA = LoGetAngleOfAttack()
if lAoA ~= nil then
lAoA = lAoA * 57.3
SendDataHW("730", (lAoA > 20.0 and 1 or 0), lHardware ) -- lamp start AOA warning (0|1)
end
end
function WeaponStatusPanel(hardware)
-- The weapon status panel, quantity and readiness of the currently selected weapon and the remaining gun ammunition are indicated.
local lHardware = hardware or 1
gES_PayloadInfo = LoGetPayloadInfo()
if gES_PayloadInfo == nil then
return
end
--WriteToLog('gES_PayloadInfo: '..dump(gES_PayloadInfo))
--[[ exsample
[Stations] = {
[1] = {
[CLSID] = string: "{682A481F-0CB5-4693-A382-D00DD4A156D7}"
[container] = boolean: "false"
[count] = number: "1"
[weapon] = {
[level3] = number: "7"
[level1] = number: "4"
[level4] = number: "10"
[level2] = number: "4"
}
}
[2] = {
[CLSID] = string: "{682A481F-0CB5-4693-A382-D00DD4A156D7}"
[container] = boolean: "false"
[count] = number: "1"
[weapon] = {
[level3] = number: "7"
[level1] = number: "4"
[level4] = number: "10"
[level2] = number: "4"
}
}
[3] = {
[wstype] = {
[level3] = number: "32"
[level1] = number: "4"
[level4] = number: "6"
[level2] = number: "7"
}
[count] = number: "20"
[CLSID] = string: "{F72F47E5-C83A-4B85-96ED-D3E46671EE9A}"
[adapter] = {
[level3] = number: "0"
[level1] = number: "0"
[level4] = number: "0"
[level2] = number: "0"
}
[container] = boolean: "true"
[weapon] = {
[level3] = number: "33"
[level1] = number: "4"
[level4] = number: "32"
[level2] = number: "7"
}
}
[4] = {
[wstype] = {
[level3] = number: "32"
[level1] = number: "4"
[level4] = number: "6"
[level2] = number: "7"
}
[count] = number: "20"
[CLSID] = string: "{F72F47E5-C83A-4B85-96ED-D3E46671EE9A}"
[adapter] = {
[level3] = number: "0"
[level1] = number: "0"
[level4] = number: "0"
[level2] = number: "0"
}
[container] = boolean: "true"
[weapon] = {
[level3] = number: "33"
[level1] = number: "4"
[level4] = number: "32"
[level2] = number: "7"
}
}
[5] = {
[wstype] = {
[level3] = number: "32"
[level1] = number: "4"
[level4] = number: "99"
[level2] = number: "4"
}
[count] = number: "1"
[CLSID] = string: "{79D73885-0801-45a9-917F-C90FE1CE3DFC}"
[adapter] = {
[level3] = number: "0"
[level1] = number: "0"
[level4] = number: "0"
[level2] = number: "0"
}
[container] = boolean: "true"
[weapon] = {
[level3] = number: "8"
[level1] = number: "4"
[level4] = number: "45"
[level2] = number: "4"
}
}
[6] = {
[wstype] = {
[level3] = number: "32"
[level1] = number: "4"
[level4] = number: "99"
[level2] = number: "4"
}
[count] = number: "1"
[CLSID] = string: "{79D73885-0801-45a9-917F-C90FE1CE3DFC}"
[adapter] = {
[level3] = number: "0"
[level1] = number: "0"
[level4] = number: "0"
[level2] = number: "0"
}
[container] = boolean: "true"
[weapon] = {
[level3] = number: "8"
[level1] = number: "4"
[level4] = number: "45"
[level2] = number: "4"
}
}
[7] = {
[wstype] = {
[level3] = number: "32"
[level1] = number: "4"
[level4] = number: "47"
[level2] = number: "4"
}
[count] = number: "8"
[CLSID] = string: "{F789E86A-EE2E-4E6B-B81E-D5E5F903B6ED}"
[adapter] = {
[level3] = number: "0"
[level1] = number: "0"
[level4] = number: "0"
[level2] = number: "0"
}
[container] = boolean: "true"
[weapon] = {
[level3] = number: "8"
[level1] = number: "4"
[level4] = number: "58"
[level2] = number: "4"
}
}
[8] = {
[wstype] = {
[level3] = number: "32"
[level1] = number: "4"
[level4] = number: "47"
[level2] = number: "4"
}
[count] = number: "8"
[CLSID] = string: "{F789E86A-EE2E-4E6B-B81E-D5E5F903B6ED}"
[adapter] = {
[level3] = number: "0"
[level1] = number: "0"
[level4] = number: "0"
[level2] = number: "0"
}
[container] = boolean: "true"
[weapon] = {
[level3] = number: "8"
[level1] = number: "4"
[level4] = number: "58"
[level2] = number: "4"
}
}
[9] = {
[CLSID] = string: "{D5435F26-F120-4FA3-9867-34ACE562EF1B}"
[container] = boolean: "false"
[count] = number: "1"
[weapon] = {
[level3] = number: "38"
[level1] = number: "4"
[level4] = number: "20"
[level2] = number: "5"
}
}
[10] = {
[CLSID] = string: "{D5435F26-F120-4FA3-9867-34ACE562EF1B}"
[container] = boolean: "false"
[count] = number: "1"
[weapon] = {
[level3] = number: "38"
[level1] = number: "4"
[level4] = number: "20"
[level2] = number: "5"
}
}
[11] = {
[CLSID] = string: ""
[container] = boolean: "false"
[count] = number: "0"
[weapon] = {
[level3] = number: "0"
[level1] = number: "0"
[level4] = number: "0"
[level2] = number: "0"
}
}
}
[CurrentStation] = number: "0"
[Cannon] = {
[shells] = number: "250"
}
]]
--[[
Weapon Panel
|
---------------------------------------------------
| | | | | | | | | | |
1 2 3 4 5 C 6 7 8 9 10
]]
-- Payload Info
-- weapon stations (panel) 1 (left) - 10 (right), no lamp for center station
SendDataHW("100", gES_PayloadInfo.Cannon.shells, lHardware ) -- count cannon shells
SendDataHW("101", (gES_PayloadInfo.Stations[1].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 1)
SendDataHW("110", (gES_PayloadInfo.Stations[2].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 10)
SendDataHW("102", (gES_PayloadInfo.Stations[3].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 2)
SendDataHW("109", (gES_PayloadInfo.Stations[4].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 9)
SendDataHW("103", (gES_PayloadInfo.Stations[5].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 3)
SendDataHW("108", (gES_PayloadInfo.Stations[6].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 8)
SendDataHW("104", (gES_PayloadInfo.Stations[7].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 4)
SendDataHW("107", (gES_PayloadInfo.Stations[8].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 7)
SendDataHW("105", (gES_PayloadInfo.Stations[9].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 5)
SendDataHW("106", (gES_PayloadInfo.Stations[10].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 6)
--SendDataHW("110", (gES_PayloadInfo.Stations[11].count > 0 and 1 or 0) ) -- weapon presend > 0 center station, not visible
--SendDataHW("CurrentStation", gES_PayloadInfo.CurrentStation, lHardware )
-- air-to-air missils panel 1 and 11, air combat modus, CurrentStation = 1, panel 1 and 11 on
-- CurrentStation 5, panel 3
-- CurrentStation 3, panel 2
-- CurrentStation 7, panel 4
-- CurrentStation 4, panel 9
-- CurrentStation 9, panel 5
-- CurrentStation 10, panel 6
-- CurrentStation 8, panel 7
-- CurrentStation 6, panel 8
-- wenn die Waffenstationen gleichmässig belegt sind, hat bei Auswahl CurrentStation immer den Wert der linken Station
-- bei ungleichmäßiger Belegung, hat CurrentStation immer den Wert der jeweiligen Station
-- Waffenbezeichnung als UUID, gES_PayloadInfo.Stations[X].CLSID
-- defination
if gES_CurrentStationTmp == nil then
gES_CurrentStationTmp = -1
end
if gES_PayloadInfo.CurrentStation > 0 and
gES_CurrentStationTmp ~= gES_PayloadInfo.CurrentStation then
gES_CurrentStationTmp = gES_PayloadInfo.CurrentStation
gES_TmpStationToPanel = {}
gES_TmpStationToPanel[1] = {Panel = 1, StationID = 101, CurrentID = 201, HardwareID = lHardware } -- left
gES_TmpStationToPanel[2] = {Panel = 10, StationID = 110, CurrentID = 210, HardwareID = lHardware } -- right
gES_TmpStationToPanel[3] = {Panel = 2, StationID = 102, CurrentID = 202, HardwareID = lHardware }
gES_TmpStationToPanel[4] = {Panel = 9, StationID = 109, CurrentID = 209, HardwareID = lHardware }
gES_TmpStationToPanel[5] = {Panel = 3, StationID = 103, CurrentID = 203, HardwareID = lHardware }
gES_TmpStationToPanel[6] = {Panel = 8, StationID = 108, CurrentID = 208, HardwareID = lHardware }
gES_TmpStationToPanel[7] = {Panel = 4, StationID = 104, CurrentID = 204, HardwareID = lHardware }
gES_TmpStationToPanel[8] = {Panel = 7, StationID = 107, CurrentID = 207, HardwareID = lHardware }
gES_TmpStationToPanel[9] = {Panel = 5, StationID = 105, CurrentID = 205, HardwareID = lHardware }
gES_TmpStationToPanel[10] = {Panel = 6, StationID = 106, CurrentID = 206, HardwareID = lHardware }
WeaponStatusPanel_Reset(201, 210, lHardware)
if gES_TmpStationToPanel[gES_PayloadInfo.CurrentStation] ~= nil then
SendDataHW(gES_TmpStationToPanel[gES_PayloadInfo.CurrentStation].CurrentID, 1, lHardware ) -- eigentliche Auswahl
table.foreach(gES_PayloadInfo.Stations, WeaponStatusPanel_selectCurrentPayloadStation) -- zugehörige Stationen
end
end
end
function FuelQuantityIndicator(hardware)
-- Fuel quantity shows the fuel remaining in all tanks
local lHardware = hardware or 1
local lEngineInfo = LoGetEngineInfo()
if lEngineInfo == nil then
return
end
--WriteToLog('lEngineInfo: '..dump(lEngineInfo))
--[[
[fuel_external] = number: "0"
[Temperature] = {
[left] = number: "626.99444580078"
[right] = number: "626.99444580078"
}
[RPM] = {
[left] = number: "87.453765869141"
[right] = number: "87.453758239746"
}
[FuelConsumption] = {
[left] = number: "0.1500396137767"
[right] = number: "0.1500396137767"
}
[fuel_internal] = number: "3773.2749023438"
[EngineStart] = {
[left] = number: "0"
[right] = number: "0"
}
[HydraulicPressure] = {
[left] = number: "210"
[right] = number: "210"
}
lPayloadInfo.Stations[8].CLSID == E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF -- ext 800l Fuel Tank
]]
SendDataHW("300", string.format("%d", math.round((lEngineInfo.fuel_internal / 10), 0, "ceil") * 10), lHardware ) -- total fuel in kg
--SendDataHW("301", string.format("%d", lEngineInfo.fuel_internal)) -- total fuel in kg
--SendDataHW("302", string.format("%d", lEngineInfo.fuel_external)) -- external fuel in kg
local lPayloadInfo = LoGetPayloadInfo()
if lPayloadInfo ~= nil then
--WriteToLog('lPayloadInfo: '..dump(lPayloadInfo))
if lPayloadInfo.Stations[10].CLSID == "{E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF}" or
lPayloadInfo.Stations[9].CLSID == "{E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF}" then -- external tanks presend and full (panel 6 and 5)
SendDataHW("303", ((lEngineInfo.fuel_external < 1240.0 ) and 1 or 0), lHardware )
else
SendDataHW("303", 1, lHardware )
end
if lPayloadInfo.Stations[5].CLSID == "{E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF}" or
lPayloadInfo.Stations[6].CLSID == "{E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF}" then-- inner tank presend and full (panel 3 and 8)
SendDataHW("304", ((lEngineInfo.fuel_external < 1.0 ) and 1 or 0), lHardware )
else
SendDataHW("304", 1, lHardware )
end
else
SendDataHW("303", 1, lHardware )
SendDataHW("304", 1, lHardware )
end
SendDataHW("305", (lEngineInfo.fuel_internal < 2800.0 and 1 or 0), lHardware ) -- Interne Flügeltanks
SendDataHW("306", (lEngineInfo.fuel_internal < 1840.0 and 1 or 0), lHardware ) -- Interne Rumpftanks
SendDataHW("307", (lEngineInfo.fuel_internal < 1.0 and 1 or 0), lHardware ) -- Zentraler Rumpftanks
SendDataHW("308", (lEngineInfo.fuel_internal < 600.0 and 1 or 0), lHardware ) -- Bingo Fuel
end
function MechanicalDevicesIndicator(hardware)
-- The mechanical devices indicator shows the position of the landing gear, flaps, leading edge flaps and airbrake
local lHardware = hardware or 1
local lMechInfo = LoGetMechInfo() -- mechanical components, e.g. Flaps, Wheelbrakes,...
if lMechInfo == nil then
return
end
--[[
[hook] = {
[status] = number: "0"
[value] = number: "0"
}
[parachute] = {
[status] = number: "0"
[value] = number: "0"
}
[controlsurfaces] = {
[eleron] = {
[left] = number: "0"
[right] = number: "-0.21084336936474"
}
[elevator] = {
[left] = number: "-0"
[right] = number: "-0"
}
[rudder] = {
[left] = number: "0"
[right] = number: "0"
}
}
[airintake] = {
[status] = number: "0"
[value] = number: "0"
}
[canopy] = {
[status] = number: "0"
[value] = number: "0"
}
[refuelingboom] = {
[status] = number: "0"
[value] = number: "0"
}
[wing] = {
[status] = number: "0"
[value] = number: "0"
}
[noseflap] = {
[status] = number: "0"
[value] = number: "0"
}
[gear] = {
[value] = number: "0"
[nose] = {
[rod] = number: "0"
}
[main] = {
[left] = {
[rod] = number: "0"
}
[right] = {
[rod] = number: "0"
}
}
[status] = number: "0"
}
[speedbrakes] = {
[status] = number: "0"
[value] = number: "0"
}
[wheelbrakes] = {
[status] = number: "0"
[value] = number: "0"
}
[flaps] = {
[status] = number: "0"
[value] = number: "0"
}]]
--SendDataHW("500", lMechInfo.gear.status )
--SendDataHW("501", lMechInfo.gear.value )
--SendDataHW("502", lMechInfo.gear.nose.rod ) -- zeigt an wie weit das Fahrwerk einsackt wenn das Flugzeug auf dem Boden ist
--SendDataHW("503", lMechInfo.gear.main.left.rod ) -- zeigt an wie weit das Fahrwerk einsackt wenn das Flugzeug auf dem Boden ist
--SendDataHW("504", lMechInfo.gear.main.right.rod ) -- zeigt an wie weit das Fahrwerk einsackt wenn das Flugzeug auf dem Boden ist
--SendDataHW("500", ((lMechInfo.gear.status == 1 and lMechInfo.gear.value < 1) and 1 or 0 ) ) -- gear warning light, go up
--SendDataHW("500", ((lMechInfo.gear.status == 0 and lMechInfo.gear.value > 0) and 1 or 0 ) ) -- gear warning light, go down
SendDataHW("500", (((lMechInfo.gear.status == 1 and lMechInfo.gear.value < 1) or (lMechInfo.gear.status == 0 and lMechInfo.gear.value > 0)) and 1 or 0 ), lHardware ) -- gear warning light
SendDataHW("501", (lMechInfo.gear.value > 0.85 and 1 or 0), lHardware ) -- nose gear
SendDataHW("502", (lMechInfo.gear.value > 0.95 and 1 or 0), lHardware ) -- left gear
SendDataHW("503", (lMechInfo.gear.value == 1 and 1 or 0), lHardware ) -- right gear
--SendDataHW("510", lMechInfo.speedbrakes.status ) -- speedbreakes on 1 (0|1)
SendDataHW("510", (lMechInfo.speedbrakes.value > 0.1 and 1 or 0), lHardware ) -- speedbreakes on > 0.1 (0 - 1)
--SendDataHW("520", lMechInfo.wheelbrakes.status, lHardware ) -- not in use
--SendDataHW("521", lMechInfo.wheelbrakes.value, lHardware ) -- not in use
local lTrueAirSpeed = LoGetTrueAirSpeed()
--SendDataHW("530", lMechInfo.flaps.status ) -- flap switch off 0, 1. position 1, 2. position 2 (0|1|2)
--SendDataHW("531", lMechInfo.flaps.value ) -- flap 1. position > 0.25, 2. position > 0.93 (0 - 1)
SendDataHW("531", (lMechInfo.flaps.value > 0.25 and 1 or 0), lHardware ) -- flap 1. position
SendDataHW("532", (lMechInfo.flaps.value > 0.93 and 1 or 0), lHardware ) -- flap 2. position
SendDataHW("533", ((lMechInfo.flaps.value > 0.93 and lTrueAirSpeed > 340) and 1 or 0), lHardware ) -- Speed Warning for Flaps, same light as gear warning light, but blinking light
end

View File

@@ -0,0 +1,884 @@
-- Su-27 Export
-- Version 0.9.9 BETA
gES_FoundFCModule = true
-- auxiliary function
dofile(gES_ExportModulePath.."FC_AuxiliaryFuntions.lua")
-----------------------------------------
-- FLAMING CLIFFS AIRCRAFT / Su-27 --
-- FC aircraft don't support GetDevice --
-----------------------------------------
function ProcessGlassCockpitFCHighImportanceConfig()
local myData = LoGetSelfData()
if (myData) then
local lLatitude = myData.LatLongAlt.Lat -- LATITUDE
local lLongitude = myData.LatLongAlt.Long -- LONGITUDE
local lBasicAtmospherePressure = LoGetBasicAtmospherePressure() -- BAROMETRIC PRESSURE
local lAltBar = LoGetAltitudeAboveSeaLevel() -- ALTITUDE SEA LEVEL (Meter)
local lAltRad = LoGetAltitudeAboveGroundLevel() -- ALTITUDE GROUND LEVEL (Meter)
--local lTrueAirSpeed = LoGetTrueAirSpeed() -- TRUE AIRSPEED (Meter/Second)
local lPitch, lBank, lYaw = LoGetADIPitchBankYaw() -- PITCH, BANK, YAW (Radian)
local lHeading = myData.Heading -- HEADING (Radian)
local lVVI = LoGetVerticalVelocity() -- VERTICAL SPEED (Meter/Second)
local lIAS = LoGetIndicatedAirSpeed() -- INDICATED AIRSPEED (Meter/Second)
--local lMachNumber = LoGetMachNumber() -- MACH
local lAoA = LoGetAngleOfAttack() -- ANGLE OF ATTACK AoA (Radian)
local lGlide = LoGetGlideDeviation() -- VOR1 HORIZONTAL DEFLECTION (-1 +1)
local lSide = LoGetSideDeviation() -- VOR1 VERTICAL DEFLECTION (-1 +1)
--local lSlipBallPosition = LoGetSlipBallPosition() -- SLIP BALL (-1 +1)
--local lAccelerationUnits = LoGetAccelerationUnits().y -- G-LOAD
--local lNavInfoPitch = LoGetNavigationInfo().Requirements.pitch -- AP REQUIRED PITCH (Radian)
--local lNavInfoRoll = LoGetNavigationInfo().Requirements.roll -- AP REQUIRED BANK (Radian)
--local lNavInfoSpeed = LoGetNavigationInfo().Requirements.speed -- AP SPEED (Meter/Second)
--local lNavInfoAltitude = LoGetNavigationInfo().Requirements.altitude -- AP ALTITUDE (Meter)
--local lNavInfoVerticalSpeed = LoGetNavigationInfo().Requirements.vertical_speed -- AP VERTICAL SPEED (Meter/Second)
--local lControlPanel_HSI = LoGetControlPanel_HSI() -- HSI Data
local lHSI_RMI = LoGetControlPanel_HSI().RMI_raw -- VOR1 OBS (Radian)
local lHSI_ADF = LoGetControlPanel_HSI().ADF_raw -- ADF OBS (Radian)
--local lHSI_Heading = LoGetControlPanel_HSI().Heading_raw -- Heading (Radian)
local lEngineRPMleft = LoGetEngineInfo().RPM.left -- ENG1 RPM %
local lEngineRPMright = LoGetEngineInfo().RPM.right -- ENG2 RPM %
local lEngineTempLeft = LoGetEngineInfo().Temperature.left -- ENG1 EGT ºC
local lEngineTempRight = LoGetEngineInfo().Temperature.right -- ENG2 EGT ºC
--local lEngineFuelInternal = LoGetEngineInfo().fuel_internal -- TANK1 (INT) (KG)
--local lEngineFuelExternal = LoGetEngineInfo().fuel_external -- TANK2 (EXT) (KG)
--local lMechInfo = LoGetMechInfo() -- mechanical components, e.g. Flaps, Wheelbrakes,...
--local lPayloadInfo = LoGetPayloadInfo() -- Paylod, e.g. bombs, guns, rockets, fuel tanks,...
local lDistanceToWay = 999
local lRoute = LoGetRoute()
if (myData and lRoute) then -- if neither are nil
local myLoc = LoGeoCoordinatesToLoCoordinates(lLongitude, lLatitude)
--lDistanceToWay = math.sqrt((myLoc.x - lRoute.goto_point.world_point.x)^2 + (myLoc.y - lRoute.goto_point.world_point.y)^2)
lDistanceToWay = math.sqrt((myLoc.x - lRoute.goto_point.world_point.x)^2 + (myLoc.z - lRoute.goto_point.world_point.z)^2)
end
if gES_GlassCockpitType == 1 then
-- HELIOS Version 1.3
-- customizing for HELOS
lPitch = math.deg(lPitch) -- PITCH, (Radian to Grad)
lBank = math.deg(lBank) -- BANK (Radian to Grad)
lYaw = math.deg(lYaw) -- YAW (Radian to Grad)
lHSI_RMI = math.deg(lHSI_RMI) -- VOR1 OBS (Radian to Grad)
lHSI_ADF = math.deg(lHSI_ADF) -- ADF OBS (Radian to Grad)
lAoA = math.deg(lAoA) -- ANGLE OF ATTACK AoA (Radian to Grad)
lHeading = math.deg(lHeading) -- Heading (Radian to Grad)
lHSI_ADF = (360 - lHSI_ADF) + (360 - lHeading)
lHSI_RMI = 360 - lHSI_RMI
lIAS = lIAS * 3.6 -- change from m/s to km/h
SendData("1", string.format("%.2f", lPitch) )
SendData("2", string.format("%.2f", lBank) )
SendData("3", string.format("%.2f", lYaw) )
SendData("4", string.format("%.2f", lAltBar) )
SendData("5", string.format("%.2f", lAltRad) )
SendData("6", string.format("%.2f", lHSI_ADF) )
SendData("7", string.format("%.2f", lHSI_RMI) )
SendData("8", string.format("%.2f", lHeading) )
SendData("9", string.format("%.2f", lEngineRPMleft) )
SendData("10", string.format("%.2f", lEngineRPMright) )
SendData("11", string.format("%.2f", lEngineTempLeft) )
SendData("12", string.format("%.2f", lEngineTempRight) )
SendData("13", string.format("%.2f", lVVI) )
SendData("14", string.format("%.2f", lIAS) )
SendData("15", string.format("%.2f", lDistanceToWay) )
SendData("16", string.format("%.2f", lAoA) )
SendData("17", string.format("%.2f", lGlide) )
SendData("18", string.format("%.2f", lSide) )
elseif gES_GlassCockpitType == 2 then
-- HawgTouch version 1.6
local lRadToDCSsignd = math.pi
local lRadToDCSunsignd = math.pi * 2
local lDefaultNull = 0.0
local lDefaultOne = 1.0
-- IAS-MACH Indicator (IAS, MACH) {"%.4f;%.4f"}
FC_Russian_AirSpeed_1600hkm(1)
-- AOA Indicator and Accelerometer (AOA, GLoad)
FC_Russian_AOA_Su2733(3)
-- ADI
FC_Russian_ADI_Old(4)
-- HSI
FC_Russian_HSI(lDistanceToWay, 5)
-- Vertical Velocity Indicator (VVI) (VVI, TurnIndicator, SlipBallPosition)
FC_Russian_VVI_Old(6)
-- Radar Altimeter (AltRad, MinAltitude, WarningFlag, MinAltitudeLamp) {"%.4f;%.4f;%.1f;%.1f"} (below 100m is warning light on)
FC_Russian_RadarAltimeter_1500m(100, 7)
-- Barometric Altimeter (AltBar, BasicAtmospherePressure)
FC_Russian_BarometricAltimeter_20000(8)
-- Tachometer (RPM) (EngineRPMleft, EngineRPMright) {"%.4f;%.4f"}
FC_Russian_EngineRPM(9)
-- Left Jet Engine Turbine Temperature Indicator (EngineTemp) {"%.4f"}
FC_TwoNeedlesGauge(lEngineTempLeft, 1200, 100, 10)
-- Right Jet Engine Turbine Temperature Indicator (EngineTemp) {"%.4f"}
FC_TwoNeedlesGauge(lEngineTempRight, 1200, 100, 11)
-- Clock from Ka-50 {CurrentHours, CurrentMinutes, CurrentSeconds, 0, FlightTimeHours, FlightTimeMinutes, 0, 0) {"%.4f;%.4f;%.4f;%.1f;%.4f;%.4f;%.4f;%.4f"}
FC_Russian_Clock_late(12)
end
else
WriteToLog("Unknown FC Error, no LoGetSelfData.")
end
end
function ProcessHARDWAREConfigHighImportance(mainPanelDevice)
end
function ProcessGlassCockpitFCLowImportanceConfig()
if gES_GlassCockpitType == 1 then
-- HELIOS Version 1.3
elseif gES_GlassCockpitType == 2 then
-- HawgTouch version 1.6
FC_WeaponPanel_SU2733(13)
FC_RadarWarning_SPO15(14)
-- Fuel Quantity Indicator
local lEngineInfo = LoGetEngineInfo()
if lEngineInfo ~= nil then
--WriteToLog('lEngineInfo: '..dump(lEngineInfo))
--[[
[fuel_external] = number: "0"
[Temperature] = {
[left] = number: "626.99444580078"
[right] = number: "626.99444580078"
}
[RPM] = {
[left] = number: "87.453765869141"
[right] = number: "87.453758239746"
}
[FuelConsumption] = {
[left] = number: "0.1500396137767"
[right] = number: "0.1500396137767"
}
[fuel_internal] = number: "3773.2749023438"
[EngineStart] = {
[left] = number: "0"
[right] = number: "0"
}
[HydraulicPressure] = {
[left] = number: "210"
[right] = number: "210"
}
lPayloadInfo.Stations[8].CLSID == E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF -- ext 800l Fuel Tank
]]
local lTotalFuel = lEngineInfo.fuel_internal
--local lTotalFuel = string.format("%3d", math.round((lEngineInfo.fuel_internal / 10), 0, "ceil") * 10)
--local lTotalFuel = string.format("%4d", lEngineInfo.fuel_internal) -- total fuel in kg
--local lTotalFuel = string.format("%4d", lEngineInfo.fuel_external) -- external fuel in kg
local lTotalFuel_9_3 = 0
local lTotalFuel_5_0 = 0
if lTotalFuel < 9000 then
if lTotalFuel > 3000 then
--[[
y_min = 0.0 -- minimaler Ausgabewert
y_max = 1.0 -- maximaler Ausgabewert
x_min = 3000 -- minimaler Eingangswert
x_max = 9000 -- maximaler Eingangswert
x = 8000 -- aktueller Eingangswert
d_y = 1 -- Delta Ausgabewerte (y_max - y_min)
d_x = 6000 -- Delta Eingangswerte (x_max - x_min)
m = 1.66666666666666666666666666667e-4 -- Steigung der linearen Funktion (d_y / d_x)
n = -0,5 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max)
y = 0.83333 -- Ergebnis (m * x + n)
]]
lTotalFuel_9_3 = 1.6666666666666666666666666666667e-4 * lTotalFuel + -0.5
else
lTotalFuel_9_3 = 0.0
end
else
lTotalFuel_9_3 = 1.0
end
if lTotalFuel < 5000 then
lTotalFuel_5_0 = lTotalFuel / 5000
else
lTotalFuel_5_0 = 1.0
end
-- TotalFuel_5_0
-- TotalFuel_9_3
-- Light1
-- Light2
-- Light3
-- Light4
-- BingoLight
SendData("15", string.format("%0.4f;%0.4f;%d;%d;%d;%d;%d",
lTotalFuel_5_0,
lTotalFuel_9_3,
(lEngineInfo.fuel_internal < 5000.0 and 1 or 0), -- Tank warning 1
(lEngineInfo.fuel_internal < 4000.0 and 1 or 0), -- Tank warning 2
(lEngineInfo.fuel_internal < 1500.0 and 1 or 0), -- Tank warning 3
(lEngineInfo.fuel_internal < 1000.0 and 1 or 0), -- Tank warning 4
(lEngineInfo.fuel_internal < 600.0 and 1 or 0))) -- Bingo Fuel
-- Hydraulic Pressure Left
FC_OneNeedleGauge(lEngineInfo.HydraulicPressure.left, 240, 17)
-- Hydraulic Pressure Right
FC_OneNeedleGauge(lEngineInfo.HydraulicPressure.right, 240, 18)
end
-- EKRAN Message
FC_EKRAN(16)
-- Mechanical Configuration Indicator (GearWarningLight, NoseGear, LeftGear, RightGear, Airbreaks, Flaps1, Flaps2) {"%.1f;%d;%d;%d;%d;%d;%d"}
local lMechInfo = LoGetMechInfo() -- mechanical components, e.g. Flaps, Wheelbrakes,...
if lMechInfo ~= nil then
local lWarningLight = 0.0
local lTrueAirSpeed = LoGetTrueAirSpeed()
if lTrueAirSpeed ~= nil then
lWarningLight = ((lMechInfo.flaps.value > 0.93 and lTrueAirSpeed > 340) and 1.0 or 0.0) -- Speed Warning for Flaps, same light as gear warning light, but blinking light
lWarningLight = (((lMechInfo.gear.status == 1 and lMechInfo.gear.value < 1) or (lMechInfo.gear.status == 0 and lMechInfo.gear.value > 0)) and 1.0 or lWarningLight ) -- gear warning light
end
-- WarningLight {0.0 = Off, 0.1 = blinking light, 0.2 = on}
-- WarningLight {0.0 = Off, no blinking light, 1.0 = on}
-- left gear {0, 1}
-- right gear {0, 1}
-- nose gear {0, 1}
-- WarningLight
-- Flap
-- Intake FOD shields
-- Speedbreakes on {0, 1}
SendData("2", string.format("%.1f;%d;%d;%d;%d;%d;%d",
(lMechInfo.gear.value > 0.95 and 1 or 0), -- left gear
(lMechInfo.gear.value == 1 and 1 or 0), -- right gear
(lMechInfo.gear.value > 0.85 and 1 or 0), -- nose gear
lWarningLight,
(lMechInfo.flaps.value > 0.93 and 1 or 0), -- flap
(lMechInfo.gear.value > 0.5 and 1 or 0), -- Intake FOD shields
(lMechInfo.speedbrakes.value > 0.1 and 1 or 0))) -- speedbreakes on > 0.1 (0 - 1)
-- Wheelbrakes Hydraulic Pressure Left
FC_OneNeedleGauge(lMechInfo.wheelbrakes.value, 240, 19)
-- Wheelbrakes Hydraulic Pressure Right
FC_OneNeedleGauge(lMechInfo.wheelbrakes.value, 240, 20)
--WriteToLog('lMechInfo.noseflap.value: '..dump(lMechInfo.noseflap.value)) -- Vorfluegel, Balkenanzeige neben dem Radarhoehenmesser (0=oben bis 30=unten)
end
-- Airintake
FC_Russian_AirIntake(21)
end
--(x < 0 and 'negative' or 'non-negative')
--[[
local lPayloadInfo = LoGetPayloadInfo()
WriteToLog('lPayloadInfo: '..dump(lPayloadInfo))
local lSnares = LoGetSnares() -- Flare and Chaff
WriteToLog('lSnares: '..dump(lSnares))
local lSightingSystemInfo = LoGetSightingSystemInfo()
WriteToLog('lSightingSystemInfo: '..dump(lSightingSystemInfo))
local lTWSInfo = LoGetTWSInfo() -- SPO Informationen, z.B. Radarwarner F15C
WriteToLog('lTWSInfo: '..dump(lTWSInfo))
local lTargetInformation = LoGetTargetInformation() -- detalierte Radar Infos z.B. F15C
WriteToLog('lTargetInformation: '..dump(lTargetInformation))
local lLockedTargetInformation = LoGetLockedTargetInformation()
WriteToLog('lLockedTargetInformation: '..dump(lLockedTargetInformation))
local lF15_TWS_Contacs = LoGetF15_TWS_Contacts() -- the same information but only for F-15 in TWS mode
WriteToLog('lF15_TWS_Contacs: '..dump(lF15_TWS_Contacs))
local lMechInfo = LoGetMechInfo() -- mechanical components, e.g. Flaps, Wheelbrakes,...
WriteToLog('lMechInfo: '..dump(lMechInfo))
local lMCPState = LoGetMCPState() -- Warnlichter
WriteToLog('lMCPState: '..dump(lMCPState))
local lControlPanel_HSI = LoGetControlPanel_HSI()
WriteToLog('lControlPanel_HSI: '..dump(lControlPanel_HSI))
local lRadioBeaconsStatus = LoGetRadioBeaconsStatus()
WriteToLog('lRadioBeaconsStatus: '..dump(lRadioBeaconsStatus))
local lEngineInfo = LoGetEngineInfo()
WriteToLog('lEngineInfo: '..dump(lEngineInfo))
]]
-- Weapon Control System
--local lNameByType = LoGetNameByType () -- args 4 (number : level1,level2,level3,level4), result string
-- values from LoGetTargetInformation().type
--WriteToLog('lNameByType: '..dump(lNameByType))
end
function ProcessHARDWAREConfigLowImportance(mainPanelDevice)
-- where necessary, specify HardwareID, example WeaponStatusPanel(2)
WeaponStatusPanel()
MechanicalDevicesIndicator()
StatusLamp()
FuelQuantityIndicator()
SightingSystem()
SPO15RWR()
PPDSPPanel()
end
-----------------------------
-- Custom functions --
-----------------------------
function SightingSystem(hardware)
local lHardware = hardware or 1
local lSightingSystemInfo = LoGetSightingSystemInfo()
if lSightingSystemInfo == nil then
return
end
--WriteToLog('lSightingSystemInfo: '..dump(lSightingSystemInfo)9
--[[
[PRF] = {
[selection] = string: "ILV"
[current] = string: "MED"
}
[laser_on] = boolean: "false"
[scale] = {
[azimuth] = number: "0.52359873056412"
[distance] = number: "10000"
}
[radar_on] = boolean: "false"
[optical_system_on] = boolean: "false"
[LaunchAuthorized] = boolean: "false"
[ECM_on] = boolean: "false"
[Manufacturer] = string: "RUS"
[TDC] = {
[y] = number: "0"
[x] = number: "0"
}
[ScanZone] = {
[coverage_H] = {
[min] = number: "0"
[max] = number: "20000"
}
[size] = {
[azimuth] = number: "1.0471974611282"
[elevation] = number: "0.17453290522099"
}
[position] = {
[exceeding_manual] = number: "0"
[distance_manual] = number: "0"
[azimuth] = number: "0"
[elevation] = number: "0"
}
}
]]
SendDataHW("600", lSightingSystemInfo.ECM_on == true and 1 or 0, lHardware )
SendDataHW("601", lSightingSystemInfo.laser_on == true and 1 or 0, lHardware )
--SendDataHW("602", lSightingSystemInfo.optical_system_on == true and 1 or 0, lHardware )
SendDataHW("603", lSightingSystemInfo.LaunchAuthorized == true and 1 or 0, lHardware )
SendDataHW("604", lSightingSystemInfo.radar_on == true and 1 or 0, lHardware )
end
function PPDSPPanel(hardware)
local lHardware = hardware or 1
local lSnares = LoGetSnares() -- Flare and Chaff
if lSnares == nil then
return
end
--WriteToLog('lSnares: '..dump(lSnares))
--[chaff] = number: "96"
--[flare] = number: "96"
local lChaffLED = math.round(lSnares.chaff / 12, 0, "ceil") + 1
local lFlareLED = math.round(lSnares.flare / 12, 0, "ceil") + 1
SendDataHW("800", (lChaffLED <= 1 and 0 or 1), lHardware )
SendDataHW("801", (lChaffLED <= 2 and 0 or 1), lHardware )
SendDataHW("802", (lChaffLED <= 3 and 0 or 1), lHardware )
SendDataHW("803", (lChaffLED <= 4 and 0 or 1), lHardware )
SendDataHW("804", (lChaffLED <= 5 and 0 or 1), lHardware )
SendDataHW("805", (lChaffLED <= 6 and 0 or 1), lHardware )
SendDataHW("806", (lChaffLED <= 7 and 0 or 1), lHardware )
SendDataHW("807", (lChaffLED <= 8 and 0 or 1), lHardware )
SendDataHW("810", (lFlareLED <= 1 and 0 or 1), lHardware )
SendDataHW("811", (lFlareLED <= 2 and 0 or 1), lHardware )
SendDataHW("812", (lFlareLED <= 3 and 0 or 1), lHardware )
SendDataHW("813", (lFlareLED <= 4 and 0 or 1), lHardware )
SendDataHW("814", (lFlareLED <= 5 and 0 or 1), lHardware )
SendDataHW("815", (lFlareLED <= 6 and 0 or 1), lHardware )
SendDataHW("816", (lFlareLED <= 7 and 0 or 1), lHardware )
SendDataHW("817", (lFlareLED <= 8 and 0 or 1), lHardware )
SendDataHW("817", (lFlareLED <= 8 and 0 or 1), lHardware )
end
function StatusLamp(hardware)
local lHardware = hardware or 1
local lMCPState = LoGetMCPState() -- Warning Lights
if lMCPState == nil then
return
end
--WriteToLog('lMCPState: '..dump(lMCPState))
--[[
[RightTailPlaneFailure] = boolean: "false"
[EOSFailure] = boolean: "false"
[ECMFailure] = boolean: "false"
[RightAileronFailure] = boolean: "false"
[MasterWarning] = boolean: "false"
[RightEngineFailure] = boolean: "false"
[CannonFailure] = boolean: "false"
[MLWSFailure] = boolean: "false"
[ACSFailure] = boolean: "false"
[RadarFailure] = boolean: "false"
[HelmetFailure] = boolean: "false"
[HUDFailure] = boolean: "false"
[LeftMainPumpFailure] = boolean: "false"
[RightWingPumpFailure] = boolean: "false"
[LeftWingPumpFailure] = boolean: "false"
[MFDFailure] = boolean: "false"
[RWSFailure] = boolean: "false"
[GearFailure] = boolean: "false"
[HydraulicsFailure] = boolean: "false"
[AutopilotFailure] = boolean: "true"
[FuelTankDamage] = boolean: "false"
[LeftAileronFailure] = boolean: "false"
[CanopyOpen] = boolean: "false"
[RightMainPumpFailure] = boolean: "false"
[StallSignalization] = boolean: "false"
[LeftEngineFailure] = boolean: "false"
[AutopilotOn] = boolean: "false"
[LeftTailPlaneFailure] = boolean: "false"
]]
SendDataHW("700", lMCPState.LeftTailPlaneFailure == true and 1 or 0, lHardware )
SendDataHW("701", lMCPState.RightTailPlaneFailure == true and 1 or 0, lHardware )
SendDataHW("702", lMCPState.MasterWarning == true and 1 or 0, lHardware )
SendDataHW("703", lMCPState.LeftEngineFailure == true and 1 or 0, lHardware )
SendDataHW("704", lMCPState.RightEngineFailure == true and 1 or 0, lHardware )
SendDataHW("705", lMCPState.LeftAileronFailure == true and 1 or 0, lHardware )
SendDataHW("706", lMCPState.RightAileronFailure == true and 1 or 0, lHardware )
SendDataHW("707", lMCPState.LeftMainPumpFailure == true and 1 or 0, lHardware )
SendDataHW("708", lMCPState.RightMainPumpFailure == true and 1 or 0, lHardware )
SendDataHW("709", lMCPState.LeftWingPumpFailure == true and 1 or 0, lHardware )
SendDataHW("710", lMCPState.RightWingPumpFailure == true and 1 or 0, lHardware )
SendDataHW("711", lMCPState.EOSFailure == true and 1 or 0, lHardware )
SendDataHW("712", lMCPState.ECMFailure == true and 1 or 0, lHardware )
SendDataHW("713", lMCPState.CannonFailure == true and 1 or 0, lHardware )
SendDataHW("714", lMCPState.MLWSFailure == true and 1 or 0, lHardware )
SendDataHW("715", lMCPState.ACSFailure == true and 1 or 0, lHardware )
SendDataHW("716", lMCPState.RadarFailure == true and 1 or 0, lHardware )
SendDataHW("717", lMCPState.HelmetFailure == true and 1 or 0, lHardware )
SendDataHW("718", lMCPState.HUDFailure == true and 1 or 0, lHardware )
SendDataHW("719", lMCPState.MFDFailure == true and 1 or 0, lHardware )
SendDataHW("720", lMCPState.RWSFailure == true and 1 or 0, lHardware )
SendDataHW("721", lMCPState.GearFailure == true and 1 or 0, lHardware )
SendDataHW("722", lMCPState.HydraulicsFailure == true and 1 or 0, lHardware )
SendDataHW("723", lMCPState.AutopilotFailure == true and 1 or 0, lHardware )
SendDataHW("724", lMCPState.FuelTankDamage == true and 1 or 0, lHardware )
SendDataHW("725", lMCPState.CanopyOpen == true and 1 or 0, lHardware )
SendDataHW("726", lMCPState.StallSignalization == true and 1 or 0, lHardware )
SendDataHW("727", lMCPState.AutopilotOn == true and 1 or 0, lHardware )
local lEngineInfo = LoGetEngineInfo()
if lEngineInfo ~= nil then
--WriteToLog('lEngineInfo: '..dump(lEngineInfo))
SendDataHW("728", lEngineInfo.EngineStart.left, lHardware ) -- lamp start left engine 1 (0|1)
SendDataHW("729", lEngineInfo.EngineStart.right, lHardware ) -- lamp start right engine 1 (0|1)
SendDataHW("730", (lEngineInfo.RPM.left > 99.95 and 1 or 0), lHardware ) -- lamp after burner left engine
SendDataHW("731", (lEngineInfo.RPM.right > 99.95 and 1 or 0), lHardware ) -- lam after burner right engine
end
local lAccelerationUnits = LoGetAccelerationUnits()
if lAccelerationUnits ~= nil then
--WriteToLog('lAccelerationUnits: '..dump(lAccelerationUnits))
SendDataHW("732", (lAccelerationUnits.y > 8.0 and 1 or 0), lHardware ) -- lamp Over-G warning
end
end
function WeaponStatusPanel(hardware)
-- The weapon status panel, quantity and readiness of the currently selected weapon and the remaining gun ammunition are indicated.
local lHardware = hardware or 1
gES_PayloadInfo = LoGetPayloadInfo()
if gES_PayloadInfo == nil then
return
end
--WriteToLog('gES_PayloadInfo: '..dump(gES_PayloadInfo))
--[[ exsample
[Stations] = {
[1] = {
[CLSID] = string: "{FBC29BFE-3D24-4C64-B81D-941239D12249}"
[container] = boolean: "false"
[count] = number: "1"
[weapon] = {
[level3] = number: "7"
[level1] = number: "4"
[level4] = number: "18"
[level2] = number: "4"
}
}
[2] = {
[CLSID] = string: "{FBC29BFE-3D24-4C64-B81D-941239D12249}"
[container] = boolean: "false"
[count] = number: "1"
[weapon] = {
[level3] = number: "7"
[level1] = number: "4"
[level4] = number: "18"
[level2] = number: "4"
}
}
[3] = {
[CLSID] = string: "{FBC29BFE-3D24-4C64-B81D-941239D12249}"
[container] = boolean: "false"
[count] = number: "1"
[weapon] = {
[level3] = number: "7"
[level1] = number: "4"
[level4] = number: "18"
[level2] = number: "4"
}
}
[4] = {
[CLSID] = string: "{FBC29BFE-3D24-4C64-B81D-941239D12249}"
[container] = boolean: "false"
[count] = number: "1"
[weapon] = {
[level3] = number: "7"
[level1] = number: "4"
[level4] = number: "18"
[level2] = number: "4"
}
}
[5] = {
[wstype] = {
[level3] = number: "32"
[level1] = number: "4"
[level4] = number: "6"
[level2] = number: "7"
}
[count] = number: "20"
[CLSID] = string: "{F72F47E5-C83A-4B85-96ED-D3E46671EE9A}"
[adapter] = {
[level3] = number: "0"
[level1] = number: "0"
[level4] = number: "0"
[level2] = number: "0"
}
[container] = boolean: "true"
[weapon] = {
[level3] = number: "33"
[level1] = number: "4"
[level4] = number: "32"
[level2] = number: "7"
}
}
[6] = {
[wstype] = {
[level3] = number: "32"
[level1] = number: "4"
[level4] = number: "6"
[level2] = number: "7"
}
[count] = number: "20"
[CLSID] = string: "{F72F47E5-C83A-4B85-96ED-D3E46671EE9A}"
[adapter] = {
[level3] = number: "0"
[level1] = number: "0"
[level4] = number: "0"
[level2] = number: "0"
}
[container] = boolean: "true"
[weapon] = {
[level3] = number: "33"
[level1] = number: "4"
[level4] = number: "32"
[level2] = number: "7"
}
}
[7] = {
[CLSID] = string: "{4203753F-8198-4E85-9924-6F8FF679F9FF}"
[container] = boolean: "false"
[count] = number: "1"
[weapon] = {
[level3] = number: "38"
[level1] = number: "4"
[level4] = number: "18"
[level2] = number: "5"
}
}
[8] = {
[CLSID] = string: "{4203753F-8198-4E85-9924-6F8FF679F9FF}"
[container] = boolean: "false"
[count] = number: "1"
[weapon] = {
[level3] = number: "38"
[level1] = number: "4"
[level4] = number: "18"
[level2] = number: "5"
}
}
[9] = {
[CLSID] = string: "{7AEC222D-C523-425e-B714-719C0D1EB14D}"
[container] = boolean: "false"
[count] = number: "1"
[weapon] = {
[level3] = number: "38"
[level1] = number: "4"
[level4] = number: "91"
[level2] = number: "5"
}
}
[10] = {
[CLSID] = string: "{7AEC222D-C523-425e-B714-719C0D1EB14D}"
[container] = boolean: "false"
[count] = number: "1"
[weapon] = {
[level3] = number: "38"
[level1] = number: "4"
[level4] = number: "91"
[level2] = number: "5"
}
}
}
[CurrentStation] = number: "0"
[Cannon] = {
[shells] = number: "250"
}
]]
--[[
Weapon Panel
|
-------------------------------------------
| | | | | | | | | |
1 2 3 4 5 6 7 8 9 10 -- Panel ID
2 4 5 7 10 9 8 6 3 1 -- gES_PayloadInfo.Station.ID
]]
-- Payload Info
-- weapon stations (panel) 1 (left) - 10 (right), no lamp for center station
SendDataHW("100", gES_PayloadInfo.Cannon.shells, lHardware ) -- count cannon shells
SendDataHW("110", (gES_PayloadInfo.Stations[1].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 1)
SendDataHW("101", (gES_PayloadInfo.Stations[2].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 10)
SendDataHW("109", (gES_PayloadInfo.Stations[3].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 2)
SendDataHW("102", (gES_PayloadInfo.Stations[4].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 9)
SendDataHW("103", (gES_PayloadInfo.Stations[5].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 3)
SendDataHW("108", (gES_PayloadInfo.Stations[6].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 8)
SendDataHW("104", (gES_PayloadInfo.Stations[7].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 4)
SendDataHW("107", (gES_PayloadInfo.Stations[8].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 7)
SendDataHW("106", (gES_PayloadInfo.Stations[9].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 5)
SendDataHW("105", (gES_PayloadInfo.Stations[10].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 6)
--SendDataHW("CurrentStation", gES_PayloadInfo.CurrentStation, lHardware )
-- air-to-air missils panel 1 and 11, air combat modus, CurrentStation = 1, panel 1 and 11 on
-- wenn die Waffenstationen gleichmässig belegt sind, hat bei Auswahl CurrentStation immer den Wert der linken Station
-- bei ungleichmäßiger Belegung, hat CurrentStation immer den Wert der jeweiligen Station
-- Waffenbezeichnung als UUID, gES_PayloadInfo.Stations[X].CLSID
-- defination
if gES_CurrentStationTmp == nil then
gES_CurrentStationTmp = -1
end
if gES_PayloadInfo.CurrentStation > 0 and
gES_CurrentStationTmp ~= gES_PayloadInfo.CurrentStation then
gES_CurrentStationTmp = gES_PayloadInfo.CurrentStation
gES_TmpStationToPanel = {}
gES_TmpStationToPanel[1] = {Panel = 10, StationID = 110, CurrentID = 210, HardwareID = lHardware }
gES_TmpStationToPanel[2] = {Panel = 1, StationID = 101, CurrentID = 201, HardwareID = lHardware }
gES_TmpStationToPanel[3] = {Panel = 9, StationID = 109, CurrentID = 209, HardwareID = lHardware }
gES_TmpStationToPanel[4] = {Panel = 2, StationID = 102, CurrentID = 202, HardwareID = lHardware }
gES_TmpStationToPanel[5] = {Panel = 3, StationID = 103, CurrentID = 203, HardwareID = lHardware }
gES_TmpStationToPanel[6] = {Panel = 8, StationID = 108, CurrentID = 208, HardwareID = lHardware }
gES_TmpStationToPanel[7] = {Panel = 4, StationID = 104, CurrentID = 204, HardwareID = lHardware }
gES_TmpStationToPanel[8] = {Panel = 7, StationID = 107, CurrentID = 207, HardwareID = lHardware }
gES_TmpStationToPanel[9] = {Panel = 6, StationID = 106, CurrentID = 206, HardwareID = lHardware }
gES_TmpStationToPanel[10] = {Panel = 5, StationID = 105, CurrentID = 205, HardwareID = lHardware }
WeaponStatusPanel_Reset(201, 210, lHardware)
if gES_TmpStationToPanel[gES_PayloadInfo.CurrentStation] ~= nil then
SendDataHW(gES_TmpStationToPanel[gES_PayloadInfo.CurrentStation].CurrentID, 1, lHardware ) -- eigentliche Auswahl
table.foreach(gES_PayloadInfo.Stations, WeaponStatusPanel_selectCurrentPayloadStation) -- zugehörige Stationen
end
end
end
function FuelQuantityIndicator(hardware)
-- Fuel quantity shows the fuel remaining in all tanks
local lHardware = hardware or 1
local lEngineInfo = LoGetEngineInfo()
if lEngineInfo == nil then
return
end
--WriteToLog('lEngineInfo: '..dump(lEngineInfo))
--[[
[fuel_external] = number: "0"
[Temperature] = {
[left] = number: "626.99444580078"
[right] = number: "626.99444580078"
}
[RPM] = {
[left] = number: "87.453765869141"
[right] = number: "87.453758239746"
}
[FuelConsumption] = {
[left] = number: "0.1500396137767"
[right] = number: "0.1500396137767"
}
[fuel_internal] = number: "3773.2749023438"
[EngineStart] = {
[left] = number: "0"
[right] = number: "0"
}
[HydraulicPressure] = {
[left] = number: "210"
[right] = number: "210"
}
lPayloadInfo.Stations[8].CLSID == E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF -- ext 800l Fuel Tank
]]
SendDataHW("300", string.format("%d", math.round((lEngineInfo.fuel_internal / 10), 0, "ceil") * 10), lHardware ) -- total fuel in kg
--SendDataHW("301", string.format("%d", lEngineInfo.fuel_internal)) -- total fuel in kg
--SendDataHW("302", string.format("%d", lEngineInfo.fuel_external)) -- external fuel in kg
SendDataHW("304", (lEngineInfo.fuel_internal < 5000.0 and 1 or 0), lHardware ) -- Tank warning 1
SendDataHW("305", (lEngineInfo.fuel_internal < 4000.0 and 1 or 0), lHardware ) -- Tank warning 2
SendDataHW("306", (lEngineInfo.fuel_internal < 1500.0 and 1 or 0), lHardware ) -- Tank warning 3
SendDataHW("307", (lEngineInfo.fuel_internal < 1000.0 and 1 or 0), lHardware ) -- Tank warning 4
SendDataHW("308", (lEngineInfo.fuel_internal < 600.0 and 1 or 0), lHardware ) -- Bingo Fuel
end
function MechanicalDevicesIndicator(hardware)
-- The mechanical devices indicator shows the position of the landing gear, flaps, leading edge flaps and airbrake
local lHardware = hardware or 1
local lMechInfo = LoGetMechInfo() -- mechanical components, e.g. Flaps, Wheelbrakes,...
if lMechInfo == nil then
return
end
--[[
[hook] = {
[status] = number: "0"
[value] = number: "0"
}
[parachute] = {
[status] = number: "0"
[value] = number: "0"
}
[controlsurfaces] = {
[eleron] = {
[left] = number: "0"
[right] = number: "-0.21084336936474"
}
[elevator] = {
[left] = number: "-0"
[right] = number: "-0"
}
[rudder] = {
[left] = number: "0"
[right] = number: "0"
}
}
[airintake] = {
[status] = number: "0"
[value] = number: "0"
}
[canopy] = {
[status] = number: "0"
[value] = number: "0"
}
[refuelingboom] = {
[status] = number: "0"
[value] = number: "0"
}
[wing] = {
[status] = number: "0"
[value] = number: "0"
}
[noseflap] = {
[status] = number: "0"
[value] = number: "0"
}
[gear] = {
[value] = number: "0"
[nose] = {
[rod] = number: "0"
}
[main] = {
[left] = {
[rod] = number: "0"
}
[right] = {
[rod] = number: "0"
}
}
[status] = number: "0"
}
[speedbrakes] = {
[status] = number: "0"
[value] = number: "0"
}
[wheelbrakes] = {
[status] = number: "0"
[value] = number: "0"
}
[flaps] = {
[status] = number: "0"
[value] = number: "0"
}]]
--SendDataHW("500", lMechInfo.gear.status )
--SendDataHW("501", lMechInfo.gear.value )
--SendDataHW("502", lMechInfo.gear.nose.rod ) -- zeigt an wie weit das Fahrwerk einsackt wenn das Flugzeug auf dem Boden ist
--SendDataHW("503", lMechInfo.gear.main.left.rod ) -- zeigt an wie weit das Fahrwerk einsackt wenn das Flugzeug auf dem Boden ist
--SendDataHW("504", lMechInfo.gear.main.right.rod ) -- zeigt an wie weit das Fahrwerk einsackt wenn das Flugzeug auf dem Boden ist
--SendDataHW("500", ((lMechInfo.gear.status == 1 and lMechInfo.gear.value < 1) and 1 or 0 ) ) -- gear warning light, go up
--SendDataHW("500", ((lMechInfo.gear.status == 0 and lMechInfo.gear.value > 0) and 1 or 0 ) ) -- gear warning light, go down
SendDataHW("500", (((lMechInfo.gear.status == 1 and lMechInfo.gear.value < 1) or (lMechInfo.gear.status == 0 and lMechInfo.gear.value > 0)) and 1 or 0 ), lHardware ) -- gear warning light
SendDataHW("501", (lMechInfo.gear.value > 0.85 and 1 or 0), lHardware ) -- nose gear
SendDataHW("502", (lMechInfo.gear.value > 0.95 and 1 or 0), lHardware ) -- left gear
SendDataHW("503", (lMechInfo.gear.value > 0.97 and 1 or 0), lHardware ) -- right gear
--SendDataHW("510", lMechInfo.speedbrakes.status ) -- speedbreakes on 1 (0|1)
SendDataHW("510", (lMechInfo.speedbrakes.value > 0.1 and 1 or 0), lHardware ) -- speedbreakes on > 0.1 (0 - 1)
--SendDataHW("520", lMechInfo.wheelbrakes.status, lHardware ) -- not in use
--SendDataHW("521", lMechInfo.wheelbrakes.value, lHardware ) -- not in use
local lGetTrueAirSpeed = LoGetTrueAirSpeed()
--SendDataHW("530", lMechInfo.flaps.status ) -- flap switch off 0, 1. position 1, 2. position 2 (0|1|2)
--SendDataHW("531", lMechInfo.flaps.value ) -- flap 1. position > 0.25, 2. position > 0.93 (0 - 1)
SendDataHW("531", (lMechInfo.flaps.value > 0.25 and 1 or 0), lHardware ) -- flap 1. position
SendDataHW("532", (lMechInfo.flaps.value > 0.93 and 1 or 0), lHardware ) -- flap 2. position
SendDataHW("533", ((lMechInfo.flaps.value > 0.93 and lGetTrueAirSpeed > 340) and 1 or 0), lHardware ) -- Speed Warning for Flaps, same light as gear warning light, but blinking light
SendDataHW("534", (lMechInfo.gear.value > 0.5 and 1 or 0), lHardware ) -- Intake FOD shields
--SendDataHW("540", lMechInfo.parachute.status )
SendDataHW("541", (lMechInfo.parachute.value < 0.5 and 1 or 0), lHardware )
end

View File

@@ -0,0 +1,880 @@
-- Su-33 Export
-- Version 0.9.9 BETA
gES_FoundFCModule = true
-- auxiliary function
dofile(gES_ExportModulePath.."FC_AuxiliaryFuntions.lua")
-----------------------------------------
-- FLAMING CLIFFS AIRCRAFT / Su-33 --
-- FC aircraft don't support GetDevice --
-----------------------------------------
function ProcessGlassCockpitFCHighImportanceConfig()
local myData = LoGetSelfData()
if (myData) then
local lLatitude = myData.LatLongAlt.Lat -- LATITUDE
local lLongitude = myData.LatLongAlt.Long -- LONGITUDE
local lBasicAtmospherePressure = LoGetBasicAtmospherePressure() -- BAROMETRIC PRESSURE
local lAltBar = LoGetAltitudeAboveSeaLevel() -- ALTITUDE SEA LEVEL (Meter)
local lAltRad = LoGetAltitudeAboveGroundLevel() -- ALTITUDE GROUND LEVEL (Meter)
--local lTrueAirSpeed = LoGetTrueAirSpeed() -- TRUE AIRSPEED (Meter/Second)
local lPitch, lBank, lYaw = LoGetADIPitchBankYaw() -- PITCH, BANK, YAW (Radian)
local lHeading = myData.Heading -- HEADING (Radian)
local lVVI = LoGetVerticalVelocity() -- VERTICAL SPEED (Meter/Second)
local lIAS = LoGetIndicatedAirSpeed() -- INDICATED AIRSPEED (Meter/Second)
--local lMachNumber = LoGetMachNumber() -- MACH
local lAoA = LoGetAngleOfAttack() -- ANGLE OF ATTACK AoA (Radian)
local lGlide = LoGetGlideDeviation() -- VOR1 HORIZONTAL DEFLECTION (-1 +1)
local lSide = LoGetSideDeviation() -- VOR1 VERTICAL DEFLECTION (-1 +1)
--local lSlipBallPosition = LoGetSlipBallPosition() -- SLIP BALL (-1 +1)
--local lAccelerationUnits = LoGetAccelerationUnits().y -- G-LOAD
--local lNavInfoPitch = LoGetNavigationInfo().Requirements.pitch -- AP REQUIRED PITCH (Radian)
--local lNavInfoRoll = LoGetNavigationInfo().Requirements.roll -- AP REQUIRED BANK (Radian)
--local lNavInfoSpeed = LoGetNavigationInfo().Requirements.speed -- AP SPEED (Meter/Second)
--local lNavInfoAltitude = LoGetNavigationInfo().Requirements.altitude -- AP ALTITUDE (Meter)
--local lNavInfoVerticalSpeed = LoGetNavigationInfo().Requirements.vertical_speed -- AP VERTICAL SPEED (Meter/Second)
--local lControlPanel_HSI = LoGetControlPanel_HSI() -- HSI Data
local lHSI_RMI = LoGetControlPanel_HSI().RMI_raw -- VOR1 OBS (Radian)
local lHSI_ADF = LoGetControlPanel_HSI().ADF_raw -- ADF OBS (Radian)
--local lHSI_Heading = LoGetControlPanel_HSI().Heading_raw -- Heading (Radian)
local lEngineRPMleft = LoGetEngineInfo().RPM.left -- ENG1 RPM %
local lEngineRPMright = LoGetEngineInfo().RPM.right -- ENG2 RPM %
local lEngineTempLeft = LoGetEngineInfo().Temperature.left -- ENG1 EGT ºC
local lEngineTempRight = LoGetEngineInfo().Temperature.right -- ENG2 EGT ºC
--local lEngineFuelInternal = LoGetEngineInfo().fuel_internal -- TANK1 (INT) (KG)
--local lEngineFuelExternal = LoGetEngineInfo().fuel_external -- TANK2 (EXT) (KG)
--local lMechInfo = LoGetMechInfo() -- mechanical components, e.g. Flaps, Wheelbrakes,...
--local lPayloadInfo = LoGetPayloadInfo() -- Paylod, e.g. bombs, guns, rockets, fuel tanks,...
local lDistanceToWay = 999
local lRoute = LoGetRoute()
if (myData and lRoute) then -- if neither are nil
local myLoc = LoGeoCoordinatesToLoCoordinates(lLongitude, lLatitude)
--lDistanceToWay = math.sqrt((myLoc.x - lRoute.goto_point.world_point.x)^2 + (myLoc.y - lRoute.goto_point.world_point.y)^2)
lDistanceToWay = math.sqrt((myLoc.x - lRoute.goto_point.world_point.x)^2 + (myLoc.z - lRoute.goto_point.world_point.z)^2)
end
if gES_GlassCockpitType == 1 then
-- HELIOS Version 1.3
-- customizing for HELOS
lPitch = math.deg(lPitch) -- PITCH, (Radian to Grad)
lBank = math.deg(lBank) -- BANK (Radian to Grad)
lYaw = math.deg(lYaw) -- YAW (Radian to Grad)
lHSI_RMI = math.deg(lHSI_RMI) -- VOR1 OBS (Radian to Grad)
lHSI_ADF = math.deg(lHSI_ADF) -- ADF OBS (Radian to Grad)
lAoA = math.deg(lAoA) -- ANGLE OF ATTACK AoA (Radian to Grad)
lHeading = math.deg(lHeading) -- Heading (Radian to Grad)
lHSI_ADF = (360 - lHSI_ADF) + (360 - lHeading)
lHSI_RMI = 360 - lHSI_RMI
lIAS = lIAS * 3.6 -- change from m/s to km/h
SendData("1", string.format("%.2f", lPitch) )
SendData("2", string.format("%.2f", lBank) )
SendData("3", string.format("%.2f", lYaw) )
SendData("4", string.format("%.2f", lAltBar) )
SendData("5", string.format("%.2f", lAltRad) )
SendData("6", string.format("%.2f", lHSI_ADF) )
SendData("7", string.format("%.2f", lHSI_RMI) )
SendData("8", string.format("%.2f", lHeading) )
SendData("9", string.format("%.2f", lEngineRPMleft) )
SendData("10", string.format("%.2f", lEngineRPMright) )
SendData("11", string.format("%.2f", lEngineTempLeft) )
SendData("12", string.format("%.2f", lEngineTempRight) )
SendData("13", string.format("%.2f", lVVI) )
SendData("14", string.format("%.2f", lIAS) )
SendData("15", string.format("%.2f", lDistanceToWay) )
SendData("16", string.format("%.2f", lAoA) )
SendData("17", string.format("%.2f", lGlide) )
SendData("18", string.format("%.2f", lSide) )
elseif gES_GlassCockpitType == 2 then
-- HawgTouch version 1.6
-- IAS-MACH Indicator (IAS, MACH) {"%.4f;%.4f"}
FC_Russian_AirSpeed_1600hkm(1)
-- AOA Indicator and Accelerometer (AOA, GLoad)
FC_Russian_AOA_Su2733(3)
-- ADI
FC_Russian_ADI_New(4)
-- HSI
FC_Russian_HSI(lDistanceToWay, 5)
-- Vertical Velocity Indicator (VVI) (VVI, TurnIndicator, SlipBallPosition)
FC_Russian_VVI_New(6)
-- Radar Altimeter (AltRad, MinAltitude, WarningFlag, MinAltitudeLamp) {"%.4f;%.4f;%.1f;%.1f"} (below 100m is warning light on)
FC_Russian_RadarAltimeter_1500m(100, 7)
-- Barometric Altimeter (AltBar, BasicAtmospherePressure)
FC_Russian_BarometricAltimeter_late(8)
-- Tachometer (RPM) (EngineRPMleft, EngineRPMright) {"%.4f;%.4f"}
FC_Russian_EngineRPM(9)
-- Left Jet Engine Turbine Temperature Indicator (EngineTemp) {"%.4f"}
FC_TwoNeedlesGauge(lEngineTempLeft, 1200, 100, 10)
-- Right Jet Engine Turbine Temperature Indicator (EngineTemp) {"%.4f"}
FC_TwoNeedlesGauge(lEngineTempRight, 1200, 100, 11)
-- Clock from Ka-50 {CurrentHours, CurrentMinutes, CurrentSeconds, 0, FlightTimeHours, FlightTimeMinutes, 0, 0) {"%.4f;%.4f;%.4f;%.1f;%.4f;%.4f;%.4f;%.4f"}
FC_Russian_Clock_late(12)
end
else
WriteToLog("Unknown FC Error, no LoGetSelfData.")
end
end
function ProcessHARDWAREConfigHighImportance(mainPanelDevice)
end
function ProcessGlassCockpitFCLowImportanceConfig()
if gES_GlassCockpitType == 1 then
-- HELIOS Version 1.3
elseif gES_GlassCockpitType == 2 then
-- HawgTouch version 1.6
FC_WeaponPanel_SU2733(13)
FC_RadarWarning_SPO15(14)
-- Fuel Quantity Indicator
local lEngineInfo = LoGetEngineInfo()
local lTotalFuel = 0
if lEngineInfo ~= nil then
--WriteToLog('lEngineInfo: '..dump(lEngineInfo))
--[[
[fuel_external] = number: "0"
[Temperature] = {
[left] = number: "626.99444580078"
[right] = number: "626.99444580078"
}
[RPM] = {
[left] = number: "87.453765869141"
[right] = number: "87.453758239746"
}
[FuelConsumption] = {
[left] = number: "0.1500396137767"
[right] = number: "0.1500396137767"
}
[fuel_internal] = number: "3773.2749023438"
[EngineStart] = {
[left] = number: "0"
[right] = number: "0"
}
[HydraulicPressure] = {
[left] = number: "210"
[right] = number: "210"
}
lPayloadInfo.Stations[8].CLSID == E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF -- ext 800l Fuel Tank
]]
lTotalFuel = lEngineInfo.fuel_internal
--lTotalFuel = string.format("%3d", math.round((lEngineInfo.fuel_internal / 10), 0, "ceil") * 10)
--lTotalFuel = string.format("%4d", lEngineInfo.fuel_internal) -- total fuel in kg
--lTotalFuel = string.format("%4d", lEngineInfo.fuel_external) -- external fuel in kg
local lTotalFuel_12_0 = 1.0
if lTotalFuel < 12000 then
--[[
y_min = 0.0 -- minimaler Ausgabewert
y_max = 1.0 -- maximaler Ausgabewert
x_min = 0 -- minimaler Eingangswert
x_max = 12000 -- maximaler Eingangswert
x = 8000 -- aktueller Eingangswert
d_y = 1 -- Delta Ausgabewerte (y_max - y_min)
d_x = 12000 -- Delta Eingangswerte (x_max - x_min)
m = 8.3333333333333333333333333333333e-5 -- Steigung der linearen Funktion (d_y / d_x)
n = 4.e-33 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max)
y = 0.66666666666666666666666666666667 -- Ergebnis (m * x + n)
]]
lTotalFuel_12_0 = 8.3333333333333333333333333333333e-5 * lTotalFuel + 4.e-33
end
-- TotalFuel_12_0
-- Light1
-- Light2
-- Light3
-- Light4
-- BingoLight
SendData("15", string.format("%0.4f;%d;%d;%d;%d;%d",
lTotalFuel_12_0,
(lEngineInfo.fuel_internal < 5000.0 and 1 or 0), -- Tank warning 1
(lEngineInfo.fuel_internal < 1000.0 and 1 or 0), -- Tank warning 2 4000
(lEngineInfo.fuel_internal < 4000.0 and 1 or 0), -- Tank warning 3 1500
(lEngineInfo.fuel_internal < 1500.0 and 1 or 0), -- Tank warning 4 1000
(lEngineInfo.fuel_internal < 600.0 and 1 or 0))) -- Bingo Fuel
-- Hydraulic Pressure Left
FC_OneNeedleGauge(lEngineInfo.HydraulicPressure.left, 300, 17)
end
-- EKRAN Message
FC_EKRAN(16)
-- Mechanical Configuration Indicator (GearWarningLight, NoseGear, LeftGear, RightGear, Airbreaks, Flaps1, Flaps2) {"%.1f;%d;%d;%d;%d;%d;%d"}
local lMechInfo = LoGetMechInfo() -- mechanical components, e.g. Flaps, Wheelbrakes,...
if lMechInfo ~= nil then
local lWarningLight = 0.0
local lTrueAirSpeed = LoGetTrueAirSpeed()
if lTrueAirSpeed ~= nil then
lWarningLight = ((lMechInfo.flaps.value > 0.93 and lTrueAirSpeed > 340) and 1.0 or 0.0) -- Speed Warning for Flaps, same light as gear warning light, but blinking light
lWarningLight = (((lMechInfo.gear.status == 1 and lMechInfo.gear.value < 1) or (lMechInfo.gear.status == 0 and lMechInfo.gear.value > 0)) and 1.0 or lWarningLight ) -- gear warning light
end
-- WarningLight {0.0 = Off, 0.1 = blinking light, 0.2 = on}
-- WarningLight {0.0 = Off, no blinking light, 1.0 = on}
-- left gear {0, 1}
-- right gear {0, 1}
-- nose gear {0, 1}
-- Hook Light
-- WarningLight
-- Flap
-- Intake FOD shields
-- Speedbreakes on {0, 1}
SendData("2", string.format("%.1f;%d;%d;%d;%d;%d;%d;%d",
(lMechInfo.gear.value > 0.95 and 1 or 0), -- left gear
(lMechInfo.gear.value == 1 and 1 or 0), -- right gear
(lMechInfo.gear.value > 0.85 and 1 or 0), -- nose gear
(lMechInfo.hook.value > 0.85 and 1 or 0), -- hook light
lWarningLight,
(lMechInfo.flaps.value > 0.93 and 1 or 0), -- flap
(lMechInfo.gear.value > 0.5 and 1 or 0), -- Intake FOD shields
(lMechInfo.speedbrakes.value > 0.1 and 1 or 0))) -- speedbreakes on > 0.1 (0 - 1)
-- Wheelbrakes Hydraulic Pressure Left
FC_OneNeedleGauge(lMechInfo.wheelbrakes.value, 300, 18)
-- Wheelbrakes Hydraulic Pressure Right
FC_OneNeedleGauge(lMechInfo.wheelbrakes.value, 300, 19)
--WriteToLog('lMechInfo.noseflap.value: '..dump(lMechInfo.noseflap.value)) -- Vorfluegel, Balkenanzeige neben dem Radarhoehenmesser (0=oben bis 30=unten)
end
-- Airintake
FC_Russian_AirIntake(20)
-- Fuel Quantity Standby Indicator
FC_OneNeedleGauge(lTotalFuel, 10000, 21)
end
--(x < 0 and 'negative' or 'non-negative')
--[[
local lPayloadInfo = LoGetPayloadInfo()
WriteToLog('lPayloadInfo: '..dump(lPayloadInfo))
local lSnares = LoGetSnares() -- Flare and Chaff
WriteToLog('lSnares: '..dump(lSnares))
local lSightingSystemInfo = LoGetSightingSystemInfo()
WriteToLog('lSightingSystemInfo: '..dump(lSightingSystemInfo))
local lTWSInfo = LoGetTWSInfo() -- SPO Informationen, z.B. Radarwarner F15C
WriteToLog('lTWSInfo: '..dump(lTWSInfo))
local lTargetInformation = LoGetTargetInformation() -- detalierte Radar Infos z.B. F15C
WriteToLog('lTargetInformation: '..dump(lTargetInformation))
local lLockedTargetInformation = LoGetLockedTargetInformation()
WriteToLog('lLockedTargetInformation: '..dump(lLockedTargetInformation))
local lF15_TWS_Contacs = LoGetF15_TWS_Contacts() -- the same information but only for F-15 in TWS mode
WriteToLog('lF15_TWS_Contacs: '..dump(lF15_TWS_Contacs))
local lMechInfo = LoGetMechInfo() -- mechanical components, e.g. Flaps, Wheelbrakes,...
WriteToLog('lMechInfo: '..dump(lMechInfo))
local lMCPState = LoGetMCPState() -- Warnlichter
WriteToLog('lMCPState: '..dump(lMCPState))
local lControlPanel_HSI = LoGetControlPanel_HSI()
WriteToLog('lControlPanel_HSI: '..dump(lControlPanel_HSI))
local lRadioBeaconsStatus = LoGetRadioBeaconsStatus()
WriteToLog('lRadioBeaconsStatus: '..dump(lRadioBeaconsStatus))
local lEngineInfo = LoGetEngineInfo()
WriteToLog('lEngineInfo: '..dump(lEngineInfo))
]]
-- Weapon Control System
--local lNameByType = LoGetNameByType () -- args 4 (number : level1,level2,level3,level4), result string
-- values from LoGetTargetInformation().type
--WriteToLog('lNameByType: '..dump(lNameByType))
end
function ProcessHARDWAREConfigLowImportance(mainPanelDevice)
-- where necessary, specify HardwareID, example WeaponStatusPanel(2)
WeaponStatusPanel()
MechanicalDevicesIndicator()
StatusLamp()
FuelQuantityIndicator()
SightingSystem()
SPO15RWR()
PPDSPPanel()
end
-----------------------------
-- Custom functions --
-----------------------------
function SightingSystem(hardware)
local lHardware = hardware or 1
local lSightingSystemInfo = LoGetSightingSystemInfo()
if lSightingSystemInfo == nil then
return
end
--WriteToLog('lSightingSystemInfo: '..dump(lSightingSystemInfo)9
--[[
[PRF] = {
[selection] = string: "ILV"
[current] = string: "MED"
}
[laser_on] = boolean: "false"
[scale] = {
[azimuth] = number: "0.52359873056412"
[distance] = number: "10000"
}
[radar_on] = boolean: "false"
[optical_system_on] = boolean: "false"
[LaunchAuthorized] = boolean: "false"
[ECM_on] = boolean: "false"
[Manufacturer] = string: "RUS"
[TDC] = {
[y] = number: "0"
[x] = number: "0"
}
[ScanZone] = {
[coverage_H] = {
[min] = number: "0"
[max] = number: "20000"
}
[size] = {
[azimuth] = number: "1.0471974611282"
[elevation] = number: "0.17453290522099"
}
[position] = {
[exceeding_manual] = number: "0"
[distance_manual] = number: "0"
[azimuth] = number: "0"
[elevation] = number: "0"
}
}
]]
SendDataHW("600", lSightingSystemInfo.ECM_on == true and 1 or 0, lHardware )
SendDataHW("601", lSightingSystemInfo.laser_on == true and 1 or 0, lHardware )
--SendDataHW("602", lSightingSystemInfo.optical_system_on == true and 1 or 0, lHardware )
SendDataHW("603", lSightingSystemInfo.LaunchAuthorized == true and 1 or 0, lHardware )
SendDataHW("604", lSightingSystemInfo.radar_on == true and 1 or 0, lHardware )
end
function PPDSPPanel(hardware)
local lHardware = hardware or 1
local lSnares = LoGetSnares() -- Flare and Chaff
if lSnares == nil then
return
end
--WriteToLog('lSnares: '..dump(lSnares))
--[chaff] = number: "48"
--[flare] = number: "48"
local lChaffLED = math.round(lSnares.chaff / 6, 0, "ceil") + 1
local lFlareLED = math.round(lSnares.flare / 6, 0, "ceil") + 1
SendDataHW("800", (lChaffLED <= 1 and 0 or 1), lHardware )
SendDataHW("801", (lChaffLED <= 2 and 0 or 1), lHardware )
SendDataHW("802", (lChaffLED <= 3 and 0 or 1), lHardware )
SendDataHW("803", (lChaffLED <= 4 and 0 or 1), lHardware )
SendDataHW("804", (lChaffLED <= 5 and 0 or 1), lHardware )
SendDataHW("805", (lChaffLED <= 6 and 0 or 1), lHardware )
SendDataHW("806", (lChaffLED <= 7 and 0 or 1), lHardware )
SendDataHW("807", (lChaffLED <= 8 and 0 or 1), lHardware )
SendDataHW("810", (lFlareLED <= 1 and 0 or 1), lHardware )
SendDataHW("811", (lFlareLED <= 2 and 0 or 1), lHardware )
SendDataHW("812", (lFlareLED <= 3 and 0 or 1), lHardware )
SendDataHW("813", (lFlareLED <= 4 and 0 or 1), lHardware )
SendDataHW("814", (lFlareLED <= 5 and 0 or 1), lHardware )
SendDataHW("815", (lFlareLED <= 6 and 0 or 1), lHardware )
SendDataHW("816", (lFlareLED <= 7 and 0 or 1), lHardware )
SendDataHW("817", (lFlareLED <= 8 and 0 or 1), lHardware )
SendDataHW("817", (lFlareLED <= 8 and 0 or 1), lHardware )
end
function StatusLamp(hardware)
local lHardware = hardware or 1
local lMCPState = LoGetMCPState() -- Warning Lights
if lMCPState == nil then
return
end
--WriteToLog('lMCPState: '..dump(lMCPState))
--[[
[RightTailPlaneFailure] = boolean: "false"
[EOSFailure] = boolean: "false"
[ECMFailure] = boolean: "false"
[RightAileronFailure] = boolean: "false"
[MasterWarning] = boolean: "false"
[RightEngineFailure] = boolean: "false"
[CannonFailure] = boolean: "false"
[MLWSFailure] = boolean: "false"
[ACSFailure] = boolean: "false"
[RadarFailure] = boolean: "false"
[HelmetFailure] = boolean: "false"
[HUDFailure] = boolean: "false"
[LeftMainPumpFailure] = boolean: "false"
[RightWingPumpFailure] = boolean: "false"
[LeftWingPumpFailure] = boolean: "false"
[MFDFailure] = boolean: "false"
[RWSFailure] = boolean: "false"
[GearFailure] = boolean: "false"
[HydraulicsFailure] = boolean: "false"
[AutopilotFailure] = boolean: "true"
[FuelTankDamage] = boolean: "false"
[LeftAileronFailure] = boolean: "false"
[CanopyOpen] = boolean: "false"
[RightMainPumpFailure] = boolean: "false"
[StallSignalization] = boolean: "false"
[LeftEngineFailure] = boolean: "false"
[AutopilotOn] = boolean: "false"
[LeftTailPlaneFailure] = boolean: "false"
]]
SendDataHW("700", lMCPState.LeftTailPlaneFailure == true and 1 or 0, lHardware )
SendDataHW("701", lMCPState.RightTailPlaneFailure == true and 1 or 0, lHardware )
SendDataHW("702", lMCPState.MasterWarning == true and 1 or 0, lHardware )
SendDataHW("703", lMCPState.LeftEngineFailure == true and 1 or 0, lHardware )
SendDataHW("704", lMCPState.RightEngineFailure == true and 1 or 0, lHardware )
SendDataHW("705", lMCPState.LeftAileronFailure == true and 1 or 0, lHardware )
SendDataHW("706", lMCPState.RightAileronFailure == true and 1 or 0, lHardware )
SendDataHW("707", lMCPState.LeftMainPumpFailure == true and 1 or 0, lHardware )
SendDataHW("708", lMCPState.RightMainPumpFailure == true and 1 or 0, lHardware )
SendDataHW("709", lMCPState.LeftWingPumpFailure == true and 1 or 0, lHardware )
SendDataHW("710", lMCPState.RightWingPumpFailure == true and 1 or 0, lHardware )
SendDataHW("711", lMCPState.EOSFailure == true and 1 or 0, lHardware )
SendDataHW("712", lMCPState.ECMFailure == true and 1 or 0, lHardware )
SendDataHW("713", lMCPState.CannonFailure == true and 1 or 0, lHardware )
SendDataHW("714", lMCPState.MLWSFailure == true and 1 or 0, lHardware )
SendDataHW("715", lMCPState.ACSFailure == true and 1 or 0, lHardware )
SendDataHW("716", lMCPState.RadarFailure == true and 1 or 0, lHardware )
SendDataHW("717", lMCPState.HelmetFailure == true and 1 or 0, lHardware )
SendDataHW("718", lMCPState.HUDFailure == true and 1 or 0, lHardware )
SendDataHW("719", lMCPState.MFDFailure == true and 1 or 0, lHardware )
SendDataHW("720", lMCPState.RWSFailure == true and 1 or 0, lHardware )
SendDataHW("721", lMCPState.GearFailure == true and 1 or 0, lHardware )
SendDataHW("722", lMCPState.HydraulicsFailure == true and 1 or 0, lHardware )
SendDataHW("723", lMCPState.AutopilotFailure == true and 1 or 0, lHardware )
SendDataHW("724", lMCPState.FuelTankDamage == true and 1 or 0, lHardware )
SendDataHW("725", lMCPState.CanopyOpen == true and 1 or 0, lHardware )
SendDataHW("726", lMCPState.StallSignalization == true and 1 or 0, lHardware )
SendDataHW("727", lMCPState.AutopilotOn == true and 1 or 0, lHardware )
local lEngineInfo = LoGetEngineInfo()
if lEngineInfo ~= nil then
--WriteToLog('lEngineInfo: '..dump(lEngineInfo))
SendDataHW("728", lEngineInfo.EngineStart.left, lHardware ) -- lamp start left engine 1 (0|1)
SendDataHW("729", lEngineInfo.EngineStart.right, lHardware ) -- lamp start right engine 1 (0|1)
SendDataHW("730", (lEngineInfo.RPM.left > 100.0 and 1 or 0), lHardware ) -- lamp after burner left engine
SendDataHW("731", (lEngineInfo.RPM.right > 100.0 and 1 or 0), lHardware ) -- lam after burner right engine
end
local lAccelerationUnits = LoGetAccelerationUnits()
if lAccelerationUnits ~= nil then
--WriteToLog('lAccelerationUnits: '..dump(lAccelerationUnits))
SendDataHW("732", (lAccelerationUnits.y > 8.0 and 1 or 0), lHardware ) -- lamp Over-G warning
end
end
function WeaponStatusPanel(hardware)
-- The weapon status panel, quantity and readiness of the currently selected weapon and the remaining gun ammunition are indicated.
local lHardware = hardware or 1
gES_PayloadInfo = LoGetPayloadInfo()
if gES_PayloadInfo == nil then
return
end
--WriteToLog('gES_PayloadInfo: '..dump(gES_PayloadInfo))
--[[ exsample
[Stations] = {
[1] = {
[CLSID] = string: "{FBC29BFE-3D24-4C64-B81D-941239D12249}"
[container] = boolean: "false"
[count] = number: "1"
[weapon] = {
[level3] = number: "7"
[level1] = number: "4"
[level4] = number: "18"
[level2] = number: "4"
}
}
[2] = {
[CLSID] = string: "{FBC29BFE-3D24-4C64-B81D-941239D12249}"
[container] = boolean: "false"
[count] = number: "1"
[weapon] = {
[level3] = number: "7"
[level1] = number: "4"
[level4] = number: "18"
[level2] = number: "4"
}
}
[3] = {
[CLSID] = string: ""
[container] = boolean: "false"
[count] = number: "0"
[weapon] = {
[level3] = number: "0"
[level1] = number: "0"
[level4] = number: "0"
[level2] = number: "0"
}
}
[4] = {
[CLSID] = string: ""
[container] = boolean: "false"
[count] = number: "0"
[weapon] = {
[level3] = number: "0"
[level1] = number: "0"
[level4] = number: "0"
[level2] = number: "0"
}
}
[5] = {
[CLSID] = string: ""
[container] = boolean: "false"
[count] = number: "0"
[weapon] = {
[level3] = number: "0"
[level1] = number: "0"
[level4] = number: "0"
[level2] = number: "0"
}
}
[6] = {
[CLSID] = string: ""
[container] = boolean: "false"
[count] = number: "0"
[weapon] = {
[level3] = number: "0"
[level1] = number: "0"
[level4] = number: "0"
[level2] = number: "0"
}
}
[7] = {
[CLSID] = string: ""
[container] = boolean: "false"
[count] = number: "0"
[weapon] = {
[level3] = number: "0"
[level1] = number: "0"
[level4] = number: "0"
[level2] = number: "0"
}
}
[8] = {
[CLSID] = string: ""
[container] = boolean: "false"
[count] = number: "0"
[weapon] = {
[level3] = number: "0"
[level1] = number: "0"
[level4] = number: "0"
[level2] = number: "0"
}
}
[9] = {
[CLSID] = string: "{37DCC01E-9E02-432F-B61D-10C166CA2798}"
[container] = boolean: "false"
[count] = number: "1"
[weapon] = {
[level3] = number: "9"
[level1] = number: "4"
[level4] = number: "7"
[level2] = number: "5"
}
}
[10] = {
[CLSID] = string: "{37DCC01E-9E02-432F-B61D-10C166CA2798}"
[container] = boolean: "false"
[count] = number: "1"
[weapon] = {
[level3] = number: "9"
[level1] = number: "4"
[level4] = number: "7"
[level2] = number: "5"
}
}
[11] = {
[CLSID] = string: "{9B25D316-0434-4954-868F-D51DB1A38DF0}"
[container] = boolean: "false"
[count] = number: "1"
[weapon] = {
[level3] = number: "7"
[level1] = number: "4"
[level4] = number: "13"
[level2] = number: "4"
}
}
[12] = {
[CLSID] = string: "{3C612111-C7AD-476E-8A8E-2485812F4E5C}"
[container] = boolean: "false"
[count] = number: "1"
[weapon] = {
[level3] = number: "9"
[level1] = number: "4"
[level4] = number: "6"
[level2] = number: "5"
}
}
}
[CurrentStation] = number: "0"
[Cannon] = {
[shells] = number: "150"
}
]]
--[[
Weapon Panel (Numper = Station number)
|
-------------------------------------------------------
| | | | | | | | | | | |
L 1 2 3 4 5 6 7 8 9 10 R -- Panel ID
1 4 5 7 9 12 11 10 8 6 3 2 -- gES_PayloadInfo.Station.ID
]]
-- Payload Info
-- weapon stations L and R not on Panel
-- weapon station 1 (left) to 10 (right), 5 and 6 center station
SendDataHW("100", gES_PayloadInfo.Cannon.shells, lHardware ) -- count cannon shells
--SendDataHW("101", (gES_PayloadInfo.Stations[1].count > 0 and 1 or 0), lHardware ) -- L
--SendDataHW("111", (gES_PayloadInfo.Stations[2].count > 0 and 1 or 0), lHardware ) -- R
SendDataHW("110", (gES_PayloadInfo.Stations[3].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 1)
SendDataHW("101", (gES_PayloadInfo.Stations[4].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 10)
SendDataHW("102", (gES_PayloadInfo.Stations[5].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 2)
SendDataHW("109", (gES_PayloadInfo.Stations[6].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 9)
SendDataHW("103", (gES_PayloadInfo.Stations[7].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 3)
SendDataHW("108", (gES_PayloadInfo.Stations[8].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 8)
SendDataHW("104", (gES_PayloadInfo.Stations[9].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 4)
SendDataHW("107", (gES_PayloadInfo.Stations[10].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 7)
SendDataHW("106", (gES_PayloadInfo.Stations[11].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 5)
SendDataHW("105", (gES_PayloadInfo.Stations[12].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 6)
--SendDataHW("CurrentStation", gES_PayloadInfo.CurrentStation, lHardware )
-- air-to-air missils panel 1 and 2, air combat modus, CurrentStation = 1, panel 1 and 2 on
-- wenn die Waffenstationen gleichmässig belegt sind, hat bei Auswahl CurrentStation immer den Wert der linken Station
-- bei ungleichmäßiger Belegung, hat CurrentStation immer den Wert der jeweiligen Station
-- Waffenbezeichnung als UUID, gES_PayloadInfo.Stations[X].CLSID
-- defination
if gES_CurrentStationTmp == nil then
gES_CurrentStationTmp = -1
end
if gES_PayloadInfo.CurrentStation > 0 and
gES_CurrentStationTmp ~= gES_PayloadInfo.CurrentStation then
gES_CurrentStationTmp = gES_PayloadInfo.CurrentStation
gES_TmpStationToPanel = {}
--gES_TmpStationToPanel[1] = {Panel = 'L', StationID = 'L', CurrentID = 'L', HardwareID = lHardware } -- L
--gES_TmpStationToPanel[2] = {Panel = 'R', StationID = 'R', CurrentID = 'R', HardwareID = lHardware } -- R
gES_TmpStationToPanel[3] = {Panel = 10, StationID = 110, CurrentID = 210, HardwareID = lHardware }
gES_TmpStationToPanel[4] = {Panel = 1, StationID = 101, CurrentID = 201, HardwareID = lHardware }
gES_TmpStationToPanel[5] = {Panel = 2, StationID = 102, CurrentID = 202, HardwareID = lHardware }
gES_TmpStationToPanel[6] = {Panel = 9, StationID = 109, CurrentID = 209, HardwareID = lHardware }
gES_TmpStationToPanel[7] = {Panel = 3, StationID = 103, CurrentID = 203, HardwareID = lHardware }
gES_TmpStationToPanel[8] = {Panel = 8, StationID = 108, CurrentID = 208, HardwareID = lHardware }
gES_TmpStationToPanel[9] = {Panel = 4, StationID = 104, CurrentID = 204, HardwareID = lHardware }
gES_TmpStationToPanel[10] = {Panel = 7, StationID = 107, CurrentID = 207, HardwareID = lHardware }
gES_TmpStationToPanel[11] = {Panel = 6, StationID = 106, CurrentID = 206, HardwareID = lHardware }
gES_TmpStationToPanel[12] = {Panel = 5, StationID = 105, CurrentID = 205, HardwareID = lHardware }
WeaponStatusPanel_Reset(201, 210, lHardware)
if gES_TmpStationToPanel[gES_PayloadInfo.CurrentStation] ~= nil then
SendDataHW(gES_TmpStationToPanel[gES_PayloadInfo.CurrentStation].CurrentID, 1, lHardware ) -- eigentliche Auswahl
table.foreach(gES_PayloadInfo.Stations, WeaponStatusPanel_selectCurrentPayloadStation) -- zugehörige Stationen
end
elseif gES_PayloadInfo.CurrentStation == 0 and gES_CurrentStationTmp > 0 then
WeaponStatusPanel_Reset(201, 210, lHardware)
gES_CurrentStationTmp = -1
end
end
function FuelQuantityIndicator(hardware)
-- Fuel quantity shows the fuel remaining in all tanks
local lHardware = hardware or 1
local lEngineInfo = LoGetEngineInfo()
if lEngineInfo == nil then
return
end
--WriteToLog('lEngineInfo: '..dump(lEngineInfo))
--[[
[fuel_external] = number: "0"
[Temperature] = {
[left] = number: "626.99444580078"
[right] = number: "626.99444580078"
}
[RPM] = {
[left] = number: "87.453765869141"
[right] = number: "87.453758239746"
}
[FuelConsumption] = {
[left] = number: "0.1500396137767"
[right] = number: "0.1500396137767"
}
[fuel_internal] = number: "3773.2749023438"
[EngineStart] = {
[left] = number: "0"
[right] = number: "0"
}
[HydraulicPressure] = {
[left] = number: "210"
[right] = number: "210"
}
lPayloadInfo.Stations[8].CLSID == E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF -- ext 800l Fuel Tank
]]
SendDataHW("300", string.format("%d", math.round((lEngineInfo.fuel_internal / 10), 0, "ceil") * 10), lHardware ) -- total fuel in kg
--SendDataHW("301", string.format("%d", lEngineInfo.fuel_internal), lHardware ) -- total fuel in kg
--SendDataHW("302", string.format("%d", lEngineInfo.fuel_external), lHardware ) -- external fuel in kg
SendDataHW("304", (lEngineInfo.fuel_internal < 5000.0 and 1 or 0), lHardware ) -- Tank warning 1
SendDataHW("305", (lEngineInfo.fuel_internal < 1000.0 and 1 or 0), lHardware ) -- Tank warning 2 4000
SendDataHW("306", (lEngineInfo.fuel_internal < 4000.0 and 1 or 0), lHardware ) -- Tank warning 3 1500
SendDataHW("307", (lEngineInfo.fuel_internal < 1500.0 and 1 or 0), lHardware ) -- Tank warning 4 1000
SendDataHW("308", (lEngineInfo.fuel_internal < 600.0 and 1 or 0), lHardware ) -- Bingo Fuel
end
function MechanicalDevicesIndicator(hardware)
-- The mechanical devices indicator shows the position of the landing gear, flaps, leading edge flaps and airbrake
local lHardware = hardware or 1
local lMechInfo = LoGetMechInfo() -- mechanical components, e.g. Flaps, Wheelbrakes,...
if lMechInfo == nil then
return
end
--WriteToLog('lMechInfo: '..dump(lMechInfo))
--[[
[hook] = {
[status] = number: "0"
[value] = number: "0"
}
[parachute] = {
[status] = number: "0"
[value] = number: "0"
}
[controlsurfaces] = {
[eleron] = {
[left] = number: "0"
[right] = number: "-0.21084336936474"
}
[elevator] = {
[left] = number: "-0"
[right] = number: "-0"
}
[rudder] = {
[left] = number: "0"
[right] = number: "0"
}
}
[airintake] = {
[status] = number: "0"
[value] = number: "0"
}
[canopy] = {
[status] = number: "0"
[value] = number: "0"
}
[refuelingboom] = {
[status] = number: "0"
[value] = number: "0"
}
[wing] = {
[status] = number: "0"
[value] = number: "0"
}
[noseflap] = {
[status] = number: "0"
[value] = number: "0"
}
[gear] = {
[value] = number: "0"
[nose] = {
[rod] = number: "0"
}
[main] = {
[left] = {
[rod] = number: "0"
}
[right] = {
[rod] = number: "0"
}
}
[status] = number: "0"
}
[speedbrakes] = {
[status] = number: "0"
[value] = number: "0"
}
[wheelbrakes] = {
[status] = number: "0"
[value] = number: "0"
}
[flaps] = {
[status] = number: "0"
[value] = number: "0"
}]]
--SendDataHW("500", lMechInfo.gear.status )
--SendDataHW("501", lMechInfo.gear.value )
--SendDataHW("502", lMechInfo.gear.nose.rod ) -- zeigt an wie weit das Fahrwerk einsackt wenn das Flugzeug auf dem Boden ist
--SendDataHW("503", lMechInfo.gear.main.left.rod ) -- zeigt an wie weit das Fahrwerk einsackt wenn das Flugzeug auf dem Boden ist
--SendDataHW("504", lMechInfo.gear.main.right.rod ) -- zeigt an wie weit das Fahrwerk einsackt wenn das Flugzeug auf dem Boden ist
--SendDataHW("500", ((lMechInfo.gear.status == 1 and lMechInfo.gear.value < 1) and 1 or 0 ) ) -- gear warning light, go up
--SendDataHW("500", ((lMechInfo.gear.status == 0 and lMechInfo.gear.value > 0) and 1 or 0 ) ) -- gear warning light, go down
SendDataHW("500", (((lMechInfo.gear.status == 1 and lMechInfo.gear.value < 1) or (lMechInfo.gear.status == 0 and lMechInfo.gear.value > 0)) and 1 or 0 ), lHardware ) -- gear warning light
SendDataHW("501", (lMechInfo.gear.value > 0.85 and 1 or 0), lHardware ) -- nose gear
SendDataHW("502", (lMechInfo.gear.value > 0.95 and 1 or 0), lHardware ) -- left gear
SendDataHW("503", (lMechInfo.gear.value == 1 and 1 or 0), lHardware ) -- right gear
--SendDataHW("510", lMechInfo.speedbrakes.status ) -- speedbreakes on 1 (0|1)
SendDataHW("510", (lMechInfo.speedbrakes.value > 0.1 and 1 or 0), lHardware ) -- speedbreakes on > 0.1 (0 - 1)
--SendDataHW("520", lMechInfo.wheelbrakes.status, lHardware ) -- not in use
--SendDataHW("521", lMechInfo.wheelbrakes.value, lHardware ) -- not in use
local lGetTrueAirSpeed = LoGetTrueAirSpeed()
if lGetTrueAirSpeed == nil then
lGetTrueAirSpeed = 0
end
--SendDataHW("530", lMechInfo.flaps.status ) -- flap switch off 0, 1. position 1, 2. position 2 (0|1|2)
--SendDataHW("531", lMechInfo.flaps.value ) -- flap 1. position > 0.25, 2. position > 0.93 (0 - 1)
SendDataHW("531", (lMechInfo.flaps.value > 0.25 and 1 or 0), lHardware ) -- flap 1. position
SendDataHW("532", (lMechInfo.flaps.value > 0.93 and 1 or 0), lHardware ) -- flap 2. position
SendDataHW("533", ((lMechInfo.flaps.value > 0.93 and lGetTrueAirSpeed > 340) and 1 or 0), lHardware ) -- Speed Warning for Flaps, same light as gear warning light, but blinking light
SendDataHW("534", (lMechInfo.gear.value > 0.5 and 1 or 0), lHardware ) -- Intake FOD shields
--SendDataHW("540", lMechInfo.parachute.status )
SendDataHW("541", (lMechInfo.hook.value > 0.8 and 1 or 0), lHardware )
--SendDataHW("550", lMechInfo.noseflap.status )
SendDataHW("551", (lMechInfo.noseflap.value > 20.0 and 1 or 0), lHardware )
end

View File

@@ -0,0 +1,310 @@
-- TF-51D Export
-- Version 1.0.0 BETA
ExportScript.FoundDCSModule = true
ExportScript.ConfigEveryFrameArguments =
{
--[[
every frames arguments
based of "mainpanel_init.lua"
Example (http://www.lua.org/manual/5.1/manual.html#pdf-string.format)
[DeviceID] = "Format"
[4] = "%.4f", <- floating-point number with 4 digits after point
[19] = "%0.1f", <- floating-point number with 1 digit after point
[129] = "%1d", <- decimal number
[5] = "%.f", <- floating point number rounded to a decimal number
]]
-- Flight Instruments
[11] = "%.4f", -- AirspeedNeedle {0,50,100,150,200,250,300,350,400,450,500,550,600,650,700} {0.0,0.05,0.10,0.15,0.2,0.25,0.3,0.35,0.4,0.45,0.5,0.55,0.6,0.65,0.7}
[29] = "%.4f", -- Variometer {-6000,-4000,-2000,2000,4000,6000} {-0.6,-0.4,-0.2,0.2,0.4,0.6}
-- Altimeter
[97] = "%.4f", -- Altimeter_Pressure {28.1, 31.0}{0.0, 1.0}
[96] = "%.41f", -- Altimeter_10000_footPtr {0.0, 100000.0}{0.0, 1.0}
[24] = "%.4f", -- Altimeter_1000_footPtr {0.0, 10000.0}{0.0, 1.0}
[25] = "%.4f", -- Altimeter_100_footPtr{0.0, 1000.0}{0.0, 1.0}
-- Artificial horizon
[15] = "%.4f", -- AHorizon_Pitch {1.0, -1.0}
[14] = "%.4f", -- AHorizon_Bank {1.0, -1.0}
[16] = "%.1f", -- AHorizon_PitchShift {-1.0, 1.0}
[20] = "%.1f", -- AHorizon_Caged {0.0, 1.0}
-- directional gyro
[12] = "%.4f", -- GyroHeading
-- turn indicator
[27] = "%.4f", -- TurnNeedle {-1.0, 1.0}
[28] = "%.4f", -- Slipball {-1.0, 1.0}
-- oxygen pressure indicator
[34] = "%.4f", -- Oxygen_Pressure {0.0, 500.0} {0.0, 1.0}
[33] = "%.4f", -- Oxygen_Flow_Blinker
-- fuel system
[155] = "%.4f", -- Fuel_Tank_Left {0.0,5.0,15.0,30.0,45.0,60.0,75.0,92.0} {0.0,0.2,0.36,0.52,0.65,0.77,0.92,1.0}
[156] = "%.4f", -- Fuel_Tank_Right {0.0,5.0,15.0,30.0,45.0,60.0,75.0,92.0} {0.0,0.2,0.36,0.52,0.65,0.77,0.92,1.0}
[32] = "%.4f", -- Fuel_Pressure {0.0, 25.0} {0.0, 1.0}
-- A-11 clock
[4] = "%.4f", -- CLOCK_currtime_hours {0.0, 12.0}{0.0, 1.0}
[5] = "%.4f", -- CLOCK_currtime_minutes {0.0, 60.0}{0.0, 1.0}
[6] = "%.4f", -- CLOCK_currtime_seconds {0.0, 60.0}{0.0, 1.0}
-- AN5730 remote compass
[1] = "%.4f", -- CompassHeading
[2] = "%.4f", -- CommandedCourse
[3] = "%.4f", -- CommandedCourseKnob
-- TailRadarWarning
[161] = "%.f", -- Lamp TailRadarWarning
-- SCR-522A Control panel
[122] = "%.f", -- A_channel_light
[123] = "%.f", -- B_channel_light
[124] = "%.f", -- C_channel_light
[125] = "%.f", -- D_channel_light
[126] = "%.f", -- Transmit_light
-- hydraulic pressure
[78] = "%.4f", -- Hydraulic_Pressure {0.0, 2000.0} {0.0, 1.0}
-- Landing gears handle
[150] = "%.4f", -- Landing_Gear_Handle
[151] = "%.4f", -- Landing_Gear_Handle_Indoor
[80] = "%.f", -- LandingGearGreenLight
[82] = "%.f", -- LandingGearRedLight
-- gauges
[10] = "%.4f", -- Manifold_Pressure {10.0, 75.0} {0.0, 1.0}
[23] = "%.4f", -- Engine_RPM {0.0, 4500.0} {0.0, 1.0}
[9] = "%.4f", -- Vacuum_Suction {0.0, 10.0} {0.0, 1.0}
[21] = "%.4f", -- Carb_Temperature {-80, 150} {-0, 1}
[22] = "%.4f", -- Coolant_Temperature {-80, 150} {-0, 1}
[30] = "%.4f", -- Oil_Temperature {0.0, 100.0} {0, 1.0}
[31] = "%.4f", -- Oil_Pressure {0.0, 200.0} {0, 1.0}
[164] = "%.1f", -- Left_Fluor_Light
[165] = "%.1f", -- Right_Fluor_Light
[59] = "%.f", -- Hight_Blower_Lamp
-- Trimmer
[170] = "%.4f", -- Aileron_Trimmer {-1.0, 1.0}
[172] = "%.4f", -- Rudder_Trimmer {-1.0, 1.0}
[171] = "%.4f", -- Elevator_Trimmer {-1.0, 1.0}
[174] = "%.4f", -- Control_Lock_Bracket
[175] = "%.4f", -- Accelerometer_main {-5.0, 12.0} {0.0, 1.0}
[177] = "%.4f", -- Accelerometer_min {-5.0, 12.0} {0.0, 1.0}
[178] = "%.4f", -- Accelerometer_max {-5.0, 12.0} {0.0, 1.0}
[101] = "%.4f", -- Ammeter {0.0, 150.0} {0.0, 1.0}
-- light
[185] = "%.1f", -- Left_cockpit_light
[186] = "%.1f", -- Right_cockpit_light
[190] = "%.4f", -- warEmergencyPowerLimWire
}
ExportScript.ConfigArguments =
{
--[[
arguments for export in low tick interval
based on "clickabledata.lua"
]]
-- Right Swich Panel
[102] = "%d", -- Generator Connect/Disconnect
[103] = "%d", -- Battery Connect/Disconnect
[104] = "%d", -- Gun Heating ON/OFF
[105] = "%d", -- Pitot Heating ON/OFF
[106] = "%d", -- Wing Position Lights Bright/Off/Dim
[107] = "%d", -- Tail Position Lights Bright/Off/Dim
[108] = "%d", -- Red Recognition Light Key/Off/Steady
[109] = "%d", -- Green Recognition Light Key/Off/Steady
[110] = "%d", -- Amber Recognition Light Key/Off/Steady
[111] = "%d", -- Recognition Lights Key
[112] = "%d", -- Circuit Protectors Reset
[100] = "%.4f", -- Right Fluorescent Light (rotary)
[90] = "%.4f", -- Left Fluorescent Light (rotary)
-- Flight Instrument panel
[3] = "%.4f", -- Course Set (rotary)
[13] = "%.4f", -- Heading Set/Cage (rotary)
[179] = "%d", -- Heading Set/Cage Button
[17] = "%.4f", -- Pitch Adjustment (rotary)
[18] = "%.4f", -- Cage (rotary)
[19] = "%d", -- Cage Button
[8] = "%d", -- Winding/Adjustment Clock Button
[7] = "%.4f", -- Winding/Adjustment Clock (rotary)
[26] = "%.4f", -- Set Pressure (rotary)
-- SCR-522A Control panel
[117] = "%d", -- Radio ON/OFF
[118] = "%d", -- A Channel Activate
[119] = "%d", -- B Channel Activate
[120] = "%d", -- C Channel Activate
[121] = "%d", -- D Channel Activate
[127] = "%.4f", -- Radio Lights Dimmer (rotary)
[116] = "%.4f", -- Radio Audio Volume (rotary)
[44] = "%d", -- Microphone On
[129] = "%d", -- Switch Locking Lever
[128] = "%d", -- Radio Mode Transmit/Receive/Remote
-------------
[71] = "%.4f", -- Cockpit Lights (rotary)
[66] = "%0.1f", -- Ignition Off/Right/Left/Both
[67] = "%d", -- Gun control Gun And Camera On/Gun And Camera OFF/Camera On
[72] = "%d", -- Silence Landing Gear Warning Horn Cut Off
-- Bomb Arm/Chemical
[69] = "%d", -- Left Bomb Arm/Chemical
[70] = "%d", -- Right Bomb Arm/Chemical
-- Release Mode
[68] = "%0.1f", -- Release Mode, Bombs and Rockets Safe/Bombs Train Release/Bombs Both Release/Rockets Arm
-- Engine Control Panel
[58] = "%d", -- Supercharger Switch Cover
[57] = "%0.1f", -- Supercharger AUTO/LOW/HIGH
[60] = "%d", -- High Blower Lamp Test
[61] = "%d", -- Fuel Booster On/Off
[62] = "%d", -- Oil Dilute Activate
[63] = "%d", -- Starter Activate
[64] = "%d", -- Starter Switch Cover
[65] = "%d", -- Primer Activate
-- Oxygen Regulator
[131] = "%d", -- Auto-Mix On-Off
[130] = "%0.4f", -- Oxygen Emergency By-pass
-- Fuel system
[85] = "%0.1f", -- Fuel Selector Valve, Select Right Combat Tank/Select Left Main Tank/Select Fuselage Tank/Select Right Main Tank/Select Left Combat Tank
[86] = "%d", -- Fuel Shut-Off Valve ON/OFF
-- AN/APS-13
[114] = "%d", -- ail Warning Radar Power ON/OFF
[115] = "%d", -- Tail Warning Radar Test
[113] = "%.4f", -- Tail Warning Radar Light Control (rotary)
-------------
[79] = "%d", -- Hydraulic Release Knob
[94] = "%.4f", -- Flaps Control Handle (rotary)
[84] = "%d", -- Parking Brake Handle
[81] = "%d", -- Safe Landing Gear Light Test
[83] = "%d", -- Unsafe Landing Gear Light Test
-- Detrola receiver
[137] = "%.4f", -- Detrola Frequency Selector (rotary)
[138] = "%.4f", -- Detrola Volume (rotary)
-- canopy
[147] = "%.4f", -- Canopy Hand Crank (rotary)
[149] = "%d", -- Canopy Emergency Release Handle
-- AN/ARA-8
[152] = "%0.1f", -- Homing Adapter Mode TRANSMIT/COMM./HOMING
[153] = "%d", -- Homing Adapter Power On/Off
[154] = "%d", -- Homing Adapter's Circuit Breaker
-- SCR-695
[139] = "%0.1f", -- IFF Code Selector Code 1/2/3/4/5/6
[140] = "%d", -- IFF Power On/Off
[141] = "%d", -- IFF TIME/OFF/ON
[142] = "%d", -- IFF Detonator Circuit On/Off
[143] = "%d", -- IFF Distress Signal On/Off
[145] = "%d", -- IFF Detonator Left
[146] = "%d", -- IFF Detonator Right
-- Trimmers
[91] = "%.4f", -- Aileron Trim (rotary)
[92] = "%.4f", -- Elevator Trim (rotary)
[93] = "%.4f", -- Rudder Trim (rotary)
-------------
[157] = "%.4f", -- Defroster (rotary)
[158] = "%.4f", -- Cold Air (rotary)
[159] = "%.4f", -- Hot Air (rotary)
-------------
[89] = "%d", -- Landing Light On/Off
[168] = "%d", -- Coolant Control Cover
[87] = "%0.1f", -- Close Coolant Control/Automatic Coolant Control/Open Coolant Control
[169] = "%d", -- Oil Control Cover
[88] = "%0.1f", -- Close Oil Control/Automatic Oil Control/Open Oil Control
[134] = "%0.1f", -- Carburetor Cold Air Control (rotary)
[135] = "%0.1f", -- Carburetor Warm Air Control (rotary)
[47] = "%0.1f", -- Mixture Control Select IDLE CUT OFF/RUN/EMERGENCY FULL RICH
[43] = "%.4f", -- Throttle (rotary)
[46] = "%.4f", -- Propeller RPM (rotary)
[173] = "%d", -- Surface Control Lock Plunger. Left Button - Lock Stick in the Forward Position', Right Button - Lock Stick in the Neutral Position
[48] = "%.4f", -- Lock Throttle (rotary)
[49] = "%.4f", -- Lock Propeller & Mixture (rotary)
[176] = "%d", -- G-meter reset
[183] = "%d", -- Mirror
--Gunsight Selector
[41] = "%d", -- Sight On/Off
[39] = "%d", -- Fixed Reticle Mask Lever
[40] = "%0.1f", -- Sight Mode, Fixed Sight/Fixed-Gyro Sight/Gyro Sight
[42] = "%.1f", -- Gun Sight Brightness
[35] = "%.1f", -- Wing Span Selector
-------------
[132] = "%.4f", -- Left Payload Salvo
[133] = "%.4f" -- Right Payload Salvo
}
-----------------------------
-- HIGH IMPORTANCE EXPORTS --
-- done every export event --
-----------------------------
-- Pointed to by ProcessIkarusDCSHighImportance
function ExportScript.ProcessIkarusDCSConfigHighImportance(mainPanelDevice)
--[[
every frame export to Ikarus
Example from A-10C
Get Radio Frequencies
get data from device
local lUHFRadio = GetDevice(54)
ExportScript.Tools.SendData("ExportID", "Format")
ExportScript.Tools.SendData(2000, string.format("%7.3f", lUHFRadio:get_frequency()/1000000)) <- special function for get frequency data
]]
end
function ExportScript.ProcessDACConfigHighImportance(mainPanelDevice)
--[[
every frame export to DAC
Example from A-10C
Get Radio Frequencies
get data from device
local UHF_RADIO = GetDevice(54)
ExportScript.Tools.SendDataDAC("ExportID", "Format")
ExportScript.Tools.SendDataDAC("ExportID", "Format", HardwareConfigID)
ExportScript.Tools.SendDataDAC("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000))
ExportScript.Tools.SendDataDAC("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000), 2) -- export to Hardware '2' Config
]]
end
-----------------------------------------------------
-- LOW IMPORTANCE EXPORTS --
-- done every gExportLowTickInterval export events --
-----------------------------------------------------
-- Pointed to by ExportScript.ProcessIkarusDCSConfigLowImportance
function ExportScript.ProcessIkarusDCSConfigLowImportance(mainPanelDevice)
--[[
export in low tick interval to Ikarus
Example from A-10C
Get Radio Frequencies
get data from device
local lUHFRadio = GetDevice(54)
ExportScript.Tools.SendData("ExportID", "Format")
ExportScript.Tools.SendData(2000, string.format("%7.3f", lUHFRadio:get_frequency()/1000000)) <- special function for get frequency data
]]
end
function ExportScript.ProcessDACConfigLowImportance(mainPanelDevice)
--[[
every frame export to hardware
Example from A-10C
Get Radio Frequencies
get data from device
local UHF_RADIO = GetDevice(54)
ExportScript.Tools.SendDataDAC("ExportID", "Format")
ExportScript.Tools.SendDataDAC("ExportID", "Format", HardwareConfigID)
ExportScript.Tools.SendDataDAC("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000))
ExportScript.Tools.SendDataDAC("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000), 2) -- export to Hardware '2' Config
]]
--=====================================================================================
--[[
ExportScript.Tools.WriteToLog('list_cockpit_params(): '..ExportScript.Tools.dump(list_cockpit_params()))
ExportScript.Tools.WriteToLog('CMSP: '..ExportScript.Tools.dump(list_indication(7)))
local ltmp1 = 0
for ltmp2 = 0, 13, 1 do
ltmp1 = list_indication(ltmp2)
ExportScript.Tools.WriteToLog(ltmp2..': '..ExportScript.Tools.dump(ltmp1))
--ExportScript.Tools.WriteToLog(ltmp2..' (metatable): '..ExportScript.Tools.dump(getmetatable(ltmp1)))
end
]]
--[[
local ltmp1 = 0
for ltmp2 = 1, 73, 1 do
ltmp1 = GetDevice(ltmp2)
ExportScript.Tools.WriteToLog(ltmp2..': '..ExportScript.Tools.dump(ltmp1))
ExportScript.Tools.WriteToLog(ltmp2..' (metatable): '..ExportScript.Tools.dump(getmetatable(ltmp1)))
end
]]
end
-----------------------------
-- Custom functions --
-----------------------------
function ExportScript.genericRadio(key, value, hardware)
end

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,429 @@
-- Ikarus and D.A.C. Export Script
-- Version 1.0.0 BETA
--
-- Tools
--
-- Copyright by Michael aka McMicha 2014
-- Contact dcs2arcaze.micha@farbpigmente.org
ExportScript.Tools = {}
function ExportScript.Tools.WriteToLog(message)
if ExportScript.logFile then
local ltmp, lMiliseconds = math.modf(os.clock())
if lMiliseconds==0 then
lMiliseconds='000'
else
lMiliseconds=tostring(lMiliseconds):sub(3,5)
end
ExportScript.logFile:write(os.date("%X")..":"..lMiliseconds.." : "..message.."\r\n")
end
end
function ExportScript.Tools.ProcessInput()
local lCommand, lCommandArgs, lDevice
-- C1,3001,4
-- lComand = C
-- lCommandArgs[1] = 1 => lDevice
-- lCommandArgs[2] = 3001
-- lCommandArgs[3] = 4
if ExportScript.Config.IkarusExport then
local lInput,from,port = ExportScript.UDPsender:receivefrom()
if lInput then
if ExportScript.Config.Debug then
ExportScript.Tools.WriteToLog("lInput: "..lInput..", from: "..from..", port: "..port)
end
lCommand = string.sub(lInput,1,1)
if lCommand == "R" then
ExportScript.Tools.ResetChangeValues()
end
if (lCommand == "C") then
lCommandArgs = ExportScript.Tools.StrSplit(string.sub(lInput,2),",")
lDevice = GetDevice(lCommandArgs[1])
if type(lDevice) == "table" then
lDevice:performClickableAction(lCommandArgs[2],lCommandArgs[3])
end
end
end
end
if ExportScript.Config.DACExport then
local lInput2,from2,port2 = ExportScript.UDPListener:receivefrom() -- Hardware
if lInput2 then
if ExportScript.Config.Debug then
ExportScript.Tools.WriteToLog("lInput2: "..lInput2..", from2: "..from2..", port2: "..port2)
end
lCommand = string.sub(lInput2,1,1)
if lCommand == "C" then
ExportScript.Tools.ResetChangeValuesDAC()
end
if (lCommand == "C") then
lCommandArgs = ExportScript.Tools.StrSplit(string.sub(lInput2,2),",")
lDevice = GetDevice(lCommandArgs[1])
if lDevice ~= "1000" then
if type(lDevice) == "table" then
lDevice:performClickableAction(lCommandArgs[2],lCommandArgs[3])
end
elseif lDevice == "1000" then
--ExportScript.genericRadio(key, value, hardware)
ExportScript.genericRadio(lCommandArgs[2],lCommandArgs[3], ExportScript.Config.genericRadioHardwareID)
end
end
end
end
end
function ExportScript.Tools.StrSplit(str, delim, maxNb)
-- Eliminate bad cases...
if string.find(str, delim) == nil then
return { str }
end
if maxNb == nil or maxNb < 1 then
maxNb = 0 -- No limit
end
local lResult = {}
local lPat = "(.-)" .. delim .. "()"
local lNb = 0
local lLastPos
for part, pos in string.gfind(str, lPat) do
lNb = lNb + 1
lResult[lNb] = part
lLastPos = pos
if lNb == maxNb then break end
end
-- Handle the last field
if lNb ~= maxNb then
lResult[lNb + 1] = string.sub(str, lLastPos)
end
return lResult
end
function ExportScript.Tools.round(num, idp)
local lMult = 10^(idp or 0)
return math.floor(num * lMult + 0.5) / lMult
end
-- Status Gathering Functions
function ExportScript.Tools.ProcessArguments(device, arguments)
local lArgument , lFormat , lArgumentValue
local lCounter = 0
if ExportScript.Config.Debug then
ExportScript.Tools.WriteToLog("======Begin========")
end
for lArgument, lFormat in pairs(arguments) do
lArgumentValue = string.format(lFormat,device:get_argument_value(lArgument))
if ExportScript.Config.Debug then
lCounter = lCounter + 1
ExportScript.Tools.WriteToLog(lCounter..". ID: "..lArgument..", Fromat: "..lFormat..", Value: "..lArgumentValue)
end
if ExportScript.Config.IkarusExport then
ExportScript.Tools.SendData(lArgument, lArgumentValue)
end
if ExportScript.Config.DACExport then
ExportScript.Tools.SendDataDAC(lArgument, lArgumentValue)
end
end
if ExportScript.Config.Debug then
ExportScript.Tools.WriteToLog("======End========")
end
end
-- Network Functions for GlassCockpit
function ExportScript.Tools.SendData(id, value)
if string.len(value) > 3 and value == string.sub("-0.00000000",1, string.len(value)) then
value = value:sub(2)
end
if ExportScript.LastData[id] == nil or ExportScript.LastData[id] ~= value then
local ldata = id .. "=" .. value
local ldataLen = string.len(ldata)
if ldataLen + ExportScript.PacketSize > 576 then
ExportScript.Tools.FlushData()
end
table.insert(ExportScript.SendStrings, ldata)
ExportScript.LastData[id] = value
ExportScript.PacketSize = ExportScript.PacketSize + ldataLen + 1
end
end
-- Network Functions for DAC
function ExportScript.Tools.SendDataDAC(id, value)
for hardware=1, #ExportScript.Config.DAC, 1 do
if ExportScript.Config.DAC[hardware] == nil then
ExportScript.Tools.WriteToLog("unknown hardware ID '"..hardware.."' for value: '"..id.."="..value.."'")
return
end
if string.len(value) > 3 and value == string.sub("-0.00000000",1, string.len(value)) then
value = value:sub(2)
end
if ExportScript.LastDataDAC[hardware][id] == nil or ExportScript.LastDataDAC[hardware][id] ~= value then
local ldata = id .. "=" .. value
local ldataLen = string.len(ldata)
if ldataLen + ExportScript.PacketSizeDAC[hardware] > 576 then
ExportScript.Tools.FlushDataDAC(hardware)
end
table.insert(ExportScript.SendStringsDAC[hardware], ldata)
ExportScript.LastDataDAC[hardware][id] = value
ExportScript.PacketSizeDAC[hardware] = ExportScript.PacketSizeDAC[hardware] + ldataLen + 1
--ExportScript.Tools.WriteToLog("id=ldata: "..ldata)
--ExportScript.Tools.WriteToLog("ExportScript.LastDataDAC["..hardware.."]: "..ExportScript.Tools.dump(ExportScript.LastDataDAC[hardware]))
end
end
end
function ExportScript.Tools.FlushData()
if #ExportScript.SendStrings > 0 then
local lES_SimID = ""
if ExportScript.GlassCockpitType == 1 then
lES_SimID = ExportScript.SimID
elseif ExportScript.GlassCockpitType == 2 then
lES_SimID = ""
end
local lPacket = lES_SimID .. table.concat(ExportScript.SendStrings, ExportScript.Config.IkarusSeparator) .. "\n"
ExportScript.socket.try(ExportScript.UDPsender:sendto(lPacket, ExportScript.Config.IkarusHost, ExportScript.Config.IkarusPort))
ExportScript.SendStrings = {}
ExportScript.PacketSize = 0
end
end
function ExportScript.Tools.FlushDataDAC(hardware)
hardware = hardware or 1
if ExportScript.Config.DAC[hardware] == nil then
ExportScript.Tools.WriteToLog("unknown hardware ID '"..hardware.."'")
return
end
if #ExportScript.SendStringsDAC[hardware] > 0 then
local lPacket = ExportScript.SimID .. table.concat(ExportScript.SendStringsDAC[hardware], ExportScript.Config.DAC[hardware].Separator) .. "\n"
ExportScript.socket.try(ExportScript.UDPsender:sendto(lPacket, ExportScript.Config.DAC[hardware].Host, ExportScript.Config.DAC[hardware].SendPort))
ExportScript.SendStringsDAC[hardware] = {}
ExportScript.PacketSizeDAC[hardware] = 0
end
end
function ExportScript.Tools.ResetChangeValues()
ExportScript.LastData = {}
ExportScript.TickCount = 10
end
function ExportScript.Tools.ResetChangeValuesDAC()
for i = 1, #ExportScript.Config.DAC, 1 do
ExportScript.LastDataDAC[i] = {}
end
ExportScript.TickCount = 10
ExportScript.TickCountDAC = 0
end
function ExportScript.Tools.SelectModule()
-- Select Module...
ExportScript.FoundDCSModule = false
ExportScript.FoundFCModule = false
ExportScript.FoundNoModul = true
local lMyInfo = LoGetSelfData()
if lMyInfo == nil then -- End SelectModule, if don't selected a aircraft
return
end
ExportScript.ModuleName = lMyInfo.Name
local lModuleName = ExportScript.ModuleName..".lua"
local lModuleFile = ""
ExportScript.FoundNoModul = false
for file in lfs.dir(ExportScript.Config.ExportModulePath) do
if lfs.attributes(ExportScript.Config.ExportModulePath..file,"mode") == "file" then
if file == lModuleName then
lModuleFile = ExportScript.Config.ExportModulePath..file
end
end
end
ExportScript.Tools.WriteToLog("File Path: "..lModuleFile)
if string.len(lModuleFile) > 1 then
ExportScript.Tools.ResetChangeValuesDAC()
-- load Aircraft File
dofile(lModuleFile)
ExportScript.Tools.SendDataDAC("File", lMyInfo.Name)
for i=1, #ExportScript.Config.DAC, 1 do
ExportScript.Tools.FlushDataDAC(i)
end
ExportScript.Tools.SendData("File", lMyInfo.Name)
ExportScript.Tools.FlushData()
ExportScript.Tools.WriteToLog("File '"..lModuleFile.."' loaded")
ExportScript.FirstNewDataSend = true
ExportScript.FirstNewDataSendCount = 5
if ExportScript.FoundDCSModule then
local lCounter = 0
for k, v in pairs(ExportScript.ConfigEveryFrameArguments) do
lCounter = lCounter + 1
end
if ExportScript.Config.Debug then
ExportScript.Tools.WriteToLog("ExportScript.ConfigEveryFrameArguments Count: "..lCounter)
end
if lCounter > 0 then
ExportScript.EveryFrameArguments = ExportScript.ConfigEveryFrameArguments
else
-- no Arguments
ExportScript.EveryFrameArguments = {}
end
lCounter = 0
for k, v in pairs(ExportScript.ConfigArguments) do
lCounter = lCounter + 1
end
if ExportScript.Config.Debug then
ExportScript.Tools.WriteToLog("ExportScript.ConfigArguments Count: "..lCounter)
end
if lCounter > 0 then
ExportScript.Arguments = ExportScript.ConfigArguments
else
-- no Arguments
ExportScript.Arguments = {}
end
ExportScript.ProcessIkarusDCSHighImportance = ExportScript.ProcessIkarusDCSConfigHighImportance
ExportScript.ProcessIkarusDCSLowImportance = ExportScript.ProcessIkarusDCSConfigLowImportance
ExportScript.ProcessDACHighImportance = ExportScript.ProcessDACConfigHighImportance
ExportScript.ProcessDACLowImportance = ExportScript.ProcessDACConfigLowImportance
elseif ExportScript.FoundFCModule then
ExportScript.ProcessIkarusFCHighImportance = ExportScript.ProcessIkarusFCHighImportanceConfig
ExportScript.ProcessIkarusFCLowImportance = ExportScript.ProcessIkarusFCLowImportanceConfig
ExportScript.ProcessDACHighImportance = ExportScript.ProcessDACConfigHighImportance
ExportScript.ProcessDACLowImportance = ExportScript.ProcessDACConfigLowImportance
else
ExportScript.Tools.WriteToLog("Unknown Module Type: "..lMyInfo.Name)
end
else -- Unknown Module
ExportScript.ProcessIkarusDCSHighImportance = ExportScript.ProcessIkarusDCSHighImportanceNoConfig
ExportScript.ProcessIkarusDCSLowImportance = ExportScript.ProcessIkarusDCSLowImportanceNoConfig
ExportScript.ProcessIkarusFCHighImportance = ExportScript.ProcessIkarusFCHighImportanceNoConfig
ExportScript.ProcessIkarusFCLowImportance = ExportScript.ProcessIkarusFCLowImportanceNoConfig
ExportScript.ProcessDACHighImportance = ExportScript.ProcessDACHighImportanceNoConfig
ExportScript.ProcessDACLowImportance = ExportScript.ProcessDACLowImportanceNoConfig
ExportScript.EveryFrameArguments = {}
ExportScript.Arguments = {}
ExportScript.Tools.WriteToLog("Unknown Module Name: "..lMyInfo.Name)
end
end
-- The ExportScript.Tools.dump function show the content of the specified variable.
-- ExportScript.Tools.dump is similar to PHP function dump and show variables from type
-- "nil, "number", "string", "boolean, "table", "function", "thread" and "userdata"
function ExportScript.Tools.dump(var, depth)
depth = depth or 0
if type(var) == "string" then
return 'string: "' .. var .. '"\n'
elseif type(var) == "nil" then
return 'nil\n'
elseif type(var) == "number" then
return 'number: "' .. var .. '"\n'
elseif type(var) == "boolean" then
return 'boolean: "' .. tostring(var) .. '"\n'
elseif type(var) == "function" then
if debug and debug.getinfo then
fcnname = tostring(var)
local info = debug.getinfo(var, "S")
if info.what == "C" then
return string.format('%q', fcnname .. ', C function') .. '\n'
else
if (string.sub(info.source, 1, 2) == [[./]]) then
return string.format('%q', fcnname .. ', defined in (' .. info.linedefined .. '-' .. info.lastlinedefined .. ')' .. info.source) ..'\n'
else
return string.format('%q', fcnname .. ', defined in (' .. info.linedefined .. '-' .. info.lastlinedefined .. ')') ..'\n'
end
end
else
return 'a function\n'
end
elseif type(var) == "thread" then
return 'thread\n'
elseif type(var) == "userdata" then
return tostring(var)..'\n'
elseif type(var) == "table" then
depth = depth + 1
out = "{\n"
for k,v in pairs(var) do
out = out .. (" "):rep(depth*4).. "["..k.."] = " .. ExportScript.Tools.dump(v, depth)
end
return out .. (" "):rep((depth-1)*4) .. "}\n"
else
return tostring(var) .. "\n"
end
end
-- round function for math libraray
-- number : value
-- decimals: number of decimal
-- method : ceil: Returns the smallest integer larger than or equal to number
-- floor: Returns the smallest integer smaller than or equal to number
function ExportScript.Tools.round(number, decimals, method)
if string.find(number, "%p" ) ~= nil then
decimals = decimals or 0
local lFactor = 10 ^ decimals
if (method == "ceil" or method == "floor") then
-- ceil: Returns the smallest integer larger than or equal to number
-- floor: Returns the smallest integer smaller than or equal to number
return math[method](number * lFactor) / lFactor
else
return tonumber(("%."..decimals.."f"):format(number))
end
else
return number
end
end
-- split function for string libraray
-- stringvalue: value
-- delimiter : delimiter for split
-- for example, see http://www.lua.org/manual/5.1/manual.html#5.4.1
function ExportScript.Tools.split(stringvalue, delimiter)
result = {};
for match in (stringvalue..delimiter):gmatch("(.-)"..delimiter) do
table.insert(result, match);
end
return result;
end
-- Pointed to by ExportScript.ProcessIkarusDCSHighImportance, if the player aircraft is something else
function ExportScript.ProcessIkarusDCSHighImportanceNoConfig(mainPanelDevice)
end
-- Pointed to by ExportScript.ProcessIkarusDCSLowImportance, if the player aircraft is something else
function ExportScript.ProcessIkarusDCSLowImportanceNoConfig(mainPanelDevice)
end
-- the player aircraft is a Flaming Cliffs or similar aircraft
function ExportScript.ProcessIkarusFCHighImportanceNoConfig()
end
function ExportScript.ProcessIkarusFCLowImportanceNoConfig()
end
-- Hardware exports
function ExportScript.ProcessDACHighImportanceNoConfig(mainPanelDevice)
end
function ExportScript.ProcessDACLowImportanceNoConfig(mainPanelDevice)
end

View File

@@ -1,722 +1,3 @@
-- HELIOS and Arcaze Export Script
-- Version 0.9.9 BETA
--
-- Copyright by Michael aka McMicha 2014
-- Contact dcs2arcaze.micha@farbpigmente.org
-- List of all DCS Module Scripts
----------
-- DATA --
----------
-- Glass Cockpit Software
-- for example
-- HELIOS (http://www.gadrocsworkshop.com/helios/), Type 1
-- HawgTouch (http://forums.eagle.ru/showthread.php?t=71729), Type 2
gES_GlassCockpitExport = true -- false for not use
gES_GlassCockpitHost = "127.0.0.1" -- IP for HELIOS or HawgToch
gES_GlassCockpitPort = 1625 -- Port for HELIOS (9089) or HawgTouch (1625)
gES_GlassCockpitSeparator = ":"
gES_GlassCockpitType = 2 -- 1 = HELIOS, 2 = HawgTouch
-- for example D.A.C. or SIOC
gES_HARDWAREExport = true -- false for not use
gES_HARDWARE = {}
-- first hardware
gES_HARDWARE[1] = {}
gES_HARDWARE[1].Host = "127.0.0.1" -- IP for hardware 1
gES_HARDWARE[1].SendPort = 26026 -- Port for hardware 1
gES_HARDWARE[1].Separator = ":"
-- secound to n hardware
--gES_HARDWARE[2] = {}
--gES_HARDWARE[2].Host = "127.0.0.1" -- IP for hardware 2
--gES_HARDWARE[2].SendPort = 9092 -- Port for hardware 2
--gES_HARDWARE[2].Separator = ";"
-- D.A.C. can data send
gES_HARDWAREListner = true -- false for not use
gES_HARDWAREListnerPort = 26027 -- Listener Port for D.A.C.
gES_ExportInterval = 0.05
gES_ExportLowTickInterval = 1
gES_ExportModulePath = lfs.writedir().."ExportsModules\\"
gES_LogPath = lfs.writedir().."Logs\\Export.log"
gES_Debug = false
gES_FirstNewDataSend = true
gES_FirstNewDataSendCount = 5
gES_genericRadioHardwareID = 1
------------
-- SCRIPT --
------------
os.setlocale("ISO-8559-1", "numeric")
-- Simulation id
gES_SimID = string.format("%08x*",os.time())
-- State data for export
gES_PacketSize = 0
gES_SendStrings = {}
gES_LastData = {}
gES_PacketSizeHW = {}
gES_SendStringsHW = {}
gES_LastDataHW = {}
for i = 1, #gES_HARDWARE, 1 do
gES_PacketSizeHW[i] = 0
gES_SendStringsHW[i] = {}
gES_LastDataHW[i] = {}
end
-- Frame counter for non important data
gES_TickCount = 0
gES_TickCountHW = 0
-- Found DCS or FC Module
gES_FoundDCSModule = false
gES_FoundFCModule = false
gES_FoundNoModul = true
---------------------------------------------
-- DCS Export API Function Implementations --
---------------------------------------------
function LuaExportStart()
-- Works once just before mission start.
-- (and before player selects their aircraft, if there is a choice!)
-- 2) Setup udp sockets to talk to GlassCockpit
package.path = package.path..";.\\LuaSocket\\?.lua"
package.cpath = package.cpath..";.\\LuaSocket\\?.dll"
gES_socket = require("socket")
gES_c = gES_socket.udp()
gES_c:setsockname("*", 0)
gES_c:setoption('broadcast', true)
gES_c:settimeout(.001) -- set the timeout for reading the socket
if gES_HARDWAREListner then
gES_c2 = gES_socket.udp()
gES_c2:setsockname("*", gES_HARDWAREListnerPort)
gES_c2:setoption('broadcast', true)
gES_c2:settimeout(.001) -- set the timeout for reading the socket
end
-- local lrename1, lrename2 = os.rename(gES_LogPath, gES_LogPath..".old")
gES_logFile = io.open(gES_LogPath, "w+")
WriteToLog("Export Modules Script Path: "..gES_ExportModulePath)
-- if lrenmae1 == nil then
-- WriteToLog("Rename Error: "..lrename2)
-- end
SelectModule() -- point globals to Module functions and data.
end
function WriteToLog(message)
if gES_logFile then
gES_logFile:write(os.date("%X :")..message.."\r\n")
end
end
function LuaExportBeforeNextFrame()
ProcessInput()
end
function LuaExportAfterNextFrame()
end
function LuaExportStop()
-- Works once just after mission stop.
for i=1, #gES_HARDWARE, 1 do
SendDataHW("DAC", "stop", i)
FlushDataHW(i)
end
gES_c:close()
if gES_HARDWAREListner then
gES_c2:close()
end
if gES_logFile then
gES_logFile:flush()
gES_logFile:close()
gES_logFile = nil
end
end
function ProcessInput()
local lCommand, lCommandArgs, lDevice
-- C1,3001,4
-- lComand = C
-- lCommandArgs[1] = 1 => lDevice
-- lCommandArgs[2] = 3001
-- lCommandArgs[3] = 4
if gES_GlassCockpitExport then
local lInput,from,port = gES_c:receivefrom()
if lInput then
if gES_Debug then
WriteToLog("lInput: "..lInput..", from: "..from..", port: "..port)
end
lCommand = string.sub(lInput,1,1)
if lCommand == "R" then
ResetChangeValues()
end
if (lCommand == "C") then
lCommandArgs = StrSplit(string.sub(lInput,2),",")
lDevice = GetDevice(lCommandArgs[1])
if type(lDevice) == "table" then
lDevice:performClickableAction(lCommandArgs[2],lCommandArgs[3])
end
end
end
end
if gES_HARDWAREListner then
local lInput2,from2,port2 = gES_c2:receivefrom() -- Hardware
if lInput2 then
if gES_Debug then
WriteToLog("lInput2: "..lInput2..", from2: "..from2..", port2: "..port2)
end
lCommand = string.sub(lInput2,1,1)
if lCommand == "C" then
ResetChangeValuesHW()
end
if (lCommand == "C") then
lCommandArgs = StrSplit(string.sub(lInput2,2),",")
lDevice = GetDevice(lCommandArgs[1])
if lDevice ~= "1000" then
if type(lDevice) == "table" then
lDevice:performClickableAction(lCommandArgs[2],lCommandArgs[3])
end
elseif lDevice == "1000" then
--genericRadio(key, value, hardware)
genericRadio(lCommandArgs[2],lCommandArgs[3], gES_genericRadioHardwareID)
end
end
end
end
end
function LuaExportActivityNextEvent(t)
t = t + gES_ExportInterval
gES_TickCount = gES_TickCount + 1
local lMyInfo = LoGetSelfData()
if lMyInfo ~= nil then
if gES_ModuleName ~= lMyInfo.Name then
SelectModule() -- point globals to Module functions and data.
end
lMyInfo = nil
end
local lDevice = GetDevice(0)
if type(lDevice) == "table" and gES_FoundDCSModule then
lDevice:update_arguments()
if gES_GlassCockpitExport then
--ProcessArguments(lDevice, gES_EveryFrameArguments) -- Module arguments as appropriate
coProcessArguments_EveryFrame = coroutine.create(ProcessArguments)
status = coroutine.resume( coProcessArguments_EveryFrame, lDevice, gES_EveryFrameArguments)
if gES_Debug then
WriteToLog("coProcessArguments_EveryFrame Status: "..dump(status))
end
--ProcessGlassCockpitDCSHighImportance(lDevice) -- Module, as appropriate; determined in SelectModule()
coProcessGlassCockpitDCSHighImportance = coroutine.create(ProcessGlassCockpitDCSHighImportance)
status = coroutine.resume( coProcessGlassCockpitDCSHighImportance, lDevice)
if gES_Debug then
WriteToLog("coProcessGlassCockpitDCSHighImportance Status: "..dump(status))
end
end
if gES_HARDWAREExport then
--ProcessHARDWAREHighImportance(lDevice) -- Module, as appropriate; determined in SelectModule()
coProcessHARDWAREHighImportance = coroutine.create(ProcessHARDWAREHighImportance)
status = coroutine.resume( coProcessHARDWAREHighImportance, lDevice)
if gES_Debug then
WriteToLog("coProcessHARDWAREHighImportance Status: "..dump(status))
end
end
if gES_FirstNewDataSend and gES_FirstNewDataSendCount == 0 then
if gES_HARDWAREExport then
ResetChangeValuesHW()
end
if gES_GlassCockpitExport then
ResetChangeValues()
end
gES_FirstNewDataSend = false
else
gES_FirstNewDataSendCount = gES_FirstNewDataSendCount - 1
end
if gES_TickCount >= gES_ExportLowTickInterval then
if gES_GlassCockpitExport then
--ProcessArguments(lDevice, gES_Arguments) -- Module arguments as appropriate
coProcessArguments_Arguments = coroutine.create(ProcessArguments)
status = coroutine.resume( coProcessArguments_Arguments, lDevice, gES_Arguments)
if gES_Debug then
WriteToLog("coProcessArguments_Arguments Status: "..dump(status))
end
--ProcessGlassCockpitDCSLowImportance(lDevice) -- Module as appropriate; determined in SelectModule()
coProcessGlassCockpitDCSLowImportance = coroutine.create(ProcessGlassCockpitDCSLowImportance)
status = coroutine.resume( coProcessGlassCockpitDCSLowImportance, lDevice)
if gES_Debug then
WriteToLog("coProcessGlassCockpitDCSLowImportance Status: "..dump(status))
end
end
if gES_HARDWAREExport then
--ProcessHARDWARELowImportance(lDevice) -- Module, as appropriate; determined in SelectModule()
coProcessHARDWARELowImportance = coroutine.create(ProcessHARDWARELowImportance)
status = coroutine.resume( coProcessHARDWARELowImportance, lDevice)
if gES_Debug then
WriteToLog("coProcessHARDWARELowImportance Status: "..dump(status))
end
gES_TickCountHW = gES_TickCountHW + 1
end
gES_TickCount = 0
end
if gES_GlassCockpitExport then
FlushData()
end
if gES_HARDWAREExport then
for i=1, #gES_HARDWARE, 1 do
FlushDataHW(i)
end
end
elseif gES_FoundFCModule then -- Assume FC Aircraft
if gES_GlassCockpitExport then
--ProcessGlassCockpitFCHighImportance()
coProcessGlassCockpitFCHighImportance = coroutine.create(ProcessGlassCockpitFCHighImportance)
status = coroutine.resume( coProcessGlassCockpitFCHighImportance)
if gES_Debug then
WriteToLog("coProcessGlassCockpitFCHighImportance Status: "..dump(status))
end
end
if gES_HARDWAREExport then
--ProcessHARDWAREHighImportance(lDevice)
coProcessHARDWAREHighImportance = coroutine.create(ProcessHARDWAREHighImportance)
status = coroutine.resume( coProcessHARDWAREHighImportance, lDevice)
if gES_Debug then
WriteToLog("coProcessHARDWAREHighImportance Status: "..dump(status))
end
end
if gES_FirstNewDataSend and gES_FirstNewDataSendCount == 0 then
if gES_HARDWAREExport then
ResetChangeValuesHW()
end
if gES_GlassCockpitExport then
ResetChangeValues()
end
gES_FirstNewDataSend = false
else
gES_FirstNewDataSendCount = gES_FirstNewDataSendCount - 1
end
if gES_TickCount >= gES_ExportLowTickInterval then
if gES_GlassCockpitExport then
--ProcessGlassCockpitFCLowImportance()
coProcessGlassCockpitFCLowImportance = coroutine.create(ProcessGlassCockpitFCLowImportance)
status = coroutine.resume( coProcessGlassCockpitFCLowImportance)
if gES_Debug then
WriteToLog("coProcessGlassCockpitFCLowImportance Status: "..dump(status))
end
end
if gES_HARDWAREExport then
--ProcessHARDWARELowImportance(lDevice)
coProcessHARDWARELowImportance = coroutine.create(ProcessHARDWARELowImportance)
status = coroutine.resume( coProcessHARDWARELowImportance, lDevice)
if gES_Debug then
WriteToLog("coProcessHARDWARELowImportance Status: "..dump(status))
end
gES_TickCountHW = gES_TickCountHW + 1
end
gES_TickCount = 0
end
if gES_GlassCockpitExport then
FlushData()
end
if gES_HARDWAREExport then
for i=1, #gES_HARDWARE, 1 do
FlushDataHW(i)
end
end
else -- No Module found
if gES_FoundNoModul then
WriteToLog("No Module Found.")
SelectModule() -- point globals to Module functions and data.
end
end
return t
end
-- Helper Functions
function StrSplit(str, delim, maxNb)
-- Eliminate bad cases...
if string.find(str, delim) == nil then
return { str }
end
if maxNb == nil or maxNb < 1 then
maxNb = 0 -- No limit
end
local lResult = {}
local lPat = "(.-)" .. delim .. "()"
local lNb = 0
local lLastPos
for part, pos in string.gfind(str, lPat) do
lNb = lNb + 1
lResult[lNb] = part
lLastPos = pos
if lNb == maxNb then break end
end
-- Handle the last field
if lNb ~= maxNb then
lResult[lNb + 1] = string.sub(str, lLastPos)
end
return lResult
end
function round(num, idp)
local lMult = 10^(idp or 0)
return math.floor(num * lMult + 0.5) / lMult
end
-- Status Gathering Functions
function ProcessArguments(device, arguments)
local lArgument , lFormat , lArgumentValue
local lCounter = 0
if gES_Debug then
WriteToLog("======Begin========")
end
for lArgument, lFormat in pairs(arguments) do
lArgumentValue = string.format(lFormat,device:get_argument_value(lArgument))
if gES_Debug then
lCounter = lCounter + 1
WriteToLog(lCounter..". ID: "..lArgument..", Fromat: "..lFormat..", Value: "..lArgumentValue)
end
SendData(lArgument, lArgumentValue)
end
if gES_Debug then
WriteToLog("======End========")
end
end
-- Network Functions for GlassCockpit
function SendData(id, value)
if string.len(value) > 3 and value == string.sub("-0.00000000",1, string.len(value)) then
value = value:sub(2)
end
if gES_LastData[id] == nil or gES_LastData[id] ~= value then
local ldata = id .. "=" .. value
local ldataLen = string.len(ldata)
if ldataLen + gES_PacketSize > 576 then
FlushData()
end
table.insert(gES_SendStrings, ldata)
gES_LastData[id] = value
gES_PacketSize = gES_PacketSize + ldataLen + 1
end
end
-- Network Functions for Hardware
function SendDataHW(id, value, hardware)
hardware = hardware or 1
if gES_HARDWARE[hardware] == nil then
WriteToLog("unknown hardware ID '"..hardware.."' for value: '"..id.."="..value.."'")
return
end
if string.len(value) > 3 and value == string.sub("-0.00000000",1, string.len(value)) then
value = value:sub(2)
end
if gES_LastDataHW[hardware][id] == nil or gES_LastDataHW[hardware][id] ~= value then
local ldata = id .. "=" .. value
local ldataLen = string.len(ldata)
if ldataLen + gES_PacketSizeHW[hardware] > 576 then
FlushDataHW(hardware)
end
table.insert(gES_SendStringsHW[hardware], ldata)
gES_LastDataHW[hardware][id] = value
gES_PacketSizeHW[hardware] = gES_PacketSizeHW[hardware] + ldataLen + 1
--WriteToLog("id=ldata: "..ldata)
--WriteToLog("gES_LastDataHW["..hardware.."]: "..dump(gES_LastDataHW[hardware]))
end
end
function FlushData()
if #gES_SendStrings > 0 then
local lES_SimID = ""
if gES_GlassCockpitType == 1 then
lES_SimID = gES_SimID
elseif gES_GlassCockpitType == 2 then
lES_SimID = ""
end
local lPacket = lES_SimID .. table.concat(gES_SendStrings, gES_GlassCockpitSeparator) .. "\n"
gES_socket.try(gES_c:sendto(lPacket, gES_GlassCockpitHost, gES_GlassCockpitPort))
gES_SendStrings = {}
gES_PacketSize = 0
end
end
function FlushDataHW(hardware)
hardware = hardware or 1
if gES_HARDWARE[hardware] == nil then
WriteToLog("unknown hardware ID '"..hardware.."'")
return
end
if #gES_SendStringsHW[hardware] > 0 then
local lPacket = gES_SimID .. table.concat(gES_SendStringsHW[hardware], gES_HARDWARE[hardware].Separator) .. "\n"
gES_socket.try(gES_c:sendto(lPacket, gES_HARDWARE[hardware].Host, gES_HARDWARE[hardware].SendPort))
gES_SendStringsHW[hardware] = {}
gES_PacketSizeHW[hardware] = 0
end
end
function ResetChangeValues()
gES_LastData = {}
gES_TickCount = 10
end
function ResetChangeValuesHW()
for i = 1, #gES_HARDWARE, 1 do
gES_LastDataHW[i] = {}
end
gES_TickCount = 10
gES_TickCountHW = 0
end
function SelectModule()
-- Select Module...
gES_FoundDCSModule = false
gES_FoundFCModule = false
gES_FoundNoModul = true
local lMyInfo = LoGetSelfData()
if lMyInfo == nil then -- End SelectModule, if don't selected a aircraft
return
end
gES_ModuleName = lMyInfo.Name
local lModuleName = gES_ModuleName..".lua"
local lModuleFile = ""
gES_FoundNoModul = false
for file in lfs.dir(gES_ExportModulePath) do
if lfs.attributes(gES_ExportModulePath..file,"mode") == "file" then
if file == lModuleName then
lModuleFile = gES_ExportModulePath..file
end
end
end
WriteToLog("File Path: "..lModuleFile)
if string.len(lModuleFile) > 1 then
ResetChangeValuesHW()
-- load Aircraft File
dofile(lModuleFile)
for i=1, #gES_HARDWARE, 1 do
SendDataHW("File", lMyInfo.Name, i)
FlushDataHW(i)
end
WriteToLog("File '"..lModuleFile.."' loaded")
gES_FirstNewDataSend = true
gES_FirstNewDataSendCount = 5
if gES_FoundDCSModule then
local lCounter = 0
for k, v in pairs(gES_GlassCockpitConfigEveryFrameArguments) do
lCounter = lCounter + 1
end
if gES_Debug then
WriteToLog("gES_GlassCockpitConfigEveryFrameArguments Count: "..lCounter)
end
if lCounter > 0 then
gES_EveryFrameArguments = gES_GlassCockpitConfigEveryFrameArguments
else
-- no Arguments
gES_EveryFrameArguments = {}
end
lCounter = 0
for k, v in pairs(gES_GlassCockpitConfigArguments) do
lCounter = lCounter + 1
end
if gES_Debug then
WriteToLog("gES_GlassCockpitConfigArguments Count: "..lCounter)
end
if lCounter > 0 then
gES_Arguments = gES_GlassCockpitConfigArguments
else
-- no Arguments
gES_Arguments = {}
end
ProcessGlassCockpitDCSHighImportance = ProcessGlassCockpitDCSConfigHighImportance
ProcessGlassCockpitDCSLowImportance = ProcessGlassCockpitDCSConfigLowImportance
ProcessHARDWAREHighImportance = ProcessHARDWAREConfigHighImportance
ProcessHARDWARELowImportance = ProcessHARDWAREConfigLowImportance
elseif gES_FoundFCModule then
ProcessGlassCockpitFCHighImportance = ProcessGlassCockpitFCHighImportanceConfig
ProcessGlassCockpitFCLowImportance = ProcessGlassCockpitFCLowImportanceConfig
ProcessHARDWAREHighImportance = ProcessHARDWAREConfigHighImportance
ProcessHARDWARELowImportance = ProcessHARDWAREConfigLowImportance
else
WriteToLog("Unknown Module Type: "..lMyInfo.Name)
end
else -- Unknown Module
ProcessGlassCockpitDCSHighImportance = ProcessGlassCockpitDCSHighImportanceNoConfig
ProcessGlassCockpitDCSLowImportance = ProcessGlassCockpitDCSLowImportanceNoConfig
ProcessGlassCockpitFCHighImportance = ProcessGlassCockpitFCHighImportanceNoConfig
ProcessGlassCockpitFCLowImportance = ProcessGlassCockpitFCLowImportanceNoConfig
ProcessHARDWAREHighImportance = ProcessHARDWARENoConfigHighImportance
ProcessHARDWARELowImportance = ProcessHARDWARENoConfigLowImportance
gES_EveryFrameArguments = {}
gES_Arguments = {}
WriteToLog("Unknown Module Name: "..lMyInfo.Name)
end
end
-- The dump function show the content of the specified variable.
-- dump is similar to PHP function var_dump and show variables from type
-- "nil, "number", "string", "boolean, "table", "function", "thread" and "userdata"
function dump(var, depth)
depth = depth or 0
if type(var) == "string" then
return 'string: "' .. var .. '"\n'
elseif type(var) == "nil" then
return 'nil\n'
elseif type(var) == "number" then
return 'number: "' .. var .. '"\n'
elseif type(var) == "boolean" then
return 'boolean: "' .. tostring(var) .. '"\n'
elseif type(var) == "function" then
if debug and debug.getinfo then
fcnname = tostring(var)
local info = debug.getinfo(var, "S")
if info.what == "C" then
return string.format('%q', fcnname .. ', C function') .. '\n'
else
if (string.sub(info.source, 1, 2) == [[./]]) then
return string.format('%q', fcnname .. ', defined in (' .. info.linedefined .. '-' .. info.lastlinedefined .. ')' .. info.source) ..'\n'
else
return string.format('%q', fcnname .. ', defined in (' .. info.linedefined .. '-' .. info.lastlinedefined .. ')') ..'\n'
end
end
else
return 'a function\n'
end
elseif type(var) == "thread" then
return 'thread\n'
elseif type(var) == "userdata" then
return tostring(var)..'\n'
elseif type(var) == "table" then
depth = depth + 1
out = "{\n"
for k,v in pairs(var) do
out = out .. (" "):rep(depth*4).. "["..k.."] = " .. dump(v, depth)
end
return out .. (" "):rep((depth-1)*4) .. "}\n"
else
return tostring(var) .. "\n"
end
end
-- round function for math libraray
-- number : value
-- decimals: number of decimal
-- method : ceil: Returns the smallest integer larger than or equal to number
-- floor: Returns the smallest integer smaller than or equal to number
function math.round(number, decimals, method)
if string.find(number, "%p" ) ~= nil then
decimals = decimals or 0
local lFactor = 10 ^ decimals
if (method == "ceil" or method == "floor") then
-- ceil: Returns the smallest integer larger than or equal to number
-- floor: Returns the smallest integer smaller than or equal to number
return math[method](number * lFactor) / lFactor
else
return tonumber(("%."..decimals.."f"):format(number))
end
else
return number
end
end
-- split function for string libraray
-- stringvalue: value
-- delimiter : delimiter for split
-- for example, see http://www.lua.org/manual/5.1/manual.html#5.4.1
function string.split(stringvalue, delimiter)
result = {};
for match in (stringvalue..delimiter):gmatch("(.-)"..delimiter) do
table.insert(result, match);
end
return result;
end
-- Pointed to by ProcessGlassCockpitDCSHighImportance, if the player aircraft is something else
function ProcessGlassCockpitDCSHighImportanceNoConfig(mainPanelDevice)
end
-- Pointed to by ProcessGlassCockpitDCSLowImportance, if the player aircraft is something else
function ProcessGlassCockpitDCSLowImportanceNoConfig(mainPanelDevice)
end
-----------------------------------------
-- FLAMING CLIFFS AIRCRAFT / Su-25T --
-- FC aircraft don't support GetDevice --
-----------------------------------------
-- the player aircraft is a Flaming Cliffs or similar aircraft
function ProcessGlassCockpitFCHighImportanceNoConfig()
end
function ProcessGlassCockpitFCLowImportanceNoConfig()
end
-- Hardware exports
function ProcessHARDWARENoConfigHighImportance(mainPanelDevice)
end
function ProcessHARDWARENoConfigLowImportance(mainPanelDevice)
end
--dofile("./AriesWings/AriesRadio.luac")
-- load the DCS ExportScript for DAC and Ikarus
dofile(lfs.writedir()..[[Scripts\DCS-ExportScript\ExportScript.lua]])