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

@ -1,106 +0,0 @@
-- modul name
-- Version
gES_FoundDCSModule = true
gES_GlassCockpitConfigEveryFrameArguments =
{
-- Hier kommen alle Anzeigen rein die in HELOS/HawgTouch angezeigt werden sollen
-- [4] DCS ID, e.g. 4 for AOA
-- "%.4f" Format des Rückgabewerte, z.B. "%.4f" eine Floatzahl mit 4 Nachkommastellen, "%0.1f" eine Floatzahl mit führender 0 und einer Nachkommstelle, "%1d" eine Einstellige dezimalzahl
-- -- AOA, Description of DCS ID
[4] = "%.4f", -- AOA
[] = "", --
}
gES_GlassCockpitConfigArguments =
{
-- Hier kommen alle Schalter rein die in HELOS/HawgTouch angezeigt werden sollen
-- [101] DCS ID from Button, e.g. 22 for PTR-EXT-STORES-JETT (mergency Jettison External Stores)
-- "%.1" Format des Wertes der an DCS gesendet werden soll, Beschreibung siehe oben
-- -- PTR-EXT-STORES-JETT (mergency Jettison External Stores) Description of DCS ID
[101] = "%.1f", -- PTR-EXT-STORES-JETT (mergency Jettison External Stores)
[] = "", --
}
-----------------------------
-- HIGH IMPORTANCE EXPORTS --
-- done every export event --
-----------------------------
-- Pointed to by ProcessGlassCockpitDCSHighImportance
function ProcessGlassCockpitDCSConfigHighImportance(mainPanelDevice)
if gES_GlassCockpitType == 1 then
-- HELIOS Version 1.3
elseif gES_GlassCockpitType == 2 then
-- HawgTouch version 1.6
end
end
function ProcessHARDWAREConfigHighImportance(mainPanelDevice)
-- Hier kommen alle Daten rein die ueber die Hardware in schneller folge ausgeben werden soll
-- In der Regel sind das die Statusanzeigen
-- SendDataHW(), 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
SendDataHW("178", mainPanelDevice:get_argument_value(178)) -- L_AILERON_EMER_DISENGAGE
SendDataHW("", mainPanelDevice:get_argument_value()) --
end
-----------------------------------------------------
-- LOW IMPORTANCE EXPORTS --
-- done every gExportLowTickInterval export events --
-----------------------------------------------------
-- Pointed to by ProcessGlassCockpitDCSConfigLowImportance
function ProcessGlassCockpitDCSConfigLowImportance(mainPanelDevice)
if gES_GlassCockpitType == 1 then
-- HELIOS Version 1.3
elseif gES_GlassCockpitType == 2 then
-- HawgTouch version 1.6
end
end
function ProcessHARDWAREConfigLowImportance(mainPanelDevice)
--[[
every frame export to hardware
Example from A-10C
Get Radio Frequencies
get data from device
local UHF_RADIO = GetDevice(54)
SendDataHW("ExportID", "Format")
SendDataHW("ExportID", "Format", HardwareConfigID)
SendDataHW("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000))
SendDataHW("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000), 2) -- export to Hardware '2' Config
]]
--=====================================================================================
--[[
WriteToLog('list_cockpit_params(): '..dump(list_cockpit_params()))
WriteToLog('CMSP: '..dump(list_indication(7)))
local ltmp1 = 0
for ltmp2 = 0, 13, 1 do
ltmp1 = list_indication(ltmp2)
WriteToLog(ltmp2..': '..dump(ltmp1))
--WriteToLog(ltmp2..' (metatable): '..dump(getmetatable(ltmp1)))
end
]]
--[[
local ltmp1 = 0
for ltmp2 = 1, 73, 1 do
ltmp1 = GetDevice(ltmp2)
WriteToLog(ltmp2..': '..dump(ltmp1))
WriteToLog(ltmp2..' (metatable): '..dump(getmetatable(ltmp1)))
end
]]
end
-----------------------------
-- Custom functions --
-----------------------------
function genericRadio(key, value, hardware)
end

File diff suppressed because it is too large Load Diff

View File

@ -1,554 +0,0 @@
-- P-51D Export
-- Version 0.9.9 BETA
gES_FoundDCSModule = true
gES_GlassCockpitConfigEveryFrameArguments =
{
--[[
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
]]
-- 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] = "%.1f", -- Lamp TailRadarWarning
-- SCR-522A Control panel
[122] = "%.1f", -- A_channel_light
[123] = "%.1f", -- B_channel_light
[124] = "%.1f", -- C_channel_light
[125] = "%.1f", -- D_channel_light
[126] = "%.1f", -- 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] = "%.1f", -- LandingGearGreenLight
[82] = "%.1f", -- 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] = "%.1f", -- 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
}
gES_GlassCockpitConfigArguments =
{
--[[
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 --
-----------------------------
function ProcessGlassCockpitDCSConfigHighImportance(mainPanelDevice)
--[[
every frame export to GlassCockpit
Example from A-10C
Get Radio Frequencies
get data from device
local lUHFRadio = GetDevice(54)
SendData("ExportID", "Format")
SendData(2000, string.format("%7.3f", lUHFRadio:get_frequency()/1000000)) <- special function for get frequency data
]]
if gES_GlassCockpitType == 1 then
-- HELIOS Version 1.3
-- WriteToLog('in ProcessGlassCockpitDCSConfigHighImportance - HELIOS: '..t)
local MainPanel = GetDevice(0)
local AirspeedNeedle = MainPanel:get_argument_value(11)*1000
local Altimeter_10000_footPtr = MainPanel:get_argument_value(96)*100000
local Variometer = MainPanel:get_argument_value(29)
local TurnNeedle = MainPanel:get_argument_value(27)
local Slipball = MainPanel:get_argument_value(28)
local CompassHeading = MainPanel:get_argument_value(1)
local CommandedCourse = MainPanel:get_argument_value(2)
local Manifold_Pressure = MainPanel:get_argument_value(10)
local Engine_RPM = MainPanel:get_argument_value(23)
local AHorizon_Pitch = MainPanel:get_argument_value(15)
local AHorizon_Bank = MainPanel:get_argument_value(14)
local AHorizon_PitchShift = MainPanel:get_argument_value(16) * 10.0 * math.pi/180.0
local AHorizon_Caged = MainPanel:get_argument_value(20)
local GyroHeading = MainPanel:get_argument_value(12)
local vaccum_suction = MainPanel:get_argument_value(9)
local carburator_temp = MainPanel:get_argument_value(21)
local coolant_temp = MainPanel:get_argument_value(22)
local Acelerometer = MainPanel:get_argument_value(175)
local OilTemperature = MainPanel:get_argument_value(30)
local OilPressure = MainPanel:get_argument_value(31)
local FuelPressure = MainPanel:get_argument_value(32)
local Clock_hours = MainPanel:get_argument_value(4)
local Clock_minutes = MainPanel:get_argument_value(5)
local Clock_seconds = MainPanel:get_argument_value(6)
local LandingGearGreenLight = MainPanel:get_argument_value(80)
local LandingGearRedLight = MainPanel:get_argument_value(82)
local Hight_Blower_Lamp = MainPanel:get_argument_value(59)
local Acelerometer_Min = MainPanel:get_argument_value(177)
local Acelerometer_Max = MainPanel:get_argument_value(178)
local Ammeter = MainPanel:get_argument_value(101)
local hydraulic_Pressure = MainPanel:get_argument_value(78)
local Oxygen_Flow_Blinker = MainPanel:get_argument_value(33)
local Oxygen_Pressure = MainPanel:get_argument_value(34)
local Fuel_Tank_Left = MainPanel:get_argument_value(155)
local Fuel_Tank_Right = MainPanel:get_argument_value(156)
local Fuel_Tank_Fuselage = MainPanel:get_argument_value(160)
local Tail_radar_warning = MainPanel:get_argument_value(161)
local Channel_A = MainPanel:get_argument_value(122)
local Channel_B = MainPanel:get_argument_value(123)
local Channel_C = MainPanel:get_argument_value(124)
local Channel_D = MainPanel:get_argument_value(125)
local transmit_light = MainPanel:get_argument_value(126)
local RocketCounter = MainPanel:get_argument_value(77)
--- preparing landing gear and High Blower lights, all together, in only one value
local gear_lights = 0
if LandingGearGreenLight > 0 then gear_lights = gear_lights +100 end
if LandingGearRedLight > 0 then gear_lights = gear_lights +10 end
if Hight_Blower_Lamp > 0 then gear_lights = gear_lights +1 end
------------------------------------------------------------
--- preparing radio lights, all together, in only one value
local radio_active = 0
if Channel_A > 0 then radio_active = 1 end
if Channel_B >0 then radio_active= 2 end
if Channel_C >0 then radio_active= 3 end
if Channel_D >0 then radio_active= 4 end
if transmit_light >0 then radio_active = radio_active + 10 end
------------------------------------------------------------
---- sending P51 and tf51 data across fc2 interface
----Please comment out the appropriate entries in the table 'gES_GlassCockpitConfigEveryFrameArguments'.
SendData("1", string.format("%.5f", math.floor((AHorizon_Pitch+1)*1000) + ((AHorizon_Bank+1)/100) ) ) -- pitch
SendData("2", string.format("%.3f", math.floor(Oxygen_Flow_Blinker*100) + (Oxygen_Pressure/100) ) ) -- bank
SendData("3", string.format("%.4f", math.floor(OilTemperature*100) + (vaccum_suction/100) ) ) -- yaw
SendData("4", string.format("%.3f", math.floor(Altimeter_10000_footPtr) + (AHorizon_Caged/100) ) ) -- barometric altitude
SendData("5", string.format("%.5f", math.floor(Clock_hours*1000000) + (Tail_radar_warning/100) ) ) -- radar altitude
SendData("6", string.format("%.5f", math.floor(CompassHeading*1000) + (CommandedCourse/100) ) ) -- adf
SendData("7", string.format("%.4f", math.floor(Clock_seconds*100) + (hydraulic_Pressure/100) ) ) -- rmi
SendData("8", string.format("%.2f", math.floor(GyroHeading*1000) + (radio_active/100) ) ) -- heading
SendData("9", string.format("%.4f", math.floor(Engine_RPM*100) + (Manifold_Pressure/100) ) ) -- left rpm
SendData("10", string.format("%.4f", math.floor(Fuel_Tank_Left*100) + (Fuel_Tank_Right/100) ) ) -- right rpm
SendData("11", string.format("%.4f", math.floor(carburator_temp*100) + (coolant_temp/100) ) ) -- left temp
SendData("12", string.format("%.4f", math.floor(gear_lights) + (Acelerometer_Min/100 ) ) ) -- right temp
SendData("13", string.format("%.2f", Variometer) ) -- vvi
SendData("14", string.format("%.5f", math.floor(AirspeedNeedle)+ (RocketCounter/100) ) ) -- ias
SendData("15", string.format("%.4f", math.floor(OilPressure*100) + (FuelPressure/100) ) ) -- distance to way
SendData("16", string.format("%.3f", math.floor(Acelerometer*1000) + (Acelerometer_Max/100 ) ) ) -- aoa
SendData("17", string.format("%.4f", math.floor((TurnNeedle+1)*100) + ((Slipball+1)/100) ) ) -- glide
SendData("18", string.format("%.4f", math.floor(Fuel_Tank_Fuselage*100) + (Ammeter/100) ) ) -- side
elseif gES_GlassCockpitType == 2 then
-- HawgTouch version 1.6
-- WriteToLog('in ProcessGlassCockpitDCSConfigHighImportance - HawgTouch: '..t)
-- ADI AN5736
-- Artificial horizon
--[15] = "%.4f", -- AHorizon_Pitch {1.0, -1.0}
--[14] = "%.4f", -- AHorizon_Bank {1.0, -1.0}
--[16] = "%.1f", -- AHorizon_PitchShift
--[20] = "%.1f", -- AHorizon_Caged
SendData(2000, string.format("%0.4f;%0.4f",
mainPanelDevice:get_argument_value(15),
mainPanelDevice:get_argument_value(14)))
-- turn indicator AN5820
--[27] = "%.4f", -- TurnNeedle {-1.0, 1.0}
--[28] = "%.4f", -- Slipball {-1.0, 1.0}
SendData(2001, string.format("%0.4f;%0.4f",
mainPanelDevice:get_argument_value(27),
mainPanelDevice:get_argument_value(28)))
-- directional gyro AN5735
--[12] = "%.1f", -- GyroHeading {0.0, 1.0}
-- Vacuum_Suction AN5771-5
--[9] = "%.4f", -- Vacuum_Suction {0.0, 1.0}
-- F-2 Airspeed Indicator
-- [11] = "%.2f", -- 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}
-- Altimeter AN5760-2
--[96] = "%.1f", -- Altimeter_10000_footPtr {0.0, 1.0}
--[24] = "%.1f", -- Altimeter_1000_footPtr {0.0, 1.0}
--[25] = "%.1f", -- Altimeter_100_footPtr {0.0, 1.0}
--[97] = "%.1f", -- Altimeter_Pressure {28.1, 31.0} {0.0, 1.0}
SendData(2002, string.format("%0.4f;%0.4f;%0.4f;%0.4f",
mainPanelDevice:get_argument_value(96),
mainPanelDevice:get_argument_value(24),
mainPanelDevice:get_argument_value(25),
mainPanelDevice:get_argument_value(97)))
-- Rate of Climb Indicator AN5825
--[29] = "%.1f", -- Variometer {0.0, 1.0}
-- D-10 Manifold Pressure Indicator
--[10] = "%.4f", -- Manifold_Pressure {10.0, 75.0} {0.0, 1.0}
-- Tachometer
--[23] = "%.4f", -- Engine_RPM {0.0, 4500.0} {0.0, 1.0}
-- AN5790-6 Carburetor Air Temperature Indicator
--[21] = "%.4f", -- Carb_Temperature {-80, 150} {-0, 1}
-- Coolant Temperature Indicator
--[22] = "%.4f", -- Carb_Temperature {-80, 150} {-0, 1}
-- Engine Gauge
--[30] = "%.4f", -- Oil_Temperature {0.0, 100.0} {0.0, 1.0}
--[31] = "%.4f", -- Oil_Pressure {0.0, 200.0} {0.0, 1.0}
--[32] = "%.1f", -- Fuel_Pressure {0.0, 25.0} -- PSI {0.0, 1.0}
SendData(2003, string.format("%0.4f;%0.4f;%0.4f",
mainPanelDevice:get_argument_value(30),
mainPanelDevice:get_argument_value(31),
mainPanelDevice:get_argument_value(32)))
-- Remote Indicator Compass
-- AN5730 remote compass
--[1] = "%.4f", -- CompassHeading {0.0, 1.0}
--[2] = "%.4f", -- CommandedCourse {0.0, 1.0}
SendData(2004, string.format("%0.4f;%0.4f",
mainPanelDevice:get_argument_value(1),
mainPanelDevice:get_argument_value(2)))
-- A-11 clock
--[4] = "%.4f", -- CLOCK_currtime_hours {0.0, 1.0}
--[5] = "%.4f", -- CLOCK_currtime_minutes {0.0, 1.0}
--[6] = "%.4f", -- CLOCK_currtime_seconds {0.0, 1.0}
SendData(2005, string.format("%0.4f;%0.4f;%0.4f",
mainPanelDevice:get_argument_value(4),
mainPanelDevice:get_argument_value(5),
mainPanelDevice:get_argument_value(6)))
-- Oxygen Flow Indicator
--[33] = "%.1f", -- Oxygen_Flow_Blinker {0.0, 1.0}
-- Oxygen Pressure Gauge
--[34] = "%.1f", -- Oxygen_Pressure {0.0, 500.0} {0.0, 1.0}
-- Hydraulic Pressure Gauge
--[78] = "%.4f", -- Hydraulic_Pressure {0.0, 2000.0} -- PSI {0.0, 1.0}
-- Fuel Gauges
-- Left Wing Main Tank
--[155] = "%.2f", -- Fuel_Tank_Left {0.0, 5.0, 15.0, 30.0, 45.0, 60.0, 75.0, 92.0} -- US GAL {0.0, 0.2, 0.36, 0.52, 0.65, 0.77, 0.92, 1.0}
-- Fuselage Tank
--[160] = "%.2f", -- Fuel_Tank_Fuselage {0.0, 10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 85.0} -- US GAL {0.0, 0.12, 0.28, 0.40, 0.51, 0.62, 0.72, 0.83, 0.96, 1.0}
-- Right Wing Main Tank
--[156] = "%.2f", -- Fuel_Tank_Right {0.0, 5.0, 15.0, 30.0, 45.0, 60.0, 75.0, 92.0} -- US GAL {0.0, 0.2, 0.36, 0.52, 0.65, 0.77, 0.92, 1.0}
-- AN-5745 accelerometer indicator
--[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}
SendData(2006, string.format("%0.4f;%0.4f;%0.4f",
mainPanelDevice:get_argument_value(175),
mainPanelDevice:get_argument_value(177),
mainPanelDevice:get_argument_value(178)))
-- Landing Gear Warning Lights
--[80] = "%.1f", -- LandingGearGreenLight
--[82] = "%.1f", -- LandingGearRedLight
SendData(2007, string.format("%.1f;%.1f",
mainPanelDevice:get_argument_value(80),
mainPanelDevice:get_argument_value(82)))
-- AMMETER
--[101] = "%.4f", -- Ammeter {0.0, 150.0} {0.0, 1.0}
end
end
function ProcessHARDWAREConfigHighImportance(mainPanelDevice)
--[[
every frame export to hardware
Example from A-10C
Get Radio Frequencies
get data from device
local UHF_RADIO = GetDevice(54)
SendDataHW("ExportID", "Format")
SendDataHW("ExportID", "Format", HardwareConfigID)
SendDataHW("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000))
SendDataHW("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000), 2) -- export to Hardware '2' Config
]]
-- no dimming lights
-- TailRadarWarning
SendDataHW("161", mainPanelDevice:get_argument_value(161) > 0.3 and 1 or 0) -- Lamp TailRadarWarning
-- SCR-522A Control panel
SendDataHW("122", mainPanelDevice:get_argument_value(122) > 0.3 and 1 or 0) -- A_channel_light
SendDataHW("123", mainPanelDevice:get_argument_value(123) > 0.3 and 1 or 0) -- B_channel_light
SendDataHW("124", mainPanelDevice:get_argument_value(124) > 0.3 and 1 or 0) -- C_channel_light
SendDataHW("125", mainPanelDevice:get_argument_value(125) > 0.3 and 1 or 0) -- D_channel_light
SendDataHW("126", mainPanelDevice:get_argument_value(126) > 0.3 and 1 or 0) -- Transmit_light
-- Landing gears
SendDataHW("80", mainPanelDevice:get_argument_value(80) > 0.3 and 1 or 0) -- LandingGearGreenLight
SendDataHW("82", mainPanelDevice:get_argument_value(82) > 0.3 and 1 or 0) -- LandingGearRedLight
-- Engine
SendDataHW("59", mainPanelDevice:get_argument_value(59) > 0.3 and 1 or 0) -- Hight_Blower_Lamp
-- Cockpit Lights
SendDataHW("164", mainPanelDevice:get_argument_value(164) > 0.3 and 1 or 0) -- Left_Fluor_Light
SendDataHW("165", mainPanelDevice:get_argument_value(165) > 0.3 and 1 or 0) -- Right_Fluor_Light
SendDataHW("185", mainPanelDevice:get_argument_value(185) > 0.3 and 1 or 0) -- Left_cockpit_light
SendDataHW("186", mainPanelDevice:get_argument_value(186) > 0.3 and 1 or 0) -- Right_cockpit_light
--[[
-- dimming lights
-- TailRadarWarning
SendDataHW("161", string.format("%.1f", mainPanelDevice:get_argument_value(161))) -- Lamp TailRadarWarning
-- SCR-522A Control panel
SendDataHW("122", string.format("%.1f", mainPanelDevice:get_argument_value(122))) -- A_channel_light
SendDataHW("123", string.format("%.1f", mainPanelDevice:get_argument_value(123))) -- B_channel_light
SendDataHW("124", string.format("%.1f", mainPanelDevice:get_argument_value(124))) -- C_channel_light
SendDataHW("125", string.format("%.1f", mainPanelDevice:get_argument_value(125))) -- D_channel_light
SendDataHW("126", string.format("%.1f", mainPanelDevice:get_argument_value(126))) -- Transmit_light
-- Landing gears
SendDataHW("80", string.format("%.1f", mainPanelDevice:get_argument_value(80))) -- LandingGearGreenLight
SendDataHW("82", string.format("%.1f", mainPanelDevice:get_argument_value(82))) -- LandingGearRedLight
-- Engine
SendDataHW("59", string.format("%.1f", mainPanelDevice:get_argument_value(59))) -- Hight_Blower_Lamp
-- Cockpit Lights
SendDataHW("164", string.format("%.1f", mainPanelDevice:get_argument_value(164))) -- Left_Fluor_Light
SendDataHW("165", string.format("%.1f", mainPanelDevice:get_argument_value(165))) -- Right_Fluor_Light
SendDataHW("185", string.format("%.1f", mainPanelDevice:get_argument_value(185))) -- Left_cockpit_light
SendDataHW("186", string.format("%.1f", mainPanelDevice:get_argument_value(186))) -- Right_cockpit_light
]]
end
-----------------------------------------------------
-- LOW IMPORTANCE EXPORTS --
-- done every gExportLowTickInterval export events --
-----------------------------------------------------
function ProcessGlassCockpitDCSConfigLowImportance(mainPanelDevice)
--[[
export in low tick interval to GlassCockpit
Example from A-10C
Get Radio Frequencies
get data from device
local lUHFRadio = GetDevice(54)
SendData("ExportID", "Format")
SendData(2000, string.format("%7.3f", lUHFRadio:get_frequency()/1000000)) <- special function for get frequency data
]]
--[[
local lDETROLA = GetDevice(24)
WriteToLog('lDETROLA: '..dump(lDETROLA:is_on()))
WriteToLog('lDETROLA: '..dump(lDETROLA:get_frequency()))
--SendData(2000, string.format("%7.3f", lDETROLA:get_frequency()/1000000))
local lINTERCOM = GetDevice(31)
WriteToLog('lINTERCOM: '..dump(lINTERCOM:is_communicator_available()))
WriteToLog('lINTERCOM: '..dump(lINTERCOM:get_noise_level()))
WriteToLog('lINTERCOM: '..dump(lINTERCOM:get_signal_level()))
]]
--[[
local ltmp1 = 0
for ltmp2 = 1, 35, 1 do
ltmp1 = GetDevice(ltmp2)
WriteToLog(ltmp2..': '..dump(ltmp1))
WriteToLog(ltmp2..' (metatable): '..dump(getmetatable(ltmp1)))
end
]]
end
function ProcessHARDWAREConfigLowImportance(mainPanelDevice)
--[[
export in low tick interval to hardware
Example from A-10C
Landing Gear
mainPanelDevice, basis panel
SendDataHW("2004", mainPanelDevice:get_argument_value(659)) -- GEAR_N_SAFE
SendDataHW("2005", mainPanelDevice:get_argument_value(660)) -- GEAR_L_SAFE
SendDataHW("2006", mainPanelDevice:get_argument_value(661)) -- GEAR_R_SAFE
]]
--[[
WriteToLog('list_cockpit_params(): '..dump(list_cockpit_params()))
local ltmp1 = 0
for ltmp2 = 1, 10, 1 do
ltmp1 = list_indication(ltmp2)
WriteToLog(ltmp2..': '..dump(ltmp1))
--WriteToLog(ltmp2..' (metatable): '..dump(getmetatable(ltmp1)))
end
]]
end

View File

@ -1,534 +0,0 @@
-- TF-51D Export
-- Version 0.9.9 BETA
gES_FoundDCSModule = true
gES_GlassCockpitConfigEveryFrameArguments =
{
--[[
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
]]
-- 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] = "%.1f", -- Lamp TailRadarWarning
-- SCR-522A Control panel
[122] = "%.1f", -- A_channel_light
[123] = "%.1f", -- B_channel_light
[124] = "%.1f", -- C_channel_light
[125] = "%.1f", -- D_channel_light
[126] = "%.1f", -- 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] = "%.1f", -- LandingGearGreenLight
[82] = "%.1f", -- 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] = "%.1f", -- 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
}
gES_GlassCockpitConfigArguments =
{
--[[
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 --
-----------------------------
function ProcessGlassCockpitDCSConfigHighImportance(mainPanelDevice)
--[[
every frame export to GlassCockpit
Example from A-10C
Get Radio Frequencies
get data from device
local lUHFRadio = GetDevice(54)
SendData("ExportID", "Format")
SendData(2000, string.format("%7.3f", lUHFRadio:get_frequency()/1000000)) <- special function for get frequency data
]]
if gES_GlassCockpitType == 1 then
-- HELIOS Version 1.3
-- WriteToLog('in ProcessGlassCockpitDCSConfigHighImportance - HELIOS: '..t)
local MainPanel = GetDevice(0)
local AirspeedNeedle = MainPanel:get_argument_value(11)*1000
local Altimeter_10000_footPtr = MainPanel:get_argument_value(96)*100000
local Variometer = MainPanel:get_argument_value(29)
local TurnNeedle = MainPanel:get_argument_value(27)
local Slipball = MainPanel:get_argument_value(28)
local CompassHeading = MainPanel:get_argument_value(1)
local CommandedCourse = MainPanel:get_argument_value(2)
local Manifold_Pressure = MainPanel:get_argument_value(10)
local Engine_RPM = MainPanel:get_argument_value(23)
local AHorizon_Pitch = MainPanel:get_argument_value(15)
local AHorizon_Bank = MainPanel:get_argument_value(14)
local AHorizon_PitchShift = MainPanel:get_argument_value(16) * 10.0 * math.pi/180.0
local AHorizon_Caged = MainPanel:get_argument_value(20)
local GyroHeading = MainPanel:get_argument_value(12)
local vaccum_suction = MainPanel:get_argument_value(9)
local carburator_temp = MainPanel:get_argument_value(21)
local coolant_temp = MainPanel:get_argument_value(22)
local Acelerometer = MainPanel:get_argument_value(175)
local OilTemperature = MainPanel:get_argument_value(30)
local OilPressure = MainPanel:get_argument_value(31)
local FuelPressure = MainPanel:get_argument_value(32)
local Clock_hours = MainPanel:get_argument_value(4)
local Clock_minutes = MainPanel:get_argument_value(5)
local Clock_seconds = MainPanel:get_argument_value(6)
local LandingGearGreenLight = MainPanel:get_argument_value(80)
local LandingGearRedLight = MainPanel:get_argument_value(82)
local Hight_Blower_Lamp = MainPanel:get_argument_value(59)
local Acelerometer_Min = MainPanel:get_argument_value(177)
local Acelerometer_Max = MainPanel:get_argument_value(178)
local Ammeter = MainPanel:get_argument_value(101)
local hydraulic_Pressure = MainPanel:get_argument_value(78)
local Oxygen_Flow_Blinker = MainPanel:get_argument_value(33)
local Oxygen_Pressure = MainPanel:get_argument_value(34)
local Fuel_Tank_Left = MainPanel:get_argument_value(155)
local Fuel_Tank_Right = MainPanel:get_argument_value(156)
local Fuel_Tank_Fuselage = MainPanel:get_argument_value(160)
local Tail_radar_warning = MainPanel:get_argument_value(161)
local Channel_A = MainPanel:get_argument_value(122)
local Channel_B = MainPanel:get_argument_value(123)
local Channel_C = MainPanel:get_argument_value(124)
local Channel_D = MainPanel:get_argument_value(125)
local transmit_light = MainPanel:get_argument_value(126)
local RocketCounter = MainPanel:get_argument_value(77)
--- preparing landing gear and High Blower lights, all together, in only one value
local gear_lights = 0
if LandingGearGreenLight > 0 then gear_lights = gear_lights +100 end
if LandingGearRedLight > 0 then gear_lights = gear_lights +10 end
if Hight_Blower_Lamp > 0 then gear_lights = gear_lights +1 end
------------------------------------------------------------
--- preparing radio lights, all together, in only one value
local radio_active = 0
if Channel_A > 0 then radio_active = 1 end
if Channel_B >0 then radio_active= 2 end
if Channel_C >0 then radio_active= 3 end
if Channel_D >0 then radio_active= 4 end
if transmit_light >0 then radio_active = radio_active + 10 end
------------------------------------------------------------
---- sending P51 and tf51 data across fc2 interface
----Please comment out the appropriate entries in the table 'gES_GlassCockpitConfigEveryFrameArguments'.
SendData("1", string.format("%.5f", math.floor((AHorizon_Pitch+1)*1000) + ((AHorizon_Bank+1)/100) ) ) -- pitch
SendData("2", string.format("%.3f", math.floor(Oxygen_Flow_Blinker*100) + (Oxygen_Pressure/100) ) ) -- bank
SendData("3", string.format("%.4f", math.floor(OilTemperature*100) + (vaccum_suction/100) ) ) -- yaw
SendData("4", string.format("%.3f", math.floor(Altimeter_10000_footPtr) + (AHorizon_Caged/100) ) ) -- barometric altitude
SendData("5", string.format("%.5f", math.floor(Clock_hours*1000000) + (Tail_radar_warning/100) ) ) -- radar altitude
SendData("6", string.format("%.5f", math.floor(CompassHeading*1000) + (CommandedCourse/100) ) ) -- adf
SendData("7", string.format("%.4f", math.floor(Clock_seconds*100) + (hydraulic_Pressure/100) ) ) -- rmi
SendData("8", string.format("%.2f", math.floor(GyroHeading*1000) + (radio_active/100) ) ) -- heading
SendData("9", string.format("%.4f", math.floor(Engine_RPM*100) + (Manifold_Pressure/100) ) ) -- left rpm
SendData("10", string.format("%.4f", math.floor(Fuel_Tank_Left*100) + (Fuel_Tank_Right/100) ) ) -- right rpm
SendData("11", string.format("%.4f", math.floor(carburator_temp*100) + (coolant_temp/100) ) ) -- left temp
SendData("12", string.format("%.4f", math.floor(gear_lights) + (Acelerometer_Min/100 ) ) ) -- right temp
SendData("13", string.format("%.2f", Variometer) ) -- vvi
SendData("14", string.format("%.5f", math.floor(AirspeedNeedle)+ (RocketCounter/100) ) ) -- ias
SendData("15", string.format("%.4f", math.floor(OilPressure*100) + (FuelPressure/100) ) ) -- distance to way
SendData("16", string.format("%.3f", math.floor(Acelerometer*1000) + (Acelerometer_Max/100 ) ) ) -- aoa
SendData("17", string.format("%.4f", math.floor((TurnNeedle+1)*100) + ((Slipball+1)/100) ) ) -- glide
SendData("18", string.format("%.4f", math.floor(Fuel_Tank_Fuselage*100) + (Ammeter/100) ) ) -- side
elseif gES_GlassCockpitType == 2 then
-- HawgTouch version 1.6
-- WriteToLog('in ProcessGlassCockpitDCSConfigHighImportance - HawgTouch: '..t)
-- ADI AN5736
-- Artificial horizon
--[15] = "%.4f", -- AHorizon_Pitch {1.0, -1.0}
--[14] = "%.4f", -- AHorizon_Bank {1.0, -1.0}
--[16] = "%.1f", -- AHorizon_PitchShift
--[20] = "%.1f", -- AHorizon_Caged
SendData(2000, string.format("%0.4f;%0.4f",
mainPanelDevice:get_argument_value(15),
mainPanelDevice:get_argument_value(14)))
-- turn indicator AN5820
--[27] = "%.4f", -- TurnNeedle {-1.0, 1.0}
--[28] = "%.4f", -- Slipball {-1.0, 1.0}
SendData(2001, string.format("%0.4f;%0.4f",
mainPanelDevice:get_argument_value(27),
mainPanelDevice:get_argument_value(28)))
-- directional gyro AN5735
--[12] = "%.1f", -- GyroHeading {0.0, 1.0}
-- Vacuum_Suction AN5771-5
--[9] = "%.4f", -- Vacuum_Suction {0.0, 1.0}
-- F-2 Airspeed Indicator
-- [11] = "%.2f", -- 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}
-- Altimeter AN5760-2
--[96] = "%.1f", -- Altimeter_10000_footPtr {0.0, 1.0}
--[24] = "%.1f", -- Altimeter_1000_footPtr {0.0, 1.0}
--[25] = "%.1f", -- Altimeter_100_footPtr {0.0, 1.0}
--[97] = "%.1f", -- Altimeter_Pressure {28.1, 31.0} {0.0, 1.0}
SendData(2002, string.format("%0.4f;%0.4f;%0.4f;%0.4f",
mainPanelDevice:get_argument_value(96),
mainPanelDevice:get_argument_value(24),
mainPanelDevice:get_argument_value(25),
mainPanelDevice:get_argument_value(97)))
-- Rate of Climb Indicator AN5825
--[29] = "%.1f", -- Variometer {0.0, 1.0}
-- D-10 Manifold Pressure Indicator
--[10] = "%.4f", -- Manifold_Pressure {10.0, 75.0} {0.0, 1.0}
-- Tachometer
--[23] = "%.4f", -- Engine_RPM {0.0, 4500.0} {0.0, 1.0}
-- AN5790-6 Carburetor Air Temperature Indicator
--[21] = "%.4f", -- Carb_Temperature {-80, 150} {-0, 1}
-- Coolant Temperature Indicator
--[22] = "%.4f", -- Carb_Temperature {-80, 150} {-0, 1}
-- Engine Gauge
--[30] = "%.4f", -- Oil_Temperature {0.0, 100.0} {0.0, 1.0}
--[31] = "%.4f", -- Oil_Pressure {0.0, 200.0} {0.0, 1.0}
--[32] = "%.1f", -- Fuel_Pressure {0.0, 25.0} -- PSI {0.0, 1.0}
SendData(2003, string.format("%0.4f;%0.4f;%0.4f",
mainPanelDevice:get_argument_value(30),
mainPanelDevice:get_argument_value(31),
mainPanelDevice:get_argument_value(32)))
-- Remote Indicator Compass
-- AN5730 remote compass
--[1] = "%.4f", -- CompassHeading {0.0, 1.0}
--[2] = "%.4f", -- CommandedCourse {0.0, 1.0}
SendData(2004, string.format("%0.4f;%0.4f",
mainPanelDevice:get_argument_value(1),
mainPanelDevice:get_argument_value(2)))
-- A-11 clock
--[4] = "%.4f", -- CLOCK_currtime_hours {0.0, 1.0}
--[5] = "%.4f", -- CLOCK_currtime_minutes {0.0, 1.0}
--[6] = "%.4f", -- CLOCK_currtime_seconds {0.0, 1.0}
SendData(2005, string.format("%0.4f;%0.4f;%0.4f",
mainPanelDevice:get_argument_value(4),
mainPanelDevice:get_argument_value(5),
mainPanelDevice:get_argument_value(6)))
-- Oxygen Flow Indicator
--[33] = "%.1f", -- Oxygen_Flow_Blinker {0.0, 1.0}
-- Oxygen Pressure Gauge
--[34] = "%.1f", -- Oxygen_Pressure {0.0, 500.0} {0.0, 1.0}
-- Hydraulic Pressure Gauge
--[78] = "%.4f", -- Hydraulic_Pressure {0.0, 2000.0} -- PSI {0.0, 1.0}
-- Fuel Gauges
-- Left Wing Main Tank
--[155] = "%.2f", -- Fuel_Tank_Left {0.0, 5.0, 15.0, 30.0, 45.0, 60.0, 75.0, 92.0} -- US GAL {0.0, 0.2, 0.36, 0.52, 0.65, 0.77, 0.92, 1.0}
-- Fuselage Tank
--[160] = "%.2f", -- Fuel_Tank_Fuselage {0.0, 10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 85.0} -- US GAL {0.0, 0.12, 0.28, 0.40, 0.51, 0.62, 0.72, 0.83, 0.96, 1.0}
-- Right Wing Main Tank
--[156] = "%.2f", -- Fuel_Tank_Right {0.0, 5.0, 15.0, 30.0, 45.0, 60.0, 75.0, 92.0} -- US GAL {0.0, 0.2, 0.36, 0.52, 0.65, 0.77, 0.92, 1.0}
-- AN-5745 accelerometer indicator
--[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}
SendData(2006, string.format("%0.4f;%0.4f;%0.4f",
mainPanelDevice:get_argument_value(175),
mainPanelDevice:get_argument_value(177),
mainPanelDevice:get_argument_value(178)))
-- Landing Gear Warning Lights
--[80] = "%.1f", -- LandingGearGreenLight
--[82] = "%.1f", -- LandingGearRedLight
SendData(2007, string.format("%.1f;%.1f",
mainPanelDevice:get_argument_value(80),
mainPanelDevice:get_argument_value(82)))
-- AMMETER
--[101] = "%.4f", -- Ammeter {0.0, 150.0} {0.0, 1.0}
end
end
function ProcessHARDWAREConfigHighImportance(mainPanelDevice)
--[[
every frame export to hardware
Example from A-10C
Get Radio Frequencies
get data from device
local UHF_RADIO = GetDevice(54)
SendDataHW("ExportID", "Format")
SendDataHW("ExportID", "Format", HardwareConfigID)
SendDataHW("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000))
SendDataHW("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000), 2) -- export to Hardware '2' Config
]]
-- no dimming lights
-- TailRadarWarning
SendDataHW("161", mainPanelDevice:get_argument_value(161) > 0.3 and 1 or 0) -- Lamp TailRadarWarning
-- SCR-522A Control panel
SendDataHW("122", mainPanelDevice:get_argument_value(122) > 0.3 and 1 or 0) -- A_channel_light
SendDataHW("123", mainPanelDevice:get_argument_value(123) > 0.3 and 1 or 0) -- B_channel_light
SendDataHW("124", mainPanelDevice:get_argument_value(124) > 0.3 and 1 or 0) -- C_channel_light
SendDataHW("125", mainPanelDevice:get_argument_value(125) > 0.3 and 1 or 0) -- D_channel_light
SendDataHW("126", mainPanelDevice:get_argument_value(126) > 0.3 and 1 or 0) -- Transmit_light
-- Landing gears
SendDataHW("80", mainPanelDevice:get_argument_value(80) > 0.3 and 1 or 0) -- LandingGearGreenLight
SendDataHW("82", mainPanelDevice:get_argument_value(82) > 0.3 and 1 or 0) -- LandingGearRedLight
-- Engine
SendDataHW("59", mainPanelDevice:get_argument_value(59) > 0.3 and 1 or 0) -- Hight_Blower_Lamp
-- Cockpit Lights
SendDataHW("164", mainPanelDevice:get_argument_value(164) > 0.3 and 1 or 0) -- Left_Fluor_Light
SendDataHW("165", mainPanelDevice:get_argument_value(165) > 0.3 and 1 or 0) -- Right_Fluor_Light
SendDataHW("185", mainPanelDevice:get_argument_value(185) > 0.3 and 1 or 0) -- Left_cockpit_light
SendDataHW("186", mainPanelDevice:get_argument_value(186) > 0.3 and 1 or 0) -- Right_cockpit_light
--[[
-- dimming lights
-- TailRadarWarning
SendDataHW("161", string.format("%.1f", mainPanelDevice:get_argument_value(161))) -- Lamp TailRadarWarning
-- SCR-522A Control panel
SendDataHW("122", string.format("%.1f", mainPanelDevice:get_argument_value(122))) -- A_channel_light
SendDataHW("123", string.format("%.1f", mainPanelDevice:get_argument_value(123))) -- B_channel_light
SendDataHW("124", string.format("%.1f", mainPanelDevice:get_argument_value(124))) -- C_channel_light
SendDataHW("125", string.format("%.1f", mainPanelDevice:get_argument_value(125))) -- D_channel_light
SendDataHW("126", string.format("%.1f", mainPanelDevice:get_argument_value(126))) -- Transmit_light
-- Landing gears
SendDataHW("80", string.format("%.1f", mainPanelDevice:get_argument_value(80))) -- LandingGearGreenLight
SendDataHW("82", string.format("%.1f", mainPanelDevice:get_argument_value(82))) -- LandingGearRedLight
-- Engine
SendDataHW("59", string.format("%.1f", mainPanelDevice:get_argument_value(59))) -- Hight_Blower_Lamp
-- Cockpit Lights
SendDataHW("164", string.format("%.1f", mainPanelDevice:get_argument_value(164))) -- Left_Fluor_Light
SendDataHW("165", string.format("%.1f", mainPanelDevice:get_argument_value(165))) -- Right_Fluor_Light
SendDataHW("185", string.format("%.1f", mainPanelDevice:get_argument_value(185))) -- Left_cockpit_light
SendDataHW("186", string.format("%.1f", mainPanelDevice:get_argument_value(186))) -- Right_cockpit_light
]]
end
-----------------------------------------------------
-- LOW IMPORTANCE EXPORTS --
-- done every gExportLowTickInterval export events --
-----------------------------------------------------
function ProcessGlassCockpitDCSConfigLowImportance(mainPanelDevice)
--[[
export in low tick interval to GlassCockpit
Example from A-10C
Get Radio Frequencies
get data from device
local lUHFRadio = GetDevice(54)
SendData("ExportID", "Format")
SendData(2000, string.format("%7.3f", lUHFRadio:get_frequency()/1000000)) <- special function for get frequency data
]]
--[[
local lDETROLA = GetDevice(24)
WriteToLog('lDETROLA: '..dump(lDETROLA:is_on()))
WriteToLog('lDETROLA: '..dump(lDETROLA:get_frequency()))
--SendData(2000, string.format("%7.3f", lDETROLA:get_frequency()/1000000))
local lINTERCOM = GetDevice(31)
WriteToLog('lINTERCOM: '..dump(lINTERCOM:is_communicator_available()))
WriteToLog('lINTERCOM: '..dump(lINTERCOM:get_noise_level()))
WriteToLog('lINTERCOM: '..dump(lINTERCOM:get_signal_level()))
]]
--[[
local ltmp1 = 0
for ltmp2 = 1, 35, 1 do
ltmp1 = GetDevice(ltmp2)
WriteToLog(ltmp2..': '..dump(ltmp1))
WriteToLog(ltmp2..' (metatable): '..dump(getmetatable(ltmp1)))
end
]]
end
function ProcessHARDWAREConfigLowImportance(mainPanelDevice)
--[[
export in low tick interval to hardware
Example from A-10C
Landing Gear
mainPanelDevice, basis panel
SendDataHW("2004", mainPanelDevice:get_argument_value(659)) -- GEAR_N_SAFE
SendDataHW("2005", mainPanelDevice:get_argument_value(660)) -- GEAR_L_SAFE
SendDataHW("2006", mainPanelDevice:get_argument_value(661)) -- GEAR_R_SAFE
]]
--[[
WriteToLog('list_cockpit_params(): '..dump(list_cockpit_params()))
local ltmp1 = 0
for ltmp2 = 1, 10, 1 do
ltmp1 = list_indication(ltmp2)
WriteToLog(ltmp2..': '..dump(ltmp1))
--WriteToLog(ltmp2..' (metatable): '..dump(getmetatable(ltmp1)))
end
]]
end

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

View File

@ -1,17 +1,17 @@
-- A-10A Export
-- Version 0.9.9 BETA
gES_FoundFCModule = true
ExportScript.FoundFCModule = true
-- auxiliary function
dofile(gES_ExportModulePath.."FC_AuxiliaryFuntions.lua")
dofile(ExportScript.Config.ExportModulePath.."FC_AuxiliaryFuntions.lua")
-----------------------------------------
-- FLAMING CLIFFS AIRCRAFT / A-10A --
-- FC aircraft don't support GetDevice --
-----------------------------------------
function ProcessGlassCockpitFCHighImportanceConfig()
function ExportScript.ProcessIkarusFCHighImportanceConfig()
local myData = LoGetSelfData()
@ -384,7 +384,7 @@ function ProcessGlassCockpitFCHighImportanceConfig()
end
end
function ProcessHARDWAREConfigHighImportance(mainPanelDevice)
function ExportScript.ProcessDACHighImportance(mainPanelDevice)
--[[
local lPayloadInfo = LoGetPayloadInfo()
WriteToLog('lPayloadInfo: '..dump(lPayloadInfo))
@ -424,7 +424,7 @@ function ProcessHARDWAREConfigHighImportance(mainPanelDevice)
]]
end
function ProcessGlassCockpitFCLowImportanceConfig()
function ExportScript.ProcessIkarusFCLowImportanceConfig()
local lEngineFuelInternal = LoGetEngineInfo().fuel_internal -- TANK1 (INT) (KG)
local lEngineFuelExternal = LoGetEngineInfo().fuel_external -- TANK2 (EXT) (KG)
@ -489,7 +489,7 @@ function ProcessGlassCockpitFCLowImportanceConfig()
-- Fuel Indicator end
-- Weapon Panel
gES_PayloadInfo = LoGetPayloadInfo()
ExportScript.AF.PayloadInfo = LoGetPayloadInfo()
--[[
ShellsCounter
Station1
@ -511,31 +511,31 @@ function ProcessGlassCockpitFCLowImportanceConfig()
1 2 3 4 5 6 7 8 9 10 11
1 3 5 7 9 11 10 8 6 4 2 -- Weapon Station ID
]]
gES_TmpWeaponPanelActive = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}
ExportScript.AF.TmpWeaponPanelActive = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}
for lIndex = 1, 11, 1 do
gES_TmpWeaponPanelActive[lIndex] = (gES_PayloadInfo.Stations[lIndex].count > 0 and 0.2 or 0.1) -- get status, empty or load
ExportScript.AF.TmpWeaponPanelActive[lIndex] = (ExportScript.AF.PayloadInfo.Stations[lIndex].count > 0 and 0.2 or 0.1) -- get status, empty or load
end
if gES_PayloadInfo.CurrentStation > 0 then
gES_TmpWeaponPanelActive[gES_PayloadInfo.CurrentStation] = 0.3 -- currrent value
if ExportScript.AF.PayloadInfo.CurrentStation > 0 then
ExportScript.AF.TmpWeaponPanelActive[ExportScript.AF.PayloadInfo.CurrentStation] = 0.3 -- currrent value
table.foreach(gES_PayloadInfo.Stations, WeaponStatusPanel_selectCurrentPayloadStationGlassCockpit_A10A) -- corresponding station
table.foreach(ExportScript.AF.PayloadInfo.Stations, WeaponStatusPanel_selectCurrentPayloadStationGlassCockpit_A10A) -- corresponding station
end
SendData(26, string.format("%d;%0.1f;%0.1f;%0.1f;%0.1f;%0.1f;%0.1f;%0.1f;%0.1f;%0.1f;%0.1f;%0.1f",
gES_PayloadInfo.Cannon.shells,
gES_TmpWeaponPanelActive[1],
gES_TmpWeaponPanelActive[3],
gES_TmpWeaponPanelActive[5],
gES_TmpWeaponPanelActive[7],
gES_TmpWeaponPanelActive[9],
gES_TmpWeaponPanelActive[11],
gES_TmpWeaponPanelActive[10],
gES_TmpWeaponPanelActive[8],
gES_TmpWeaponPanelActive[6],
gES_TmpWeaponPanelActive[4],
gES_TmpWeaponPanelActive[2]))
ExportScript.AF.PayloadInfo.Cannon.shells,
ExportScript.AF.TmpWeaponPanelActive[1],
ExportScript.AF.TmpWeaponPanelActive[3],
ExportScript.AF.TmpWeaponPanelActive[5],
ExportScript.AF.TmpWeaponPanelActive[7],
ExportScript.AF.TmpWeaponPanelActive[9],
ExportScript.AF.TmpWeaponPanelActive[11],
ExportScript.AF.TmpWeaponPanelActive[10],
ExportScript.AF.TmpWeaponPanelActive[8],
ExportScript.AF.TmpWeaponPanelActive[6],
ExportScript.AF.TmpWeaponPanelActive[4],
ExportScript.AF.TmpWeaponPanelActive[2]))
-- Wepaon Panel end
-- UHF Gauges, no value
@ -543,23 +543,23 @@ function ProcessGlassCockpitFCLowImportanceConfig()
end
end
function ProcessHARDWAREConfigLowImportance(mainPanelDevice)
function ExportScript.ProcessDACLowImportance(mainPanelDevice)
-- where necessary, specify HardwareID, example SightingSystem(2)
SightingSystem()
FuelQuantityIndicator()
StatusLamp()
MechanicalDevicesIndicator()
FlareChaff()
WeaponStatusPanel()
RWRStatusPanel()
AOAIndicator()
ExportScript.AF.SightingSystem()
ExportScript.AF.FuelQuantityIndicator()
ExportScript.AF.StatusLamp()
ExportScript.AF.MechanicalDevicesIndicator()
ExportScript.AF.FlareChaff()
ExportScript.AF.WeaponStatusPanel()
ExportScript.AF.RWRStatusPanel()
ExportScript.AF.AOAIndicator()
end
-----------------------------
-- Custom functions --
-----------------------------
function SightingSystem(hardware)
function ExportScript.AF.SightingSystem(hardware)
local lHardware = hardware or 1
local lSightingSystemInfo = LoGetSightingSystemInfo()
if lSightingSystemInfo == nil then
@ -609,7 +609,7 @@ function SightingSystem(hardware)
--SendDataHW("604", lSightingSystemInfo.radar_on == true and 1 or 0, lHardware )
end
function FuelQuantityIndicator(hardware)
function ExportScript.AF.FuelQuantityIndicator(hardware)
-- Fuel quantity shows the fuel remaining in all tanks
local lHardware = hardware or 1
local lEngineInfo = LoGetEngineInfo()
@ -659,7 +659,7 @@ function FuelQuantityIndicator(hardware)
]]
end
function StatusLamp(hardware)
function ExportScript.AF.StatusLamp(hardware)
local lHardware = hardware or 1
local lMCPState = LoGetMCPState() -- Warning Lights
if lMCPState == nil then
@ -734,7 +734,7 @@ function StatusLamp(hardware)
end
end
function FlareChaff(hardware)
function ExportScript.AF.FlareChaff(hardware)
local lHardware = hardware or 1
local lSnares = LoGetSnares() -- Flare and Chaff
if lSnares == nil then
@ -749,7 +749,7 @@ function FlareChaff(hardware)
SendDataHW("801", lSnares.flare, lHardware )
end
function MechanicalDevicesIndicator(hardware)
function ExportScript.AF.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,...
@ -855,7 +855,7 @@ function MechanicalDevicesIndicator(hardware)
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
end
function RWRStatusPanel(hardware)
function ExportScript.AF.RWRStatusPanel(hardware)
-- RWR Status Panel only
local lHardware = hardware or 1
local lTWSInfo = LoGetTWSInfo()
@ -920,7 +920,7 @@ function RWRStatusPanel(hardware)
SendDataHW("444", (lScanTmp and 1 or 0), lHardware )
end
function AOAIndicator(hardware)
function ExportScript.AF.AOAIndicator(hardware)
-- AOA Indicator only
local lHardware = hardware or 1
local lAoA = LoGetAngleOfAttack()
@ -946,14 +946,14 @@ function AOAIndicator(hardware)
end
end
function WeaponStatusPanel(hardware)
function ExportScript.AF.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
ExportScript.AF.PayloadInfo = LoGetPayloadInfo()
if ExportScript.AF.PayloadInfo == nil then
return
end
--WriteToLog('gES_PayloadInfo: '..dump(gES_PayloadInfo))
--WriteToLog('ExportScript.AF.PayloadInfo: '..dump(ExportScript.AF.PayloadInfo))
--[[ exsample
[Stations] = {
[1] = {
@ -1177,44 +1177,44 @@ function WeaponStatusPanel(hardware)
]]
-- Payload Info
-- weapon stations (panel) 1 (left) - 11 (right) reserved
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("102", (gES_PayloadInfo.Stations[3].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 2)
SendDataHW("103", (gES_PayloadInfo.Stations[5].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 3)
SendDataHW("104", (gES_PayloadInfo.Stations[7].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 4)
SendDataHW("105", (gES_PayloadInfo.Stations[9].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 5)
SendDataHW("106", (gES_PayloadInfo.Stations[11].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 6, center station)
SendDataHW("107", (gES_PayloadInfo.Stations[10].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 7)
SendDataHW("108", (gES_PayloadInfo.Stations[8].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 8)
SendDataHW("109", (gES_PayloadInfo.Stations[6].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 9)
SendDataHW("110", (gES_PayloadInfo.Stations[4].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 10)
SendDataHW("111", (gES_PayloadInfo.Stations[2].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 11)
SendDataHW("100", ExportScript.AF.PayloadInfo.Cannon.shells, lHardware ) -- count cannon shells
SendDataHW("101", (ExportScript.AF.PayloadInfo.Stations[1].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 1)
SendDataHW("102", (ExportScript.AF.PayloadInfo.Stations[3].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 2)
SendDataHW("103", (ExportScript.AF.PayloadInfo.Stations[5].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 3)
SendDataHW("104", (ExportScript.AF.PayloadInfo.Stations[7].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 4)
SendDataHW("105", (ExportScript.AF.PayloadInfo.Stations[9].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 5)
SendDataHW("106", (ExportScript.AF.PayloadInfo.Stations[11].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 6, center station)
SendDataHW("107", (ExportScript.AF.PayloadInfo.Stations[10].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 7)
SendDataHW("108", (ExportScript.AF.PayloadInfo.Stations[8].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 8)
SendDataHW("109", (ExportScript.AF.PayloadInfo.Stations[6].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 9)
SendDataHW("110", (ExportScript.AF.PayloadInfo.Stations[4].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 10)
SendDataHW("111", (ExportScript.AF.PayloadInfo.Stations[2].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 11)
-- weapon stations (panel) 1 (left) - 11 (right) empty
SendDataHW("121", (gES_PayloadInfo.Stations[1].count == 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 1)
SendDataHW("122", (gES_PayloadInfo.Stations[3].count == 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 2)
SendDataHW("123", (gES_PayloadInfo.Stations[5].count == 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 3)
SendDataHW("124", (gES_PayloadInfo.Stations[7].count == 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 4)
SendDataHW("125", (gES_PayloadInfo.Stations[9].count == 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 5)
SendDataHW("126", (gES_PayloadInfo.Stations[11].count == 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 6, center station)
SendDataHW("127", (gES_PayloadInfo.Stations[10].count == 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 7)
SendDataHW("128", (gES_PayloadInfo.Stations[8].count == 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 8)
SendDataHW("129", (gES_PayloadInfo.Stations[6].count == 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 9)
SendDataHW("130", (gES_PayloadInfo.Stations[4].count == 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 10)
SendDataHW("131", (gES_PayloadInfo.Stations[2].count == 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 11)
--SendDataHW("CurrentStation", gES_PayloadInfo.CurrentStation, lHardware )
SendDataHW("121", (ExportScript.AF.PayloadInfo.Stations[1].count == 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 1)
SendDataHW("122", (ExportScript.AF.PayloadInfo.Stations[3].count == 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 2)
SendDataHW("123", (ExportScript.AF.PayloadInfo.Stations[5].count == 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 3)
SendDataHW("124", (ExportScript.AF.PayloadInfo.Stations[7].count == 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 4)
SendDataHW("125", (ExportScript.AF.PayloadInfo.Stations[9].count == 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 5)
SendDataHW("126", (ExportScript.AF.PayloadInfo.Stations[11].count == 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 6, center station)
SendDataHW("127", (ExportScript.AF.PayloadInfo.Stations[10].count == 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 7)
SendDataHW("128", (ExportScript.AF.PayloadInfo.Stations[8].count == 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 8)
SendDataHW("129", (ExportScript.AF.PayloadInfo.Stations[6].count == 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 9)
SendDataHW("130", (ExportScript.AF.PayloadInfo.Stations[4].count == 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 10)
SendDataHW("131", (ExportScript.AF.PayloadInfo.Stations[2].count == 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 11)
--SendDataHW("CurrentStation", ExportScript.AF.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
-- Waffenbezeichnung als UUID, ExportScript.AF.PayloadInfo.Stations[X].CLSID
-- defination
if gES_CurrentStationTmp == nil then
gES_CurrentStationTmp = -1
if ExportScript.AF.CurrentStationTmp == nil then
ExportScript.AF.CurrentStationTmp = -1
end
if gES_PayloadInfo.CurrentStation > 0 and
gES_CurrentStationTmp ~= gES_PayloadInfo.CurrentStation then
gES_CurrentStationTmp = gES_PayloadInfo.CurrentStation
if ExportScript.AF.PayloadInfo.CurrentStation > 0 and
ExportScript.AF.CurrentStationTmp ~= ExportScript.AF.PayloadInfo.CurrentStation then
ExportScript.AF.CurrentStationTmp = ExportScript.AF.PayloadInfo.CurrentStation
gTmpStationToPanel = {}
gTmpStationToPanel[1] = {Panel = 1, StationID = 101, CurrentID = 201, CurrentID2 = 221, HardwareID = lHardware } -- left
@ -1232,30 +1232,30 @@ function WeaponStatusPanel(hardware)
WeaponStatusPanel_Reset(201, 211, lHardware)
WeaponStatusPanel_Reset(221, 231, lHardware)
SendDataHW(gTmpStationToPanel[gES_PayloadInfo.CurrentStation].CurrentID, 1, lHardware) -- eigentliche Auswahl
--WriteToLog('aktiv: '..gTmpStationToPanel[gES_PayloadInfo.CurrentStation].CurrentID)
if gES_PayloadInfo.Stations[gES_PayloadInfo.CurrentStation].container then
if gES_PayloadInfo.Stations[gES_PayloadInfo.CurrentStation].count > 1 then
SendDataHW(gTmpStationToPanel[gES_PayloadInfo.CurrentStation].CurrentID2, 1, lHardware) -- eigentliche Auswahl
--WriteToLog('aktiv2: '..gTmpStationToPanel[gES_PayloadInfo.CurrentStation].CurrentID2)
SendDataHW(gTmpStationToPanel[ExportScript.AF.PayloadInfo.CurrentStation].CurrentID, 1, lHardware) -- eigentliche Auswahl
--WriteToLog('aktiv: '..gTmpStationToPanel[ExportScript.AF.PayloadInfo.CurrentStation].CurrentID)
if ExportScript.AF.PayloadInfo.Stations[ExportScript.AF.PayloadInfo.CurrentStation].container then
if ExportScript.AF.PayloadInfo.Stations[ExportScript.AF.PayloadInfo.CurrentStation].count > 1 then
SendDataHW(gTmpStationToPanel[ExportScript.AF.PayloadInfo.CurrentStation].CurrentID2, 1, lHardware) -- eigentliche Auswahl
--WriteToLog('aktiv2: '..gTmpStationToPanel[ExportScript.AF.PayloadInfo.CurrentStation].CurrentID2)
end
end
table.foreach(gES_PayloadInfo.Stations, WeaponStatusPanel_selectCurrentPayloadStation) -- zugehörige Stationen
elseif gES_PayloadInfo.CurrentStation == 0 and gES_CurrentStationTmp > 0 then
table.foreach(ExportScript.AF.PayloadInfo.Stations, WeaponStatusPanel_selectCurrentPayloadStation) -- zugehörige Stationen
elseif ExportScript.AF.PayloadInfo.CurrentStation == 0 and ExportScript.AF.CurrentStationTmp > 0 then
WeaponStatusPanel_Reset(201, 211, lHardware)
WeaponStatusPanel_Reset(221, 231, lHardware)
gES_CurrentStationTmp = -1
ExportScript.AF.CurrentStationTmp = -1
end
end
-- Helper functions
function WeaponStatusPanel_selectCurrentPayloadStation(_index)
if gES_PayloadInfo.Stations[gES_PayloadInfo.CurrentStation].CLSID == gES_PayloadInfo.Stations[_index].CLSID and gES_PayloadInfo.CurrentStation ~= _index then
if ExportScript.AF.PayloadInfo.Stations[ExportScript.AF.PayloadInfo.CurrentStation].CLSID == ExportScript.AF.PayloadInfo.Stations[_index].CLSID and ExportScript.AF.PayloadInfo.CurrentStation ~= _index then
SendDataHW(gTmpStationToPanel[_index].CurrentID, 1, gTmpStationToPanel[_index].HardwareID)
--WriteToLog('aktiv3: '..gTmpStationToPanel[_index].CurrentID)
if gES_PayloadInfo.Stations[gES_PayloadInfo.CurrentStation].container then
if gES_PayloadInfo.Stations[gES_PayloadInfo.CurrentStation].count > 1 then
if ExportScript.AF.PayloadInfo.Stations[ExportScript.AF.PayloadInfo.CurrentStation].container then
if ExportScript.AF.PayloadInfo.Stations[ExportScript.AF.PayloadInfo.CurrentStation].count > 1 then
SendDataHW(gTmpStationToPanel[_index].CurrentID2, 1, gTmpStationToPanel[_index].HardwareID)
--WriteToLog('aktiv3: '..gTmpStationToPanel[_index].CurrentID2)
end
@ -1271,7 +1271,7 @@ function WeaponStatusPanel_Reset(lMinId, lMaxID, lHardware)
end
function WeaponStatusPanel_selectCurrentPayloadStationGlassCockpit_A10A(_index)
if gES_PayloadInfo.Stations[gES_PayloadInfo.CurrentStation].CLSID == gES_PayloadInfo.Stations[_index].CLSID and gES_PayloadInfo.CurrentStation ~= _index then
gES_TmpWeaponPanelActive[_index] = 0.3
if ExportScript.AF.PayloadInfo.Stations[ExportScript.AF.PayloadInfo.CurrentStation].CLSID == ExportScript.AF.PayloadInfo.Stations[_index].CLSID and ExportScript.AF.PayloadInfo.CurrentStation ~= _index then
ExportScript.AF.TmpWeaponPanelActive[_index] = 0.3
end
end
end

View File

@ -1,404 +1,314 @@
-- Bf-109K-4 Kurfürst
-- Version 0.9.9
gES_FoundDCSModule = true
gES_GlassCockpitConfigEveryFrameArguments =
{
[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] = "%1d", -- 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] = "%1d", -- LeftWing_MG151_Control_Lamp {0.0, 1.0}
[45] = "%1d", -- 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] = "%1d", -- LandingGearRedLight {0.0, 1.0}
[57] = "%1d", -- LandingGearGreenLightLeft {0.0, 1.0}
[58] = "%1d", -- LandingGearGreenLightRight {0.0, 1.0}
-- Fuel_Reserve_Lamp
[135] = "%1d" -- Fuel_Reserve_Lamp {0.0, 29.0} = {0.0, 1.0}
}
gES_GlassCockpitConfigArguments =
{
-- 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 ProcessGlassCockpitDCSHighImportance
function ProcessGlassCockpitDCSConfigHighImportance(mainPanelDevice)
if gES_GlassCockpitType == 1 then
-- HELIOS Version 1.3
elseif gES_GlassCockpitType == 2 then
-- HawgTouch version 1.6
-- LwMW50P
--SendData("1", string.format("%0.4f", mainPanelDevice:get_argument_value(1)))
-- LwASI
--SendData("2", string.format("%0.4f", mainPanelDevice:get_argument_value(2)))
-- ME4KH2OTemp
--SendData("27", string.format("%0.4f", mainPanelDevice:get_argument_value(27)))
-- ME4KOilTemp
--SendData("28", string.format("%0.4f", mainPanelDevice:get_argument_value(28)))
-- LwMAP
--SendData("32", string.format("%0.4f", mainPanelDevice:get_argument_value(32)))
-- ME4KFuel
--SendData("33", string.format("%0.4f", mainPanelDevice:get_argument_value(33)))
-- LwO2P
--SendData("34", string.format("%0.4f", mainPanelDevice:get_argument_value(34)))
-- LwBlink
--SendData("35", string.format("%0.4f", mainPanelDevice:get_argument_value(35)))
-- LwVSI
--SendData("36", string.format("%0.4f", mainPanelDevice:get_argument_value(36)))
-- LwALT
--Altimeter_km, Altimeter_m, Altimeter_Pressure
--[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}
SendData("2000", string.format("%0.3f;%0.3f;%0.3f", mainPanelDevice:get_argument_value(9),
mainPanelDevice:get_argument_value(8),
mainPanelDevice:get_argument_value(10)))
-- LwAtt
--AHorizon_Bank, AHorizon_Pitch, TurnNeedle, Slipball
--[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}
SendData("2001", string.format("%0.3f;%0.3f;%0.3f;%0.3f", mainPanelDevice:get_argument_value(4),
mainPanelDevice:get_argument_value(5),
mainPanelDevice:get_argument_value(3),
mainPanelDevice:get_argument_value(6)))
-- LwHead
--CompassHeading, CommandedCourse
--[13] = "%.4f", -- CompassHeading {0.0, 1.0}
--[12] = "%.4f", -- CommandedCourse {0.0, 1.0}
SendData("2002", string.format("%0.3f;%0.3f", mainPanelDevice:get_argument_value(13),
mainPanelDevice:get_argument_value(12)))
-- LwClock,
-- No Id for Clock
--CLOCK_currtime_hours, CLOCK_currtime_minutes, CLOCK_currtime_seconds, CLOCK_chrono_minutes
--SendData("2003", string.format("%0.2f;%0.2f;%0.2f;%0.2f", mainPanelDevice:get_argument_value(), mainPanelDevice:get_argument_value(), mainPanelDevice:get_argument_value(), mainPanelDevice:get_argument_value()))
-- LwDblP
--Oil_Pressure; Fuel_Pressure;
--[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}
SendData("2004", string.format("%0.3f;%0.3f", mainPanelDevice:get_argument_value(26),
mainPanelDevice:get_argument_value(25)))
-- LwAFN2
--AFN2_Horizontal_Needle, AFN2_Vertical_Needle, AFN2_Signal_Lamp
--[14] = "%.4f", -- AFN2_Horizontal_Needle {0.0, 1.0}
--[15] = "%.4f", -- AFN2_Vertical_Needle {-1.0, 1.0}
--[16] = "%1d", -- AFN2_Signal_Lamp {0.0, 1.0}
SendData("2005", string.format("%0.3f;%0.3f;%0.3f", mainPanelDevice:get_argument_value(14),
mainPanelDevice:get_argument_value(15),
mainPanelDevice:get_argument_value(16)))
-- LwProp
--Propeller_Pitch_Hour; Propeller_Pitch_Minute
--[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}
SendData("2006", string.format("%0.3f;%0.3f", mainPanelDevice:get_argument_value(30),
mainPanelDevice:get_argument_value(31)))
end
end
function ProcessHARDWAREConfigHighImportance(mainPanelDevice)
-- Hier kommen alle Daten rein die ueber die Hardware in schneller folge ausgeben werden soll
-- In der Regel sind das die Statusanzeigen
-- SendDataHW(), 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
--SendDataHW("178", mainPanelDevice:get_argument_value(178)) -- L_AILERON_EMER_DISENGAGE
--SendDataHW("", mainPanelDevice:get_argument_value()) --
SendDataHW("16", mainPanelDevice:get_argument_value(16)) -- AFN2_Signal_Lamp
SendDataHW("35", mainPanelDevice:get_argument_value(35) > 0.8 and 1 or 0) -- Oxygen_Flow_Blinker
SendDataHW("42", mainPanelDevice:get_argument_value(42) > 0.8 and 1 or 0) -- MG131_0_Klappanker
SendDataHW("43", mainPanelDevice:get_argument_value(43) > 0.8 and 1 or 0) -- MG131_1_Klappanker
SendDataHW("44", mainPanelDevice:get_argument_value(44)) -- LeftWing_MG151_Control_Lamp
SendDataHW("45", mainPanelDevice:get_argument_value(45)) -- RightWing_MG151_Control_Lamp
SendDataHW("56", mainPanelDevice:get_argument_value(56)) -- LandingGearRedLight
SendDataHW("57", mainPanelDevice:get_argument_value(57)) -- LandingGearGreenLightLeft
SendDataHW("58", mainPanelDevice:get_argument_value(58)) -- LandingGearGreenLightRight
SendDataHW("135", mainPanelDevice:get_argument_value(135) > 0.8 and 1 or 0) -- Pitot_Heat_Lamp
-- ??? SendDataHW("135", mainPanelDevice:get_argument_value(135)) -- Fuel_Reserve_Lamp
-- Bomb lamps ????
--[[
WriteToLog('AFN2_Signal_Lamp: '..dump(mainPanelDevice:get_argument_value(16)))
WriteToLog('Oxygen_Flow_Blinker: '..dump(mainPanelDevice:get_argument_value(mainPanelDevice:get_argument_value(35))))
WriteToLog('MG131_0_Klappanker: '..dump(mainPanelDevice:get_argument_value(42)))
WriteToLog('MG131_1_Klappanker: '..dump(mainPanelDevice:get_argument_value(43)))
WriteToLog('LeftWing_MG151_Control_Lamp: '..dump(mainPanelDevice:get_argument_value(44)))
WriteToLog('RightWing_MG151_Control_Lamp: '..dump(mainPanelDevice:get_argument_value(46)))
WriteToLog('LandingGearRedLight: '..dump(mainPanelDevice:get_argument_value(56)))
WriteToLog('LandingGearGreenLightLeft: '..dump(mainPanelDevice:get_argument_value(57)))
WriteToLog('LandingGearGreenLightRight: '..dump(mainPanelDevice:get_argument_value(58)))
WriteToLog('Pitot_Heat_Lamp: '..dump(mainPanelDevice:get_argument_value(135)))
]]
end
-----------------------------------------------------
-- LOW IMPORTANCE EXPORTS --
-- done every gExportLowTickInterval export events --
-----------------------------------------------------
-- Pointed to by ProcessGlassCockpitDCSConfigLowImportance
function ProcessGlassCockpitDCSConfigLowImportance(mainPanelDevice)
end
function ProcessHARDWAREConfigLowImportance(mainPanelDevice)
--[[
every frame export to hardware
Example from A-10C
Get Radio Frequencies
get data from device
local UHF_RADIO = GetDevice(54)
SendDataHW("ExportID", "Format")
SendDataHW("ExportID", "Format", HardwareConfigID)
SendDataHW("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000))
SendDataHW("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000), 2) -- export to Hardware '2' Config
]]
local lRADIO = GetDevice(14)
SendDataHW("2000", string.format("%7.3f", lRADIO:get_frequency()/1000000))
--=====================================================================================
--[[
WriteToLog('list_cockpit_params(): '..dump(list_cockpit_params()))
WriteToLog('CMSP: '..dump(list_indication(7)))
local ltmp1 = 0
for ltmp2 = 0, 13, 1 do
ltmp1 = list_indication(ltmp2)
WriteToLog(ltmp2..': '..dump(ltmp1))
--WriteToLog(ltmp2..' (metatable): '..dump(getmetatable(ltmp1)))
end
]]
--[[
local ltmp1 = 0
for ltmp2 = 1, 16, 1 do
ltmp1 = GetDevice(ltmp2)
WriteToLog(ltmp2..': '..dump(ltmp1))
WriteToLog(ltmp2..' (metatable): '..dump(getmetatable(ltmp1)))
end
]]
end
-----------------------------
-- Custom functions --
-----------------------------
function genericRadio(key, value, hardware)
end
-- 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

View File

@ -1,10 +1,20 @@
-- F-86 Export
-- Version 0.9.9 BETA
-- Version 1.0.0 BETA
gES_FoundDCSModule = true
ExportScript.FoundDCSModule = true
gES_GlassCockpitConfigEveryFrameArguments =
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}
@ -74,36 +84,41 @@ gES_GlassCockpitConfigEveryFrameArguments =
[814] = "%.4f", -- ARN6_Scale {1.0, 0.0}
[830] = "%.4f", -- ARN6_FreqScale {0.0, 1.0}
-- light system
[182] = "%.4f", -- IlluminationLights {0.0, 1.0}
[825] = "%.4f", -- StandByCompassLight {0.0, 1.0}
[180] = "%.4f", -- PrimaryInstLights {0.0, 1.0}
[185] = "%.4f", -- AuxiliaryInstrumentLights {0.0, 1.0}
[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] = "%.1f", -- lamp_ELEC_GenOff {-1.0, 1.0}
[610] = "%.1f", -- lamp_ELEC_MainInstInverterOffSelectAlt {-1.0, 1.0}
[611] = "%.1f", -- lamp_ELEC_BothInstInvertersOff {-1.0, 1.0}
[612] = "%.1f", -- lamp_ELEC_MainRadarInverterOff {-1.0, 1.0}
[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] = "%.1f", -- lamp_HYDRO_AltFltContSysOper {-1.0, 1.0}
[39] = "%.1f", -- lamp_HYDRO_LeftGear {-1.0, 1.0}
[41] = "%.1f", -- lamp_HYDRO_RightGear {-1.0, 1.0}
[40] = "%.1f", -- lamp_HYDRO_NoseGear {-1.0, 1.0}
[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] = "%.1f", -- lamp_FUEL_OutbdTanksEmpty {-1.0, 1.0}
[625] = "%.f", -- lamp_FUEL_OutbdTanksEmpty {-1.0, 1.0}
-- fire detection system
[615] = "%.1f", -- lamp_FIRE_DETECTION_FwdFireWarning {-1.0, 1.0}
[616] = "%.1f", -- lamp_FIRE_DETECTION_AftFireWarning {-1.0, 1.0}
[615] = "%.f", -- lamp_FIRE_DETECTION_FwdFireWarning {-1.0, 1.0}
[616] = "%.f", -- lamp_FIRE_DETECTION_AftFireWarning {-1.0, 1.0}
-- control system
[613] = "%.1f", -- lamp_CONTROL_TakeOffPosInd {-1.0, 1.0}
[613] = "%.f", -- lamp_CONTROL_TakeOffPosInd {-1.0, 1.0}
-- air system
[614] = "%.1f" -- lamp_WindshieldAntiIceOverheatWarning {-1.0, 1.0}
[614] = "%.f" -- lamp_WindshieldAntiIceOverheatWarning {-1.0, 1.0}
}
gES_GlassCockpitConfigArguments =
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}
@ -280,109 +295,31 @@ gES_GlassCockpitConfigArguments =
-- done every export event --
-----------------------------
-- Pointed to by ProcessGlassCockpitDCSHighImportance
function ProcessGlassCockpitDCSConfigHighImportance(mainPanelDevice)
if gES_GlassCockpitType == 1 then
-- HELIOS Version 1.3
elseif gES_GlassCockpitType == 2 then
-- HawgTouch version 1.6
-- ACC
-- Accelerometer; AccelerometerMin; AccelerometerMax;
SendData(2001, string.format("%0.4f;%0.4f;%0.4f",
mainPanelDevice:get_argument_value(6),
mainPanelDevice:get_argument_value(1003),
mainPanelDevice:get_argument_value(1002)))
-- ADI
-- AttitudeIndicatorPitch; AttitudeIndicatorBank; AttitudeIndicatorPitchSphere; AttitudeIndicatorBankNeedle; AttitudeIndicatorOffFlag
SendData(2002, string.format("%.4f;%.4f;%.4f;%.4f;%.1f",
mainPanelDevice:get_argument_value(605),
mainPanelDevice:get_argument_value(606),
mainPanelDevice:get_argument_value(81),
mainPanelDevice:get_argument_value(1005),
mainPanelDevice:get_argument_value(713)))
-- Altimeter
-- Altimeter10000; Altimeter1000; Altimeter100; AltimeterHG
SendData(2003, string.format("%0.4f;%0.4f;%0.4f;%0.4f",
mainPanelDevice:get_argument_value(707),
mainPanelDevice:get_argument_value(523),
mainPanelDevice:get_argument_value(524),
mainPanelDevice:get_argument_value(700)))
-- Airspeed
-- Airspeed; AirspeedDrum; AirspeedM1
SendData(2004, string.format("%0.4f;%0.4f;%0.4f",
mainPanelDevice:get_argument_value(178),
mainPanelDevice:get_argument_value(709),
mainPanelDevice:get_argument_value(8)))
-- RMI
-- ARN6_Bearing; ARN6_Scale
SendData(2008, string.format("%0.4f;%0.4f",
mainPanelDevice:get_argument_value(600),
mainPanelDevice:get_argument_value(814)))
-- Clock
-- CLOCK_currtime_hours; CLOCK_currtime_minutes; CLOCK_currtime_seconds; CLOCK_seconds_meter_time_minutes; CLOCK_seconds_meter_time_seconds
-- CLOCK_currtime_hours; CLOCK_currtime_minutes; <= Beta
SendData(2005, string.format("%0.4f;%0.4f",
mainPanelDevice:get_argument_value(19),
mainPanelDevice:get_argument_value(18)))
-- GyroCompass
-- GyroCompassNeedle; GyroCompassScale
SendData(2006, string.format("%0.4f;%0.4f",
mainPanelDevice:get_argument_value(711),
mainPanelDevice:get_argument_value(712)))
-- Labs
-- LABS_roll_needle; LABS_pitch_needle
SendData(2007, string.format("%0.4f;%0.4f",
mainPanelDevice:get_argument_value(603),
mainPanelDevice:get_argument_value(604)))
-- RMI
-- ARN6_Bearing; ARN6_Scale
SendData(2008, string.format("%0.4f;%0.4f",
mainPanelDevice:get_argument_value(600),
mainPanelDevice:get_argument_value(814)))
-- Gear
-- Left; Right; Front
SendData(2010, string.format("%0.4f;%0.4f;%0.4f",
mainPanelDevice:get_argument_value(39),
mainPanelDevice:get_argument_value(41),
mainPanelDevice:get_argument_value(40)))
end
-- 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 ProcessHARDWAREConfigHighImportance(mainPanelDevice)
-- Hier kommen alle Daten rein die ueber die Hardware in schneller folge ausgeben werden soll
-- In der Regel sind das die Statusanzeigen
-- SendDataHW(), 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 <20>bergeben DCS ID aus dem Spiel ausliest
-- 178 ist die DCS ID von dem man die Werte haben will
-- Description
-- light system
SendDataHW("182", mainPanelDevice:get_argument_value(182)) -- IlluminationLights {0.0, 1.0}
SendDataHW("825", mainPanelDevice:get_argument_value(825)) -- StandByCompassLight {0.0, 1.0}
SendDataHW("180", mainPanelDevice:get_argument_value(180)) -- PrimaryInstLights {0.0, 1.0}
SendDataHW("185", mainPanelDevice:get_argument_value(185)) -- AuxiliaryInstrumentLights {0.0, 1.0}
-- LAMPS
-- electric system
SendDataHW("617", mainPanelDevice:get_argument_value(617)) -- lamp_ELEC_GenOff {-1.0, 1.0}
SendDataHW("610", mainPanelDevice:get_argument_value(610)) -- lamp_ELEC_MainInstInverterOffSelectAlt {-1.0, 1.0}
SendDataHW("611", mainPanelDevice:get_argument_value(611)) -- lamp_ELEC_BothInstInvertersOff {-1.0, 1.0}
SendDataHW("612", mainPanelDevice:get_argument_value(612)) -- lamp_ELEC_MainRadarInverterOff {-1.0, 1.0}
-- hydraulic system
SendDataHW("614", mainPanelDevice:get_argument_value(614)) -- lamp_HYDRO_AltFltContSysOper {-1.0, 1.0}
SendDataHW("39", mainPanelDevice:get_argument_value(39)) -- lamp_HYDRO_LeftGear {-1.0, 1.0}
SendDataHW("41", mainPanelDevice:get_argument_value(41)) -- lamp_HYDRO_RightGear {-1.0, 1.0}
SendDataHW("40", mainPanelDevice:get_argument_value(40)) -- lamp_HYDRO_NoseGear {-1.0, 1.0}
-- fuel system
SendDataHW("625", mainPanelDevice:get_argument_value(625)) -- lamp_FUEL_OutbdTanksEmpty {-1.0, 1.0}
-- fire detection system
SendDataHW("615", mainPanelDevice:get_argument_value(615)) -- lamp_FIRE_DETECTION_FwdFireWarning {-1.0, 1.0}
SendDataHW("616", mainPanelDevice:get_argument_value(616)) -- lamp_FIRE_DETECTION_AftFireWarning {-1.0, 1.0}
-- control system
SendDataHW("613", mainPanelDevice:get_argument_value(613)) -- lamp_CONTROL_TakeOffPosInd {-1.0, 1.0}
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
-----------------------------------------------------
@ -390,46 +327,50 @@ end
-- done every gExportLowTickInterval export events --
-----------------------------------------------------
-- Pointed to by ProcessGlassCockpitDCSConfigLowImportance
function ProcessGlassCockpitDCSConfigLowImportance(mainPanelDevice)
if gES_GlassCockpitType == 1 then
-- HELIOS Version 1.3
elseif gES_GlassCockpitType == 2 then
-- HawgTouch version 1.6
end
-- 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 ProcessHARDWAREConfigLowImportance(mainPanelDevice)
function ExportScript.ProcessDACConfigLowImportance(mainPanelDevice)
--[[
every frame export to hardware
export in low tick interval to DAC
Example from A-10C
Get Radio Frequencies
get data from device
local UHF_RADIO = GetDevice(54)
SendDataHW("ExportID", "Format")
SendDataHW("ExportID", "Format", HardwareConfigID)
SendDataHW("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000))
SendDataHW("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000), 2) -- export to Hardware '2' Config
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
]]
--=====================================================================================
--[[
WriteToLog('list_cockpit_params(): '..dump(list_cockpit_params()))
WriteToLog('CMSP: '..dump(list_indication(7)))
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)
WriteToLog(ltmp2..': '..dump(ltmp1))
--WriteToLog(ltmp2..' (metatable): '..dump(getmetatable(ltmp1)))
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)
WriteToLog(ltmp2..': '..dump(ltmp1))
WriteToLog(ltmp2..' (metatable): '..dump(getmetatable(ltmp1)))
ExportScript.Tools.WriteToLog(ltmp2..': '..ExportScript.Tools.dump(ltmp1))
ExportScript.Tools.WriteToLog(ltmp2..' (metatable): '..ExportScript.Tools.dump(getmetatable(ltmp1)))
end
]]
end
@ -438,6 +379,6 @@ end
-- Custom functions --
-----------------------------
function genericRadio(key, value, hardware)
function ExportScript.genericRadio(key, value, hardware)
end

View File

@ -1,10 +1,20 @@
-- FW-190D9 Dora
-- Version 0.9.9
-- Version 1.0.0
gES_FoundDCSModule = true
ExportScript.FoundDCSModule = true
gES_GlassCockpitConfigEveryFrameArguments =
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}
@ -24,7 +34,7 @@ gES_GlassCockpitConfigEveryFrameArguments =
[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}
--[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}
@ -53,30 +63,34 @@ gES_GlassCockpitConfigEveryFrameArguments =
[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}
--[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] = "%1d", -- BombLamp_1 {0.0, 1.0}
[197] = "%1d", -- BombLamp_2 {0.0, 1.0}
[198] = "%1d", -- BombLamp_3 {0.0, 1.0}
[199] = "%1d", -- BombLamp_4 {0.0, 1.0}
[137] = "%1d", -- RocketEmCvr {0.0, 1.0}
[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] = "%1d", -- L_GEAR_UP {0.0, 1.0}
[69] = "%1d", -- L_GEAR_DOWN {0.0, 1.0}
[70] = "%1d", -- R_GEAR_UP {0.0, 1.0}
[71] = "%1d", -- R_GEAR_DOWN {0.0, 1.0}
[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] = "%1d", -- FLAPS_UP {0.0, 1.0}
[73] = "%1d", -- FLAPS_START {0.0, 1.0}
[72] = "%.f", -- FLAPS_UP {0.0, 1.0}
[73] = "%.f", -- FLAPS_START {0.0, 1.0}
[74] = "%1d" -- FLAPS_DOWN {0.0, 1.0}
}
gES_GlassCockpitConfigArguments =
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
@ -184,88 +198,46 @@ gES_GlassCockpitConfigArguments =
-- done every export event --
-----------------------------
-- Pointed to by ProcessGlassCockpitDCSHighImportance
function ProcessGlassCockpitDCSConfigHighImportance(mainPanelDevice)
if gES_GlassCockpitType == 1 then
-- HELIOS Version 1.3
elseif gES_GlassCockpitType == 2 then
-- HawgTouch Version 1.6
-- Altimeter_km, Altimeter_m, Altimeter_Pressure
SendData("2000", string.format("%0.3f;%0.3f;%0.3f",
mainPanelDevice:get_argument_value(35),
mainPanelDevice:get_argument_value(32),
mainPanelDevice:get_argument_value(33)))
-- LwAtt - AHorizon_Bank, AHorizon_Pitch, TurnNeedle, Slipball
SendData("2001", string.format("%0.3f;%0.3f;%0.3f;%0.3f",
mainPanelDevice:get_argument_value(38),
mainPanelDevice:get_argument_value(37),
mainPanelDevice:get_argument_value(40),
mainPanelDevice:get_argument_value(41)))
-- LwHead - CompassHeading, CommandedCourse liefert nur 0.000
SendData("2002", string.format("%0.3f;%0.3f",
mainPanelDevice:get_argument_value(45),
mainPanelDevice:get_argument_value(44)))
-- LwClock - CLOCK_currtime_hours, CLOCK_currtime_minutes, CLOCK_currtime_seconds, CLOCK_chrono_minutes
SendData("2003", string.format("%0.3f;%0.3f;%0.3f;%0.3f",
mainPanelDevice:get_argument_value(21),
mainPanelDevice:get_argument_value(22),
mainPanelDevice:get_argument_value(23),
mainPanelDevice:get_argument_value(27)))
-- LwDblP - Oil_Pressure; Fuel_Pressure;
SendData("2004", string.format("%0.3f;%0.3f",
mainPanelDevice:get_argument_value(95),
mainPanelDevice:get_argument_value(94)))
-- now not ID
-- LwAFN2 - AFN2_Horizontal_Needle, AFN2_Vertical_Needle, AFN2_Signal_Lamp
--SendData("2005", string.format("%0.3f;%0.3f;%0.3f",
-- mainPanelDevice:get_argument_value(),
-- mainPanelDevice:get_argument_value(),
-- mainPanelDevice:get_argument_value()))
-- Gear - L_GEAR_UP, L_GEAR_DOWN, R_GEAR_UP, R_GEAR_DOWN, FLAPS_UP, FLAPS_START, FLAPS_DOWN
SendData("2007", string.format("%0.3f;%0.3f;%0.3f;%0.3f;%0.3f;%0.3f;%0.3f",
mainPanelDevice:get_argument_value(68),
mainPanelDevice:get_argument_value(69),
mainPanelDevice:get_argument_value(70),
mainPanelDevice:get_argument_value(71),
mainPanelDevice:get_argument_value(72),
mainPanelDevice:get_argument_value(73),
mainPanelDevice:get_argument_value(74)))
-- Ammo counter 1
SendData("2008", string.format("%0.3f;%0.3f",
mainPanelDevice:get_argument_value(52),
mainPanelDevice:get_argument_value(50)))
-- Ammo counter 2
SendData("2009", string.format("%0.3f;%0.3f",
mainPanelDevice:get_argument_value(55),
mainPanelDevice:get_argument_value(164)))
-- Ammo counter 3
SendData("2010", string.format("%0.3f;%0.3f",
mainPanelDevice:get_argument_value(58),
mainPanelDevice:get_argument_value(165)))
-- Ammo counter 4
SendData("2011", string.format("%0.3f;%0.3f",
mainPanelDevice:get_argument_value(61),
mainPanelDevice:get_argument_value(166)))
end
-- 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 ProcessHARDWAREConfigHighImportance(mainPanelDevice)
-- Hier kommen alle Daten rein die ueber die Hardware in schneller folge ausgeben werden soll
-- In der Regel sind das die Statusanzeigen
-- SendDataHW(), 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 <20>bergeben DCS ID aus dem Spiel ausliest
-- 178 ist die DCS ID von dem man die Werte haben will
-- Description
-- SendDataHW("178", mainPanelDevice:get_argument_value(178)) -- L_AILERON_EMER_DISENGAGE
-- SendDataHW("", mainPanelDevice:get_argument_value()) --
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
-----------------------------------------------------
@ -273,41 +245,50 @@ end
-- done every gExportLowTickInterval export events --
-----------------------------------------------------
-- Pointed to by ProcessGlassCockpitDCSConfigLowImportance
function ProcessGlassCockpitDCSConfigLowImportance(mainPanelDevice)
-- 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 ProcessHARDWAREConfigLowImportance(mainPanelDevice)
function ExportScript.ProcessDACConfigLowImportance(mainPanelDevice)
--[[
every frame export to hardware
export in low tick interval to DAC
Example from A-10C
Get Radio Frequencies
get data from device
local UHF_RADIO = GetDevice(54)
SendDataHW("ExportID", "Format")
SendDataHW("ExportID", "Format", HardwareConfigID)
SendDataHW("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000))
SendDataHW("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000), 2) -- export to Hardware '2' Config
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
]]
--=====================================================================================
--[[
WriteToLog('list_cockpit_params(): '..dump(list_cockpit_params()))
WriteToLog('CMSP: '..dump(list_indication(7)))
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)
WriteToLog(ltmp2..': '..dump(ltmp1))
--WriteToLog(ltmp2..' (metatable): '..dump(getmetatable(ltmp1)))
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)
WriteToLog(ltmp2..': '..dump(ltmp1))
WriteToLog(ltmp2..' (metatable): '..dump(getmetatable(ltmp1)))
ExportScript.Tools.WriteToLog(ltmp2..': '..ExportScript.Tools.dump(ltmp1))
ExportScript.Tools.WriteToLog(ltmp2..' (metatable): '..ExportScript.Tools.dump(getmetatable(ltmp1)))
end
]]
end
@ -316,5 +297,5 @@ end
-- Custom functions --
-----------------------------
function genericRadio(key, value, hardware)
end
function ExportScript.genericRadio(key, value, hardware)
end

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +1,20 @@
-- MiG-15Bis
-- Version 0.9.9 BETA
-- Version 1.0.0 BETA
gES_FoundDCSModule = true
ExportScript.FoundDCSModule = true
gES_GlassCockpitConfigEveryFrameArguments =
ExportScript.ConfigEveryFrameArguments =
{
-- arguments for export every frame
-- based of "mainpanel_init.lua"
--[[
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
@ -84,34 +92,34 @@ gES_GlassCockpitConfigEveryFrameArguments =
[245] = "%.4f", -- ASP_3N_Range
-- Lamps
-- electric system
[57] = "%.4f", -- lamp_GeneratorOff {-1.0, 1.0}{-1.0, 1.0}
[58] = "%.4f", -- lamp_Ignition {-1.0, 1.0}{-1.0, 1.0}
[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] = "%.4f", -- lamp_IsolatingValve {-1.0, 1.0}{-1.0, 1.0}
[119] = "%.f", -- lamp_IsolatingValve {-1.0, 1.0}{-1.0, 1.0}
-- gear system
[75] = "%.4f", -- lamp_LeftGearExt {-1.0, 1.0}{-1.0, 1.0}
[74] = "%.4f", -- lamp_LeftGearRet {-1.0, 1.0}{-1.0, 1.0}
[79] = "%.4f", -- lamp_RightGearExt {-1.0, 1.0}{-1.0, 1.0}
[78] = "%.4f", -- lamp_RightGearRet {-1.0, 1.0}{-1.0, 1.0}
[77] = "%.4f", -- lamp_NoseGearExt {-1.0, 1.0}{-1.0, 1.0}
[76] = "%.4f", -- lamp_NoseGearRet {-1.0, 1.0}{-1.0, 1.0}
[53] = "%.4f", -- lamp_ExtendGears {-1.0, 1.0}{-1.0, 1.0}
[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] = "%.4f", -- lamp_Remain300 {-1.0, 1.0}{-1.0, 1.0}
[50] = "%.4f", -- lamp_AftEmpty {-1.0, 1.0}{-1.0, 1.0}
[52] = "%.4f", -- lamp_DropTanks {-1.0, 1.0}{-1.0, 1.0}
[51] = "%.4f", -- lamp_BoostPressure {-1.0, 1.0}{-1.0, 1.0}
[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] = "%.4f", -- lamp_TrimmerNeutral {-1.0, 1.0}{-1.0, 1.0}
[59] = "%.4f", -- lamp_FlapsExt {-1.0, 1.0}{-1.0, 1.0}
[124] = "%.4f", -- lamp_AirBrakeExt {-1.0, 1.0}{-1.0, 1.0}
[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] = "%.4f", -- lamp_FireDetected {-1.0, 1.0}{-1.0, 1.0}
[135] = "%.f", -- lamp_FireDetected {-1.0, 1.0}{-1.0, 1.0}
-- ARC-5
[183] = "%.4f", -- lamp_ARC_5 {-1.0, 1.0}{-1.0, 1.0}
[218] = "%.4f", -- light_ARC_5_scale {-1.0, 1.0}{-1.0, 1.0}
[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] = "%.4f", -- lamp_Marker {-1.0, 1.0}{-1.0, 1.0}
[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}
@ -119,9 +127,9 @@ gES_GlassCockpitConfigEveryFrameArguments =
[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] = "%.4f" -- lamp_GunCamera {-1.0, 1.0}{-1.0, 1.0}
[55] = "%.f" -- lamp_GunCamera {-1.0, 1.0}{-1.0, 1.0}
}
gES_GlassCockpitConfigArguments =
ExportScript.ConfigArguments =
{
--[[
arguments for export in low tick interval
@ -271,132 +279,31 @@ gES_GlassCockpitConfigArguments =
-- done every export event --
-----------------------------
-- Pointed to by ProcessGlassCockpitDCSHighImportance
function ProcessGlassCockpitDCSConfigHighImportance(mainPanelDevice)
if gES_GlassCockpitType == 1 then
-- HELIOS Version 1.3
elseif gES_GlassCockpitType == 2 then
-- HawgTouch version 1.6
-- ADI
-- AGK_47B_roll;AGK_47B_pitch;AGK_47B_failure_flag;AGK_47B_sideslip;
-- AGK_47B_turn;AGK_47B_horizon
SendData(2001, string.format("%.4f;%.4f;%.4f;%.4f;%.4f;%.1f",
mainPanelDevice:get_argument_value(6),
mainPanelDevice:get_argument_value(7),
mainPanelDevice:get_argument_value(11),
mainPanelDevice:get_argument_value(8),
mainPanelDevice:get_argument_value(9),
mainPanelDevice:get_argument_value(10)))
-- Altimeter
-- Altimeter_km;Altimeter_m;Altimeter_Pressure
SendData(2002, string.format("%0.4f;%0.4f;%0.4f",
mainPanelDevice:get_argument_value(28),
mainPanelDevice:get_argument_value(29),
mainPanelDevice:get_argument_value(31)))
-- Airspeed
-- IAS;TAS
SendData(2003, string.format("%0.4f;%0.4f",
mainPanelDevice:get_argument_value(4),
mainPanelDevice:get_argument_value(5)))
-- Brake
-- LeftBrakePressure;RightBrakePressure
SendData(2004, string.format("%0.4f;%0.4f",
mainPanelDevice:get_argument_value(121),
mainPanelDevice:get_argument_value(122)))
-- Cockpit
-- CockpitAltitude;PressureDifference;
SendData(2005, string.format("%0.4f;%0.4f",
mainPanelDevice:get_argument_value(39),
mainPanelDevice:get_argument_value(40)))
-- FuelFlow
-- OilTemperature;OilPressure;EngineFuelPressure;
SendData(2006, string.format("%0.4f;%0.4f;%0.4f",
mainPanelDevice:get_argument_value(45),
mainPanelDevice:get_argument_value(44),
mainPanelDevice:get_argument_value(43)))
-- Gear
-- lamp_LeftGearExt;lamp_LeftGearRet;lamp_RightGearExt;lamp_RightGearRet;lamp_NoseGearExt;
-- lamp_NoseGearRet;lamp_ExtendGears
SendData(2007, string.format("%.4f;%.4f;%.4f;%.4f;%.4f;%.4f;%.3f",
mainPanelDevice:get_argument_value(75),
mainPanelDevice:get_argument_value(74),
mainPanelDevice:get_argument_value(79),
mainPanelDevice:get_argument_value(78),
mainPanelDevice:get_argument_value(77),
mainPanelDevice:get_argument_value(76),
mainPanelDevice:get_argument_value(53)))
-- GyroCompass
-- HeadingScale;Heading
SendData(2008, string.format("%0.4f;%0.4f",
mainPanelDevice:get_argument_value(32),
mainPanelDevice:get_argument_value(33)))
-- VoltAmpMeter
-- VoltAmperMeter; lamps_lightness;
SendData(2009, string.format("%0.4f;%0.4f",
mainPanelDevice:get_argument_value(83),
mainPanelDevice:get_argument_value(244)))
-- Clock
-- CLOCK_currtime_hours;CLOCK_currtime_minutes;CLOCK_flight_time_meter_status;
-- CLOCK_flight_hours; CLOCK_flight_minutes;CLOCK_seconds_meter_time_minutes;
-- CLOCK_seconds_meter_time_seconds
SendData(2010, string.format("%.4f;%.4f;%.4f;%.4f;%.4f;%.4f;%.3f",
mainPanelDevice:get_argument_value(15),
mainPanelDevice:get_argument_value(16),
mainPanelDevice:get_argument_value(22),
mainPanelDevice:get_argument_value(18),
mainPanelDevice:get_argument_value(19),
mainPanelDevice:get_argument_value(20),
mainPanelDevice:get_argument_value(17)))
-- Compass
-- heading, pitch, bank
SendData(2011, string.format("%0.4f;%0.4f;%0.4f",
mainPanelDevice:get_argument_value(33),
mainPanelDevice:get_argument_value(7),
mainPanelDevice:get_argument_value(6)))
end
-- 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 ProcessHARDWAREConfigHighImportance(mainPanelDevice)
-- SendDataHW("", mainPanelDevice:get_argument_value()) --
-- Lamps
-- electric system
SendDataHW("57", mainPanelDevice:get_argument_value(57)) -- lamp_GeneratorOff
SendDataHW("58", mainPanelDevice:get_argument_value(58)) -- lamp_Ignition
-- power plant
SendDataHW("119", mainPanelDevice:get_argument_value(119)) -- lamp_IsolatingValve
-- gear system
SendDataHW("75", mainPanelDevice:get_argument_value(75)) -- lamp_LeftGearExt
SendDataHW("74", mainPanelDevice:get_argument_value(74)) -- lamp_LeftGearRet
SendDataHW("79", mainPanelDevice:get_argument_value(79)) -- lamp_RightGearExt
SendDataHW("78", mainPanelDevice:get_argument_value(78)) -- lamp_RightGearRet
SendDataHW("77", mainPanelDevice:get_argument_value(77)) -- lamp_NoseGearExt
SendDataHW("76", mainPanelDevice:get_argument_value(76)) -- lamp_NoseGearRet
SendDataHW("53", mainPanelDevice:get_argument_value(53)) -- lamp_ExtendGears
-- fuel system
SendDataHW("56", mainPanelDevice:get_argument_value(56)) -- lamp_Remain300
SendDataHW("50", mainPanelDevice:get_argument_value(50)) -- lamp_AftEmpty
SendDataHW("52", mainPanelDevice:get_argument_value(52)) -- lamp_DropTanks
SendDataHW("51", mainPanelDevice:get_argument_value(51)) -- lamp_BoostPressure
-- control system
SendDataHW("113", mainPanelDevice:get_argument_value(113)) -- lamp_TrimmerNeutral
SendDataHW("59", mainPanelDevice:get_argument_value(59)) -- lamp_FlapsExt
SendDataHW("124", mainPanelDevice:get_argument_value(124)) -- lamp_AirBrakeExt
-- fire extinguisher system
SendDataHW("135", mainPanelDevice:get_argument_value(135)) -- lamp_FireDetected
-- ARC-5
SendDataHW("183", mainPanelDevice:get_argument_value(183)) -- lamp_ARC_5
SendDataHW("218", mainPanelDevice:get_argument_value(218)) -- light_ARC_5_scale
-- MRP-48P
SendDataHW("54", mainPanelDevice:get_argument_value(54)) -- lamp_Marker
-- Light System
SendDataHW("226", mainPanelDevice:get_argument_value(226)) -- light_LeftUV
SendDataHW("215", mainPanelDevice:get_argument_value(215)) -- light_CenterUV
SendDataHW("227", mainPanelDevice:get_argument_value(227)) -- light_RightUV
SendDataHW("217", mainPanelDevice:get_argument_value(217)) -- light_Panels
SendDataHW("216", mainPanelDevice:get_argument_value(216)) -- light_AuxLeftPanel
-- Gun Camera
SendDataHW("55", mainPanelDevice:get_argument_value(55)) -- lamp_GunCamera
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
-----------------------------------------------------
@ -404,46 +311,51 @@ end
-- done every gExportLowTickInterval export events --
-----------------------------------------------------
-- Pointed to by ProcessGlassCockpitDCSConfigLowImportance
function ProcessGlassCockpitDCSConfigLowImportance(mainPanelDevice)
if gES_GlassCockpitType == 1 then
-- HELIOS Version 1.3
elseif gES_GlassCockpitType == 2 then
-- HawgTouch version 1.6
end
-- 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 ProcessHARDWAREConfigLowImportance(mainPanelDevice)
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)
SendDataHW("ExportID", "Format")
SendDataHW("ExportID", "Format", HardwareConfigID)
SendDataHW("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000))
SendDataHW("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000), 2) -- export to Hardware '2' Config
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
]]
--=====================================================================================
--[[
WriteToLog('list_cockpit_params(): '..dump(list_cockpit_params()))
WriteToLog('CMSP: '..dump(list_indication(7)))
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)
WriteToLog(ltmp2..': '..dump(ltmp1))
--WriteToLog(ltmp2..' (metatable): '..dump(getmetatable(ltmp1)))
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)
WriteToLog(ltmp2..': '..dump(ltmp1))
WriteToLog(ltmp2..' (metatable): '..dump(getmetatable(ltmp1)))
ExportScript.Tools.WriteToLog(ltmp2..': '..ExportScript.Tools.dump(ltmp1))
ExportScript.Tools.WriteToLog(ltmp2..' (metatable): '..ExportScript.Tools.dump(getmetatable(ltmp1)))
end
]]
end
@ -452,5 +364,5 @@ end
-- Custom functions --
-----------------------------
function genericRadio(key, value, hardware)
function ExportScript.genericRadio(key, value, hardware)
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

@ -1,19 +1,19 @@
-- Su-25T Export
-- Version 0.9.9 BETA
-- Version 1.0.0 BETA
gES_FoundFCModule = true
ExportScript.FoundFCModule = true
-- auxiliary function
dofile(gES_ExportModulePath.."FC_AuxiliaryFuntions.lua")
dofile(ExportScript.Config.ExportModulePath.."FC_AuxiliaryFuntions.lua")
-----------------------------------------
-- FLAMING CLIFFS AIRCRAFT / Su-25T --
-- FC aircraft don't support GetDevice --
-----------------------------------------
function ProcessGlassCockpitFCHighImportanceConfig()
local myData = LoGetSelfData()
function ExportScript.ProcessIkarusFCHighImportanceConfig()
local lFunctionTyp = "Ikarus" -- function type for shared function
local myData = nil -- = LoGetSelfData()
if (myData) then
local lLatitude = myData.LatLongAlt.Lat -- LATITUDE
@ -140,15 +140,20 @@ function ProcessGlassCockpitFCHighImportanceConfig()
FC_Russian_Clock_late(12)
end
else
WriteToLog("Unknown FC Error, no LoGetSelfData.")
--WriteToLog("Unknown FC Error, no LoGetSelfData.")
end
end
function ProcessHARDWAREConfigHighImportance()
function ExportScript.ProcessDACConfigHighImportance()
local lFunctionTyp = "DAC" -- function type for shared function
end
function ProcessGlassCockpitFCLowImportanceConfig()
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
@ -299,14 +304,14 @@ function ProcessGlassCockpitFCLowImportanceConfig()
--WriteToLog('lNameByType: '..dump(lNameByType))
end
function ProcessHARDWAREConfigLowImportance()
-- where necessary, specify HardwareID, example WeaponStatusPanel(2)
WeaponStatusPanel()
MechanicalDevicesIndicator()
StatusLamp()
FuelQuantityIndicator()
SightingSystem()
SPO15RWR()
function ExportScript.ProcessDACConfigLowImportance()
local lFunctionTyp = "DAC" -- function type for shared function
-- WeaponStatusPanel()
-- MechanicalDevicesIndicator()
-- StatusLamp()
-- FuelQuantityIndicator()
-- SightingSystem()
-- SPO15RWR()
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

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]])