From 743acae7da8827d6198006855d9b038408c5ee8f Mon Sep 17 00:00:00 2001 From: mcmicha Date: Sat, 30 Jan 2016 18:58:07 +0100 Subject: [PATCH] add SU-25T export --- .../ExportsModules/FC_AuxiliaryFuntions.lua | 473 +++-- .../ExportsModules/Su-25T.lua | 1767 ++++++++--------- 2 files changed, 1208 insertions(+), 1032 deletions(-) diff --git a/Scripts/DCS-ExportScript/ExportsModules/FC_AuxiliaryFuntions.lua b/Scripts/DCS-ExportScript/ExportsModules/FC_AuxiliaryFuntions.lua index b5d0bd4..80cb36e 100644 --- a/Scripts/DCS-ExportScript/ExportsModules/FC_AuxiliaryFuntions.lua +++ b/Scripts/DCS-ExportScript/ExportsModules/FC_AuxiliaryFuntions.lua @@ -1,5 +1,5 @@ -- Flaming Cliffs Auxiliary Functons --- Version 0.9.9 +-- Version 1.0.0 -- Weapon Panel for Su-25A and Su-25T function ExportScript.AF.WeaponPanel_SU25(FunctionTyp) @@ -17,9 +17,7 @@ function ExportScript.AF.WeaponPanel_SU25(FunctionTyp) ExportScript.AF.TmpWeaponPanel = {[231] = 0, [232] = 0, [233] = 0, [234] = 0, [235] = 0} end - if(ExportScript.AF.EventNumberOLD < ExportScript.AF.EventNumber) then - ExportScript.AF.EventNumberOLD = ExportScript.AF.EventNumber - +-- if(ExportScript.AF.EventNumberOLD < ExportScript.AF.EventNumber) then -- defination ExportScript.AF.PayloadInfo = LoGetPayloadInfo() if ExportScript.AF.PayloadInfo ~= nil then @@ -29,7 +27,7 @@ function ExportScript.AF.WeaponPanel_SU25(FunctionTyp) if ExportScript.AF.CannonContainer == nil then -- Find Cannon-Containers, aka SPPU_22 ExportScript.AF.CannonContainer = {} ExportScript.AF.CannonContainer.counter = 0 - table.foreach(ExportScript.AF.PayloadInfo.Stations, WeaponStatusPanel_FindCannonContainer) + table.foreach(ExportScript.AF.PayloadInfo.Stations, ExportScript.AF.WeaponStatusPanel_FindCannonContainer) end if ExportScript.AF.PayloadInfo.CurrentStation > 0 and @@ -56,7 +54,7 @@ function ExportScript.AF.WeaponPanel_SU25(FunctionTyp) if ExportScript.AF.TmpStationToPanel[ExportScript.AF.PayloadInfo.CurrentStation] ~= nil then ExportScript.AF.TmpWeaponPanelActive[ExportScript.AF.TmpStationToPanel[ExportScript.AF.PayloadInfo.CurrentStation].CurrentID] = 1 -- currrent value - table.foreach(ExportScript.AF.PayloadInfo.Stations, WeaponStatusPanel_selectCurrentPayloadStationGlassCockpit) -- corresponding station + table.foreach(ExportScript.AF.PayloadInfo.Stations, ExportScript.AF.WeaponStatusPanel_selectCurrentPayloadStationGlassCockpit) -- corresponding station end end @@ -159,6 +157,8 @@ function ExportScript.AF.WeaponPanel_SU25(FunctionTyp) -- InnerCannon {transversely striped = 0.0, 1/4 = 01, 1/2 = 03, 3/4 = 0.6, Full = 1.0} -- ReserveWeapon {transversely striped = 0.0, Gun = 1.0} + ExportScript.AF.TmpWeaponPanel = {} + ExportScript.AF.TmpWeaponPanel[231] = lMainGun -- main cannon shells ExportScript.AF.TmpWeaponPanelPresend[101] = (ExportScript.AF.PayloadInfo.Stations[1].count > 0 and 1 or 0) -- weapon presend panel 1 ExportScript.AF.TmpWeaponPanelPresend[102] = (ExportScript.AF.PayloadInfo.Stations[3].count > 0 and 1 or 0) -- weapon presend panel 2 ExportScript.AF.TmpWeaponPanelPresend[103] = (ExportScript.AF.PayloadInfo.Stations[5].count > 0 and 1 or 0) -- weapon presend panel 3 @@ -179,17 +179,14 @@ function ExportScript.AF.WeaponPanel_SU25(FunctionTyp) --ExportScript.AF.TmpWeaponPanelActive[208] -- weapon active panel 8 --ExportScript.AF.TmpWeaponPanelActive[209] -- weapon active panel 9 --ExportScript.AF.TmpWeaponPanelActive[210] -- weapon active panel 10 - ExportScript.AF.TmpWeaponPanel = {} - ExportScript.AF.TmpWeaponPanel[231] = lMainGun -- main cannon shells ExportScript.AF.TmpWeaponPanel[232] = lWeaponType -- current weapon type ExportScript.AF.TmpWeaponPanel[233] = lOuterCannon -- outer cannon shells ExportScript.AF.TmpWeaponPanel[234] = lInnerCannon -- inner cannon shells ExportScript.AF.TmpWeaponPanel[235] = lReserve -- reserve weapon end - end + --end if ExportScript.Config.IkarusExport and lFunctionTyp == "Ikarus" then -ExportScript.Tools.WriteToLog("WeaponPanel_SU25: "..ExportScript.Tools.dump(ExportScript.AF.TmpWeaponPanelPresend)) for key, value in pairs(ExportScript.AF.TmpWeaponPanelPresend) do ExportScript.Tools.SendData(key, value) end @@ -203,10 +200,10 @@ ExportScript.Tools.WriteToLog("WeaponPanel_SU25: "..ExportScript.Tools.dump(Expo if ExportScript.Config.DACExport and lFunctionTyp == "DAC" then for key, value in pairs(ExportScript.AF.TmpWeaponPanelPresend) do - ExportScript.Tools.SendData(key, value) + ExportScript.Tools.SendDataDAC(key, value) end for key, value in pairs(ExportScript.AF.TmpWeaponPanelActive) do - ExportScript.Tools.SendData(key, value) + ExportScript.Tools.SendDataDAC(key, value) end end end @@ -250,7 +247,7 @@ function ExportScript.AF.FC_WeaponPanel_SU2733(exportid) if ExportScript.AF.TmpStationToPanel[ExportScript.AF.PayloadInfo.CurrentStation] ~= nil then ExportScript.AF.TmpWeaponPanelActive[ExportScript.AF.TmpStationToPanel[ExportScript.AF.PayloadInfo.CurrentStation].CurrentID] = 1 -- currrent value - table.foreach(ExportScript.AF.PayloadInfo.Stations, WeaponStatusPanel_selectCurrentPayloadStationGlassCockpit) -- corresponding station + table.foreach(ExportScript.AF.PayloadInfo.Stations, ExportScript.AF.WeaponStatusPanel_selectCurrentPayloadStationGlassCockpit) -- corresponding station end end @@ -505,9 +502,8 @@ function ExportScript.AF.FC_RadarWarning_SPO15(exportid) end -- HSI for SU25T, SU-27, SU-33, MIG-29 -function ExportScript.AF.FC_Russian_HSI(distancetoway, exportid) +function ExportScript.AF.FC_Russian_HSI(distancetoway) local lDistanceToWay = distancetoway or 999 - local lExportID = exportid or 5 local lDefaultOne = 1.0 local lDefaultNull = 0.0 @@ -585,7 +581,7 @@ function ExportScript.AF.FC_Russian_HSI(distancetoway, exportid) -- HSI_lateral_deviation{-1.0, 1.0} -- HSI_range_unavailable_flag{0.0, 1.0} -- HSI_course_unavailable_flag{0.0, 1.0} - SendData(lExportID, string.format("%.4f;%.4f;%.4f;%.4f;%.1f;%.1f;%.1f;%.3f;%.3f;%.3f;%.4f;%.4f;%.1f;%.1f", + --[[SendData(lExportID, string.format("%.4f;%.4f;%.4f;%.4f;%.1f;%.1f;%.1f;%.3f;%.3f;%.3f;%.4f;%.4f;%.1f;%.1f", lHeading, -- compass card (lHeading + (lHSI_Curse / lRadToDCSunsignd)) - 1, -- doppel pfeil lHeading, -- gelbes dreieck @@ -599,13 +595,26 @@ function ExportScript.AF.FC_Russian_HSI(distancetoway, exportid) lGlide, lSide, lDefaultNull, -- ??? - lDefaultNull)) -- deaktiviert die Course Anzeige + lDefaultNull)) -- deaktiviert die Course Anzeige]] + + ExportScript.Tools.SendData(11, string.format("%.4f", lHeading)) -- compass card + ExportScript.Tools.SendData(12, string.format("%.4f", ((lHeading + (lHSI_Curse / lRadToDCSunsignd)) - 1))) -- double arrow + ExportScript.Tools.SendData(13, string.format("%.4f", lHeading)) -- yellow triangle + ExportScript.Tools.SendData(14, string.format("%.4f", (0 - (lHeading + (lHSI_ADF / lRadToDCSunsignd))))) -- yellow arrow + ExportScript.Tools.SendData(15, lDefaultNull) -- KC Flag + ExportScript.Tools.SendData(16, lDefaultOne) -- K Flag + ExportScript.Tools.SendData(17, lDefaultOne) -- L Flag + ExportScript.Tools.SendData(18, string.format("%.4f", lAltCounter[tonumber(string.sub(lDistanceToWayTmp, 1, 1))])) + ExportScript.Tools.SendData(19, string.format("%.4f", lAltCounter[tonumber(string.sub(lDistanceToWayTmp, 2, 2))])) + ExportScript.Tools.SendData(20, string.format("%.4f", lRangeCounter3)) + ExportScript.Tools.SendData(21, string.format("%.4f", lGlide)) + ExportScript.Tools.SendData(22, string.format("%.4f", lSide)) + ExportScript.Tools.SendData(23, lDefaultNull) + ExportScript.Tools.SendData(24, lDefaultNull) end -- HSI for SU25A -function ExportScript.AF.FC_Russian_HSI_old(exportid) - local lDistanceToWay = distancetoway or 999 - local lExportID = exportid or 5 +function ExportScript.AF.FC_Russian_HSI_old() local lDefaultOne = 1.0 local lDefaultNull = 0.0 @@ -634,20 +643,27 @@ function ExportScript.AF.FC_Russian_HSI_old(exportid) -- ILS needle horizontal{-1.0, 1.0} -- ILS needle vertical{-1.0, 1.0} - SendData(lExportID, string.format("%.4f;%.4f;%.4f;%.1f;%.1f;%.4f;%.4f", + --[[SendData(lExportID, string.format("%.4f;%.4f;%.4f;%.1f;%.1f;%.4f;%.4f", lHeading, -- compass card (lHeading + (lHSI_Curse / lRadToDCSunsignd)), -- - 1, -- white needle 0 - (lHeading + (lHSI_ADF / lRadToDCSunsignd)), -- yellow needle lDefaultOne, -- T Flag lDefaultOne, -- K Flag lGlide, - lSide)) + lSide))))]] + + ExportScript.Tools.SendData(11, string.format("%.4f", lHeading)) -- compass card + ExportScript.Tools.SendData(12, string.format("%.4f", (lHeading + (lHSI_Curse / lRadToDCSunsignd)))) -- white needle + ExportScript.Tools.SendData(13, string.format("%.4f", (0 - (lHeading + (lHSI_ADF / lRadToDCSunsignd))))) -- yellow needle + ExportScript.Tools.SendData(16, lDefaultOne) -- T Flag + ExportScript.Tools.SendData(17, lDefaultOne) -- K Flag + ExportScript.Tools.SendData(21, string.format("%.4f", lGlide)) + ExportScript.Tools.SendData(22, string.format("%.4f", lSide)) end -- HSI-Distance for SU25A -function ExportScript.AF.FC_Russian_HSI_Distance_old(distancetoway, exportid) +function ExportScript.AF.FC_Russian_HSI_Distance_old(distancetoway) local lDistanceToWay = distancetoway or 999 - local lExportID = exportid or 21 local lAltCounter = {[0] = 0.0, [1] = 0.11, [2] = 0.22, [3] = 0.33, [4] = 0.44, [5] = 0.55, [6] = 0.66, [7] = 0.77, [8] = 0.88, [9] = 0.99} lDistanceToWay = ExportScript.Tools.round(lDistanceToWay / 1000, 1) @@ -673,15 +689,18 @@ function ExportScript.AF.FC_Russian_HSI_Distance_old(distancetoway, exportid) lRangeCounter3 = lDistanceToWay * 0.11 end - SendData(lExportID, string.format("%.3f;%.3f;%.3f", + --[[SendData(lExportID, string.format("%.3f;%.3f;%.3f", lAltCounter[tonumber(string.sub(lDistanceToWayTmp, 1, 1))], lAltCounter[tonumber(string.sub(lDistanceToWayTmp, 2, 2))], - lRangeCounter3)) -- deaktiviert die Course Anzeige + lRangeCounter3)) -- deaktiviert die Course Anzeige]] + + ExportScript.Tools.SendData(18, string.format("%.4f", lAltCounter[tonumber(string.sub(lDistanceToWayTmp, 1, 1))])) + ExportScript.Tools.SendData(19, string.format("%.4f", lAltCounter[tonumber(string.sub(lDistanceToWayTmp, 2, 2))])) + ExportScript.Tools.SendData(20, string.format("%.4f", lRangeCounter3)) end -- ADI for SU-25, SU25T, SU-27, MIG-29A and MIG-29S -function ExportScript.AF.FC_Russian_ADI_Old(exportid) - local lExportID = exportid or 4 +function ExportScript.AF.FC_Russian_ADI_Old() local lDefaultNull = 0.0 local lRadToDCSsignd = math.pi @@ -706,9 +725,10 @@ function ExportScript.AF.FC_Russian_ADI_Old(exportid) lNavInfoPitch = lNavInfoPitch / lRadToDCSsignd lNavInfoRoll = lNavInfoRoll / lRadToDCSsignd lPitch = lPitch / (lRadToDCSsignd / 2) - --lPitch = (lPitch > 0.0 and (0 - lPitch) or (lPitch + lPitch + lPitch)) -- pitch muss negiert werden - lBank = lBank / (lRadToDCSsignd / 2) - SendData(lExportID, string.format("%.4f;%.4f;%.1f;%.1f;%.4f;%.4f;%.4f;%.4f;%.4f;%.4f", + lPitch = (lPitch > 0.0 and (0 - lPitch) or (lPitch + lPitch + lPitch)) -- pitch muss negiert werden + --lBank = lBank / (lRadToDCSsignd / 2) + lBank = lBank / lRadToDCSsignd + --[[SendData(lExportID, string.format("%.4f;%.4f;%.1f;%.1f;%.4f;%.4f;%.4f;%.4f;%.4f;%.4f", lBank, lPitch, lDefaultNull, @@ -718,12 +738,21 @@ function ExportScript.AF.FC_Russian_ADI_Old(exportid) lDefaultNull, lDefaultNull, lDefaultNull, - lSlipBallPosition)) + lSlipBallPosition))]] + ExportScript.Tools.SendData(1, string.format("%.4f", lBank)) + ExportScript.Tools.SendData(2, string.format("%.4f", lPitch)) + ExportScript.Tools.SendData(3, lDefaultNull) + ExportScript.Tools.SendData(4, lDefaultNull) + ExportScript.Tools.SendData(5, string.format("%.4f", lNavInfoRoll)) + ExportScript.Tools.SendData(6, string.format("%.4f", lNavInfoPitch)) + ExportScript.Tools.SendData(7, lDefaultNull) + ExportScript.Tools.SendData(8, lDefaultNull) + ExportScript.Tools.SendData(9, lDefaultNull) + ExportScript.Tools.SendData(10, string.format("%.4f", lSlipBallPosition)) end -- ADI for SU-33 -function ExportScript.AF.FC_Russian_ADI_New(exportid) - local lExportID = exportid or 4 +function ExportScript.AF.FC_Russian_ADI_New() local lDefaultNull = 0.0 local lRadToDCSsignd = math.pi @@ -750,7 +779,7 @@ function ExportScript.AF.FC_Russian_ADI_New(exportid) lPitch = lPitch / (lRadToDCSsignd / 2) lPitch = (lPitch > 0.0 and (0 - lPitch) or (lPitch + lPitch + lPitch)) -- pitch muss negiert werden lBank = lBank / lRadToDCSsignd --(lRadToDCSsignd / 2) - SendData(lExportID, string.format("%.4f;%.4f;%.1f;%.1f;%.4f;%.4f;%.4f;%.4f;%.4f;%.4f", + --[[SendData(lExportID, string.format("%.4f;%.4f;%.1f;%.1f;%.4f;%.4f;%.4f;%.4f;%.4f;%.4f", lBank, lPitch, lDefaultNull, @@ -760,13 +789,23 @@ function ExportScript.AF.FC_Russian_ADI_New(exportid) lDefaultNull, lDefaultNull, lDefaultNull, - lSlipBallPosition)) + lSlipBallPosition))]] + + ExportScript.Tools.SendData(1, string.format("%.4f", lBank)) + ExportScript.Tools.SendData(2, string.format("%.4f", lPitch)) + ExportScript.Tools.SendData(3, lDefaultNull) + ExportScript.Tools.SendData(4, lDefaultNull) + ExportScript.Tools.SendData(5, string.format("%.4f", lNavInfoRoll)) + ExportScript.Tools.SendData(6, string.format("%.4f", lNavInfoPitch)) + ExportScript.Tools.SendData(7, lDefaultNull) + ExportScript.Tools.SendData(8, lDefaultNull) + ExportScript.Tools.SendData(9, lDefaultNull) + ExportScript.Tools.SendData(10, string.format("%.4f", lSlipBallPosition)) end -- Radar Altimeter for SU-25A, SU25-T, SU-27, SU-33 -function ExportScript.AF.FC_Russian_RadarAltimeter_1500m(warningflag, exportid) +function ExportScript.AF.FC_Russian_RadarAltimeter_1500m(warningflag) local lWarning_Flag = warningflag or 100 - local lExportID = exportid or 7 local lScaleValue = 1500 local lAltRad = LoGetAltitudeAboveGroundLevel() -- ALTITUDE GROUND LEVEL (Meter) @@ -780,17 +819,21 @@ function ExportScript.AF.FC_Russian_RadarAltimeter_1500m(warningflag, exportid) -- DangerRALT {0.0,1.0} -- Warning_Flag {0, 1} -- DangerRALT_Lamp {0, 1} - SendData(lExportID, string.format("%.4f;%.4f;%d;%d", + --[[SendData(lExportID, string.format("%.4f;%.4f;%d;%d", lAltRad, lDangerRALT, lWarning_Flag, - lDangerRALT_Lamp)) + lDangerRALT_Lamp)))]] + + ExportScript.Tools.SendData(25, string.format("%.4f", lAltRad)) + ExportScript.Tools.SendData(26, string.format("%.4f", lDangerRALT)) + ExportScript.Tools.SendData(27, lWarning_Flag) + ExportScript.Tools.SendData(28, lDangerRALT_Lamp) end -- Radar Altimeter for MiG-29A, MiG-29S -function ExportScript.AF.FC_Russian_RadarAltimeter_1000m(warningflag, exportid) +function ExportScript.AF.FC_Russian_RadarAltimeter_1000m(warningflag) local lWarning_Flag = warningflag or 100 - local lExportID = exportid or 7 local lScaleValue = 1000 local lAltRad = LoGetAltitudeAboveGroundLevel() -- ALTITUDE GROUND LEVEL (Meter) @@ -804,11 +847,16 @@ function ExportScript.AF.FC_Russian_RadarAltimeter_1000m(warningflag, exportid) -- DangerRALT {0.0,1.0} -- Warning_Flag {0, 1} -- DangerRALT_Lamp {0, 1} - SendData(lExportID, string.format("%.4f;%.4f;%d;%d", + --[[SendData(lExportID, string.format("%.4f;%.4f;%d;%d", lAltRad, lDangerRALT, lWarning_Flag, - lDangerRALT_Lamp)) + lDangerRALT_Lamp)))]] + + ExportScript.Tools.SendData(25, string.format("%.4f", lAltRad)) + ExportScript.Tools.SendData(26, string.format("%.4f", lDangerRALT)) + ExportScript.Tools.SendData(27, lWarning_Flag) + ExportScript.Tools.SendData(28, lDangerRALT_Lamp) end -- Barometric Altimeter for @@ -882,8 +930,7 @@ function ExportScript.AF.FC_Russian_BarometricAltimeter(exportid) end -- Barometric Altimeter for SU-25A, SU25-T -function ExportScript.AF.FC_Russian_BarometricAltimeter_late(exportid) - local lExportID = exportid or 8 +function ExportScript.AF.FC_Russian_BarometricAltimeter_late() local lBasicAtmospherePressure = LoGetBasicAtmospherePressure() -- BAROMETRIC PRESSURE (mm Hg) local lAltBar = LoGetAltitudeAboveSeaLevel() -- ALTITUDE SEA LEVEL (Meter) @@ -909,16 +956,20 @@ function ExportScript.AF.FC_Russian_BarometricAltimeter_late(exportid) -- AltBar_meter_needle {0.0,1.0} -- BasicAtmospherePressure {600.0, 800.0} -- AltBar_kilometer {0.0, 99.9} - SendData(lExportID, string.format("%.4f;%.4f;%.4f;%.4f", + --[[SendData(lExportID, string.format("%.4f;%.4f;%.4f;%.4f", lAltBar_kilometer_needle, lAltBar_meter_needle, lBasicAtmospherePressure, - lAltBar)) + lAltBar))]] + + ExportScript.Tools.SendData(30, string.format("%.4f", lAltBar_kilometer_needle)) + ExportScript.Tools.SendData(31, string.format("%.4f", lAltBar_meter_needle)) + ExportScript.Tools.SendData(32, string.format("%.4f", lBasicAtmospherePressure)) + ExportScript.Tools.SendData(33, string.format("%.4f", lAltBar)) end -- Barometric Altimeter for SU-27, SU-33 -function ExportScript.AF.FC_Russian_BarometricAltimeter_20000(exportid) - local lExportID = exportid or 8 +function ExportScript.AF.FC_Russian_BarometricAltimeter_20000() local lBasicAtmospherePressure = LoGetBasicAtmospherePressure() -- BAROMETRIC PRESSURE (mm Hg) local lAltBar = LoGetAltitudeAboveSeaLevel() -- ALTITUDE SEA LEVEL (Meter) @@ -943,15 +994,18 @@ function ExportScript.AF.FC_Russian_BarometricAltimeter_20000(exportid) -- AltBar_kilometer_needle {0.0,1.0} -- AltBar_meter_needle {0.0,1.0} -- BasicAtmospherePressure {0.0, 1.0}={600.0, 800.0} - SendData(lExportID, string.format("%.4f;%.4f;%.4f", + --[[SendData(lExportID, string.format("%.4f;%.4f;%.4f", lAltBar_kilometer_needle, lAltBar_meter_needle, - lBasicAtmospherePressure)) + lBasicAtmospherePressure))]] + + ExportScript.Tools.SendData(30, string.format("%.4f", lAltBar_kilometer_needle)) + ExportScript.Tools.SendData(31, string.format("%.4f", lAltBar_meter_needle)) + ExportScript.Tools.SendData(32, string.format("%.4f", lBasicAtmospherePressure)) end -- Barometric Altimeter for MiG-29A, MiG-29S -function ExportScript.AF.FC_Russian_BarometricAltimeter_30000(exportid) - local lExportID = exportid or 8 +function ExportScript.AF.FC_Russian_BarometricAltimeter_30000() local lBasicAtmospherePressure = LoGetBasicAtmospherePressure() -- BAROMETRIC PRESSURE (mm Hg) local lAltBar = LoGetAltitudeAboveSeaLevel() -- ALTITUDE SEA LEVEL (Meter) @@ -976,15 +1030,18 @@ function ExportScript.AF.FC_Russian_BarometricAltimeter_30000(exportid) -- AltBar_kilometer_needle {0.0,1.0} -- AltBar_meter_needle {0.0,1.0} -- BasicAtmospherePressure {0.0, 1.0}={600.0, 800.0} - SendData(lExportID, string.format("%.4f;%.4f;%.4f", + --[[SendData(lExportID, string.format("%.4f;%.4f;%.4f", lBasicAtmospherePressure, lAltBar_meter_needle, - lAltBar_kilometer_needle)) + lAltBar_kilometer_needle))]] + + ExportScript.Tools.SendData(30, string.format("%.4f", lAltBar_kilometer_needle)) + ExportScript.Tools.SendData(31, string.format("%.4f", lAltBar_meter_needle)) + ExportScript.Tools.SendData(32, string.format("%.4f", lBasicAtmospherePressure)) end -- Air Speed Indicator for SU-25A, SU-25T -function ExportScript.AF.FC_Russian_AirSpeed_1100hkm(exportid) - local lExportID = exportid or 1 +function ExportScript.AF.FC_Russian_AirSpeed_1100hkm() local lIAS = LoGetIndicatedAirSpeed() * 3.6 -- INDICATED AIRSPEED (Meter/Second to Km/h) local lTAS = LoGetTrueAirSpeed() * 3.6 -- TRUE AIRSPEED (Meter/Second to Km/h) @@ -1031,12 +1088,14 @@ function ExportScript.AF.FC_Russian_AirSpeed_1100hkm(exportid) -- IAS {0.0,1.0} -- TAS {0.0,1.0} - SendData(lExportID, string.format("%.4f;%.4f", lIAS, lTAS)) + --[[SendData(lExportID, string.format("%.4f;%.4f", lIAS, lTAS))]] + + ExportScript.Tools.SendData(35, string.format("%.4f", lIAS)) + ExportScript.Tools.SendData(36, string.format("%.4f", lTAS)) end -- Air Speed Indicator for SU-27, SU-33 -function ExportScript.AF.FC_Russian_AirSpeed_1600hkm(exportid) - local lExportID = exportid or 1 +function ExportScript.AF.FC_Russian_AirSpeed_1600hkm() local lScaleValueIAS = 1600 local lScaleValueMach = 3.5 @@ -1195,12 +1254,14 @@ function ExportScript.AF.FC_Russian_AirSpeed_1600hkm(exportid) -- IAS {0.0,1.0} -- MACH {0.0,1.0} - SendData(lExportID, string.format("%.4f;%.4f", lIAStmp, lMACHtmp)) + --[[SendData(lExportID, string.format("%.4f;%.4f", lIAStmp, lMACHtmp))]] + + ExportScript.Tools.SendData(35, string.format("%.4f", lIAStmp)) + ExportScript.Tools.SendData(36, string.format("%.4f", lMACHtmp)) end -- Air Speed Indicator for MiG-29A, MiG-29S -function ExportScript.AF.FC_Russian_AirSpeed_1000hkm(exportid) - local lExportID = exportid or 1 +function ExportScript.AF.FC_Russian_AirSpeed_1000hkm() local lIAS = LoGetIndicatedAirSpeed() * 3.6 -- INDICATED AIRSPEED (Meter/Second to Km/h) local lThousand = 0.0 @@ -1243,12 +1304,14 @@ function ExportScript.AF.FC_Russian_AirSpeed_1000hkm(exportid) -- IAS {0.0,1.0} -- Thousand {0.0,1.0} - SendData(lExportID, string.format("%.4f;%.4f", lIAS, lThousand)) + --[[SendData(lExportID, string.format("%.4f;%.4f", lIAS, lThousand))]] + + ExportScript.Tools.SendData(35, string.format("%.4f", lIAS)) + ExportScript.Tools.SendData(36, string.format("%.4f", lThousand)) end -- Vertical Velocity Indicator (Old Style) for SU-25, SU25T, SU-27, MIG-29A and MIG-29S -function ExportScript.AF.FC_Russian_VVI_Old(exportid) - local lExportID = exportid or 6 +function ExportScript.AF.FC_Russian_VVI_Old() local lVVI = LoGetVerticalVelocity() -- VERTICAL SPEED (Meter/Second) local lPitch, lBank, lYaw = LoGetADIPitchBankYaw() -- PITCH, BANK, YAW (Radian) @@ -1278,15 +1341,18 @@ function ExportScript.AF.FC_Russian_VVI_Old(exportid) -- lVVI {-1.0, 0.0, 1.0} {0.0=0, 0.05=10, 0.10=20, 0.24=50, 0.49=100, 0.74=150, 1.0=200} -- lBank {-1.0, 0.0,1.0} -- lSlipBallPosition {0.0,1.0} - SendData(lExportID, string.format("%.4f;%.4f;%.4f", + --[[SendData(lExportID, string.format("%.4f;%.4f;%.4f", lVVI, lBank, - lSlipBallPosition)) + lSlipBallPosition))]] + + ExportScript.Tools.SendData(40, string.format("%.4f", lVVI)) + ExportScript.Tools.SendData(41, string.format("%.4f", lBank)) + ExportScript.Tools.SendData(42, string.format("%.4f", lSlipBallPosition)) end -- VVI for SU-33 -function ExportScript.AF.FC_Russian_VVI_New(exportid) - local lExportID = exportid or 6 +function ExportScript.AF.FC_Russian_VVI_New() local lVVI = LoGetVerticalVelocity() -- VERTICAL SPEED (Meter/Second) @@ -1321,21 +1387,24 @@ function ExportScript.AF.FC_Russian_VVI_New(exportid) lVVI = (lVVI < -1.0 and -1.0 or lVVI) end - SendData(lExportID, string.format("%.4f", lVVI)) + --[[SendData(lExportID, string.format("%.4f", lVVI))]] + + ExportScript.Tools.SendData(40, string.format("%.4f", lVVI)) end -- Airintake for SU-27 and SU-33 -function ExportScript.AF.FC_Russian_AirIntake(exportid) - local lExportID = exportid or 21 +function ExportScript.AF.FC_Russian_AirIntake() local lAirI = LoGetMechInfo().airintake.value - SendData(lExportID, string.format("%.4f;%.4f", lAirI, lAirI)) + --[[SendData(lExportID, string.format("%.4f;%.4f", lAirI, lAirI))]] + + ExportScript.Tools.SendData(45, string.format("%.4f", lAirI)) + ExportScript.Tools.SendData(46, string.format("%.4f", lAirI)) end -- AOA Indicator and Accelerometer (AOA, GLoad) for SU-25, SU25T -function ExportScript.AF.FC_Russian_AOA_Su25(exportid) - local lExportID = exportid or 3 +function ExportScript.AF.FC_Russian_AOA_Su25() local lAoA = LoGetAngleOfAttack() -- ANGLE OF ATTACK AoA (Radian) local lAccelerationUnits = LoGetAccelerationUnits().y -- G-LOAD @@ -1409,14 +1478,16 @@ function ExportScript.AF.FC_Russian_AOA_Su25(exportid) lAccelerationUnits = 0.18360983599491558834620754850374 * lAccelerationUnits + 2.559143240842e-33 end - SendData(lExportID, string.format("%.4f;%.4f", + --[[SendData(lExportID, string.format("%.4f;%.4f", lAoA, - lAccelerationUnits) ) + lAccelerationUnits) )]] + + ExportScript.Tools.SendData(50, string.format("%.4f", lAoA)) + ExportScript.Tools.SendData(51, string.format("%.4f", lAccelerationUnits)) end -- AOA Indicator and Accelerometer (AOA, GLoad) for SU-27, SU33 -function ExportScript.AF.FC_Russian_AOA_Su2733(exportid) - local lExportID = exportid or 3 +function ExportScript.AF.FC_Russian_AOA_Su2733() local lAoA = LoGetAngleOfAttack() -- ANGLE OF ATTACK AoA (Radian) local lAccelerationUnits = LoGetAccelerationUnits().y -- G-LOAD @@ -1489,14 +1560,16 @@ function ExportScript.AF.FC_Russian_AOA_Su2733(exportid) lAccelerationUnits = 0.09672619047619047619047619047619 * lAccelerationUnits end - SendData(lExportID, string.format("%.4f;%.4f", + --[[SendData(lExportID, string.format("%.4f;%.4f", lAoA, - lAccelerationUnits) ) + lAccelerationUnits) )]] + + ExportScript.Tools.SendData(50, string.format("%.4f", lAoA)) + ExportScript.Tools.SendData(51, string.format("%.4f", lAccelerationUnits)) end -- AOA Indicator and Accelerometer (AOA, GLoad) for MiG-29A, MiG-29S -function ExportScript.AF.FC_Russian_AOA_MiG29(exportid) - local lExportID = exportid or 3 +function ExportScript.AF.FC_Russian_AOA_MiG29() local lAoA = LoGetAngleOfAttack() -- ANGLE OF ATTACK AoA (Radian) local lAccelerationUnits = LoGetAccelerationUnits().y -- G-LOAD @@ -1569,14 +1642,16 @@ function ExportScript.AF.FC_Russian_AOA_MiG29(exportid) lAccelerationUnits = 0.09672619047619047619047619047619 * lAccelerationUnits end - SendData(lExportID, string.format("%.4f;%.4f", + --[[SendData(lExportID, string.format("%.4f;%.4f", lAoA, - lAccelerationUnits) ) + lAccelerationUnits) )]] + + ExportScript.Tools.SendData(50, string.format("%.4f", lAoA)) + ExportScript.Tools.SendData(51, string.format("%.4f", lAccelerationUnits)) end -- Russian Clock ACS-1 for KA-50, SU-25A, MIG-29A , MIG-29S -function ExportScript.AF.FC_Russian_Clock_ACS1(exportid) - local lExportID = exportid or 12 +function ExportScript.AF.FC_Russian_Clock_ACS1() local lDefaultOne = 1.0 local lDefaultNull = 0.0 @@ -1600,7 +1675,7 @@ function ExportScript.AF.FC_Russian_Clock_ACS1(exportid) -- flight_minutes {0.0,1.0} -- seconds_meter_time_minutes {0.0,1.0} -- seconds_meter_time_seconds {0.0,1.0} - SendData(lExportID, string.format("%.4f;%.4f;%.4f;%.1f;%.4f;%.4f;%.4f;%.4f", + --[[SendData(lExportID, string.format("%.4f;%.4f;%.4f;%.1f;%.4f;%.4f;%.4f;%.4f", lCurrentHours, lCurrentMinutes, lCurrentSeconds, @@ -1608,12 +1683,20 @@ function ExportScript.AF.FC_Russian_Clock_ACS1(exportid) lFlightTimeHours, lFlightTimeMinutes, lDefaultNull, - lDefaultNull)) + lDefaultNull))]] + + ExportScript.Tools.SendData(55, string.format("%.4f", lCurrentHours)) + ExportScript.Tools.SendData(56, string.format("%.4f", lCurrentMinutes)) + ExportScript.Tools.SendData(57, string.format("%.4f", lCurrentSeconds)) + ExportScript.Tools.SendData(58, lDefaultNull) -- red/white flag + ExportScript.Tools.SendData(59, string.format("%.4f", lFlightTimeHours)) + ExportScript.Tools.SendData(60, string.format("%.4f", lFlightTimeMinutes)) + ExportScript.Tools.SendData(61, lDefaultNull) + ExportScript.Tools.SendData(62, lDefaultNull) end -- Russian Clock (latest Model) for SU-25T, SU-27, SU-33 -function ExportScript.AF.FC_Russian_Clock_late(exportid) - local lExportID = exportid or 12 +function ExportScript.AF.FC_Russian_Clock_late() local lDefaultOne = 1.0 local lDefaultNull = 0.0 @@ -1636,19 +1719,26 @@ function ExportScript.AF.FC_Russian_Clock_late(exportid) -- flight_hours {0.0,1.0} -- flight_minutes {0.0,1.0} -- seconds_meter_time_seconds {0.0,1.0} - SendData(lExportID, string.format("%.4f;%.4f;%.4f;%.1f;%.4f;%.4f;%.4f", + --[[SendData(lExportID, string.format("%.4f;%.4f;%.4f;%.1f;%.4f;%.4f;%.4f", lCurrentHours, lCurrentMinutes, lCurrentSeconds, lDefaultNull, -- red/white flag lFlightTimeHours, lFlightTimeMinutes, - lCurrentSeconds)) + lCurrentSeconds))]] + + ExportScript.Tools.SendData(55, string.format("%.4f", lCurrentHours)) + ExportScript.Tools.SendData(56, string.format("%.4f", lCurrentMinutes)) + ExportScript.Tools.SendData(57, string.format("%.4f", lCurrentSeconds)) + ExportScript.Tools.SendData(58, lDefaultNull) -- red/white flag + ExportScript.Tools.SendData(59, string.format("%.4f", lFlightTimeHours)) + ExportScript.Tools.SendData(60, string.format("%.4f", lFlightTimeMinutes)) + ExportScript.Tools.SendData(61, string.format("%.4f", lCurrentSeconds)) end -- Russian Enging RPM (Tachometer) for SU-25A+T, SU-27, SU-33, MIG-29 -function ExportScript.AF.FC_Russian_EngineRPM(exportid) - local lExportID = exportid or 9 +function ExportScript.AF.FC_Russian_EngineRPM() local lScaleValue = 110 local lEngineRPMleft = LoGetEngineInfo().RPM.left -- ENG1 RPM % @@ -1660,13 +1750,16 @@ function ExportScript.AF.FC_Russian_EngineRPM(exportid) lEngineRPMright = (lEngineRPMright > 1.0 and 1.0 or lEngineRPMright) -- the result is limited to 1.0 -- EngineRPMleft {0.0,1.0} -- EngineRPMright {0.0,1.0} - SendData(lExportID, string.format("%.4f;%.4f", lEngineRPMleft, lEngineRPMright)) + --[[SendData(lExportID, string.format("%.4f;%.4f", lEngineRPMleft, lEngineRPMright))]] + + ExportScript.Tools.SendData(65, string.format("%.4f", lEngineRPMleft)) + ExportScript.Tools.SendData(66, string.format("%.4f", lEngineRPMright)) end -- Russian Exthaus Gas Temperature 1.000GradC for SU-25A, SU25T, MIG-29 function ExportScript.AF.FC_Russian_EGT_1000gc(egttemp, exportid) local lEGTtemp = egttemp or 1 - local lExportID = exportid or 10 + local lExportID = exportid or 70 --[[ y_min = 0.0 0.068 -- minimaler Ausgabewert @@ -1690,12 +1783,12 @@ function ExportScript.AF.FC_Russian_EGT_1000gc(egttemp, exportid) end -- ExthausGasTemperature {0.0,1.0} - SendData(lExportID, string.format("%.4f", lEGTtemp)) + ExportScript.Tools.SendData(lExportID, string.format("%.4f", lEGTtemp)) end -- Russian Mechanical Device Indicator for SU-25A+T -function ExportScript.AF.FC_Russian_MDI_SU25(exportid) - local lExportID = exportid or 2 +function ExportScript.AF.FC_Russian_MDI_SU25(FunctionTyp) + local lFunctionTyp = FunctionTyp or "Ikarus" local lMechInfo = LoGetMechInfo() -- mechanical components, e.g. Flaps, Wheelbrakes,... if lMechInfo == nil then @@ -1717,19 +1810,39 @@ function ExportScript.AF.FC_Russian_MDI_SU25(exportid) -- speedbreakes on {0, 1} -- flap 1. position {0, 1} -- flap 2. position {0, 1} - SendData(lExportID, string.format("%.1f;%d;%d;%d;%d;%d;%d", + --[[SendData(lExportID, string.format("%.1f;%d;%d;%d;%d;%d;%d", lWarningLight, (lMechInfo.gear.value > 0.85 and 1 or 0), -- nose gear (lMechInfo.gear.value > 0.95 and 1 or 0), -- left gear (lMechInfo.gear.value == 1 and 1 or 0), -- right gear (lMechInfo.speedbrakes.value > 0.1 and 1 or 0), -- speedbreakes on > 0.1 (0 - 1) (lMechInfo.flaps.value > 0.25 and 1 or 0), -- flap 1. position - (lMechInfo.flaps.value > 0.93 and 1 or 0))) -- flap 2. position + (lMechInfo.flaps.value > 0.93 and 1 or 0))) -- flap 2. position]] + + if ExportScript.Config.IkarusExport and lFunctionTyp == "Ikarus" then + ExportScript.Tools.SendData(500, string.format("%.1f", lWarningLight)) + ExportScript.Tools.SendData(501, (lMechInfo.gear.value > 0.85 and 1 or 0)) -- nose gear + ExportScript.Tools.SendData(502, (lMechInfo.gear.value > 0.95 and 1 or 0)) -- left gear + ExportScript.Tools.SendData(503, (lMechInfo.gear.value == 1 and 1 or 0)) -- right gear + ExportScript.Tools.SendData(510, (lMechInfo.speedbrakes.value > 0.1 and 1 or 0)) -- speedbreakes on > 0.1 (0 - 1) + ExportScript.Tools.SendData(531, (lMechInfo.flaps.value > 0.25 and 1 or 0)) -- flap 1. position + ExportScript.Tools.SendData(532, (lMechInfo.flaps.value > 0.93 and 1 or 0)) -- flap 2. position + end + + if ExportScript.Config.DACExport and lFunctionTyp == "DAC" then + ExportScript.Tools.SendDataDAC(500, (((lMechInfo.gear.status == 1 and lMechInfo.gear.value < 1) or (lMechInfo.gear.status == 0 and lMechInfo.gear.value > 0)) and 1 or 0 )) + ExportScript.Tools.SendDataDAC(501, (lMechInfo.gear.value > 0.85 and 1 or 0)) -- nose gear + ExportScript.Tools.SendDataDAC(502, (lMechInfo.gear.value > 0.95 and 1 or 0)) -- left gear + ExportScript.Tools.SendDataDAC(503, (lMechInfo.gear.value == 1 and 1 or 0)) -- right gear + ExportScript.Tools.SendDataDAC(510, (lMechInfo.speedbrakes.value > 0.1 and 1 or 0)) -- speedbreakes on > 0.1 (0 - 1) + ExportScript.Tools.SendDataDAC(531, (lMechInfo.flaps.value > 0.25 and 1 or 0)) -- flap 1. position + ExportScript.Tools.SendDataDAC(532, (lMechInfo.flaps.value > 0.93 and 1 or 0)) -- flap 2. position + ExportScript.Tools.SendDataDAC(533, ((lMechInfo.flaps.value > 0.93 and lTrueAirSpeed > 340) and 1 or 0)) -- Speed Warning for Flaps, same light as gear warning light, but blinking light + end end -- Russian System Test EKRAN -function ExportScript.AF.FC_EKRAN(exportid) - local lExportID = exportid or 16 +function ExportScript.AF.FC_EKRAN() local lMCPState = LoGetMCPState() -- Warning Lights if lMCPState == nil then @@ -1828,11 +1941,16 @@ function ExportScript.AF.FC_EKRAN(exportid) -- FAILlight (failure text) -- MEMORYlight (memmory text) -- TURNlight (turn text) - SendData(lExportID, string.format("%s;%s;%s;%s", + --[[SendData(lExportID, string.format("%s;%s;%s;%s", gDisplayWindow, lFAILlight, lMEMORYlight, - lTURNlight)) + lTURNlight))]] + + ExportScript.Tools.SendData(80, string.format("%s;", gDisplayWindow)) + ExportScript.Tools.SendData(81, string.format("%s;", lFAILlight)) + ExportScript.Tools.SendData(82, string.format("%s;", lMEMORYlight)) + ExportScript.Tools.SendData(83, string.format("%s;", lTURNlight)) end -- ADI for A-10A, F-15C @@ -2253,7 +2371,7 @@ function ExportScript.AF.FC_OneNeedleGauge(value, scala, exportid) lValue = lValue / lScala lValue = (lValue > 1.0 and 1.0 or lValue) -- the result is limited to 1.0 - SendData(lExportID, string.format("%.4f", lValue)) + ExportScript.Tools.SendData(lExportID, string.format("%.4f", lValue)) end -- Gauges with 1 needle and 2 digits display @@ -2464,7 +2582,7 @@ emitter_table = if lTWSInfo == nil then return end - --WriteToLog('lTWSInfo: '..dump(lTWSInfo)) + --ExportScript.Tools.WriteToLog('lTWSInfo: '..ExportScript.Tools.dump(lTWSInfo)) --[[ [Emitters] = { [1] = { @@ -2496,18 +2614,25 @@ emitter_table = } [Mode] = number: "0" ]] -ExportScript.Tools.WriteToLog("SPO15RWR: "..ExportScript.AF.EventNumberOLD.." < "..ExportScript.AF.EventNumber) - if(ExportScript.AF.EventNumberOLD < ExportScript.AF.EventNumber) then - ExportScript.AF.EventNumberOLD = ExportScript.AF.EventNumber + + --if(ExportScript.AF.EventNumberOLD < ExportScript.AF.EventNumber) then local lPriorityTmp = 0 local lPrimaryThreatTmp = 0 local lActiveLamp = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0} -- 10 x for direction if ExportScript.AF.SPO15RWRData == nil then - ExportScript.AF.SPO15RWRData = {} + ExportScript.AF.SPO15RWRData = {} + + ExportScript.AF.SPO15RWRData[400] = 1 -- Power light end -ExportScript.Tools.WriteToLog("1") + + if ExportScript.AF.SPO15RWRDataIkarus == nil then + ExportScript.AF.SPO15RWRDataIkarus = {} + + ExportScript.AF.SPO15RWRDataIkarus[400] = 1 -- Power light + end + if(#lTWSInfo.Emitters > 0) then -ExportScript.Tools.WriteToLog("2") + ExportScript.AF.SPO15_FoundErmitter = true for EmitterIndex = 1, #lTWSInfo.Emitters, 1 do @@ -2518,11 +2643,10 @@ ExportScript.Tools.WriteToLog("2") end for EmitterIndex = 1, #lTWSInfo.Emitters, 1 do -ExportScript.Tools.WriteToLog("3") + local lAzimut = ExportScript.Tools.round(lTWSInfo.Emitters[EmitterIndex].Azimuth * 90, 1) if EmitterIndex == lPrimaryThreatTmp then -ExportScript.Tools.WriteToLog("3.1") -- primary threat -- direction to the threat ExportScript.AF.SPO15RWRData[401] = (lAzimut <= -170.0 and 1 or 0) -- left back side @@ -2579,7 +2703,8 @@ ExportScript.Tools.WriteToLog("3.1") lPrimaryTypeTmp = nil end -ExportScript.Tools.WriteToLog("3.2") + + -- secondary threat lActiveLamp = ExportScript.AF.SPO15RWR_SendDataHW(lActiveLamp, 1, 451, lAzimut <= -170.0) -- left back side lActiveLamp = ExportScript.AF.SPO15RWR_SendDataHW(lActiveLamp, 2, 452, (lAzimut <= -90.0 and lAzimut >= -170.0 )) -- left 90 degree lActiveLamp = ExportScript.AF.SPO15RWR_SendDataHW(lActiveLamp, 3, 453, (lAzimut <= -55.0 and lAzimut >= -125.0 )) -- left 50 degree @@ -2595,7 +2720,7 @@ ExportScript.Tools.WriteToLog("3.2") -- type of the secondary threat local lSecondaryTypeTmp = ExportScript.AF.FindRadarTypeForSPO15(lTWSInfo) - ExportScript.AF.SPO15RWRData[470] = (lSecondaryTypeTmp.AIR == 1 and 1 or 0) -- primary Air or Weapon + ExportScript.AF.SPO15RWRData[470] = (lSecondaryTypeTmp.AIR == 1 and 1 or 0) -- secondary Air or Weapon ExportScript.AF.SPO15RWRData[471] = (lSecondaryTypeTmp.LRR == 1 and 1 or 0) -- long range radar ExportScript.AF.SPO15RWRData[472] = (lSecondaryTypeTmp.MRR == 1 and 1 or 0) -- mid range radar ExportScript.AF.SPO15RWRData[473] = (lSecondaryTypeTmp.SRR == 1 and 1 or 0) -- short range radar @@ -2603,26 +2728,112 @@ ExportScript.Tools.WriteToLog("3.2") ExportScript.AF.SPO15RWRData[475] = (lSecondaryTypeTmp.AWACS == 1 and 1 or 0) -- AWACS lSecondaryTypeTmp = nil + + if ExportScript.Config.IkarusExport then + -- all data conditioned for Ikarus + ExportScript.AF.SPO15RWRDataIkarus = {[400]=1,[401]=0,[402]=0,[403]=0,[404]=0,[405]=0,[406]=0,[407]=0,[408]=0,[409]=0,[410]=0,[411]=0,[412]=0,[413]=0,[414]=0,[415]=0,[416]=0,[417]=0,[418]=0,[419]=0,[420]=0,[421]=0,[422]=0} + + -- Primary threat Light 1/2 + local lTmp = 0.1 + for Index=401, 410, 1 do + if ExportScript.AF.SPO15RWRData[Index] == 1 and ExportScript.AF.SPO15RWRDataIkarus[401] == 0 then + ExportScript.AF.SPO15RWRDataIkarus[401] = lTmp -- Primary threat Light 1 + end + if ExportScript.AF.SPO15RWRData[Index] == 1 and ExportScript.AF.SPO15RWRDataIkarus[402] == 0 and ExportScript.AF.SPO15RWRDataIkarus[401] ~= lTmp then + ExportScript.AF.SPO15RWRDataIkarus[402] = lTmp -- Primary threat Light 2 + break + end + lTmp = lTmp + 0.1 + end + + -- Primary threat Type + for Index=430, 435, 1 do + if ExportScript.AF.SPO15RWRData[Index] == 1 then + ExportScript.AF.SPO15RWRDataIkarus[403] = ((Index - 430) / 10) + 0.1 -- 0.1=primary Air or Weapon, 0.2=long range radar, 0.3=mid range radar, 0.4=short range radar, 0.5=EWR, 0.6=AWACS + break + end + end + + -- Hemisphere + if ExportScript.AF.SPO15RWRData[442] == 1 and ExportScript.AF.SPO15RWRData[443] == 1 then + ExportScript.AF.SPO15RWRDataIkarus[404] = 0.3 -- top and bottom hemisphere + elseif ExportScript.AF.SPO15RWRData[442] == 0 and ExportScript.AF.SPO15RWRData[443] == 1 then + ExportScript.AF.SPO15RWRDataIkarus[404] = 0.2 -- bottom hemisphere + elseif ExportScript.AF.SPO15RWRData[442] == 1 and ExportScript.AF.SPO15RWRData[443] == 0 then + ExportScript.AF.SPO15RWRDataIkarus[404] = 0.1 -- top hemisphere + end + + -- Lock + if ExportScript.AF.SPO15RWRData[440] == 1 then + ExportScript.AF.SPO15RWRDataIkarus[405] = 0.1 -- Lock + elseif ExportScript.AF.SPO15RWRData[441] == 1 then + ExportScript.AF.SPO15RWRDataIkarus[405] = 0.2 -- Missle on air + end + + -- Ermitter power + for Index=411, 425, 1 do + if ExportScript.AF.SPO15RWRData[Index] == 1 then + ExportScript.AF.SPO15RWRDataIkarus[406] = ExportScript.AF.SPO15RWRDataIkarus[406] + 0.01 -- Ermitter power 0.0 off, 0.01=first lamp - 0.15=last lamp + else + break + end + end + + -- Secondary thread + lTmp = 407 -- to 416 + for Index=451, 460, 1 do + if ExportScript.AF.SPO15RWRData[Index] == 1 then + ExportScript.AF.SPO15RWRDataIkarus[lTmp] = 1 + end + lTmp = lTmp + 1 + end + + -- type of the secondary threat + if ExportScript.AF.SPO15RWRData[470] == 1 then + ExportScript.AF.SPO15RWRDataIkarus[417] = 1 -- secondary Air or Weapon + end + if ExportScript.AF.SPO15RWRData[471] == 1 then + ExportScript.AF.SPO15RWRDataIkarus[418] = 1 -- long range radar + end + if ExportScript.AF.SPO15RWRData[472] == 1 then + ExportScript.AF.SPO15RWRDataIkarus[419] = 1 -- mid range radar + end + if ExportScript.AF.SPO15RWRData[473] == 1 then + ExportScript.AF.SPO15RWRDataIkarus[420] = 1 -- short range radar + end + if ExportScript.AF.SPO15RWRData[474] == 1 then + ExportScript.AF.SPO15RWRDataIkarus[421] = 1 -- EWR + end + if ExportScript.AF.SPO15RWRData[475] == 1 then + ExportScript.AF.SPO15RWRDataIkarus[422] = 1 -- AWACS + end + end + else lPriorityTmp = 0 lPrimaryThreatTmp = 0 -ExportScript.Tools.WriteToLog("4") + if ExportScript.AF.SPO15_FoundErmitter == nil or ExportScript.AF.SPO15_FoundErmitter then ExportScript.AF.SPO15RWR_Reset(401, 480) + + ExportScript.AF.SPO15RWRDataIkarus = {[400]=1,[401]=0,[402]=0,[403]=0,[404]=0,[405]=0,[406]=0,[407]=0,[408]=0,[409]=0,[410]=0,[411]=0,[412]=0,[413]=0,[414]=0,[415]=0,[416]=0,[417]=0,[418]=0,[419]=0,[420]=0,[421]=0,[422]=0} + end + end + --end + + if ExportScript.Config.IkarusExport and lFunctionTyp == "Ikarus" then + if ExportScript.AF.SPO15RWRDataIkarus ~= nil then + for key, value in pairs(ExportScript.AF.SPO15RWRDataIkarus) do + ExportScript.Tools.SendData(key, value) end end end - if ExportScript.Config.IkarusExport and lFunctionTyp == "Ikarus" then -ExportScript.Tools.WriteToLog("SPO15RWRData: "..ExportScript.Tools.dump(ExportScript.AF.SPO15RWRData)) - for key, value in pairs(ExportScript.AF.SPO15RWRData) do - ExportScript.Tools.SendData(key, value) - end - end - if ExportScript.Config.DACExport and lFunctionTyp == "DAC" then - for key, value in pairs(ExportScript.AF.SPO15RWRData) do - ExportScript.Tools.SendDataDAC(key, value) + if ExportScript.AF.SPO15RWRData ~= nil then + for key, value in pairs(ExportScript.AF.SPO15RWRData) do + ExportScript.Tools.SendDataDAC(key, value) + end end end @@ -2780,7 +2991,7 @@ function ExportScript.AF.WeaponStatusPanel_selectCurrentPayloadStation(_index) end function ExportScript.AF.SPO15RWR_Reset(lMinId, lMaxID) -ExportScript.Tools.WriteToLog('SPO15RWR_Reset') +--ExportScript.Tools.WriteToLog('SPO15RWR_Reset') for lCounter = lMinId, lMaxID, 1 do ExportScript.AF.SPO15RWRData[lCounter] = 0 end diff --git a/Scripts/DCS-ExportScript/ExportsModules/Su-25T.lua b/Scripts/DCS-ExportScript/ExportsModules/Su-25T.lua index ded58d3..fdc8f24 100644 --- a/Scripts/DCS-ExportScript/ExportsModules/Su-25T.lua +++ b/Scripts/DCS-ExportScript/ExportsModules/Su-25T.lua @@ -1,904 +1,869 @@ --- Su-25T Export --- Version 1.0.0 BETA - -ExportScript.FoundFCModule = true - --- auxiliary function -dofile(ExportScript.Config.ExportModulePath.."FC_AuxiliaryFuntions.lua") - ------------------------------------------ --- FLAMING CLIFFS AIRCRAFT / Su-25T -- --- FC aircraft don't support GetDevice -- ------------------------------------------ - -function ExportScript.ProcessIkarusFCHighImportanceConfig() - local lFunctionTyp = "Ikarus" -- function type for shared function - local myData = nil -- = LoGetSelfData() - - if (myData) then - local lLatitude = myData.LatLongAlt.Lat -- LATITUDE - local lLongitude = myData.LatLongAlt.Long -- LONGITUDE - local lBasicAtmospherePressure = LoGetBasicAtmospherePressure() -- BAROMETRIC PRESSURE - local lAltBar = LoGetAltitudeAboveSeaLevel() -- ALTITUDE SEA LEVEL (Meter) - local lAltRad = LoGetAltitudeAboveGroundLevel() -- ALTITUDE GROUND LEVEL (Meter) - --local lTrueAirSpeed = LoGetTrueAirSpeed() -- TRUE AIRSPEED (Meter/Second) - local lPitch, lBank, lYaw = LoGetADIPitchBankYaw() -- PITCH, BANK, YAW (Radian) - - local lHeading = myData.Heading -- HEADING (Radian) - local lVVI = LoGetVerticalVelocity() -- VERTICAL SPEED (Meter/Second) - local lIAS = LoGetIndicatedAirSpeed() -- INDICATED AIRSPEED (Meter/Second) - --local lMachNumber = LoGetMachNumber -- MACH - local lAoA = LoGetAngleOfAttack() -- ANGLE OF ATTACK AoA (Radian) - - local lGlide = LoGetGlideDeviation() -- VOR1 HORIZONTAL DEFLECTION (-1 +1) - local lSide = LoGetSideDeviation() -- VOR1 VERTICAL DEFLECTION (-1 +1) - --local lSlipBallPosition = LoGetSlipBallPosition() -- SLIP BALL (-1 +1) - --local lAccelerationUnits = LoGetAccelerationUnits().y -- G-LOAD - - --local lNavInfoPitch = LoGetNavigationInfo().Requirements.pitch -- AP REQUIRED PITCH (Radian) - --local lNavInfoRoll = LoGetNavigationInfo().Requirements.roll -- AP REQUIRED BANK (Radian) - --local lNavInfoSpeed = LoGetNavigationInfo().Requirements.speed -- AP SPEED (Meter/Second) - --local lNavInfoAltitude = LoGetNavigationInfo().Requirements.altitude -- AP ALTITUDE (Meter) - --local lNavInfoVerticalSpeed = LoGetNavigationInfo().Requirements.vertical_speed -- AP VERTICAL SPEED (Meter/Second) - - --local lControlPanel_HSI = LoGetControlPanel_HSI() -- HSI Data - local lHSI_RMI = LoGetControlPanel_HSI().RMI_raw -- VOR1 OBS (Radian) - local lHSI_ADF = LoGetControlPanel_HSI().ADF_raw -- ADF OBS (Radian) - --local lHSI_Heading = LoGetControlPanel_HSI().Heading_raw -- Heading (Radian) - - local lEngineRPMleft = LoGetEngineInfo().RPM.left -- ENG1 RPM % - local lEngineRPMright = LoGetEngineInfo().RPM.right -- ENG2 RPM % - local lEngineTempLeft = LoGetEngineInfo().Temperature.left -- ENG1 EGT ºC - local lEngineTempRight = LoGetEngineInfo().Temperature.right -- ENG2 EGT ºC - --local lEngineFuelInternal = LoGetEngineInfo().fuel_internal -- TANK1 (INT) (KG) - --local lEngineFuelExternal = LoGetEngineInfo().fuel_external -- TANK2 (EXT) (KG) - - --local lMechInfo = LoGetMechInfo() -- mechanical components, e.g. Flaps, Wheelbrakes,... - --local lPayloadInfo = LoGetPayloadInfo() -- Paylod, e.g. bombs, guns, rockets, fuel tanks,... - - local lDistanceToWay = 999 - local lRoute = LoGetRoute() - - if (myData and lRoute) then -- if neither are nil - local myLoc = LoGeoCoordinatesToLoCoordinates(lLongitude, lLatitude) +-- Su-25T Export +-- Version 1.0.0 BETA + +ExportScript.FoundFCModule = true + +-- auxiliary function +dofile(ExportScript.Config.ExportModulePath.."FC_AuxiliaryFuntions.lua") + +----------------------------------------- +-- FLAMING CLIFFS AIRCRAFT / Su-25T -- +-- FC aircraft don't support GetDevice -- +----------------------------------------- + +function ExportScript.ProcessIkarusFCHighImportanceConfig() + local lFunctionTyp = "Ikarus" -- function type for shared function + local myData = LoGetSelfData() + + if (myData) then + local lLatitude = myData.LatLongAlt.Lat -- LATITUDE + local lLongitude = myData.LatLongAlt.Long -- LONGITUDE + --[[ + local lBasicAtmospherePressure = LoGetBasicAtmospherePressure() -- BAROMETRIC PRESSURE + local lAltBar = LoGetAltitudeAboveSeaLevel() -- ALTITUDE SEA LEVEL (Meter) + local lAltRad = LoGetAltitudeAboveGroundLevel() -- ALTITUDE GROUND LEVEL (Meter) + local lTrueAirSpeed = LoGetTrueAirSpeed() -- TRUE AIRSPEED (Meter/Second) + local lPitch, lBank, lYaw = LoGetADIPitchBankYaw() -- PITCH, BANK, YAW (Radian) + + local lHeading = myData.Heading -- HEADING (Radian) + local lVVI = LoGetVerticalVelocity() -- VERTICAL SPEED (Meter/Second) + local lIAS = LoGetIndicatedAirSpeed() -- INDICATED AIRSPEED (Meter/Second) + local lMachNumber = LoGetMachNumber -- MACH + local lAoA = LoGetAngleOfAttack() -- ANGLE OF ATTACK AoA (Radian) + + local lGlide = LoGetGlideDeviation() -- VOR1 HORIZONTAL DEFLECTION (-1 +1) + local lSide = LoGetSideDeviation() -- VOR1 VERTICAL DEFLECTION (-1 +1) + local lSlipBallPosition = LoGetSlipBallPosition() -- SLIP BALL (-1 +1) + local lAccelerationUnits = LoGetAccelerationUnits().y -- G-LOAD + + local lNavInfoPitch = LoGetNavigationInfo().Requirements.pitch -- AP REQUIRED PITCH (Radian) + local lNavInfoRoll = LoGetNavigationInfo().Requirements.roll -- AP REQUIRED BANK (Radian) + local lNavInfoSpeed = LoGetNavigationInfo().Requirements.speed -- AP SPEED (Meter/Second) + local lNavInfoAltitude = LoGetNavigationInfo().Requirements.altitude -- AP ALTITUDE (Meter) + local lNavInfoVerticalSpeed = LoGetNavigationInfo().Requirements.vertical_speed -- AP VERTICAL SPEED (Meter/Second) + + local lControlPanel_HSI = LoGetControlPanel_HSI() -- HSI Data + local lHSI_RMI = LoGetControlPanel_HSI().RMI_raw -- VOR1 OBS (Radian) + local lHSI_ADF = LoGetControlPanel_HSI().ADF_raw -- ADF OBS (Radian) + local lHSI_Heading = LoGetControlPanel_HSI().Heading_raw -- Heading (Radian) + + local lEngineRPMleft = LoGetEngineInfo().RPM.left -- ENG1 RPM % + local lEngineRPMright = LoGetEngineInfo().RPM.right -- ENG2 RPM % + ]] + local lEngineTempLeft = LoGetEngineInfo().Temperature.left -- ENG1 EGT + local lEngineTempRight = LoGetEngineInfo().Temperature.right -- ENG2 EGT + --[[ + local lEngineFuelInternal = LoGetEngineInfo().fuel_internal -- TANK1 (INT) (KG) + local lEngineFuelExternal = LoGetEngineInfo().fuel_external -- TANK2 (EXT) (KG) + + local lMechInfo = LoGetMechInfo() -- mechanical components, e.g. Flaps, Wheelbrakes,... + local lPayloadInfo = LoGetPayloadInfo() -- Paylod, e.g. bombs, guns, rockets, fuel tanks,... + ]] + + local lDistanceToWay = 999 + local lRoute = LoGetRoute() + + if (myData and lRoute) then -- if neither are nil + local myLoc = LoGeoCoordinatesToLoCoordinates(lLongitude, lLatitude) --lDistanceToWay = math.sqrt((myLoc.x - lRoute.goto_point.world_point.x)^2 + (myLoc.y - lRoute.goto_point.world_point.y)^2) - lDistanceToWay = math.sqrt((myLoc.x - lRoute.goto_point.world_point.x)^2 + (myLoc.z - lRoute.goto_point.world_point.z)^2) - end - - if gES_GlassCockpitType == 1 then - -- HELIOS Version 1.3 - -- customizing for HELOS - lPitch = math.deg(lPitch) -- PITCH, (Radian to Grad) - lBank = math.deg(lBank) -- BANK (Radian to Grad) - lYaw = math.deg(lYaw) -- YAW (Radian to Grad) - lHSI_RMI = math.deg(lHSI_RMI) -- VOR1 OBS (Radian to Grad) - lHSI_ADF = math.deg(lHSI_ADF) -- ADF OBS (Radian to Grad) - lAoA = math.deg(lAoA) -- ANGLE OF ATTACK AoA (Radian to Grad) - lHeading = math.deg(lHeading) -- Heading (Radian to Grad) - lHSI_ADF = (360 - lHSI_ADF) + (360 - lHeading) - lHSI_RMI = 360 - lHSI_RMI - lIAS = lIAS * 3.6 -- change from m/s to km/h - - SendData("1", string.format("%.2f", lPitch) ) - SendData("2", string.format("%.2f", lBank) ) - SendData("3", string.format("%.2f", lYaw) ) - SendData("4", string.format("%.2f", lAltBar) ) - SendData("5", string.format("%.2f", lAltRad) ) - SendData("6", string.format("%.2f", lHSI_ADF) ) - SendData("7", string.format("%.2f", lHSI_RMI) ) - SendData("8", string.format("%.2f", lHeading) ) - SendData("9", string.format("%.2f", lEngineRPMleft) ) - SendData("10", string.format("%.2f", lEngineRPMright) ) - SendData("11", string.format("%.2f", lEngineTempLeft) ) - SendData("12", string.format("%.2f", lEngineTempRight) ) - SendData("13", string.format("%.2f", lVVI) ) - SendData("14", string.format("%.2f", lIAS) ) - SendData("15", string.format("%.2f", lDistanceToWay) ) - SendData("16", string.format("%.2f", lAoA) ) - SendData("17", string.format("%.2f", lGlide) ) - SendData("18", string.format("%.2f", lSide) ) + lDistanceToWay = math.sqrt((myLoc.x - lRoute.goto_point.world_point.x)^2 + (myLoc.z - lRoute.goto_point.world_point.z)^2) + end + + -- IAS-TAS Indicator (IAS, TAS) {"%.4f;%.4f"} + ExportScript.AF.FC_Russian_AirSpeed_1100hkm() + + -- AOA Indicator and Accelerometer (AOA, GLoad) + ExportScript.AF.FC_Russian_AOA_Su25() + + -- ADI + ExportScript.AF.FC_Russian_ADI_Old() + + -- HSI + ExportScript.AF.FC_Russian_HSI(lDistanceToWay) + + -- Vertical Velocity Indicator (VVI) (VVI, TurnIndicator, SlipBallPosition) + ExportScript.AF.FC_Russian_VVI_Old(6) + + -- Radar Altimeter (AltRad, MinAltitude, WarningFlag, MinAltitudeLamp) {"%.4f;%.4f;%.1f;%.1f"} (below 100m is warning light on) + ExportScript.AF.FC_Russian_RadarAltimeter_1500m(100) + + -- Barometric Altimeter (AltBar, BasicAtmospherePressure) + ExportScript.AF.FC_Russian_BarometricAltimeter_late() + + -- Tachometer (RPM) (EngineRPMleft, EngineRPMright) {"%.4f;%.4f"} + ExportScript.AF.FC_Russian_EngineRPM() + + -- Left Jet Engine Turbine Temperature Indicator (EngineTemp) {"%.4f"} + ExportScript.AF.FC_Russian_EGT_1000gc(lEngineTempLeft, 70) + + -- Right Jet Engine Turbine Temperature Indicator (EngineTemp) {"%.4f"} + ExportScript.AF.FC_Russian_EGT_1000gc(lEngineTempRight, 71) + + -- Clock from Ka-50 {CurrentHours, CurrentMinutes, CurrentSeconds, 0, FlightTimeHours, FlightTimeMinutes, 0, 0) {"%.4f;%.4f;%.4f;%.1f;%.4f;%.4f;%.4f;%.4f"} + ExportScript.AF.FC_Russian_Clock_late() - elseif gES_GlassCockpitType == 2 then - -- HawgTouch version 1.6 - - local lRadToDCSsignd = math.pi - local lRadToDCSunsignd = math.pi * 2 - local lDefaultNull = 0.0 - local lDefaultOne = 1.0 - - -- IAS-TAS Indicator (IAS, TAS) {"%.4f;%.4f"} - FC_Russian_AirSpeed_1100hkm(1) - - -- AOA Indicator and Accelerometer (AOA, GLoad) - FC_Russian_AOA_Su25(3) - - -- ADI - FC_Russian_ADI_Old(4) - - -- HSI - FC_Russian_HSI(lDistanceToWay, 5) - - -- Vertical Velocity Indicator (VVI) (VVI, TurnIndicator, SlipBallPosition) - FC_Russian_VVI_Old(6) - - -- Radar Altimeter (AltRad, MinAltitude, WarningFlag, MinAltitudeLamp) {"%.4f;%.4f;%.1f;%.1f"} (below 100m is warning light on) - FC_Russian_RadarAltimeter_1500m(100, 7) - - -- Barometric Altimeter (AltBar, BasicAtmospherePressure) - FC_Russian_BarometricAltimeter_late(8) - - -- Tachometer (RPM) (EngineRPMleft, EngineRPMright) {"%.4f;%.4f"} - FC_Russian_EngineRPM(9) - - -- Left Jet Engine Turbine Temperature Indicator (EngineTemp) {"%.4f"} - FC_Russian_EGT_1000gc(lEngineTempLeft, 10) - - -- Right Jet Engine Turbine Temperature Indicator (EngineTemp) {"%.4f"} - FC_Russian_EGT_1000gc(lEngineTempRight, 11) - - -- Clock from Ka-50 {CurrentHours, CurrentMinutes, CurrentSeconds, 0, FlightTimeHours, FlightTimeMinutes, 0, 0) {"%.4f;%.4f;%.4f;%.1f;%.4f;%.4f;%.4f;%.4f"} - FC_Russian_Clock_late(12) - end - else - --WriteToLog("Unknown FC Error, no LoGetSelfData.") - end - -end - -function ExportScript.ProcessDACConfigHighImportance() - local lFunctionTyp = "DAC" -- function type for shared function -end - -function ExportScript.ProcessIkarusFCLowImportanceConfig() - local lFunctionTyp = "Ikarus" -- function type for shared function - - ExportScript.AF.SPO15RWR(lFunctionTyp) + ExportScript.AF.EventNumberOLD = ExportScript.AF.EventNumber + else + --WriteToLog("Unknown FC Error, no LoGetSelfData.") + end +end + +function ExportScript.ProcessDACConfigHighImportance() + local lFunctionTyp = "DAC" -- function type for shared function +end + +function ExportScript.ProcessIkarusFCLowImportanceConfig() + local lFunctionTyp = "Ikarus" -- function type for shared function + -- Weapon Panel ExportScript.AF.WeaponPanel_SU25(lFunctionTyp) - - if gES_GlassCockpitType == 1 then - -- HELIOS Version 1.3 - - elseif gES_GlassCockpitType == 2 then - -- HawgTouch version 1.6 - - FC_WeaponPanel_SU25(13) - - FC_RadarWarning_SPO15(14) - - -- Fuel Quantity Indicator - local lEngineInfo = LoGetEngineInfo() - if lEngineInfo ~= nil then - --WriteToLog('lEngineInfo: '..dump(lEngineInfo)) - --[[ - [fuel_external] = number: "0" - [Temperature] = { - [left] = number: "626.99444580078" - [right] = number: "626.99444580078" - } - [RPM] = { - [left] = number: "87.453765869141" - [right] = number: "87.453758239746" - } - [FuelConsumption] = { - [left] = number: "0.1500396137767" - [right] = number: "0.1500396137767" - } - [fuel_internal] = number: "3773.2749023438" - [EngineStart] = { - [left] = number: "0" - [right] = number: "0" - } - [HydraulicPressure] = { - [left] = number: "210" - [right] = number: "210" - } - lPayloadInfo.Stations[8].CLSID == E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF -- ext 800l Fuel Tank - ]] - - local lTotalFuel = lEngineInfo.fuel_internal - --local lTotalFuel = string.format("%3d", math.round((lEngineInfo.fuel_internal / 10), 0, "ceil") * 10) - --local lTotalFuel = string.format("%4d", lEngineInfo.fuel_internal) -- total fuel in kg - --local lTotalFuel = string.format("%4d", lEngineInfo.fuel_external) -- external fuel in kg - local lFuelCounter = {[0] = 0.0, [1] = 0.11, [2] = 0.22, [3] = 0.33, [4] = 0.44, [5] = 0.55, [6] = 0.66, [7] = 0.77, [8] = 0.88, [9] = 0.99} - lTotalFuel = string.format("%03d", math.round((lEngineInfo.fuel_internal / 10), 0, "ceil")) -- auf drei stellen bringen - - local lExtTank1 = 1.0 -- external tanks - local lExtTank2 = 1.0 -- inner tanks - - local lPayloadInfo = LoGetPayloadInfo() - if lPayloadInfo ~= nil then - --WriteToLog('lPayloadInfo: '..dump(lPayloadInfo)) - if lPayloadInfo.Stations[10].CLSID == "{E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF}" or - lPayloadInfo.Stations[9].CLSID == "{E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF}" then -- external tanks presend and full (panel 6 and 5) - lExtTank1 = ((lEngineInfo.fuel_external < 1240.0 ) and 1.0 or 0.0) - end - if lPayloadInfo.Stations[5].CLSID == "{E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF}" or - lPayloadInfo.Stations[6].CLSID == "{E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF}" then-- inner tanks presend and full (panel 3 and 8) - lExtTank2 = ((lEngineInfo.fuel_external < 1.0 ) and 1.0 or 0.0) - end - end - -- TotalFuel_100 - -- TotalFuel_10 - -- TotalFuel_1 - -- Light1 - -- Light2 - -- Light3 - -- Light4 - -- Light5 - -- BingoLight - SendData("15", string.format("%0.2f;%0.2f;%0.2f;%d;%d;%d;%d;%d;%d", - lFuelCounter[tonumber(string.sub(lTotalFuel, 1, 1))], - lFuelCounter[tonumber(string.sub(lTotalFuel, 2, 2))], - lFuelCounter[tonumber(string.sub(lTotalFuel, 3, 3))], - lExtTank1, -- external tanks - lExtTank2, -- inner tanks - (lEngineInfo.fuel_internal < 2800.0 and 1 or 0), -- Interne Flügeltanks - (lEngineInfo.fuel_internal < 1840.0 and 1 or 0), -- Interne Rumpftanks - (lEngineInfo.fuel_internal < 1.0 and 1 or 0), -- Zentraler Rumpftanks - (lEngineInfo.fuel_internal < 600.0 and 1 or 0))) -- Bingo Fuel - - -- Hydraulic Pressure Left - FC_OneNeedleGauge(lEngineInfo.HydraulicPressure.left, 240, 17) - - -- Hydraulic Pressure Right - FC_OneNeedleGauge(lEngineInfo.HydraulicPressure.right, 240, 18) - end - - -- EKRAN Message - FC_EKRAN(16) - - -- Mechanical Configuration Indicator (GearWarningLight, NoseGear, LeftGear, RightGear, Airbreaks, Flaps1, Flaps2) {"%.1f;%d;%d;%d;%d;%d;%d"} - FC_Russian_MDI_SU25(2) - - local lMechInfo = LoGetMechInfo() -- mechanical components, e.g. Flaps, Wheelbrakes,... - if lMechInfo ~= nil then - -- Wheelbrakes Hydraulic Pressure Left - FC_OneNeedleGauge(lMechInfo.wheelbrakes.value, 240, 19) - - -- Wheelbrakes Hydraulic Pressure Right - FC_OneNeedleGauge(lMechInfo.wheelbrakes.value, 240, 20) - end - end - - --(x < 0 and 'negative' or 'non-negative') - --[[ - local lPayloadInfo = LoGetPayloadInfo() - WriteToLog('lPayloadInfo: '..dump(lPayloadInfo)) - - local lSnares = LoGetSnares() -- Flare and Chaff - WriteToLog('lSnares: '..dump(lSnares)) - - local lSightingSystemInfo = LoGetSightingSystemInfo() - WriteToLog('lSightingSystemInfo: '..dump(lSightingSystemInfo)) - - local lTWSInfo = LoGetTWSInfo() -- SPO Informationen, z.B. Radarwarner F15C - WriteToLog('lTWSInfo: '..dump(lTWSInfo)) - - local lTargetInformation = LoGetTargetInformation() -- detalierte Radar Infos z.B. F15C - WriteToLog('lTargetInformation: '..dump(lTargetInformation)) - - local lLockedTargetInformation = LoGetLockedTargetInformation() - WriteToLog('lLockedTargetInformation: '..dump(lLockedTargetInformation)) - - local lF15_TWS_Contacs = LoGetF15_TWS_Contacts() -- the same information but only for F-15 in TWS mode - WriteToLog('lF15_TWS_Contacs: '..dump(lF15_TWS_Contacs)) - - local lMechInfo = LoGetMechInfo() -- mechanical components, e.g. Flaps, Wheelbrakes,... - WriteToLog('lMechInfo: '..dump(lMechInfo)) - - local lMCPState = LoGetMCPState() -- Warnlichter - WriteToLog('lMCPState: '..dump(lMCPState)) - - local lControlPanel_HSI = LoGetControlPanel_HSI() - WriteToLog('lControlPanel_HSI: '..dump(lControlPanel_HSI)) - - local lRadioBeaconsStatus = LoGetRadioBeaconsStatus() - WriteToLog('lRadioBeaconsStatus: '..dump(lRadioBeaconsStatus)) - - local lEngineInfo = LoGetEngineInfo() - WriteToLog('lEngineInfo: '..dump(lEngineInfo)) - ]] - -- Weapon Control System - --local lNameByType = LoGetNameByType () -- args 4 (number : level1,level2,level3,level4), result string - -- values from LoGetTargetInformation().type - --WriteToLog('lNameByType: '..dump(lNameByType)) -end - -function ExportScript.ProcessDACConfigLowImportance() - local lFunctionTyp = "DAC" -- function type for shared function --- WeaponStatusPanel() --- MechanicalDevicesIndicator() --- StatusLamp() --- FuelQuantityIndicator() --- SightingSystem() --- SPO15RWR() -end - ------------------------------ --- Custom functions -- ------------------------------ - -function SightingSystem(hardware) - local lHardware = hardware or 1 - local lSightingSystemInfo = LoGetSightingSystemInfo() - if lSightingSystemInfo == nil then - return - end - --WriteToLog('lSightingSystemInfo: '..dump(lSightingSystemInfo)9 - --[[ - [PRF] = { - [selection] = string: "ILV" - [current] = string: "MED" - } - [laser_on] = boolean: "false" - [scale] = { - [azimuth] = number: "0.52359873056412" - [distance] = number: "10000" - } - [radar_on] = boolean: "false" - [optical_system_on] = boolean: "false" - [LaunchAuthorized] = boolean: "false" - [ECM_on] = boolean: "false" - [Manufacturer] = string: "RUS" - [TDC] = { - [y] = number: "0" - [x] = number: "0" - } - [ScanZone] = { - [coverage_H] = { - [min] = number: "0" - [max] = number: "20000" - } - [size] = { - [azimuth] = number: "1.0471974611282" - [elevation] = number: "0.17453290522099" - } - [position] = { - [exceeding_manual] = number: "0" - [distance_manual] = number: "0" - [azimuth] = number: "0" - [elevation] = number: "0" - } - } - ]] - SendDataHW("600", lSightingSystemInfo.ECM_on == true and 1 or 0, lHardware ) - SendDataHW("601", lSightingSystemInfo.laser_on == true and 1 or 0, lHardware ) - SendDataHW("602", lSightingSystemInfo.optical_system_on == true and 1 or 0, lHardware ) - SendDataHW("603", lSightingSystemInfo.LaunchAuthorized == true and 1 or 0, lHardware ) - --SendDataHW("604", lSightingSystemInfo.radar_on == true and 1 or 0, lHardware ) -end - -function FlareChaff(hardware) - local lHardware = hardware or 1 - local lSnares = LoGetSnares() -- Flare and Chaff - if lSnares == nil then - return - end - --WriteToLog('lSnares: '..dump(lSnares)) - - --[chaff] = number: "128" - --[flare] = number: "128" -end - -function StatusLamp(hardware) - local lHardware = hardware or 1 - local lMCPState = LoGetMCPState() -- Warning Lights - if lMCPState == nil then - return - end - --WriteToLog('lMCPState: '..dump(lMCPState)) - --[[ - [RightTailPlaneFailure] = boolean: "false" - [EOSFailure] = boolean: "false" - [ECMFailure] = boolean: "false" - [RightAileronFailure] = boolean: "false" - [MasterWarning] = boolean: "false" - [RightEngineFailure] = boolean: "false" - [CannonFailure] = boolean: "false" - [MLWSFailure] = boolean: "false" - [ACSFailure] = boolean: "false" - [RadarFailure] = boolean: "false" - [HelmetFailure] = boolean: "false" - [HUDFailure] = boolean: "false" - [LeftMainPumpFailure] = boolean: "false" - [RightWingPumpFailure] = boolean: "false" - [LeftWingPumpFailure] = boolean: "false" - [MFDFailure] = boolean: "false" - [RWSFailure] = boolean: "false" - [GearFailure] = boolean: "false" - [HydraulicsFailure] = boolean: "false" - [AutopilotFailure] = boolean: "true" - [FuelTankDamage] = boolean: "false" - [LeftAileronFailure] = boolean: "false" - [CanopyOpen] = boolean: "false" - [RightMainPumpFailure] = boolean: "false" - [StallSignalization] = boolean: "false" - [LeftEngineFailure] = boolean: "false" - [AutopilotOn] = boolean: "false" - [LeftTailPlaneFailure] = boolean: "false" - ]] - - SendDataHW("700", lMCPState.LeftTailPlaneFailure == true and 1 or 0, lHardware ) - SendDataHW("701", lMCPState.RightTailPlaneFailure == true and 1 or 0, lHardware ) - SendDataHW("702", lMCPState.MasterWarning == true and 1 or 0, lHardware ) - SendDataHW("703", lMCPState.LeftEngineFailure == true and 1 or 0, lHardware ) - SendDataHW("704", lMCPState.RightEngineFailure == true and 1 or 0, lHardware ) - SendDataHW("705", lMCPState.LeftAileronFailure == true and 1 or 0, lHardware ) - SendDataHW("706", lMCPState.RightAileronFailure == true and 1 or 0, lHardware ) - SendDataHW("707", lMCPState.LeftMainPumpFailure == true and 1 or 0, lHardware ) - SendDataHW("708", lMCPState.RightMainPumpFailure == true and 1 or 0, lHardware ) - SendDataHW("709", lMCPState.LeftWingPumpFailure == true and 1 or 0, lHardware ) - SendDataHW("710", lMCPState.RightWingPumpFailure == true and 1 or 0, lHardware ) - SendDataHW("711", lMCPState.EOSFailure == true and 1 or 0, lHardware ) - SendDataHW("712", lMCPState.ECMFailure == true and 1 or 0, lHardware ) - SendDataHW("713", lMCPState.CannonFailure == true and 1 or 0, lHardware ) - SendDataHW("714", lMCPState.MLWSFailure == true and 1 or 0, lHardware ) - SendDataHW("715", lMCPState.ACSFailure == true and 1 or 0, lHardware ) - SendDataHW("716", lMCPState.RadarFailure == true and 1 or 0, lHardware ) - SendDataHW("717", lMCPState.HelmetFailure == true and 1 or 0, lHardware ) - SendDataHW("718", lMCPState.HUDFailure == true and 1 or 0, lHardware ) - SendDataHW("719", lMCPState.MFDFailure == true and 1 or 0, lHardware ) - SendDataHW("720", lMCPState.RWSFailure == true and 1 or 0, lHardware ) - SendDataHW("721", lMCPState.GearFailure == true and 1 or 0, lHardware ) - SendDataHW("722", lMCPState.HydraulicsFailure == true and 1 or 0, lHardware ) - SendDataHW("723", lMCPState.AutopilotFailure == true and 1 or 0, lHardware ) - SendDataHW("724", lMCPState.FuelTankDamage == true and 1 or 0, lHardware ) - SendDataHW("725", lMCPState.CanopyOpen == true and 1 or 0, lHardware ) - SendDataHW("726", lMCPState.StallSignalization == true and 1 or 0, lHardware ) - SendDataHW("727", lMCPState.AutopilotOn == true and 1 or 0, lHardware ) - - local lEngineInfo = LoGetEngineInfo() - if lEngineInfo ~= nil then - --WriteToLog('lEngineInfo: '..dump(lEngineInfo)) - SendDataHW("728", lEngineInfo.EngineStart.left, lHardware ) -- lamp start left engine 1 (0|1) - SendDataHW("729", lEngineInfo.EngineStart.right, lHardware ) -- lamp start right engine 1 (0|1) - end - - local lAoA = LoGetAngleOfAttack() - if lAoA ~= nil then - lAoA = lAoA * 57.3 - SendDataHW("730", (lAoA > 20.0 and 1 or 0), lHardware ) -- lamp start AOA warning (0|1) - end -end - -function WeaponStatusPanel(hardware) --- The weapon status panel, quantity and readiness of the currently selected weapon and the remaining gun ammunition are indicated. - local lHardware = hardware or 1 - gES_PayloadInfo = LoGetPayloadInfo() - if gES_PayloadInfo == nil then - return - end - --WriteToLog('gES_PayloadInfo: '..dump(gES_PayloadInfo)) - --[[ exsample - [Stations] = { - [1] = { - [CLSID] = string: "{682A481F-0CB5-4693-A382-D00DD4A156D7}" - [container] = boolean: "false" - [count] = number: "1" - [weapon] = { - [level3] = number: "7" - [level1] = number: "4" - [level4] = number: "10" - [level2] = number: "4" - } - } - [2] = { - [CLSID] = string: "{682A481F-0CB5-4693-A382-D00DD4A156D7}" - [container] = boolean: "false" - [count] = number: "1" - [weapon] = { - [level3] = number: "7" - [level1] = number: "4" - [level4] = number: "10" - [level2] = number: "4" - } - } - [3] = { - [wstype] = { - [level3] = number: "32" - [level1] = number: "4" - [level4] = number: "6" - [level2] = number: "7" - } - [count] = number: "20" - [CLSID] = string: "{F72F47E5-C83A-4B85-96ED-D3E46671EE9A}" - [adapter] = { - [level3] = number: "0" - [level1] = number: "0" - [level4] = number: "0" - [level2] = number: "0" - } - [container] = boolean: "true" - [weapon] = { - [level3] = number: "33" - [level1] = number: "4" - [level4] = number: "32" - [level2] = number: "7" - } - } - [4] = { - [wstype] = { - [level3] = number: "32" - [level1] = number: "4" - [level4] = number: "6" - [level2] = number: "7" - } - [count] = number: "20" - [CLSID] = string: "{F72F47E5-C83A-4B85-96ED-D3E46671EE9A}" - [adapter] = { - [level3] = number: "0" - [level1] = number: "0" - [level4] = number: "0" - [level2] = number: "0" - } - [container] = boolean: "true" - [weapon] = { - [level3] = number: "33" - [level1] = number: "4" - [level4] = number: "32" - [level2] = number: "7" - } - } - [5] = { - [wstype] = { - [level3] = number: "32" - [level1] = number: "4" - [level4] = number: "99" - [level2] = number: "4" - } - [count] = number: "1" - [CLSID] = string: "{79D73885-0801-45a9-917F-C90FE1CE3DFC}" - [adapter] = { - [level3] = number: "0" - [level1] = number: "0" - [level4] = number: "0" - [level2] = number: "0" - } - [container] = boolean: "true" - [weapon] = { - [level3] = number: "8" - [level1] = number: "4" - [level4] = number: "45" - [level2] = number: "4" - } - } - [6] = { - [wstype] = { - [level3] = number: "32" - [level1] = number: "4" - [level4] = number: "99" - [level2] = number: "4" - } - [count] = number: "1" - [CLSID] = string: "{79D73885-0801-45a9-917F-C90FE1CE3DFC}" - [adapter] = { - [level3] = number: "0" - [level1] = number: "0" - [level4] = number: "0" - [level2] = number: "0" - } - [container] = boolean: "true" - [weapon] = { - [level3] = number: "8" - [level1] = number: "4" - [level4] = number: "45" - [level2] = number: "4" - } - } - [7] = { - [wstype] = { - [level3] = number: "32" - [level1] = number: "4" - [level4] = number: "47" - [level2] = number: "4" - } - [count] = number: "8" - [CLSID] = string: "{F789E86A-EE2E-4E6B-B81E-D5E5F903B6ED}" - [adapter] = { - [level3] = number: "0" - [level1] = number: "0" - [level4] = number: "0" - [level2] = number: "0" - } - [container] = boolean: "true" - [weapon] = { - [level3] = number: "8" - [level1] = number: "4" - [level4] = number: "58" - [level2] = number: "4" - } - } - [8] = { - [wstype] = { - [level3] = number: "32" - [level1] = number: "4" - [level4] = number: "47" - [level2] = number: "4" - } - [count] = number: "8" - [CLSID] = string: "{F789E86A-EE2E-4E6B-B81E-D5E5F903B6ED}" - [adapter] = { - [level3] = number: "0" - [level1] = number: "0" - [level4] = number: "0" - [level2] = number: "0" - } - [container] = boolean: "true" - [weapon] = { - [level3] = number: "8" - [level1] = number: "4" - [level4] = number: "58" - [level2] = number: "4" - } - } - [9] = { - [CLSID] = string: "{D5435F26-F120-4FA3-9867-34ACE562EF1B}" - [container] = boolean: "false" - [count] = number: "1" - [weapon] = { - [level3] = number: "38" - [level1] = number: "4" - [level4] = number: "20" - [level2] = number: "5" - } - } - [10] = { - [CLSID] = string: "{D5435F26-F120-4FA3-9867-34ACE562EF1B}" - [container] = boolean: "false" - [count] = number: "1" - [weapon] = { - [level3] = number: "38" - [level1] = number: "4" - [level4] = number: "20" - [level2] = number: "5" - } - } - [11] = { - [CLSID] = string: "" - [container] = boolean: "false" - [count] = number: "0" - [weapon] = { - [level3] = number: "0" - [level1] = number: "0" - [level4] = number: "0" - [level2] = number: "0" - } - } - } - [CurrentStation] = number: "0" - [Cannon] = { - [shells] = number: "250" - } - ]] - --[[ - Weapon Panel - | - --------------------------------------------------- - | | | | | | | | | | | - 1 2 3 4 5 C 6 7 8 9 10 - ]] - -- Payload Info - -- weapon stations (panel) 1 (left) - 10 (right), no lamp for center station - SendDataHW("100", gES_PayloadInfo.Cannon.shells, lHardware ) -- count cannon shells - SendDataHW("101", (gES_PayloadInfo.Stations[1].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 1) - SendDataHW("110", (gES_PayloadInfo.Stations[2].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 10) - SendDataHW("102", (gES_PayloadInfo.Stations[3].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 2) - SendDataHW("109", (gES_PayloadInfo.Stations[4].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 9) - SendDataHW("103", (gES_PayloadInfo.Stations[5].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 3) - SendDataHW("108", (gES_PayloadInfo.Stations[6].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 8) - SendDataHW("104", (gES_PayloadInfo.Stations[7].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 4) - SendDataHW("107", (gES_PayloadInfo.Stations[8].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 7) - SendDataHW("105", (gES_PayloadInfo.Stations[9].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 5) - SendDataHW("106", (gES_PayloadInfo.Stations[10].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 6) - --SendDataHW("110", (gES_PayloadInfo.Stations[11].count > 0 and 1 or 0) ) -- weapon presend > 0 center station, not visible - --SendDataHW("CurrentStation", gES_PayloadInfo.CurrentStation, lHardware ) - -- air-to-air missils panel 1 and 11, air combat modus, CurrentStation = 1, panel 1 and 11 on - -- CurrentStation 5, panel 3 - -- CurrentStation 3, panel 2 - -- CurrentStation 7, panel 4 - -- CurrentStation 4, panel 9 - -- CurrentStation 9, panel 5 - -- CurrentStation 10, panel 6 - -- CurrentStation 8, panel 7 - -- CurrentStation 6, panel 8 - -- wenn die Waffenstationen gleichmässig belegt sind, hat bei Auswahl CurrentStation immer den Wert der linken Station - -- bei ungleichmäßiger Belegung, hat CurrentStation immer den Wert der jeweiligen Station - -- Waffenbezeichnung als UUID, gES_PayloadInfo.Stations[X].CLSID - - -- defination - if gES_CurrentStationTmp == nil then - gES_CurrentStationTmp = -1 - end - - if gES_PayloadInfo.CurrentStation > 0 and - gES_CurrentStationTmp ~= gES_PayloadInfo.CurrentStation then - gES_CurrentStationTmp = gES_PayloadInfo.CurrentStation - - gES_TmpStationToPanel = {} - gES_TmpStationToPanel[1] = {Panel = 1, StationID = 101, CurrentID = 201, HardwareID = lHardware } -- left - gES_TmpStationToPanel[2] = {Panel = 10, StationID = 110, CurrentID = 210, HardwareID = lHardware } -- right - gES_TmpStationToPanel[3] = {Panel = 2, StationID = 102, CurrentID = 202, HardwareID = lHardware } - gES_TmpStationToPanel[4] = {Panel = 9, StationID = 109, CurrentID = 209, HardwareID = lHardware } - gES_TmpStationToPanel[5] = {Panel = 3, StationID = 103, CurrentID = 203, HardwareID = lHardware } - gES_TmpStationToPanel[6] = {Panel = 8, StationID = 108, CurrentID = 208, HardwareID = lHardware } - gES_TmpStationToPanel[7] = {Panel = 4, StationID = 104, CurrentID = 204, HardwareID = lHardware } - gES_TmpStationToPanel[8] = {Panel = 7, StationID = 107, CurrentID = 207, HardwareID = lHardware } - gES_TmpStationToPanel[9] = {Panel = 5, StationID = 105, CurrentID = 205, HardwareID = lHardware } - gES_TmpStationToPanel[10] = {Panel = 6, StationID = 106, CurrentID = 206, HardwareID = lHardware } - - WeaponStatusPanel_Reset(201, 210, lHardware) - - if gES_TmpStationToPanel[gES_PayloadInfo.CurrentStation] ~= nil then - SendDataHW(gES_TmpStationToPanel[gES_PayloadInfo.CurrentStation].CurrentID, 1, lHardware ) -- eigentliche Auswahl - - table.foreach(gES_PayloadInfo.Stations, WeaponStatusPanel_selectCurrentPayloadStation) -- zugehörige Stationen - end - end -end - -function FuelQuantityIndicator(hardware) --- Fuel quantity shows the fuel remaining in all tanks - local lHardware = hardware or 1 - local lEngineInfo = LoGetEngineInfo() - if lEngineInfo == nil then - return - end - --WriteToLog('lEngineInfo: '..dump(lEngineInfo)) - --[[ - [fuel_external] = number: "0" - [Temperature] = { - [left] = number: "626.99444580078" - [right] = number: "626.99444580078" - } - [RPM] = { - [left] = number: "87.453765869141" - [right] = number: "87.453758239746" - } - [FuelConsumption] = { - [left] = number: "0.1500396137767" - [right] = number: "0.1500396137767" - } - [fuel_internal] = number: "3773.2749023438" - [EngineStart] = { - [left] = number: "0" - [right] = number: "0" - } - [HydraulicPressure] = { - [left] = number: "210" - [right] = number: "210" - } - lPayloadInfo.Stations[8].CLSID == E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF -- ext 800l Fuel Tank - ]] - - SendDataHW("300", string.format("%d", math.round((lEngineInfo.fuel_internal / 10), 0, "ceil") * 10), lHardware ) -- total fuel in kg - --SendDataHW("301", string.format("%d", lEngineInfo.fuel_internal)) -- total fuel in kg - --SendDataHW("302", string.format("%d", lEngineInfo.fuel_external)) -- external fuel in kg - - local lPayloadInfo = LoGetPayloadInfo() - if lPayloadInfo ~= nil then - --WriteToLog('lPayloadInfo: '..dump(lPayloadInfo)) - if lPayloadInfo.Stations[10].CLSID == "{E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF}" or - lPayloadInfo.Stations[9].CLSID == "{E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF}" then -- external tanks presend and full (panel 6 and 5) - SendDataHW("303", ((lEngineInfo.fuel_external < 1240.0 ) and 1 or 0), lHardware ) - else - SendDataHW("303", 1, lHardware ) - end - if lPayloadInfo.Stations[5].CLSID == "{E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF}" or - lPayloadInfo.Stations[6].CLSID == "{E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF}" then-- inner tank presend and full (panel 3 and 8) - SendDataHW("304", ((lEngineInfo.fuel_external < 1.0 ) and 1 or 0), lHardware ) - else - SendDataHW("304", 1, lHardware ) - end - else - SendDataHW("303", 1, lHardware ) - SendDataHW("304", 1, lHardware ) - end - SendDataHW("305", (lEngineInfo.fuel_internal < 2800.0 and 1 or 0), lHardware ) -- Interne Flügeltanks - SendDataHW("306", (lEngineInfo.fuel_internal < 1840.0 and 1 or 0), lHardware ) -- Interne Rumpftanks - SendDataHW("307", (lEngineInfo.fuel_internal < 1.0 and 1 or 0), lHardware ) -- Zentraler Rumpftanks - SendDataHW("308", (lEngineInfo.fuel_internal < 600.0 and 1 or 0), lHardware ) -- Bingo Fuel - -end - -function MechanicalDevicesIndicator(hardware) --- The mechanical devices indicator shows the position of the landing gear, flaps, leading edge flaps and airbrake - local lHardware = hardware or 1 - local lMechInfo = LoGetMechInfo() -- mechanical components, e.g. Flaps, Wheelbrakes,... - if lMechInfo == nil then - return - end - --[[ - [hook] = { - [status] = number: "0" - [value] = number: "0" - } - [parachute] = { - [status] = number: "0" - [value] = number: "0" - } - [controlsurfaces] = { - [eleron] = { - [left] = number: "0" - [right] = number: "-0.21084336936474" - } - [elevator] = { - [left] = number: "-0" - [right] = number: "-0" - } - [rudder] = { - [left] = number: "0" - [right] = number: "0" - } - } - [airintake] = { - [status] = number: "0" - [value] = number: "0" - } - [canopy] = { - [status] = number: "0" - [value] = number: "0" - } - [refuelingboom] = { - [status] = number: "0" - [value] = number: "0" - } - [wing] = { - [status] = number: "0" - [value] = number: "0" - } - [noseflap] = { - [status] = number: "0" - [value] = number: "0" - } - [gear] = { - [value] = number: "0" - [nose] = { - [rod] = number: "0" - } - [main] = { - [left] = { - [rod] = number: "0" - } - [right] = { - [rod] = number: "0" - } - } - [status] = number: "0" - } - [speedbrakes] = { - [status] = number: "0" - [value] = number: "0" - } - [wheelbrakes] = { - [status] = number: "0" - [value] = number: "0" - } - [flaps] = { - [status] = number: "0" - [value] = number: "0" - }]] - --SendDataHW("500", lMechInfo.gear.status ) - --SendDataHW("501", lMechInfo.gear.value ) - --SendDataHW("502", lMechInfo.gear.nose.rod ) -- zeigt an wie weit das Fahrwerk einsackt wenn das Flugzeug auf dem Boden ist - --SendDataHW("503", lMechInfo.gear.main.left.rod ) -- zeigt an wie weit das Fahrwerk einsackt wenn das Flugzeug auf dem Boden ist - --SendDataHW("504", lMechInfo.gear.main.right.rod ) -- zeigt an wie weit das Fahrwerk einsackt wenn das Flugzeug auf dem Boden ist - --SendDataHW("500", ((lMechInfo.gear.status == 1 and lMechInfo.gear.value < 1) and 1 or 0 ) ) -- gear warning light, go up - --SendDataHW("500", ((lMechInfo.gear.status == 0 and lMechInfo.gear.value > 0) and 1 or 0 ) ) -- gear warning light, go down - SendDataHW("500", (((lMechInfo.gear.status == 1 and lMechInfo.gear.value < 1) or (lMechInfo.gear.status == 0 and lMechInfo.gear.value > 0)) and 1 or 0 ), lHardware ) -- gear warning light - SendDataHW("501", (lMechInfo.gear.value > 0.85 and 1 or 0), lHardware ) -- nose gear - SendDataHW("502", (lMechInfo.gear.value > 0.95 and 1 or 0), lHardware ) -- left gear - SendDataHW("503", (lMechInfo.gear.value == 1 and 1 or 0), lHardware ) -- right gear - - --SendDataHW("510", lMechInfo.speedbrakes.status ) -- speedbreakes on 1 (0|1) - SendDataHW("510", (lMechInfo.speedbrakes.value > 0.1 and 1 or 0), lHardware ) -- speedbreakes on > 0.1 (0 - 1) - - --SendDataHW("520", lMechInfo.wheelbrakes.status, lHardware ) -- not in use - --SendDataHW("521", lMechInfo.wheelbrakes.value, lHardware ) -- not in use - - local lTrueAirSpeed = LoGetTrueAirSpeed() - --SendDataHW("530", lMechInfo.flaps.status ) -- flap switch off 0, 1. position 1, 2. position 2 (0|1|2) - --SendDataHW("531", lMechInfo.flaps.value ) -- flap 1. position > 0.25, 2. position > 0.93 (0 - 1) - SendDataHW("531", (lMechInfo.flaps.value > 0.25 and 1 or 0), lHardware ) -- flap 1. position - SendDataHW("532", (lMechInfo.flaps.value > 0.93 and 1 or 0), lHardware ) -- flap 2. position - SendDataHW("533", ((lMechInfo.flaps.value > 0.93 and lTrueAirSpeed > 340) and 1 or 0), lHardware ) -- Speed Warning for Flaps, same light as gear warning light, but blinking light -end + + -- SPO15 Radar Warning Reciver + ExportScript.AF.SPO15RWR(lFunctionTyp) + + -- EKRAN Message + ExportScript.AF.FC_EKRAN() + + -- Mechanical Configuration Indicator (GearWarningLight, NoseGear, LeftGear, RightGear, Airbreaks, Flaps1, Flaps2) + ExportScript.AF.FC_Russian_MDI_SU25(lFunctionTyp) + + -- Fuel Quantity Indicator + local lEngineInfo = LoGetEngineInfo() + if lEngineInfo ~= nil then + -- ExportScript.Tools.WriteToLog('lEngineInfo: '..ExportScript.Tools.dump(lEngineInfo)) + --[[ + [fuel_external] = number: "0" + [Temperature] = { + [left] = number: "626.99444580078" + [right] = number: "626.99444580078" + } + [RPM] = { + [left] = number: "87.453765869141" + [right] = number: "87.453758239746" + } + [FuelConsumption] = { + [left] = number: "0.1500396137767" + [right] = number: "0.1500396137767" + } + [fuel_internal] = number: "3773.2749023438" + [EngineStart] = { + [left] = number: "0" + [right] = number: "0" + } + [HydraulicPressure] = { + [left] = number: "210" + [right] = number: "210" + } + lPayloadInfo.Stations[8].CLSID == E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF -- ext 800l Fuel Tank + ]] + + local lTotalFuel = lEngineInfo.fuel_internal + --local lTotalFuel = string.format("%3d", ExportScript.Tools.round((lEngineInfo.fuel_internal / 10), 0, "ceil") * 10) + --local lTotalFuel = string.format("%4d", lEngineInfo.fuel_internal) -- total fuel in kg + --local lTotalFuel = string.format("%4d", lEngineInfo.fuel_external) -- external fuel in kg + local lFuelCounter = {[0] = 0.0, [1] = 0.11, [2] = 0.22, [3] = 0.33, [4] = 0.44, [5] = 0.55, [6] = 0.66, [7] = 0.77, [8] = 0.88, [9] = 0.99} + lTotalFuel = string.format("%03d", ExportScript.Tools.round((lEngineInfo.fuel_internal / 10), 0, "ceil")) -- auf drei stellen bringen + + local lExtTank1 = 1.0 -- external tanks + local lExtTank2 = 1.0 -- inner tanks + + local lPayloadInfo = LoGetPayloadInfo() + if lPayloadInfo ~= nil then + --ExportScript.Tools.WriteToLog('lPayloadInfo: '..ExportScript.Tools.dump(lPayloadInfo)) + if lPayloadInfo.Stations[10].CLSID == "{E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF}" or + lPayloadInfo.Stations[9].CLSID == "{E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF}" then -- external tanks presend and full (panel 6 and 5) + lExtTank1 = ((lEngineInfo.fuel_external < 1240.0 ) and 1.0 or 0.0) + end + if lPayloadInfo.Stations[5].CLSID == "{E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF}" or + lPayloadInfo.Stations[6].CLSID == "{E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF}" then-- inner tanks presend and full (panel 3 and 8) + lExtTank2 = ((lEngineInfo.fuel_external < 1.0 ) and 1.0 or 0.0) + end + end + -- TotalFuel_100 + -- TotalFuel_10 + -- TotalFuel_1 + -- Light1 + -- Light2 + -- Light3 + -- Light4 + -- Light5 + -- BingoLight + --[[SendData("15", string.format("%0.2f;%0.2f;%0.2f;%d;%d;%d;%d;%d;%d", + lFuelCounter[tonumber(string.sub(lTotalFuel, 1, 1))], + lFuelCounter[tonumber(string.sub(lTotalFuel, 2, 2))], + lFuelCounter[tonumber(string.sub(lTotalFuel, 3, 3))], + lExtTank1, -- external tanks + lExtTank2, -- inner tanks + (lEngineInfo.fuel_internal < 2800.0 and 1 or 0), -- Interne Flügeltanks + (lEngineInfo.fuel_internal < 1840.0 and 1 or 0), -- Interne Rumpftanks + (lEngineInfo.fuel_internal < 1.0 and 1 or 0), -- Zentraler Rumpftanks + (lEngineInfo.fuel_internal < 600.0 and 1 or 0))) -- Bingo Fuel]] + + ExportScript.Tools.SendData(300, string.format("%0.2f", lFuelCounter[tonumber(string.sub(lTotalFuel, 1, 1))])) + ExportScript.Tools.SendData(301, string.format("%0.2f", lFuelCounter[tonumber(string.sub(lTotalFuel, 2, 2))])) + ExportScript.Tools.SendData(302, string.format("%0.2f", lFuelCounter[tonumber(string.sub(lTotalFuel, 3, 3))])) + ExportScript.Tools.SendData(303, lExtTank1) -- external tanks + ExportScript.Tools.SendData(304, lExtTank2) -- inner tanks + ExportScript.Tools.SendData(305, (lEngineInfo.fuel_internal < 2800.0 and 1 or 0)) -- inner wing tank + ExportScript.Tools.SendData(306, (lEngineInfo.fuel_internal < 1840.0 and 1 or 0)) -- inner hull tank + ExportScript.Tools.SendData(307, (lEngineInfo.fuel_internal < 1.0 and 1 or 0)) -- central hull tank + ExportScript.Tools.SendData(308, (lEngineInfo.fuel_internal < 600.0 and 1 or 0)) -- Bingo Fuel + + -- Hydraulic Pressure Left + ExportScript.AF.FC_OneNeedleGauge(lEngineInfo.HydraulicPressure.left, 240, 85) + + -- Hydraulic Pressure Right + ExportScript.AF.FC_OneNeedleGauge(lEngineInfo.HydraulicPressure.right, 240, 86) + end + + local lMechInfo = LoGetMechInfo() -- mechanical components, e.g. Flaps, Wheelbrakes,... + if lMechInfo ~= nil then + -- Wheelbrakes Hydraulic Pressure Left + ExportScript.AF.FC_OneNeedleGauge(lMechInfo.wheelbrakes.value, 240, 87) + + -- Wheelbrakes Hydraulic Pressure Right + ExportScript.AF.FC_OneNeedleGauge(lMechInfo.wheelbrakes.value, 240, 88) + end + + ExportScript.AF.EventNumberOLD = ExportScript.AF.EventNumber + + -- (x < 0 and 'negative' or 'non-negative') + --[[ + local lPayloadInfo = LoGetPayloadInfo() + ExportScript.Tools.WriteToLog('lPayloadInfo: '..ExportScript.Tools.dump(lPayloadInfo)) + + local lSnares = LoGetSnares() -- Flare and Chaff + ExportScript.Tools.WriteToLog('lSnares: '..ExportScript.Tools.dump(lSnares)) + + local lSightingSystemInfo = LoGetSightingSystemInfo() + ExportScript.Tools.WriteToLog('lSightingSystemInfo: '..ExportScript.Tools.dump(lSightingSystemInfo)) + + local lTWSInfo = LoGetTWSInfo() -- SPO Informationen, z.B. Radarwarner F15C + ExportScript.Tools.WriteToLog('lTWSInfo: '..ExportScript.Tools.dump(lTWSInfo)) + + local lTargetInformation = LoGetTargetInformation() -- detalierte Radar Infos z.B. F15C + ExportScript.Tools.WriteToLog('lTargetInformation: '..ExportScript.Tools.dump(lTargetInformation)) + + local lLockedTargetInformation = LoGetLockedTargetInformation() + ExportScript.Tools.WriteToLog('lLockedTargetInformation: '..ExportScript.Tools.dump(lLockedTargetInformation)) + + local lF15_TWS_Contacs = LoGetF15_TWS_Contacts() -- the same information but only for F-15 in TWS mode + ExportScript.Tools.WriteToLog('lF15_TWS_Contacs: '..ExportScript.Tools.dump(lF15_TWS_Contacs)) + + local lMechInfo = LoGetMechInfo() -- mechanical components, e.g. Flaps, Wheelbrakes,... + ExportScript.Tools.WriteToLog('lMechInfo: '..ExportScript.Tools.dump(lMechInfo)) + + local lMCPState = LoGetMCPState() -- Warnlichter + ExportScript.Tools.WriteToLog('lMCPState: '..ExportScript.Tools.dump(lMCPState)) + + local lControlPanel_HSI = LoGetControlPanel_HSI() + ExportScript.Tools.WriteToLog('lControlPanel_HSI: '..ExportScript.Tools.dump(lControlPanel_HSI)) + + local lRadioBeaconsStatus = LoGetRadioBeaconsStatus() + ExportScript.Tools.WriteToLog('lRadioBeaconsStatus: '..ExportScript.Tools.dump(lRadioBeaconsStatus)) + + local lEngineInfo = LoGetEngineInfo() + ExportScript.Tools.WriteToLog('lEngineInfo: '..ExportScript.Tools.dump(lEngineInfo)) + ]] + -- Weapon Control System + -- local lNameByType = LoGetNameByType () -- args 4 (number : level1,level2,level3,level4), result string + -- values from LoGetTargetInformation().type + -- ExportScript.Tools.WriteToLog('lNameByType: '..ExportScript.Tools.dump(lNameByType)) +end + +function ExportScript.ProcessDACConfigLowImportance() + local lFunctionTyp = "DAC" -- function type for shared function +-- WeaponStatusPanel() +-- MechanicalDevicesIndicator() +-- StatusLamp() +-- FuelQuantityIndicator() +-- SightingSystem() +-- SPO15RWR() +end + +----------------------------- +-- Custom functions -- +----------------------------- + +function SightingSystem(hardware) + local lHardware = hardware or 1 + local lSightingSystemInfo = LoGetSightingSystemInfo() + if lSightingSystemInfo == nil then + return + end + --WriteToLog('lSightingSystemInfo: '..dump(lSightingSystemInfo)9 + --[[ + [PRF] = { + [selection] = string: "ILV" + [current] = string: "MED" + } + [laser_on] = boolean: "false" + [scale] = { + [azimuth] = number: "0.52359873056412" + [distance] = number: "10000" + } + [radar_on] = boolean: "false" + [optical_system_on] = boolean: "false" + [LaunchAuthorized] = boolean: "false" + [ECM_on] = boolean: "false" + [Manufacturer] = string: "RUS" + [TDC] = { + [y] = number: "0" + [x] = number: "0" + } + [ScanZone] = { + [coverage_H] = { + [min] = number: "0" + [max] = number: "20000" + } + [size] = { + [azimuth] = number: "1.0471974611282" + [elevation] = number: "0.17453290522099" + } + [position] = { + [exceeding_manual] = number: "0" + [distance_manual] = number: "0" + [azimuth] = number: "0" + [elevation] = number: "0" + } + } + ]] + SendDataHW("600", lSightingSystemInfo.ECM_on == true and 1 or 0, lHardware ) + SendDataHW("601", lSightingSystemInfo.laser_on == true and 1 or 0, lHardware ) + SendDataHW("602", lSightingSystemInfo.optical_system_on == true and 1 or 0, lHardware ) + SendDataHW("603", lSightingSystemInfo.LaunchAuthorized == true and 1 or 0, lHardware ) + --SendDataHW("604", lSightingSystemInfo.radar_on == true and 1 or 0, lHardware ) +end + +function FlareChaff(hardware) + local lHardware = hardware or 1 + local lSnares = LoGetSnares() -- Flare and Chaff + if lSnares == nil then + return + end + --WriteToLog('lSnares: '..dump(lSnares)) + + --[chaff] = number: "128" + --[flare] = number: "128" +end + +function StatusLamp(hardware) + local lHardware = hardware or 1 + local lMCPState = LoGetMCPState() -- Warning Lights + if lMCPState == nil then + return + end + --WriteToLog('lMCPState: '..dump(lMCPState)) + --[[ + [RightTailPlaneFailure] = boolean: "false" + [EOSFailure] = boolean: "false" + [ECMFailure] = boolean: "false" + [RightAileronFailure] = boolean: "false" + [MasterWarning] = boolean: "false" + [RightEngineFailure] = boolean: "false" + [CannonFailure] = boolean: "false" + [MLWSFailure] = boolean: "false" + [ACSFailure] = boolean: "false" + [RadarFailure] = boolean: "false" + [HelmetFailure] = boolean: "false" + [HUDFailure] = boolean: "false" + [LeftMainPumpFailure] = boolean: "false" + [RightWingPumpFailure] = boolean: "false" + [LeftWingPumpFailure] = boolean: "false" + [MFDFailure] = boolean: "false" + [RWSFailure] = boolean: "false" + [GearFailure] = boolean: "false" + [HydraulicsFailure] = boolean: "false" + [AutopilotFailure] = boolean: "true" + [FuelTankDamage] = boolean: "false" + [LeftAileronFailure] = boolean: "false" + [CanopyOpen] = boolean: "false" + [RightMainPumpFailure] = boolean: "false" + [StallSignalization] = boolean: "false" + [LeftEngineFailure] = boolean: "false" + [AutopilotOn] = boolean: "false" + [LeftTailPlaneFailure] = boolean: "false" + ]] + + SendDataHW("700", lMCPState.LeftTailPlaneFailure == true and 1 or 0, lHardware ) + SendDataHW("701", lMCPState.RightTailPlaneFailure == true and 1 or 0, lHardware ) + SendDataHW("702", lMCPState.MasterWarning == true and 1 or 0, lHardware ) + SendDataHW("703", lMCPState.LeftEngineFailure == true and 1 or 0, lHardware ) + SendDataHW("704", lMCPState.RightEngineFailure == true and 1 or 0, lHardware ) + SendDataHW("705", lMCPState.LeftAileronFailure == true and 1 or 0, lHardware ) + SendDataHW("706", lMCPState.RightAileronFailure == true and 1 or 0, lHardware ) + SendDataHW("707", lMCPState.LeftMainPumpFailure == true and 1 or 0, lHardware ) + SendDataHW("708", lMCPState.RightMainPumpFailure == true and 1 or 0, lHardware ) + SendDataHW("709", lMCPState.LeftWingPumpFailure == true and 1 or 0, lHardware ) + SendDataHW("710", lMCPState.RightWingPumpFailure == true and 1 or 0, lHardware ) + SendDataHW("711", lMCPState.EOSFailure == true and 1 or 0, lHardware ) + SendDataHW("712", lMCPState.ECMFailure == true and 1 or 0, lHardware ) + SendDataHW("713", lMCPState.CannonFailure == true and 1 or 0, lHardware ) + SendDataHW("714", lMCPState.MLWSFailure == true and 1 or 0, lHardware ) + SendDataHW("715", lMCPState.ACSFailure == true and 1 or 0, lHardware ) + SendDataHW("716", lMCPState.RadarFailure == true and 1 or 0, lHardware ) + SendDataHW("717", lMCPState.HelmetFailure == true and 1 or 0, lHardware ) + SendDataHW("718", lMCPState.HUDFailure == true and 1 or 0, lHardware ) + SendDataHW("719", lMCPState.MFDFailure == true and 1 or 0, lHardware ) + SendDataHW("720", lMCPState.RWSFailure == true and 1 or 0, lHardware ) + SendDataHW("721", lMCPState.GearFailure == true and 1 or 0, lHardware ) + SendDataHW("722", lMCPState.HydraulicsFailure == true and 1 or 0, lHardware ) + SendDataHW("723", lMCPState.AutopilotFailure == true and 1 or 0, lHardware ) + SendDataHW("724", lMCPState.FuelTankDamage == true and 1 or 0, lHardware ) + SendDataHW("725", lMCPState.CanopyOpen == true and 1 or 0, lHardware ) + SendDataHW("726", lMCPState.StallSignalization == true and 1 or 0, lHardware ) + SendDataHW("727", lMCPState.AutopilotOn == true and 1 or 0, lHardware ) + + local lEngineInfo = LoGetEngineInfo() + if lEngineInfo ~= nil then + --WriteToLog('lEngineInfo: '..dump(lEngineInfo)) + SendDataHW("728", lEngineInfo.EngineStart.left, lHardware ) -- lamp start left engine 1 (0|1) + SendDataHW("729", lEngineInfo.EngineStart.right, lHardware ) -- lamp start right engine 1 (0|1) + end + + local lAoA = LoGetAngleOfAttack() + if lAoA ~= nil then + lAoA = lAoA * 57.3 + SendDataHW("730", (lAoA > 20.0 and 1 or 0), lHardware ) -- lamp start AOA warning (0|1) + end +end + +function WeaponStatusPanel(hardware) +-- The weapon status panel, quantity and readiness of the currently selected weapon and the remaining gun ammunition are indicated. + local lHardware = hardware or 1 + gES_PayloadInfo = LoGetPayloadInfo() + if gES_PayloadInfo == nil then + return + end + --WriteToLog('gES_PayloadInfo: '..dump(gES_PayloadInfo)) + --[[ exsample + [Stations] = { + [1] = { + [CLSID] = string: "{682A481F-0CB5-4693-A382-D00DD4A156D7}" + [container] = boolean: "false" + [count] = number: "1" + [weapon] = { + [level3] = number: "7" + [level1] = number: "4" + [level4] = number: "10" + [level2] = number: "4" + } + } + [2] = { + [CLSID] = string: "{682A481F-0CB5-4693-A382-D00DD4A156D7}" + [container] = boolean: "false" + [count] = number: "1" + [weapon] = { + [level3] = number: "7" + [level1] = number: "4" + [level4] = number: "10" + [level2] = number: "4" + } + } + [3] = { + [wstype] = { + [level3] = number: "32" + [level1] = number: "4" + [level4] = number: "6" + [level2] = number: "7" + } + [count] = number: "20" + [CLSID] = string: "{F72F47E5-C83A-4B85-96ED-D3E46671EE9A}" + [adapter] = { + [level3] = number: "0" + [level1] = number: "0" + [level4] = number: "0" + [level2] = number: "0" + } + [container] = boolean: "true" + [weapon] = { + [level3] = number: "33" + [level1] = number: "4" + [level4] = number: "32" + [level2] = number: "7" + } + } + [4] = { + [wstype] = { + [level3] = number: "32" + [level1] = number: "4" + [level4] = number: "6" + [level2] = number: "7" + } + [count] = number: "20" + [CLSID] = string: "{F72F47E5-C83A-4B85-96ED-D3E46671EE9A}" + [adapter] = { + [level3] = number: "0" + [level1] = number: "0" + [level4] = number: "0" + [level2] = number: "0" + } + [container] = boolean: "true" + [weapon] = { + [level3] = number: "33" + [level1] = number: "4" + [level4] = number: "32" + [level2] = number: "7" + } + } + [5] = { + [wstype] = { + [level3] = number: "32" + [level1] = number: "4" + [level4] = number: "99" + [level2] = number: "4" + } + [count] = number: "1" + [CLSID] = string: "{79D73885-0801-45a9-917F-C90FE1CE3DFC}" + [adapter] = { + [level3] = number: "0" + [level1] = number: "0" + [level4] = number: "0" + [level2] = number: "0" + } + [container] = boolean: "true" + [weapon] = { + [level3] = number: "8" + [level1] = number: "4" + [level4] = number: "45" + [level2] = number: "4" + } + } + [6] = { + [wstype] = { + [level3] = number: "32" + [level1] = number: "4" + [level4] = number: "99" + [level2] = number: "4" + } + [count] = number: "1" + [CLSID] = string: "{79D73885-0801-45a9-917F-C90FE1CE3DFC}" + [adapter] = { + [level3] = number: "0" + [level1] = number: "0" + [level4] = number: "0" + [level2] = number: "0" + } + [container] = boolean: "true" + [weapon] = { + [level3] = number: "8" + [level1] = number: "4" + [level4] = number: "45" + [level2] = number: "4" + } + } + [7] = { + [wstype] = { + [level3] = number: "32" + [level1] = number: "4" + [level4] = number: "47" + [level2] = number: "4" + } + [count] = number: "8" + [CLSID] = string: "{F789E86A-EE2E-4E6B-B81E-D5E5F903B6ED}" + [adapter] = { + [level3] = number: "0" + [level1] = number: "0" + [level4] = number: "0" + [level2] = number: "0" + } + [container] = boolean: "true" + [weapon] = { + [level3] = number: "8" + [level1] = number: "4" + [level4] = number: "58" + [level2] = number: "4" + } + } + [8] = { + [wstype] = { + [level3] = number: "32" + [level1] = number: "4" + [level4] = number: "47" + [level2] = number: "4" + } + [count] = number: "8" + [CLSID] = string: "{F789E86A-EE2E-4E6B-B81E-D5E5F903B6ED}" + [adapter] = { + [level3] = number: "0" + [level1] = number: "0" + [level4] = number: "0" + [level2] = number: "0" + } + [container] = boolean: "true" + [weapon] = { + [level3] = number: "8" + [level1] = number: "4" + [level4] = number: "58" + [level2] = number: "4" + } + } + [9] = { + [CLSID] = string: "{D5435F26-F120-4FA3-9867-34ACE562EF1B}" + [container] = boolean: "false" + [count] = number: "1" + [weapon] = { + [level3] = number: "38" + [level1] = number: "4" + [level4] = number: "20" + [level2] = number: "5" + } + } + [10] = { + [CLSID] = string: "{D5435F26-F120-4FA3-9867-34ACE562EF1B}" + [container] = boolean: "false" + [count] = number: "1" + [weapon] = { + [level3] = number: "38" + [level1] = number: "4" + [level4] = number: "20" + [level2] = number: "5" + } + } + [11] = { + [CLSID] = string: "" + [container] = boolean: "false" + [count] = number: "0" + [weapon] = { + [level3] = number: "0" + [level1] = number: "0" + [level4] = number: "0" + [level2] = number: "0" + } + } + } + [CurrentStation] = number: "0" + [Cannon] = { + [shells] = number: "250" + } + ]] + --[[ + Weapon Panel + | + --------------------------------------------------- + | | | | | | | | | | | + 1 2 3 4 5 C 6 7 8 9 10 + ]] + -- Payload Info + -- weapon stations (panel) 1 (left) - 10 (right), no lamp for center station + SendDataHW("100", gES_PayloadInfo.Cannon.shells, lHardware ) -- count cannon shells + SendDataHW("101", (gES_PayloadInfo.Stations[1].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 1) + SendDataHW("110", (gES_PayloadInfo.Stations[2].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 10) + SendDataHW("102", (gES_PayloadInfo.Stations[3].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 2) + SendDataHW("109", (gES_PayloadInfo.Stations[4].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 9) + SendDataHW("103", (gES_PayloadInfo.Stations[5].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 3) + SendDataHW("108", (gES_PayloadInfo.Stations[6].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 8) + SendDataHW("104", (gES_PayloadInfo.Stations[7].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 4) + SendDataHW("107", (gES_PayloadInfo.Stations[8].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 7) + SendDataHW("105", (gES_PayloadInfo.Stations[9].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 5) + SendDataHW("106", (gES_PayloadInfo.Stations[10].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 6) + --SendDataHW("110", (gES_PayloadInfo.Stations[11].count > 0 and 1 or 0) ) -- weapon presend > 0 center station, not visible + --SendDataHW("CurrentStation", gES_PayloadInfo.CurrentStation, lHardware ) + -- air-to-air missils panel 1 and 11, air combat modus, CurrentStation = 1, panel 1 and 11 on + -- CurrentStation 5, panel 3 + -- CurrentStation 3, panel 2 + -- CurrentStation 7, panel 4 + -- CurrentStation 4, panel 9 + -- CurrentStation 9, panel 5 + -- CurrentStation 10, panel 6 + -- CurrentStation 8, panel 7 + -- CurrentStation 6, panel 8 + -- wenn die Waffenstationen gleichmässig belegt sind, hat bei Auswahl CurrentStation immer den Wert der linken Station + -- bei ungleichmässiger Belegung, hat CurrentStation immer den Wert der jeweiligen Station + -- Waffenbezeichnung als UUID, gES_PayloadInfo.Stations[X].CLSID + + -- defination + if gES_CurrentStationTmp == nil then + gES_CurrentStationTmp = -1 + end + + if gES_PayloadInfo.CurrentStation > 0 and + gES_CurrentStationTmp ~= gES_PayloadInfo.CurrentStation then + gES_CurrentStationTmp = gES_PayloadInfo.CurrentStation + + gES_TmpStationToPanel = {} + gES_TmpStationToPanel[1] = {Panel = 1, StationID = 101, CurrentID = 201, HardwareID = lHardware } -- left + gES_TmpStationToPanel[2] = {Panel = 10, StationID = 110, CurrentID = 210, HardwareID = lHardware } -- right + gES_TmpStationToPanel[3] = {Panel = 2, StationID = 102, CurrentID = 202, HardwareID = lHardware } + gES_TmpStationToPanel[4] = {Panel = 9, StationID = 109, CurrentID = 209, HardwareID = lHardware } + gES_TmpStationToPanel[5] = {Panel = 3, StationID = 103, CurrentID = 203, HardwareID = lHardware } + gES_TmpStationToPanel[6] = {Panel = 8, StationID = 108, CurrentID = 208, HardwareID = lHardware } + gES_TmpStationToPanel[7] = {Panel = 4, StationID = 104, CurrentID = 204, HardwareID = lHardware } + gES_TmpStationToPanel[8] = {Panel = 7, StationID = 107, CurrentID = 207, HardwareID = lHardware } + gES_TmpStationToPanel[9] = {Panel = 5, StationID = 105, CurrentID = 205, HardwareID = lHardware } + gES_TmpStationToPanel[10] = {Panel = 6, StationID = 106, CurrentID = 206, HardwareID = lHardware } + + WeaponStatusPanel_Reset(201, 210, lHardware) + + if gES_TmpStationToPanel[gES_PayloadInfo.CurrentStation] ~= nil then + SendDataHW(gES_TmpStationToPanel[gES_PayloadInfo.CurrentStation].CurrentID, 1, lHardware ) -- eigentliche Auswahl + + table.foreach(gES_PayloadInfo.Stations, WeaponStatusPanel_selectCurrentPayloadStation) -- zugehörige Stationen + end + end +end + +function FuelQuantityIndicator() +-- Fuel quantity shows the fuel remaining in all tanks + local lEngineInfo = LoGetEngineInfo() + if lEngineInfo == nil then + return + end + --WriteToLog('lEngineInfo: '..dump(lEngineInfo)) + --[[ + [fuel_external] = number: "0" + [Temperature] = { + [left] = number: "626.99444580078" + [right] = number: "626.99444580078" + } + [RPM] = { + [left] = number: "87.453765869141" + [right] = number: "87.453758239746" + } + [FuelConsumption] = { + [left] = number: "0.1500396137767" + [right] = number: "0.1500396137767" + } + [fuel_internal] = number: "3773.2749023438" + [EngineStart] = { + [left] = number: "0" + [right] = number: "0" + } + [HydraulicPressure] = { + [left] = number: "210" + [right] = number: "210" + } + lPayloadInfo.Stations[8].CLSID == E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF -- ext 800l Fuel Tank + ]] + + ExportScript.Tools.SendDataDAC("300", string.format("%d", math.round((lEngineInfo.fuel_internal / 10), 0, "ceil") * 10)) -- total fuel in kg + --ExportScript.Tools.SendDataDAC("301", string.format("%d", lEngineInfo.fuel_internal)) -- total fuel in kg + --ExportScript.Tools.SendDataDAC("302", string.format("%d", lEngineInfo.fuel_external)) -- external fuel in kg + + local lPayloadInfo = LoGetPayloadInfo() + if lPayloadInfo ~= nil then + --WriteToLog('lPayloadInfo: '..dump(lPayloadInfo)) + if lPayloadInfo.Stations[10].CLSID == "{E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF}" or + lPayloadInfo.Stations[9].CLSID == "{E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF}" then -- external tanks presend and full (panel 6 and 5) + ExportScript.Tools.SendDataDAC("303", ((lEngineInfo.fuel_external < 1240.0 ) and 1 or 0)) + else + ExportScript.Tools.SendDataDAC("303", 1) + end + if lPayloadInfo.Stations[5].CLSID == "{E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF}" or + lPayloadInfo.Stations[6].CLSID == "{E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF}" then-- inner tank presend and full (panel 3 and 8) + ExportScript.Tools.SendDataDAC("304", ((lEngineInfo.fuel_external < 1.0 ) and 1 or 0)) + else + ExportScript.Tools.SendDataDAC("304", 1) + end + else + ExportScript.Tools.SendDataDAC("303", 1) + ExportScript.Tools.SendDataDAC("304", 1) + end + ExportScript.Tools.SendDataDAC("305", (lEngineInfo.fuel_internal < 2800.0 and 1 or 0)) -- inner wing tank + ExportScript.Tools.SendDataDAC("306", (lEngineInfo.fuel_internal < 1840.0 and 1 or 0)) -- inner hull tank + ExportScript.Tools.SendDataDAC("307", (lEngineInfo.fuel_internal < 1.0 and 1 or 0)) -- central hull tank + ExportScript.Tools.SendDataDAC("308", (lEngineInfo.fuel_internal < 600.0 and 1 or 0)) -- Bingo Fuel + +end + +function MechanicalDevicesIndicator(hardware) +-- The mechanical devices indicator shows the position of the landing gear, flaps, leading edge flaps and airbrake + local lHardware = hardware or 1 + local lMechInfo = LoGetMechInfo() -- mechanical components, e.g. Flaps, Wheelbrakes,... + if lMechInfo == nil then + return + end + --[[ + [hook] = { + [status] = number: "0" + [value] = number: "0" + } + [parachute] = { + [status] = number: "0" + [value] = number: "0" + } + [controlsurfaces] = { + [eleron] = { + [left] = number: "0" + [right] = number: "-0.21084336936474" + } + [elevator] = { + [left] = number: "-0" + [right] = number: "-0" + } + [rudder] = { + [left] = number: "0" + [right] = number: "0" + } + } + [airintake] = { + [status] = number: "0" + [value] = number: "0" + } + [canopy] = { + [status] = number: "0" + [value] = number: "0" + } + [refuelingboom] = { + [status] = number: "0" + [value] = number: "0" + } + [wing] = { + [status] = number: "0" + [value] = number: "0" + } + [noseflap] = { + [status] = number: "0" + [value] = number: "0" + } + [gear] = { + [value] = number: "0" + [nose] = { + [rod] = number: "0" + } + [main] = { + [left] = { + [rod] = number: "0" + } + [right] = { + [rod] = number: "0" + } + } + [status] = number: "0" + } + [speedbrakes] = { + [status] = number: "0" + [value] = number: "0" + } + [wheelbrakes] = { + [status] = number: "0" + [value] = number: "0" + } + [flaps] = { + [status] = number: "0" + [value] = number: "0" + }]] + --SendDataHW("500", lMechInfo.gear.status ) + --SendDataHW("501", lMechInfo.gear.value ) + --SendDataHW("502", lMechInfo.gear.nose.rod ) -- zeigt an wie weit das Fahrwerk einsackt wenn das Flugzeug auf dem Boden ist + --SendDataHW("503", lMechInfo.gear.main.left.rod ) -- zeigt an wie weit das Fahrwerk einsackt wenn das Flugzeug auf dem Boden ist + --SendDataHW("504", lMechInfo.gear.main.right.rod ) -- zeigt an wie weit das Fahrwerk einsackt wenn das Flugzeug auf dem Boden ist + --SendDataHW("500", ((lMechInfo.gear.status == 1 and lMechInfo.gear.value < 1) and 1 or 0 ) ) -- gear warning light, go up + --SendDataHW("500", ((lMechInfo.gear.status == 0 and lMechInfo.gear.value > 0) and 1 or 0 ) ) -- gear warning light, go down + SendDataHW("500", (((lMechInfo.gear.status == 1 and lMechInfo.gear.value < 1) or (lMechInfo.gear.status == 0 and lMechInfo.gear.value > 0)) and 1 or 0 ), lHardware ) -- gear warning light + SendDataHW("501", (lMechInfo.gear.value > 0.85 and 1 or 0), lHardware ) -- nose gear + SendDataHW("502", (lMechInfo.gear.value > 0.95 and 1 or 0), lHardware ) -- left gear + SendDataHW("503", (lMechInfo.gear.value == 1 and 1 or 0), lHardware ) -- right gear + + --SendDataHW("510", lMechInfo.speedbrakes.status ) -- speedbreakes on 1 (0|1) + SendDataHW("510", (lMechInfo.speedbrakes.value > 0.1 and 1 or 0), lHardware ) -- speedbreakes on > 0.1 (0 - 1) + + --SendDataHW("520", lMechInfo.wheelbrakes.status, lHardware ) -- not in use + --SendDataHW("521", lMechInfo.wheelbrakes.value, lHardware ) -- not in use + + local lTrueAirSpeed = LoGetTrueAirSpeed() + --SendDataHW("530", lMechInfo.flaps.status ) -- flap switch off 0, 1. position 1, 2. position 2 (0|1|2) + --SendDataHW("531", lMechInfo.flaps.value ) -- flap 1. position > 0.25, 2. position > 0.93 (0 - 1) + SendDataHW("531", (lMechInfo.flaps.value > 0.25 and 1 or 0), lHardware ) -- flap 1. position + SendDataHW("532", (lMechInfo.flaps.value > 0.93 and 1 or 0), lHardware ) -- flap 2. position + SendDataHW("533", ((lMechInfo.flaps.value > 0.93 and lTrueAirSpeed > 340) and 1 or 0), lHardware ) -- Speed Warning for Flaps, same light as gear warning light, but blinking light +end