commit 103275b10a9dbc940a2bc48e0ca7ed09f22d75ce Author: mcmicha Date: Thu Jul 30 01:35:28 2015 +0200 Initial commit diff --git a/ExportsModules/A-10A.lua b/ExportsModules/A-10A.lua new file mode 100644 index 0000000..3626eb8 --- /dev/null +++ b/ExportsModules/A-10A.lua @@ -0,0 +1,1241 @@ +-- A-10A Export +-- Version 0.9.9 BETA + +gES_FoundFCModule = true + +-- auxiliary function +dofile(gES_ExportModulePath.."FC_AuxiliaryFuntions.lua") + +----------------------------------------- +-- FLAMING CLIFFS AIRCRAFT / A-10A -- +-- FC aircraft don't support GetDevice -- +----------------------------------------- + +function ProcessGlassCockpitFCHighImportanceConfig() + + local myData = LoGetSelfData() + + if (myData) then + local lLatitude = myData.LatLongAlt.Lat -- LATITUDE + local lLongitude = myData.LatLongAlt.Long -- LONGITUDE + local lBasicAtmospherePressure = LoGetBasicAtmospherePressure() -- BAROMETRIC PRESSURE + local lAltBar = LoGetAltitudeAboveSeaLevel() -- ALTITUDE SEA LEVEL (Meter) + local lAltRad = LoGetAltitudeAboveGroundLevel() -- ALTITUDE GROUND LEVEL (Meter) + --local lTrueAirSpeed = LoGetTrueAirSpeed() -- TRUE AIRSPEED (Meter/Second) + local lPitch, lBank, lYaw = LoGetADIPitchBankYaw() -- PITCH, BANK, YAW (Radian) + + local lHeading = myData.Heading -- HEADING (Radian) + local lVVI = LoGetVerticalVelocity() -- VERTICAL SPEED (Meter/Second) + local lIAS = LoGetIndicatedAirSpeed() -- INDICATED AIRSPEED (Meter/Second) + --local lMachNumber = LoGetMachNumber -- MACH + local lAoA = LoGetAngleOfAttack() -- ANGLE OF ATTACK AoA (Radian) + + local lGlide = LoGetGlideDeviation() -- VOR1 HORIZONTAL DEFLECTION (-1 +1) + local lSide = LoGetSideDeviation() -- VOR1 VERTICAL DEFLECTION (-1 +1) + --local lSlipBallPosition = LoGetSlipBallPosition() -- SLIP BALL (-1 +1) + --local lAccelerationUnits = LoGetAccelerationUnits().y -- G-LOAD + + --local lNavInfoPitch = LoGetNavigationInfo().Requirements.pitch -- AP REQUIRED PITCH (Radian) + --local lNavInfoRoll = LoGetNavigationInfo().Requirements.roll -- AP REQUIRED BANK (Radian) + --local lNavInfoSpeed = LoGetNavigationInfo().Requirements.speed -- AP SPEED (Meter/Second) + --local lNavInfoAltitude = LoGetNavigationInfo().Requirements.altitude -- AP ALTITUDE (Meter) + --local lNavInfoVerticalSpeed = LoGetNavigationInfo().Requirements.vertical_speed -- AP VERTICAL SPEED (Meter/Second) + + --local lControlPanel_HSI = LoGetControlPanel_HSI() -- HSI Data + local lHSI_RMI = LoGetControlPanel_HSI().RMI_raw -- VOR1 OBS (Radian) + local lHSI_ADF = LoGetControlPanel_HSI().ADF_raw -- ADF OBS (Radian) + --local lHSI_Heading = LoGetControlPanel_HSI().Heading_raw -- Heading (Radian) + + local lEngineRPMleft = LoGetEngineInfo().RPM.left -- ENG1 RPM % + local lEngineRPMright = LoGetEngineInfo().RPM.right -- ENG2 RPM % + local lEngineTempLeft = LoGetEngineInfo().Temperature.left -- ENG1 EGT ºC + local lEngineTempRight = LoGetEngineInfo().Temperature.right -- ENG2 EGT ºC + local lEngineFuelConsumptionLeft = LoGetEngineInfo().FuelConsumption.left + local lEngineFuelConsumptionRight = LoGetEngineInfo().FuelConsumption.right + local lEngineHydraulicPressureLeft = LoGetEngineInfo().HydraulicPressure.left + local lEngineHydraulicPressureRight = LoGetEngineInfo().HydraulicPressure.right + --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 + --lBasicAtmospherePressure = lBasicAtmospherePressure * 0.03937 -- BAROMETRIC PRESSURE (MM TO IN) + --lTrueAirSpeed = lTrueAirSpeed * 1.94 -- TRUE AIRSPEED (M/S TO KNOTS) + lAltBar = lAltBar * 3.28084 -- ALTITUDE SEA LEVEL (MTS TO FT) + lAltRad = lAltRad * 3.28084 -- ALTITUDE GROUND LEVEL (MTS TO FT) + lVVI = lVVI * 196.8504 -- VERTICAL SPEED (M/S TO FPM) + lIAS = lIAS * 1.9438444924574 -- INDICATED AIRSPEED (M/S TO KNOTS) + 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 + + SendData("1", string.format("%.2f", lPitch) ) + SendData("2", string.format("%.2f", lBank) ) + SendData("3", string.format("%.2f", lYaw) ) + SendData("4", string.format("%.2f", lAltBar) ) + SendData("5", string.format("%.2f", lAltRad) ) + SendData("6", string.format("%.2f", lHSI_ADF) ) + SendData("7", string.format("%.2f", lHSI_RMI) ) + SendData("8", string.format("%.2f", lHeading) ) + SendData("9", string.format("%.2f", lEngineRPMleft) ) + SendData("10", string.format("%.2f", lEngineRPMright) ) + SendData("11", string.format("%.2f", lEngineTempLeft) ) + SendData("12", string.format("%.2f", lEngineTempRight) ) + SendData("13", string.format("%.2f", lVVI) ) + SendData("14", string.format("%.2f", lIAS) ) + SendData("15", string.format("%.2f", lDistanceToWay) ) + SendData("16", string.format("%.2f", lAoA) ) + SendData("17", string.format("%.2f", lGlide) ) + SendData("18", string.format("%.2f", lSide) ) + + elseif gES_GlassCockpitType == 2 then + -- HawgTouch version 1.6 + + -- Barometrisic Altimeter + --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} + local lAltCounter = {[0] = 0.0, [1] = 0.1, [2] = 0.2, [3] = 0.3, [4] = 0.4, [5] = 0.5, [6] = 0.6, [7] = 0.7, [8] = 0.8, [9] = 0.9} + --local lAltBarTmp = string.format("%03d", ((lAltBar * 3.28084) / 100)) -- meter to feeds + --lAltBar = lAltBar + (9.5 * (760 - lBasicAtmospherePressure)) -- 9.5 m per 1mmHg difference , eventuell minus der Differenz + local lAltBarTmp = ((lAltBar * 3.28084) / 100) -- meter to feeds + lAltBar = lAltBar * 3.28084 -- meter to feeds + lBasicAtmospherePressure = lBasicAtmospherePressure * 3.937023 -- mmHg to inPa (0.03937023 * 100) + lBasicAtmospherePressure = string.format("%04d", lBasicAtmospherePressure) + + lAltBar = lAltBar / 1000 + lAltBar = lAltBar - math.round(lAltBar, 0, "floor") + + local lAltCounter3 = 0 + local lAltBarTmp2 = string.format("%03d", lAltBarTmp) + + if lAltBarTmp > 10 then + lAltCounter3 = (lAltBarTmp - (math.round(lAltBarTmp / 10, 0, "floor") * 10)) * 0.1 + else + lAltCounter3 = lAltBarTmp * 0.1 + end + + -- AltBar {0.0,1.0} + -- AltBar_1000 {0.0,1.0} + -- AltBar_100 {0.0,1.0} + -- AltBar_10 {0.0,1.0} + -- BasicAtmospherePressure_1 {0.0,1.0} + -- BasicAtmospherePressure_10 {0.0,1.0} + -- BasicAtmospherePressure_100 {0.0,1.0} + -- BasicAtmospherePressure_1000 {0.0,1.0} + SendData(1, string.format("%.4f;%.2f;%.2f;%.2f;%.2f;%.2f;%.2f;%.2f", + lAltBar, + lAltCounter[tonumber(string.sub(lAltBarTmp2, 1, 1))], + lAltCounter[tonumber(string.sub(lAltBarTmp2, 2, 2))], + lAltCounter3, + lAltCounter[tonumber(string.sub(lBasicAtmospherePressure, 4, 4))], + lAltCounter[tonumber(string.sub(lBasicAtmospherePressure, 3, 3))], + lAltCounter[tonumber(string.sub(lBasicAtmospherePressure, 2, 2))], + lAltCounter[tonumber(string.sub(lBasicAtmospherePressure, 1, 1))])) + -- Barometrisic Altimeter end + + -- Air Speed Indicator (IAS) + lAltBar = LoGetAltitudeAboveSeaLevel() * 3.28084 -- ALTITUDE SEA LEVEL (Meter to Feeds) + lIAS = lIAS * 1.9438444924574 -- INDICATED AIRSPEED (M/S TO KNOTS) + local lIAStmp = lIAS + + --[[ + y_min = 0.0 -- minimaler Ausgabewert + y_max = 1.0 -- maximaler Ausgabewert + x_min = 0.0 -- minimaler Eingangswert + x_max = 550.0 -- maximaler Eingangswert + x = 250.0 -- aktueller Eingangswert + + d_y = 1.0 -- Delta Ausgabewerte (y_max - y_min) + d_x = 550.0 -- Delta Eingangswerte (x_max - x_min) + m = 0.00181818181818181818181818181818 -- Steigung der linearen Funktion (d_y / d_x) + n = 0.000000000000000000000000000001 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max) + + y = 0.45454545454545454545454545454645 -- Ergebnis (m * x + n) + ]] + lIAS = 0.00181818181818181818181818181818 * lIAS + 0.000000000000000000000000000001 + + if lIAStmp > 100 then + lIAStmp = lIAStmp - (math.round((lIAStmp / 100), 0, "floor") * 100) + end + + lIAStmp = lIAStmp / 100 + + -- IAS {0.0,1.0} + -- IAS Decimals {0.0,1.0} + -- Barometric Altimeter in Feeds for calculate max Air Speed + SendData(2, string.format("%.4f;%.4f;%d", lIAS, lIAStmp, lAltBar)) + -- Air Speed Indicator End + + -- RPM Engine Left + FC_TwoNeedlesGauge(lEngineRPMleft, 105, 10, 3) + + -- RPM Engine Right + FC_TwoNeedlesGauge(lEngineRPMright, 105, 10, 4) + + -- Oil Pressure Left, no value but similar to Engine RPM + FC_OneNeedleGauge(lEngineRPMleft, 110, 11) + + -- Oil Pressure Right, no value but similar to Engine RPM + FC_OneNeedleGauge(lEngineRPMright, 110, 12) + + -- RPM FAN Left + if lEngineRPMleft > 98.85 then + lEngineRPMleft = lEngineRPMleft / 1.88 --52.58 > 80% + elseif lEngineRPMleft > 97.9768 then + lEngineRPMleft = lEngineRPMleft / 2.33278 --42.0 = 79% + elseif lEngineRPMleft > 97.2773 then + lEngineRPMleft = lEngineRPMleft / 3.03992 --32.0 = 78% + elseif lEngineRPMleft > 96.7213 then + lEngineRPMleft = lEngineRPMleft / 3.5429 --27.3 = 77% + elseif lEngineRPMleft > 96.2496 then + lEngineRPMleft = lEngineRPMleft / 3.5648 --27.0 = 76% + elseif lEngineRPMleft > 95.7494 then + lEngineRPMleft = lEngineRPMleft / 3.5996 --26.6 = 75% + elseif lEngineRPMleft > 93.2737 then + lEngineRPMleft = lEngineRPMleft / 3.54653 --26.3 = 70% + elseif lEngineRPMleft > 90.7216 then + lEngineRPMleft = lEngineRPMleft / 3.4893 --26.0 = 65% + elseif lEngineRPMleft > 88.1733 then + lEngineRPMleft = lEngineRPMleft / 3.4376 --25.65 = 60% + elseif lEngineRPMleft > 85.0282 then + lEngineRPMleft = lEngineRPMleft / 3.3608 --25.3 = 55% + elseif lEngineRPMleft > 81.9344 then + lEngineRPMleft = lEngineRPMleft / 3.2774 --25.0 = 50% + elseif lEngineRPMleft > 77.7911 then + lEngineRPMleft = lEngineRPMleft / 3.53596 --22.0 = 45% + elseif lEngineRPMleft > 72.1855 then + lEngineRPMleft = lEngineRPMleft / 3.6093 --20.0 = 40% + elseif lEngineRPMleft > 67.8386 then + lEngineRPMleft = lEngineRPMleft / 3.9905 --17.0 = 35% + elseif lEngineRPMleft > 63.4883 then + lEngineRPMleft = lEngineRPMleft / 3.968 --16.0 = 33% + end + + --[[ + y_min = 0.0 0.25 0.2659 0.49 -- minimaler Ausgabewert + y_max = 0.25 0.2659 0.49 1.0 -- maximaler Ausgabewert + x_min = 0.0 50.0 70.0 80.0 -- minimaler Eingangswert + x_max = 50.0 70.0 80.0 100.0 -- maximaler Eingangswert + x = 40.0 60.0 75.0 95.0 -- aktueller Eingangswert + + d_y = 0.25 0.0159 0.2241 0.51 -- Delta Ausgabewerte (y_max - y_min) + d_x = 50.0 20.0 10.0 20.0 -- Delta Eingangswerte (x_max - x_min) + m = 0.005 0.000795 0.02241 0.0255 -- Steigung der linearen Funktion (d_y / d_x) + n = 0.0 0.21025 -1.3028 -1.55 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max) + + y = 0.2 0.25795 0.37795 0.8725 -- Ergebnis (m * x + n) + ]] +--[[ if lEngineRPMleft > 80 then + lEngineRPMleft = 0.0255 * lEngineRPMleft + -1.55 + elseif lEngineRPMleft > 70 then + lEngineRPMleft = 0.02241 * lEngineRPMleft + -1.3028 + elseif lEngineRPMleft > 50 then + lEngineRPMleft = 0.000795 * lEngineRPMleft + 0.21025 + else + lEngineRPMleft = 0.005 * lEngineRPMleft + end + + lEngineRPMleft = lEngineRPMleft * 85.263157894736842105263157894737 +]] + FC_OneNeedleGauge(lEngineRPMleft, 100, 5) + + -- RPM FAN Right + if lEngineRPMright > 94 then + lEngineRPMright = lEngineRPMright / 1.88 --50.0 + elseif lEngineRPMright > 90 then + lEngineRPMright = lEngineRPMright / 3.384 --26.6 + elseif lEngineRPMright > 85 then + lEngineRPMright = lEngineRPMright / 3.334 --25.5 + elseif lEngineRPMright > 80 then + lEngineRPMright = lEngineRPMright / 3.2 --25.0 + elseif lEngineRPMright > 75 then + lEngineRPMright = lEngineRPMright / 3.75 --20.0 + elseif lEngineRPMright > 70 then + lEngineRPMright = lEngineRPMright / 4.667 --15.0 + elseif lEngineRPMright > 65 then + lEngineRPMright = lEngineRPMright / 4.815 --13.5 + elseif lEngineRPMright > 60 then + lEngineRPMright = lEngineRPMright / 5 --12.0 + end + FC_OneNeedleGauge(lEngineRPMright, 100, 6) + + -- RPM APU, no value + -- Exaust Gas Temperature APU, no value + + -- Exaust Gas Temperature Left + --FC_TwoNeedlesGauge(lEngineTempLeft, 1200, 100, 7) + FC_A10A_ExaustGasTemp(lEngineTempLeft, 7) + + -- Exaust Gas Temperature Right + FC_TwoNeedlesGauge(lEngineTempRight, 1200, 100, 8) + --FC_A10A_ExaustGasTemp(lEngineTempRight, 8) + + -- Fuel Flow Left + FC_OneNeedleGauge((lEngineFuelConsumptionLeft * 2.2046223302272) * 3600, 5000, 9) + + -- Fuel Flow Right + FC_OneNeedleGauge((lEngineFuelConsumptionRight * 2.2046223302272) * 3600, 5000, 10) + + -- Hydraulic Pressure Left (small gauges over fuel gauge) + FC_OneNeedleGauge(lEngineHydraulicPressureLeft, 100, 13) + + -- Hydraulic Pressure Right (small gauges over fuel gauge) + FC_OneNeedleGauge(lEngineHydraulicPressureRight, 100, 14) + + -- VVI + FC_US_VVI(15) + + -- AOA + --FC_US_AOA(16) + --WriteToLog('lAoA 1: '..dump(lAoA)) + local lAoATmp = 0.7728 * math.deg(lAoA) + 12.22 + --WriteToLog('lAoA 2: '..dump(lAoATmp)) + --[[ + y_min = 0.0 -- minimaler Ausgabewert + y_max = 1.0 -- maximaler Ausgabewert + x_min = 0.0 -- minimaler Eingangswert + x_max = 30.0 -- maximaler Eingangswert + x = 12.6 -- aktueller Eingangswert + + d_y = 1.0 -- Delta Ausgabewerte (y_max - y_min) + d_x = 30.0 -- Delta Eingangswerte (x_max - x_min) + m = 0.03333333333333333333333333333333 -- Steigung der linearen Funktion (d_y / d_x) + n = 0.0000000000000000000000000000001 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max) + + y = 0.4200000000000000000000000000001 -- Ergebnis (m * x + n) + ]] + lAoATmp = 0.03333333333333333333333333333333 * lAoATmp + 0.0000000000000000000000000000001 + SendData(16, string.format("%.4f;%d", lAoATmp, 0) ) + + -- G-LOAD + FC_US_GLOAD(17) + + -- Clock + FC_US_Clock(18) + + -- Standby Compass + FC_US_Compass(19) + + -- ADI + FC_US_ADI(20) + + -- Standby ADI + FC_US_stbyADI(21) + + -- HSI + FC_US_HSI(lDistanceToWay, 22) + end + else + WriteToLog("Unknown FC Error, no LoGetSelfData.") + end +end + +function ProcessHARDWAREConfigHighImportance(mainPanelDevice) + --[[ + 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)) + ]] +end + +function ProcessGlassCockpitFCLowImportanceConfig() + 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,... + + if gES_GlassCockpitType == 1 then + -- HELIOS Version 1.3 + + elseif gES_GlassCockpitType == 2 then + -- HawgTouch version 1.6 + + -- Flaps Indicator + local lFlapsValue = lMechInfo.flaps.value + + lFlapsValue = lFlapsValue / 1.6 + lFlapsValue = (lFlapsValue > 1.0 and 1.0 or lFlapsValue) -- the result is limited to 1.0 + + SendData(23, string.format("%.4f", lFlapsValue)) + -- Flaps Indicator end + + -- Gear Lamps + local lGearValue = lMechInfo.gear.value + local lGear1, lGear2, lGear3 = 0, 0, 0 + + if lGearValue > 0.85 then + lGear1 = 1 + end + if lGearValue > 0.9 then + lGear2 = 1 + end + if lGearValue == 1.0 then + lGear3 = 1 + end + SendData(24, string.format("%d;%d;%d", + lGear1, -- GEAR_N_SAFE + lGear2, -- GEAR_L_SAFE + lGear3)) -- GEAR_R_SAFE + -- Gear Lamps end + + -- Fuel Indicator + local lCounter = {[0] = 0.0, [1] = 0.1, [2] = 0.2, [3] = 0.3, [4] = 0.4, [5] = 0.5, [6] = 0.6, [7] = 0.7, [8] = 0.8, [9] = 0.9} + + lEngineFuelInternal = lEngineFuelInternal * 2.2046223302272 -- kg to lbs + local lFuelNeedle = (lEngineFuelInternal / 2) / 6000 -- 6000 = scala + lEngineFuelInternal = lEngineFuelInternal / 100 -- um unf die ersten drei stellen zukommen + local lEngineFuelInternalTmp = string.format("%03d", lEngineFuelInternal) + + local lFuelCounter3 = 0 + if lEngineFuelInternal > 10 then + lFuelCounter3 = (lEngineFuelInternal - (math.round(lEngineFuelInternal / 10, 0, "floor") * 10)) * 0.1 + else + lFuelCounter3 = lEngineFuelInternal * 0.1 + end + + SendData(25, string.format("%.2f;%.2f;%.2f;%.4f;%.4f", + lCounter[tonumber(string.sub(lEngineFuelInternalTmp, 1, 1))], + lCounter[tonumber(string.sub(lEngineFuelInternalTmp, 2, 2))], + lFuelCounter3, + lFuelNeedle, + lFuelNeedle)) + -- Fuel Indicator end + + -- Weapon Panel + gES_PayloadInfo = LoGetPayloadInfo() + --[[ + ShellsCounter + Station1 + Station2 + ... + Station11 + + Station Data: + 0.0 = off + 0.1 = E (Empty, yellow E) + 0.2 = 1 (load, white one) + 0.3 = RR (active, two green R and white 1 for load) + ]] + --[[ + Weapon Panel + | + --------------------------------------------------- + | | | | | | | | | | | + 1 2 3 4 5 6 7 8 9 10 11 + 1 3 5 7 9 11 10 8 6 4 2 -- Weapon Station ID + ]] + gES_TmpWeaponPanelActive = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0} + + for lIndex = 1, 11, 1 do + gES_TmpWeaponPanelActive[lIndex] = (gES_PayloadInfo.Stations[lIndex].count > 0 and 0.2 or 0.1) -- get status, empty or load + end + + if gES_PayloadInfo.CurrentStation > 0 then + gES_TmpWeaponPanelActive[gES_PayloadInfo.CurrentStation] = 0.3 -- currrent value + + table.foreach(gES_PayloadInfo.Stations, WeaponStatusPanel_selectCurrentPayloadStationGlassCockpit_A10A) -- corresponding station + end + + SendData(26, string.format("%d;%0.1f;%0.1f;%0.1f;%0.1f;%0.1f;%0.1f;%0.1f;%0.1f;%0.1f;%0.1f;%0.1f", + gES_PayloadInfo.Cannon.shells, + gES_TmpWeaponPanelActive[1], + gES_TmpWeaponPanelActive[3], + gES_TmpWeaponPanelActive[5], + gES_TmpWeaponPanelActive[7], + gES_TmpWeaponPanelActive[9], + gES_TmpWeaponPanelActive[11], + gES_TmpWeaponPanelActive[10], + gES_TmpWeaponPanelActive[8], + gES_TmpWeaponPanelActive[6], + gES_TmpWeaponPanelActive[4], + gES_TmpWeaponPanelActive[2])) + -- Wepaon Panel end + + -- UHF Gauges, no value + SendData(27, "001.00") + end +end + +function ProcessHARDWAREConfigLowImportance(mainPanelDevice) +-- where necessary, specify HardwareID, example SightingSystem(2) + SightingSystem() + FuelQuantityIndicator() + StatusLamp() + MechanicalDevicesIndicator() + FlareChaff() + WeaponStatusPanel() + RWRStatusPanel() + AOAIndicator() +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 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 + lEngineInfo.fuel_external) * 2.2) / 100), 0, "ceil") * 100), lHardware ) -- total fuel in lbs + --SendDataHW("301", string.format("%d", lEngineInfo.fuel_internal * 2.2), lHardware ) -- internal fuel in lbs + --SendDataHW("302", string.format("%d", lEngineInfo.fuel_external * 2.2), lHardware ) -- external fuel in lbs + + --[[ + local lPayloadInfo = LoGetPayloadInfo() + if lPayloadInfo == nil then + return + end + SendDataHW("303", ((lPayloadInfo.Stations[5].count > 0 and lPayloadInfo.Stations[5].CLSID == "Fuel_Tank_FT600") and 1 or 0), lHardware ) -- weapon presend > 0 (panel 5) + SendDataHW("304", ((lPayloadInfo.Stations[6].count > 0 and lPayloadInfo.Stations[6].CLSID == "Fuel_Tank_FT600") and 1 or 0), lHardware ) -- weapon presend > 0 (panel 6) + SendDataHW("305", ((lPayloadInfo.Stations[7].count > 0 and lPayloadInfo.Stations[7].CLSID == "Fuel_Tank_FT600") and 1 or 0), lHardware ) -- weapon presend > 0 (panel 7) + SendDataHW("307", (lEngineInfo.fuel_internal < 600.0 and 1 or 0), lHardware ) -- Bingo Fuel + ]] +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 +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: "30" + --[flare] = number: "30" + + SendDataHW("800", lSnares.chaff, lHardware ) + SendDataHW("801", lSnares.flare, lHardware ) +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 ) -- not in use + --SendDataHW("521", lMechInfo.wheelbrakes.value ) -- not in use + + local lGetTrueAirSpeed = LoGetTrueAirSpeed() + if lGetTrueAirSpeed == nil then + lGetTrueAirSpeed = 0 + end + --SendDataHW("530", lMechInfo.flaps.status ) -- flap switch off 0, 1. position 1, 2. position 2 (0|1|2) + --SendDataHW("531", lMechInfo.flaps.value ) -- flap 1. position > 0.25, 2. position > 0.93 (0 - 1) + SendDataHW("531", (lMechInfo.flaps.value > 0.25 and 1 or 0), lHardware ) -- flap 1. position + SendDataHW("532", (lMechInfo.flaps.value > 0.93 and 1 or 0), lHardware ) -- flap 2. position + SendDataHW("533", ((lMechInfo.flaps.value > 0.93 and lGetTrueAirSpeed > 340) and 1 or 0), lHardware ) -- Speed Warning for Flaps, same light as gear warning light, but blinking light +end + +function RWRStatusPanel(hardware) +-- RWR Status Panel only + local lHardware = hardware or 1 + local lTWSInfo = LoGetTWSInfo() + if lTWSInfo == nil then + return + end + --WriteToLog('lTWSInfo: '..dump(lTWSInfo)) + --[[ + [Emitters] = { + [1] = { + [Type] = { + [level3] = number: "105" + [level1] = number: "2" + [level4] = number: "46" + [level2] = number: "16" + } + [Azimuth] = number: "1.8300691843033" + [Power] = number: "0.92326503992081" + [ID] = number: "16777472" + [Priority] = number: "230.92445373535" + [SignalType] = string: "lock" + } + [2] = { + [Type] = { + [level3] = number: "101" + [level1] = number: "2" + [level4] = number: "39" + [level2] = number: "16" + } + [Azimuth] = number: "2.6759564876556" + [Power] = number: "0.90609884262085" + [ID] = number: "16777728" + [Priority] = number: "140.90609741211" + [SignalType] = string: "scan" + } + } + [Mode] = number: "0" + ]] + + local lPrimaryThreatTmp = 0 + local lPriorityTmp = 0 + local lScanTmp = false + local lMissileTmp = false + + if(#lTWSInfo.Emitters > 0) then + for EmitterIndex = 1, #lTWSInfo.Emitters, 1 do + if(lTWSInfo.Emitters[EmitterIndex].Priority > lPriorityTmp) then + lPrimaryThreatTmp = EmitterIndex + end + if(lTWSInfo.Emitters[EmitterIndex].SignalType == "scan") then + lScanTmp = true + elseif(lTWSInfo.Emitters[EmitterIndex].SignalType == "missile_radio_guided") then + lMissileTmp = true + end + end + else + lPrimaryThreatTmp = 0 + lPriorityTmp = 0 + end + + SendDataHW("440", (lMissileTmp and 1 or 0), lHardware ) + SendDataHW("444", (lScanTmp and 1 or 0), lHardware ) +end + +function AOAIndicator(hardware) +-- AOA Indicator only + local lHardware = hardware or 1 + local lAoA = LoGetAngleOfAttack() + if lAoA == nil then + return + end + local lMechInfo = LoGetMechInfo() -- mechanical components, e.g. Gear + if lMechInfo == nil then + return + end + + if lMechInfo.gear.status == 1 then + local lAOAUnits = (lAoA * 57.3) * 0.7728 + 12.22 + --WriteToLog('lAoA: '..dump(lAoA)) + --WriteToLog('lAOAUnits: '..dump(lAOAUnits)) + SendDataHW("900", (lAOAUnits > 21.0 and 1 or 0), lHardware ) + SendDataHW("901", ((lAOAUnits > 18.0 and lAOAUnits < 22.0) and 1 or 0), lHardware ) + SendDataHW("902", (lAOAUnits < 19.0 and 1 or 0), lHardware ) + else -- AOA Index Lamps off + SendDataHW("900", 0, lHardware ) + SendDataHW("901", 0, lHardware ) + SendDataHW("902", 0, lHardware ) + 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: "{6D21ECEA-F85B-4E8D-9D51-31DC9B8AA4EF}" + [container] = boolean: "false" + [count] = number: "1" + [weapon] = { + [level3] = number: "45" + [level1] = number: "4" + [level4] = number: "25" + [level2] = number: "15" + } + } + [2] = { + [wstype] = { + [level3] = number: "32" + [level1] = number: "4" + [level4] = number: "117" + [level2] = number: "7" + } + [count] = number: "7" + [CLSID] = string: "{69926055-0DA8-4530-9F2F-C86B157EA9F6}" + [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: "147" + [level2] = number: "7" + } + } + [3] = { + [wstype] = { + [level3] = number: "32" + [level1] = number: "4" + [level4] = number: "135" + [level2] = number: "4" + } + [count] = number: "2" + [CLSID] = string: "LAU_88_AGM_65H_2_L" + [adapter] = { + [level3] = number: "47" + [level1] = number: "4" + [level4] = number: "4" + [level2] = number: "15" + } + [container] = boolean: "true" + [weapon] = { + [level3] = number: "8" + [level1] = number: "4" + [level4] = number: "138" + [level2] = number: "4" + } + } + [4] = { + [wstype] = { + [level3] = number: "32" + [level1] = number: "4" + [level4] = number: "114" + [level2] = number: "5" + } + [count] = number: "3" + [CLSID] = string: "BRU-42_3*BDU-33" + [adapter] = { + [level3] = number: "0" + [level1] = number: "0" + [level4] = number: "0" + [level2] = number: "0" + } + [container] = boolean: "true" + [weapon] = { + [level3] = number: "9" + [level1] = number: "4" + [level4] = number: "69" + [level2] = number: "5" + } + } + [5] = { + [CLSID] = string: "{5335D97A-35A5-4643-9D9B-026C75961E52}" + [container] = boolean: "false" + [count] = number: "1" + [weapon] = { + [level3] = number: "38" + [level1] = number: "4" + [level4] = number: "35" + [level2] = number: "5" + } + } + [6] = { + [CLSID] = string: "Fuel_Tank_FT600" + [container] = boolean: "false" + [count] = number: "1" + [weapon] = { + [level3] = number: "43" + [level1] = number: "1" + [level4] = number: "103" + [level2] = number: "3" + } + } + [7] = { + [CLSID] = string: "{5335D97A-35A5-4643-9D9B-026C75961E52}" + [container] = boolean: "false" + [count] = number: "1" + [weapon] = { + [level3] = number: "38" + [level1] = number: "4" + [level4] = number: "35" + [level2] = number: "5" + } + } + [8] = { + [wstype] = { + [level3] = number: "32" + [level1] = number: "4" + [level4] = number: "114" + [level2] = number: "5" + } + [count] = number: "3" + [CLSID] = string: "BRU-42_3*BDU-33" + [adapter] = { + [level3] = number: "0" + [level1] = number: "0" + [level4] = number: "0" + [level2] = number: "0" + } + [container] = boolean: "true" + [weapon] = { + [level3] = number: "9" + [level1] = number: "4" + [level4] = number: "69" + [level2] = number: "5" + } + } + [9] = { + [wstype] = { + [level3] = number: "32" + [level1] = number: "4" + [level4] = number: "106" + [level2] = number: "4" + } + [count] = number: "2" + [CLSID] = string: "{E6A6262A-CA08-4B3D-B030-E1A993B98453}" + [adapter] = { + [level3] = number: "47" + [level1] = number: "4" + [level4] = number: "4" + [level2] = number: "15" + } + [container] = boolean: "true" + [weapon] = { + [level3] = number: "8" + [level1] = number: "4" + [level4] = number: "77" + [level2] = number: "4" + } + } + [10] = { + [wstype] = { + [level3] = number: "32" + [level1] = number: "4" + [level4] = number: "117" + [level2] = number: "7" + } + [count] = number: "7" + [CLSID] = string: "{69926055-0DA8-4530-9F2F-C86B157EA9F6}" + [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: "147" + [level2] = number: "7" + } + } + [11] = { + [wstype] = { + [level3] = number: "32" + [level1] = number: "4" + [level4] = number: "50" + [level2] = number: "4" + } + [count] = number: "2" + [CLSID] = string: "{DB434044-F5D0-4F1F-9BA9-B73027E18DD3}" + [adapter] = { + [level3] = number: "0" + [level1] = number: "0" + [level4] = number: "0" + [level2] = number: "0" + } + [container] = boolean: "true" + [weapon] = { + [level3] = number: "7" + [level1] = number: "4" + [level4] = number: "22" + [level2] = number: "4" + } + } + } + [CurrentStation] = number: "0" + [Cannon] = { + [shells] = number: "1150" + } + ]] + --[[ + Weapon Panel + | + --------------------------------------------------- + | | | | | | | | | | | + 1 2 3 4 5 6 7 8 9 10 11 + 1 3 5 7 9 11 10 8 6 4 2 -- Weapon Station ID + ]] + -- Payload Info + -- weapon stations (panel) 1 (left) - 11 (right) reserved + SendDataHW("100", gES_PayloadInfo.Cannon.shells, lHardware ) -- count cannon shells + SendDataHW("101", (gES_PayloadInfo.Stations[1].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 1) + SendDataHW("102", (gES_PayloadInfo.Stations[3].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 2) + SendDataHW("103", (gES_PayloadInfo.Stations[5].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 3) + SendDataHW("104", (gES_PayloadInfo.Stations[7].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 4) + SendDataHW("105", (gES_PayloadInfo.Stations[9].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 5) + SendDataHW("106", (gES_PayloadInfo.Stations[11].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 6, center station) + SendDataHW("107", (gES_PayloadInfo.Stations[10].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 7) + SendDataHW("108", (gES_PayloadInfo.Stations[8].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 8) + SendDataHW("109", (gES_PayloadInfo.Stations[6].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 9) + SendDataHW("110", (gES_PayloadInfo.Stations[4].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 10) + SendDataHW("111", (gES_PayloadInfo.Stations[2].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 11) + -- weapon stations (panel) 1 (left) - 11 (right) empty + SendDataHW("121", (gES_PayloadInfo.Stations[1].count == 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 1) + SendDataHW("122", (gES_PayloadInfo.Stations[3].count == 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 2) + SendDataHW("123", (gES_PayloadInfo.Stations[5].count == 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 3) + SendDataHW("124", (gES_PayloadInfo.Stations[7].count == 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 4) + SendDataHW("125", (gES_PayloadInfo.Stations[9].count == 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 5) + SendDataHW("126", (gES_PayloadInfo.Stations[11].count == 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 6, center station) + SendDataHW("127", (gES_PayloadInfo.Stations[10].count == 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 7) + SendDataHW("128", (gES_PayloadInfo.Stations[8].count == 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 8) + SendDataHW("129", (gES_PayloadInfo.Stations[6].count == 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 9) + SendDataHW("130", (gES_PayloadInfo.Stations[4].count == 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 10) + SendDataHW("131", (gES_PayloadInfo.Stations[2].count == 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 11) + --SendDataHW("CurrentStation", gES_PayloadInfo.CurrentStation, lHardware ) + -- air-to-air missils panel 1 and 11, air combat modus, CurrentStation = 1, panel 1 and 11 on + -- wenn die Waffenstationen gleichmässig belegt sind, hat bei Auswahl CurrentStation immer den Wert der linken Station + -- bei ungleichmäßiger Belegung, hat CurrentStation immer den Wert der jeweiligen Station + -- Waffenbezeichnung als UUID, gES_PayloadInfo.Stations[X].CLSID + + -- defination + if gES_CurrentStationTmp == nil then + gES_CurrentStationTmp = -1 + end + + if gES_PayloadInfo.CurrentStation > 0 and + gES_CurrentStationTmp ~= gES_PayloadInfo.CurrentStation then + gES_CurrentStationTmp = gES_PayloadInfo.CurrentStation + + gTmpStationToPanel = {} + gTmpStationToPanel[1] = {Panel = 1, StationID = 101, CurrentID = 201, CurrentID2 = 221, HardwareID = lHardware } -- left + gTmpStationToPanel[3] = {Panel = 2, StationID = 102, CurrentID = 202, CurrentID2 = 222, HardwareID = lHardware } + gTmpStationToPanel[5] = {Panel = 3, StationID = 103, CurrentID = 203, CurrentID2 = 223, HardwareID = lHardware } + gTmpStationToPanel[7] = {Panel = 4, StationID = 104, CurrentID = 204, CurrentID2 = 224, HardwareID = lHardware } + gTmpStationToPanel[9] = {Panel = 5, StationID = 105, CurrentID = 205, CurrentID2 = 225, HardwareID = lHardware } + gTmpStationToPanel[11] = {Panel = 6, StationID = 106, CurrentID = 206, CurrentID2 = 226, HardwareID = lHardware } + gTmpStationToPanel[10] = {Panel = 7, StationID = 107, CurrentID = 207, CurrentID2 = 227, HardwareID = lHardware } + gTmpStationToPanel[8] = {Panel = 8, StationID = 108, CurrentID = 208, CurrentID2 = 228, HardwareID = lHardware } + gTmpStationToPanel[6] = {Panel = 9, StationID = 109, CurrentID = 209, CurrentID2 = 229, HardwareID = lHardware } + gTmpStationToPanel[4] = {Panel = 10, StationID = 110, CurrentID = 210, CurrentID2 = 230, HardwareID = lHardware } + gTmpStationToPanel[2] = {Panel = 11, StationID = 111, CurrentID = 211, CurrentID2 = 231, HardwareID = lHardware } -- right + + WeaponStatusPanel_Reset(201, 211, lHardware) + WeaponStatusPanel_Reset(221, 231, lHardware) + + SendDataHW(gTmpStationToPanel[gES_PayloadInfo.CurrentStation].CurrentID, 1, lHardware) -- eigentliche Auswahl + --WriteToLog('aktiv: '..gTmpStationToPanel[gES_PayloadInfo.CurrentStation].CurrentID) + if gES_PayloadInfo.Stations[gES_PayloadInfo.CurrentStation].container then + if gES_PayloadInfo.Stations[gES_PayloadInfo.CurrentStation].count > 1 then + SendDataHW(gTmpStationToPanel[gES_PayloadInfo.CurrentStation].CurrentID2, 1, lHardware) -- eigentliche Auswahl + --WriteToLog('aktiv2: '..gTmpStationToPanel[gES_PayloadInfo.CurrentStation].CurrentID2) + end + end + table.foreach(gES_PayloadInfo.Stations, WeaponStatusPanel_selectCurrentPayloadStation) -- zugehörige Stationen + elseif gES_PayloadInfo.CurrentStation == 0 and gES_CurrentStationTmp > 0 then + WeaponStatusPanel_Reset(201, 211, lHardware) + WeaponStatusPanel_Reset(221, 231, lHardware) + gES_CurrentStationTmp = -1 + end +end + +-- Helper functions + +function WeaponStatusPanel_selectCurrentPayloadStation(_index) + if gES_PayloadInfo.Stations[gES_PayloadInfo.CurrentStation].CLSID == gES_PayloadInfo.Stations[_index].CLSID and gES_PayloadInfo.CurrentStation ~= _index then + SendDataHW(gTmpStationToPanel[_index].CurrentID, 1, gTmpStationToPanel[_index].HardwareID) + --WriteToLog('aktiv3: '..gTmpStationToPanel[_index].CurrentID) + if gES_PayloadInfo.Stations[gES_PayloadInfo.CurrentStation].container then + if gES_PayloadInfo.Stations[gES_PayloadInfo.CurrentStation].count > 1 then + SendDataHW(gTmpStationToPanel[_index].CurrentID2, 1, gTmpStationToPanel[_index].HardwareID) + --WriteToLog('aktiv3: '..gTmpStationToPanel[_index].CurrentID2) + end + end + end +end + +function WeaponStatusPanel_Reset(lMinId, lMaxID, lHardware) +--WriteToLog('WeaponStatusPanel_Reset') + for lCounter = lMinId, lMaxID, 1 do + SendDataHW(lCounter, 0, lHardware) + end +end + +function WeaponStatusPanel_selectCurrentPayloadStationGlassCockpit_A10A(_index) + if gES_PayloadInfo.Stations[gES_PayloadInfo.CurrentStation].CLSID == gES_PayloadInfo.Stations[_index].CLSID and gES_PayloadInfo.CurrentStation ~= _index then + gES_TmpWeaponPanelActive[_index] = 0.3 + end +end \ No newline at end of file diff --git a/ExportsModules/A-10C.lua b/ExportsModules/A-10C.lua new file mode 100644 index 0000000..02197b2 --- /dev/null +++ b/ExportsModules/A-10C.lua @@ -0,0 +1,1884 @@ +-- A-10C Export +-- Version 0.9.9 BETA + +gES_FoundDCSModule = true + +gES_GlassCockpitConfigEveryFrameArguments = +{ + [4] = "%.4f", -- AOA + [12] = "%.4f", -- Variometer (VVI) {-1.0, -0.5, -0.29, 0.29, 0.5, 1.0} {-6000, -2000, -1000, 1000, 2000, 6000} + [13] = "%.4f", -- APU RPM + [14] = "%.4f", -- APU Temperature + [15] = "%.4f", -- Accelerometer_main + [17] = "%.4f", -- ADI Pitch + [18] = "%.4f", -- ADI Bank + [19] = "%0.1f", -- ADI Course Warning Flag + [20] = "%.4f", -- ADI Bank Steering Bar + [21] = "%.4f", -- ADI Pitch Steering Bar + [23] = "%.4f", -- ADI Turn Needle + [24] = "%.4f", -- ADI Slip Ball + [25] = "%0.1f", -- ADI Attitude Warning Flag + [26] = "%0.1f", -- ADI Glide-Slope Warning Flag + [27] = "%.4f", -- ADI Glide-Slope Indicator + [32] = "%0.1f", -- HSI Range Flag + [33] = "%.4f", -- HSI Bearing #1 + [34] = "%.4f", -- HSI Heading + [35] = "%.4f", -- HSI Bearing #2 + [36] = "%.4f", -- HSI Heading Marker + [40] = "%0.1f", -- HSI Power Flag + [41] = "%.4f", -- HSI Deviation + [46] = "%0.1f", -- HSI Bearing Flag + [47] = "%.4f", -- HSI Course Arrow + [48] = "%.4f", -- Airspeed Needle + [49] = "%.4f", -- Airspeed Dial + [55] = "%0.1f", -- AOA Power Flag + [63] = "%.4f", -- Standby Attitude Indicator pitch + [64] = "%.4f", -- Standby Attitude Indicator bank + [65] = "%0.1f", -- Standby Attitude Indicator warning flag + [715] = "%.4f", -- Standby Attitude Indicator manual pitch adjustment + [70] = "%.4f", -- Left Engine Temperature + [73] = "%.4f", -- Right Engine Temperature + [76] = "%.4f", -- EngineLeftFanSpeed + [77] = "%.4f", -- EngineRightFanSpeed + [78] = "%.4f", -- EngineLeftCoreSpeedTenth + [80] = "%.4f", -- EngineRightCoreSpeedTenth + [82] = "%.4f", -- Left Engine Oil Pressure + [83] = "%.4f", -- Right Engine Oil Pressure + [84] = "%.4f", -- EngineLeftFuelFlow + [85] = "%.4f", -- EngineRightFuelFlow + [88] = "%.4f", -- Fuel Indicator, FuelQuantityLeft + [89] = "%.4f", -- Fuel Indicator, FuelQuantityRight + [90] = "%.4f", -- FuelQuantityCounterTenthOfThous + [91] = "%.4f", -- FuelQuantityCounterThousands + [92] = "%.4f", -- FuelQuantityCounterHundreds + [129] = "%1d", -- PTR-LCP-EAC (EAC On/Off) + -- Misc lamps + [178] = "%0.1f", -- L_AILERON_EMER_DISENGAGE + [179] = "%0.1f", -- R_AILERON_EMER_DISENGAGE + [181] = "%0.1f", -- L_ELEVATOR_EMER_DISENGAGE + [182] = "%0.1f", -- R_ELEVATOR_EMER_DISENGAGE + --STABILITY AUGMENTATION SYSTEM PANEL + [185] = "%1d", -- PTR-SASP-YAW-SASENGAGE-L (Yaw SAS Engage left) + [186] = "%1d", -- PTR-SASP-YAW-SASENGAGE-R (Yaw SAS Engage right) + [187] = "%1d", -- PTR-SASP-PITCH-SASENGAGE-L (Pitch SAS Engage left) + [188] = "%1d", -- PTR-SASP-PITCH-SASENGAGE-R (Pitch SAS Engage right) + -- Misc lamps + [191] = "%0.1f", -- TAKE_OFF_TRIM + [215] = "%0.1f", -- L_ENG_FIRE + [216] = "%0.1f", -- APU_FIRE + [217] = "%0.1f", -- R_ENG_FIRE + [260] = "%0.1f", -- TACAN_test_light {0.0, 1.0} + -- + [269] = "%.4f", -- HARS_sync {-1.0, 1.0} + [274] = "%.4f", -- OxygenVolume {0.0, 1.0} + [281] = "%.4f", -- CabinPressAlt {0.0, 1.0} + --Light System Control Panel + [289] = "%1d", -- PTR-LGHTCP-ANTICOLLISION (Anticollision Lights) + -- CMSC lamps + [372] = "%0.1f", -- CMSC_MissileLaunchIndicator {0.0, 1.0} + [373] = "%0.1f", -- CMSC_PriorityStatusIndicator {0.0, 1.0} + [374] = "%0.1f", -- CMSC_UnknownStatusIndicator {0.0, 1.0} + -- Master Warning Lamp UFCP + [404] = "%0.1f", -- MASTER_WARNING_STUB MASTER WARNING + -- Caution Panel LAMPS + [480] = "%0.1f", -- ENG_START_CYCLE + [481] = "%0.1f", -- L_HYD_PRESS + [482] = "%0.1f", -- R_HYD_PRESS + [483] = "%0.1f", -- GUN_UNSAFE + [484] = "%0.1f", -- ANTISKID + [485] = "%0.1f", -- L_HYD_RES + [486] = "%0.1f", -- R_HYD_RES + [487] = "%0.1f", -- OXY_LOW + [488] = "%0.1f", -- ELEV_DISENG + [489] = "%0.1f", -- VOID1 + [490] = "%0.1f", -- SEAT_NOT_ARMED + [491] = "%0.1f", -- BLEED_AIR_LEAK + [492] = "%0.1f", -- AIL_DISENG + [493] = "%0.1f", -- L_AIL_TAB + [494] = "%0.1f", -- R_AIL_TAB + [495] = "%0.1f", -- SERVICE_AIR_HOT + [496] = "%0.1f", -- PITCH_SAS + [497] = "%0.1f", -- L_ENG_HOT + [498] = "%0.1f", -- R_ENG_HOT + [499] = "%0.1f", -- WINDSHIELD_HOT + [500] = "%0.1f", -- YAW_SAS + [501] = "%0.1f", -- L_ENG_OIL_PRESS + [502] = "%0.1f", -- R_ENG_OIL_PRESS + [503] = "%0.1f", -- CICU + [504] = "%0.1f", -- GCAS + [505] = "%0.1f", -- L_MAIN_PUMP + [506] = "%0.1f", -- R_MAIN_PUMP + [507] = "%0.1f", -- VOID2 + [508] = "%0.1f", -- LASTE + [509] = "%0.1f", -- L_WING_PUMP + [510] = "%0.1f", -- R_WING_PUMP + [511] = "%0.1f", -- HARS + [512] = "%0.1f", -- IFF_MODE_4 + [513] = "%0.1f", -- L_MAIN_FUEL_LOW + [514] = "%0.1f", -- R_MAIN_FUEL_LOW + [515] = "%0.1f", -- L_R_TKS_UNEQUAL + [516] = "%0.1f", -- EAC + [517] = "%0.1f", -- L_FUEL_PRESS + [518] = "%0.1f", -- R_FUEL_PRESS + [519] = "%0.1f", -- NAV + [520] = "%0.1f", -- STALL_SYS + [521] = "%0.1f", -- L_CONV + [522] = "%0.1f", -- R_CONV + [523] = "%0.1f", -- CADC + [524] = "%0.1f", -- APU_GEN + [525] = "%0.1f", -- L_GEN + [526] = "%0.1f", -- R_GEN + [527] = "%0.1f", -- INST_INV + -- Angle of attack indicator + [540] = "%0.1f", -- AOA_INDEXER_HIGH + [541] = "%0.1f", -- AOA_INDEXER_NORM + [542] = "%0.1f", -- AOA_INDEXER_LOW + -- Misc Data + [600] = "%0.1f", -- BreathFlow {0.0, 1.0} + [604] = "%.4f", -- OxygenPress {0.0, 0.5, 1.0} + -- NMSP Panel lamps + [606] = "%0.1f", -- HARS + [608] = "%0.1f", -- EGI + [610] = "%0.1f", -- TISL + [612] = "%0.1f", -- STRPT + [614] = "%0.1f", -- ANCHR + [616] = "%0.1f", -- TCN + [618] = "%0.1f", -- ILS + [619] = "%0.1f", -- UHF + [620] = "%0.1f", -- FM + -- Hydraulic Pressure + [647] = "%.4f", -- HydraulicPressureLeft {0.0,1.0} + [648] = "%.4f", -- HydraulicPressureRight {0.0,1.0} + -- Flap Indicator + [653] = "%.4f", -- FlapPositionIndicator {0,20} {0,2/3,1} + -- CPT MECH + [654] = "%1d", -- PTR-ANTI-SKID (Anti Skid) + -- Landing Gear Lamps + [659] = "%0.1f", -- GEAR_N_SAFE + [660] = "%0.1f", -- GEAR_L_SAFE + [661] = "%0.1f", -- GEAR_R_SAFE + -- Misc lamps + [662] = "%0.1f", -- GUN_READY + [663] = "%0.1f", -- NOSEWHEEL_STEERING + [664] = "%0.1f", -- MARKER_BEACON + [665] = "%0.1f", -- CANOPY_UNLOCKED + [730] = "%0.1f", -- AIR_REFUEL_READY + [731] = "%0.1f", -- AIR_REFUEL_LATCHED + [732] = "%0.1f", -- AIR_REFUEL_DISCONNECT + [737] = "%0.1f", -- HANDLE_GEAR_WARNING + -- IFF Panel lamps + [798] = "%0.1f", -- IFF_reply_lamp {0, 1} + [799] = "%0.1f", -- IFF_test_lamp {0, 1} + -- + [902] = "%.4f", -- Accelerometer_min + [903] = "%.4f", -- Accelerometer_max + -- Standby Compass + [6] = "%.4f", -- heading + [720] = "%.4f", -- pitch + [721] = "%.4f", -- bank +} +gES_GlassCockpitConfigArguments = +{ + [22] = "%.3f", -- AAP ?? + -- Emergency Jettison Button + [101] = "%.1f", -- PTR-EXT-STORES-JETT (mergency Jettison External Stores) + --Fire Extinguishers Panel + [102] = "%1d", -- PTR-FIRE-LENG-PULL (Left Engine Fire T-Handle) + [103] = "%1d", -- PTR-FIRE-APU-PULL (APU Fire T-Handle) + [104] = "%1d", -- PTR-FIRE-RENG-PULL (Right Engine Fire T-Handle) + [105] = "%1d", -- PTR-FIRE-EXTING-DISCH (Fire Extinguishing Agent Discharge) + -- Fuel System Control Panel + [106] = "%1d", -- PTR-FSCP-EXT-TANKS-WING (External Wing Tanks Boost Pumps) + [107] = "%1d", -- PTR-FSCP-EXT-TANKS-FUS (External Fuselage Tank Boost Pump) + [108] = "%1d", -- PTR-FSCP-TK-GATE (Tank Gate) + [109] = "%1d", -- PTR-FSCP-CROSS-FEED (Cross Feed) + [110] = "%1d", -- PTR-FSCP-BOOST-PUMPS-WING-L (Boost Pumps Left Wing) + [111] = "%1d", -- PTR-FSCP-BOOST-PUMPS-WING-R (Boost Pumps Right Wing) + [112] = "%1d", -- PTR-FSCP-BOOST-PUMPS-MAIN-L (Boost Pumps Main Fuselage Left) + [113] = "%1d", -- PTR-FSCP-BOOST-PUMPS-MAIN-R (Boost Pumps Main Fuselage Right) + [114] = "%1d", -- PTR-FSCP-SIG-AMPL (Signal Amplifier Norm/Override) + [115] = "%.1f", -- PTR-FSCP-LINE-CHECK (Line Check) + [116] = "%.3f", -- PTR-FSCP-RCVR-LT (Refueling Lighting Dial) + [117] = "%1d", -- PTR-FSCP-FILLDISABLE-WING-L (Fill Disable Wing Left) + [118] = "%1d", -- PTR-FSCP-FILLDISABLE-WING-R (Fill Disable Wing Right) + [119] = "%1d", -- PTR-FSCP-FILLDISABLE-MAIN-L (Fill Disable Main Left) + [120] = "%1d", -- PTR-FSCP-FILLDISABLE-MAIN-R (Fill Disable Main Right) + [121] = "%1d", -- PTR-FSCP-RCVR-LEVER (Aerial Refueling Slipway Control Lever) + -- Engine System and Throttle panel + [122] = "%1d", -- PTR-FUEL-FLOW-L (Left Engine Fuel Flow Control) + [123] = "%1d", -- PTR-FUEL-FLOW-R (Right Engine Fuel Flow Control) + [124] = "%1d", -- PTR-ENGINE-OPER-L (Engine Operate Left) + [125] = "%1d", -- PTR-ENGINE-OPER-R (Engine Operate Right) + [126] = "%1d", -- PTR-APU-START (APU On/Off) + [127] = "%.1f", -- PTR-THROTTLE-FRICTION (Throttle Friction Control) + -- LASTE Control Panel + [130] = "%1d", -- PTR-LCP-RDRALTM (Radar Altimeter Normal/Disabled) + [131] = "%.1f", -- PTR-LCP-AUTOPILOT-ENGAGE (Autopilot Engage/Disengage) + [132] = "%1d", -- PTR-LCP-AUTOPILOT-PATH-ALT (Autopilot Mode Select Switch) + -- ANARC186-VHF_AM + -- AM Radio + [133] = "%.3f", -- PTR-ANARC186-VHFAM-VOLUME (Volume) + [134] = "%1d", -- PTR-ANARC186-VHFAM-SQUELCH (Squelch / TONE) + [135] = "%0.1f", -- PTR-ANARC186-VHFAM-FREQEMER-CONTROL (Frequency Selection Dial) + [136] = "%.1f", -- PTR-ANARC186-VHFAM-LOAD (Load) + [137] = "%0.3f", -- PTR-ANARC186-VHFAM-PRESET (Preset Channel Selector) + [138] = "%0.1f", -- PTR-ANARC186-VHFAM-MODE (Frequency Mode Dial) + [139] = "%0.2f", -- PTR-ANARC186-VHFAM-FREQ-1 (Frequency Selector the 1nd) + [140] = "%0.2f", -- PTR-ANARC186-VHFAM-FREQ-2 (Frequency Selector the 2nd) + [141] = "%0.2f", -- PTR-ANARC186-VHFAM-FREQ-3 (Frequency Selector the 3nd) + [142] = "%0.2f", -- PTR-ANARC186-VHFAM-FREQ-4 (Frequency Selector the 4nd) + -- FM Radio + [147] = "%.3f", -- PTR-ANARC186-VHFFM-VOLUME (Volume) + [148] = "%1d", -- PTR-ANARC186-VHFFM-SQUELCH (Squelch / TONE) + [149] = "%0.1f", -- PTR-ANARC186-VHFFM-FREQEMER-CONTROL (Frequency Selection Dial) + [150] = "%.1f", -- PTR-ANARC186-VHFFM-LOAD (Load) + [151] = "%0.3f", -- PTR-ANARC186-VHFFM-PRESET (Preset Channel Selector) + [152] = "%0.1f", -- PTR-ANARC186-VHFFM-MODE (Frequency Mode Dial) + [153] = "%0.2f", -- PTR-ANARC186-VHFFM-FREQ-1 (Frequency Selector the 1nd) + [154] = "%0.2f", -- PTR-ANARC186-VHFFM-FREQ-2 (Frequency Selector the 2nd) + [155] = "%0.2f", -- PTR-ANARC186-VHFFM-FREQ-3 (Frequency Selector the 3nd) + [156] = "%0.2f", -- PTR-ANARC186-VHFFM-FREQ-4 (Frequency Selector the 4nd) + -- ANARC164 + -- UHF Raido + [161] = "%0.2f", -- PTR-ANARC164-CHANNEL-SELECTOR (Preset Channel Selector) + [162] = "%0.1f", -- PTR-ANARC164-100MHZ-SELECTOR (100 MHz Selector) + [163] = "%0.2f", -- PTR-ANARC164-10MHZ-SELECTOR (10 MHz Selector) + [164] = "%0.2f", -- PTR-ANARC164-1MHZ-SELECTOR (1 MHz Selector) + [165] = "%0.2f", -- PTR-ANARC164-0.1MHZ-SELECTOR (0.1 MHz Selector) + [166] = "%0.2f", -- PTR-ANARC164-0.025MHZ-SELECTOR (0.025 MHz Selector) + [167] = "%0.1f", -- PTR-ANARC164-FREQMODE (Frequency Mode Dial) + [168] = "%0.1f", -- PTR-ANARC164-FUNCTION (Function Dial) + [169] = "%1d", -- PTR-ANARC164-T-TONE (T-Tone) + [170] = "%1d", -- PTR-ANARC164-SQUELCH (Squelch) + [171] = "%.3f", -- PTR-ANARC164-VOLUME (Volume) + [172] = "%.1f", -- PTR-ANARC164-TEST-DISPLAY (Test Display) + [173] = "%.1f", -- PTR-ANARC164-STATUS (Status) + [734] = "%1d", -- PTR-ANARC164-COVER + [735] = "%.1f", -- PTR-ANARC164-LOAD (Load button) + --Emergency Flight Control Panel + [174] = "%1d", -- PTR-EFCP-SPDBK-EMER-RETR (Speed Brake Emergency Retract) + [175] = "%1d", -- Speed Brake Emergency Retract (Pitch/Roll Trim Norm/Emergency Override) + [176] = "%0.1f", -- PTR-EFCP-TRIM (Trim Emergency ...) + [177] = "%1d", -- PTR-EFCP-AILERON-EMER-DISENGAGE (Aileron Emergency Disengage) + [180] = "%1d", -- PTR-EFCP-ELEVATOR-EMER-DISENGAGE (Elevator Emergency Disengage) + [183] = "%1d", -- PTR-EFCP-FLAP-EMER-RETR (Flaps Emergency Retract) + [184] = "%1d", -- PTR-EFCP-MRFCS (Manual Reversion Flight Control System (MRFCS)) + --STABILITY AUGMENTATION SYSTEM PANEL + [189] = "%1d", -- PTR-SASP-MONITOR-TEST (Monitor Test Left/Right) + [190] = "%.1f", -- PTR-SASP-TO-TRIM (Set Takeoff Trim) + [192] = "%.3f", -- PTR-SASP-YAW-TRIM (Yaw Trim) + --Light System Control Panel + [193] = "%.3f", -- PTR-ALCP-RSIL (Refuel Status Indexer Lights) + [194] = "%0.1f", -- PTR-ALCP-NVIS-LTS (Nightvision Lights) + [195] = "%.3f", -- PTR-ALCP-WPNSTA (Weapon Station Lights. No function) + [196] = "%1d", -- PTR-ALCP-HARSSAS (HARS-SAS Override/NORM) + -- ALCP + [197] = "%.1f", -- "PTR-ALCP-SIGLIGHTS-LAMP-TEST (Test Cockpit Indication Lights) + --Light System Control Panel + [198] = "%.1f", -- PTR-ALCP-FDBAL-TEST (Fire Detect Bleed Air Test) + --IFF + [199] = "%0.1f", -- PTR-IFFCP-CODE (Code) + [200] = "%0.1f", -- PTR-IFFCP-MASTER (Master) + [201] = "%1d", -- PTR-IFFCP-OUT-AUDIO-LIGHT (Audio/light) + [202] = "%1d", -- PTR-IFFCP-TEST-M-1 (Test M-1) + [203] = "%1d", -- PTR-IFFCP-TEST-M-2 (Test M-2) + [204] = "%1d", -- PTR-IFFCP-TEST-M-3A (Test M-3A) + [205] = "%1d", -- PTR-IFFCP-TEST-M-C (Test M-C) + [206] = "%1d", -- PTR-IFFCP-RADTEST (RAD Test/Mon) + [207] = "%1d", -- PTR-IFFCP-MIC-IDENT (Ident/Mic) + [208] = "%1d", -- PTR-IFFCP-ON-OUT (IFF On/Out) + [209] = "%0.2f", -- PTR-IFFCP-MODE1-WHEEL1 (MODE1-WHEEL1) + [210] = "%0.2f", -- PTR-IFFCP-MODE1-WHEEL2 (MODE1-WHEEL2) + [211] = "%0.2f", -- PTR-IFFCP-MODE3A-WHEEL1 (MODE3A-WHEEL1) + [212] = "%0.2f", -- PTR-IFFCP-MODE3A-WHEEL2 (MODE3A-WHEEL2) + [213] = "%0.2f", -- PTR-IFFCP-MODE3A-WHEEL3 (MODE3A-WHEEL3) + [214] = "%0.2f", -- PTR-IFFCP-MODE3A-WHEEL4 (MODE3A-WHEEL4) + --Inercom Panel + [221] = "%.3f", -- PTR-INTERCOM-INT (INT Switch) + [222] = "%1d", -- PTR-INTERCOM-INT (INT Switch) + [223] = "%.3f", -- PTR-INTERCOM-FM (FM Switch) + [224] = "%1d", -- PTR-INTERCOM-FM (FM Switch) + [225] = "%.3f", -- PTR-INTERCOM-VHF (VHF Switch) + [226] = "%1d", -- PTR-INTERCOM-VHF (VHF Switch) + [227] = "%.3f", -- PTR-INTERCOM-UHF (UHF Switch) + [228] = "%1d", -- PTR-INTERCOM-UHF (UHF Switch) + [229] = "%.3f", -- PTR-INTERCOM-AIM (AIM Switch) + [230] = "%1d", -- PTR-INTERCOM-AIM (AIM Switch) + [231] = "%.3f", -- PTR-INTERCOM-IFF (IFF Switch) + [232] = "%1d", -- PTR-INTERCOM-IFF (IFF Switch) + [233] = "%.3f", -- PTR-INTERCOM-ILS (ILS Switch) + [234] = "%1d", -- PTR-INTERCOM-ILS (ILS Switch) + [235] = "%.3f", -- PTR-INTERCOM-TCN (TCN Switch) + [236] = "%1d", -- PTR-INTERCOM-TCN (TCN Switch) + [237] = "%1d", -- PTR-INTERCOM-HM (HM Switch) + [238] = "%.3f", -- PTR-INTERCOM-VOL (Intercom volume) + [239] = "%0.1f", -- PTR-INTERCOM-MODE (Selector switch) + [240] = "%.1f", -- PTR-INTERCOM-CALL (Call button) + --Electrical Power Panel + [241] = "%1d", -- PTR-EPP-APU-GEN-PWR (APU Generator On/Off) + [242] = "%1d", -- PTR-EPP-INVERTER (Inverter Switch) + [243] = "%1d", -- PTR-EPP-EMER-FLOOD (Emergency Flood Light) + [244] = "%1d", -- PTR-EPP-AC-GEN-PWR-L (Left AC Generator Power) + [245] = "%1d", -- PTR-EPP-AC-GEN-PWR-R (Right AC Generator Power) + [246] = "%1d", -- PTR-EPP-BATTERY-PWR (Battery Power) + --ILS + [247] = "%1d", -- PTR-ILSCP-PWR (ILS Frequency MHz / Power. Right mouse click to cycle power. Rotate mouse wheel to change frequency value) + [248] = "%0.1f", -- PTR-ILSCP-PWR (ILS Frequency MHz / Power. Right mouse click to cycle power. Rotate mouse wheel to change frequency value) + [249] = "%.3f", -- PTR-ILSCP-VOL (ILS Frequency kHz / Volume. Rotate mouse wheel to change frequency value. Left or Right click and hold while moving mouse to adjust volumeILS Frequency kHz / Volume. Rotate mouse wheel to change frequency value. Left or Right click and hold while moving mouse to adjust) + [250] = "%0.1f", -- PTR-ILSCP-VOL (ILS Frequency kHz / Volume. Rotate mouse wheel to change frequency value. Left or Right click and hold while moving mouse to adjust volumeILS Frequency kHz / Volume. Rotate mouse wheel to change frequency value. Left or Right click and hold while moving mouse to adjust) + [251] = "%0.1f", -- ILS_window_wheel_MHz + [252] = "%0.1f", -- ILS_window_wheel_KHz + --TACAN + [258] = "%0.2f", -- PTR-TACAN-CHANNEL-SELECTOR-2 (Channel Selector (Ones) / X/Y Mode. Right mouse click to select X/Y. Rotate mouse wheel to make channel selection) + [259] = "%.1f", -- PTR-TACAN-TEST (Test TACAN Signal on HSI) + [261] = "%.3f", -- PTR-TACAN-VOL (Signal Volume) + [262] = "%0.1f", -- PTR-TACAN-MODE (Mode Dial) + [266] = "%1d", -- XYwheel + --HARS + [267] = "%.1f", -- PTR-HARS-CP-PUSH-TO-SYNC (HARS Push-To-Sync) + [268] = "%.3f", -- PTR-HARS-CP-PUSH-TO-SYNC (HARS Push-To-Sync) + [270] = "%1d", -- PTR-HARS-CP-SLAVE (HARS SLAVE-DG mode) + [271] = "%.3f", -- PTR-HARS-CP-LATITUDE (HARS Latitude Dial) + [272] = "%1d", -- PTR-HARS-CP-MAG-VAR (HARS MAG VAR) + [273] = "%1d", -- PTR-HARS-CP-N-S (HARS N/S toggle switch) + [711] = "%.1f", -- PTR-HARS-FAST-ERECT (HARS Fast Erect) + --Environment Control Panel + [275] = "%.1f", -- PTR-ENVCP-OXY-TEST (Oxygen Indicator Test) + [276] = "%1d", -- PTR-ENVCP-WINDSHIELD-DEFOG (Windshield Defog/Deice) + [277] = "%.3f", -- PTR-ENVCP-CANOPY-DEFOG (Canopy Defog) + [278] = "%1d", -- PTR-ENVCP-WINDSHIELD-RREMOVE-WASH (Windshield Rain Removal/Wash) + [279] = "%1d", -- PTR-ENVCP-PITOT-HEAT (Pitot Heater) + [280] = "%1d", -- PTR-ENVCP-BLEED-AIR (Bleed Air) + [282] = "%1d", -- PTR-ENVCP-TEMP-PRESS (Temperature/Pressure Control) + [283] = "%1d", -- PTR-ENVCP-MAIN-AIR-SUPPLY (Main Air Supply) + [284] = "%.3f", -- PTR-ENVCP-FLOW-LEVEL (Flow Level Control) + --Light System Control Panel + [287] = "%1d", -- PTR-LGHTCP-POSITION (Position Lights, FLASH/OFF/STEADY) + [288] = "%.3f", -- PTR-LGHTCP-FORMATION (Formation Lights) + [290] = "%.3f", -- PTR-LGHTCP-ENG-INST (Engine Instruments Lights) + [291] = "%1d", -- PTR-LGHTCP-NOSE-ILLUM (Nose Illumination) + [292] = "%.3f", -- PTR-LGHTCP-FLIGHT-INST (Flight Instruments Lights) + [293] = "%.3f", -- PTR-LGHTCP-AUX-INST (Auxiliary Instruments Lights) + [294] = "%1d", -- PTR-LGHTCP-SIGNAL-LTS (Signal Lights) + [295] = "%1d", -- PTR-LGHTCP-ACCEL-COMP (Accelerometer & Compass Lights) + [296] = "%.3f", -- PTR-LGHTCP-FLOOD (Flood Light) + [297] = "%.3f", -- PTR-LGHTCP-CONSOLE (Console Light) + -- Left MFCDI + [300] = "%.1f", -- PNT-BTN-MFD-L-01 (OSB 1) + [301] = "%.1f", -- PNT-BTN-MFD-L-02 (OSB 2) + [302] = "%.1f", -- PNT-BTN-MFD-L-03 (OSB 3) + [303] = "%.1f", -- PNT-BTN-MFD-L-04 (OSB 4) + [304] = "%.1f", -- PNT-BTN-MFD-L-05 (OSB 5) + [305] = "%.1f", -- PNT-BTN-MFD-L-06 (OSB 6) + [306] = "%.1f", -- PNT-BTN-MFD-L-07 (OSB 7) + [307] = "%.1f", -- PNT-BTN-MFD-L-08 (OSB 8) + [308] = "%.1f", -- PNT-BTN-MFD-L-09 (OSB 9) + [309] = "%.1f", -- PNT-BTN-MFD-L-10 (OSB 10) + [310] = "%.1f", -- PNT-BTN-MFD-L-11 (OSB 11) + [311] = "%.1f", -- PNT-BTN-MFD-L-12 (OSB 12) + [312] = "%.1f", -- PNT-BTN-MFD-L-13 (OSB 13) + [313] = "%.1f", -- PNT-BTN-MFD-L-14 (OSB 14) + [314] = "%.1f", -- PNT-BTN-MFD-L-15 (OSB 15) + [315] = "%.1f", -- PNT-BTN-MFD-L-16 (OSB 16) + [316] = "%.1f", -- PNT-BTN-MFD-L-17 (OSB 17) + [317] = "%.1f", -- PNT-BTN-MFD-L-18 (OSB 18) + [318] = "%.1f", -- PNT-BTN-MFD-L-19 (OSB 19) + [319] = "%.1f", -- PNT-BTN-MFD-L-20 (OSB 20) + [320] = "%1d", -- PNT-MFCD-L-ADJ-UP/DN (Moving Map Scale Adjust Increase/Decrease) + [321] = "%1d", -- PNT-MFCD-L-DSP-UP/DN (Decrease/Increase Backlight Brightness) + [322] = "%1d", -- PNT-MFD-L-BRT-UP/DN (Decrease/Increase Brightness) + [323] = "%1d", -- PNT-MFD-L-CON-UP/DN (Decrease/Increase Contrast) + [324] = "%1d", -- PNT-MFD-L-SYM-UP/DN (Decrease/Increase Symbol Levels) + [325] = "%0.1f", -- PNT-LVR-MFD-L (DAY/NIGHT/OFF) + -- Right MFCDI + [326] = "%.1f", -- PNT-BTN-MFD-R-01 (OSB 1) + [327] = "%.1f", -- PNT-BTN-MFD-R-02 (OSB 2) + [328] = "%.1f", -- PNT-BTN-MFD-R-03 (OSB 3) + [329] = "%.1f", -- PNT-BTN-MFD-R-04 (OSB 4) + [330] = "%.1f", -- PNT-BTN-MFD-R-05 (OSB 5) + [331] = "%.1f", -- PNT-BTN-MFD-R-06 (OSB 6) + [332] = "%.1f", -- PNT-BTN-MFD-R-07 (OSB 7) + [333] = "%.1f", -- PNT-BTN-MFD-R-08 (OSB 8) + [334] = "%.1f", -- PNT-BTN-MFD-R-09 (OSB 9) + [335] = "%.1f", -- PNT-BTN-MFD-R-10 (OSB 10) + [336] = "%.1f", -- PNT-BTN-MFD-R-11 (OSB 11) + [337] = "%.1f", -- PNT-BTN-MFD-R-12 (OSB 12) + [338] = "%.1f", -- PNT-BTN-MFD-R-13 (OSB 13) + [339] = "%.1f", -- PNT-BTN-MFD-R-14 (OSB 14) + [340] = "%.1f", -- PNT-BTN-MFD-R-15 (OSB 15) + [341] = "%.1f", -- PNT-BTN-MFD-R-16 (OSB 16) + [342] = "%.1f", -- PNT-BTN-MFD-R-17 (OSB 17) + [343] = "%.1f", -- PNT-BTN-MFD-R-18 (OSB 18) + [344] = "%.1f", -- PNT-BTN-MFD-R-19 (OSB 19) + [345] = "%.1f", -- PNT-BTN-MFD-R-20 (OSB 20) + [346] = "%1d", -- PNT-MFCD-R-ADJ-UP/DN (Moving Map Scale Adjust Increase/Decrease) + [347] = "%1d", -- PNT-MFCD-R-DSP-UP/DN (Decrease/Increase Backlight Brightness) + [348] = "%1d", -- PNT-MFD-R-BRT-UP/DN (Decrease/Increase Brightness) + [349] = "%1d", -- PNT-MFD-R-CON-UP/DN (Decrease/Increase Contrast) + [350] = "%1d", -- PNT-MFD-R-SYM-UP/DN (Decrease/Increase Symbol Levels) + [351] = "%0.1f", -- PNT-LVR-MFD-R (DAY/NIGHT/OFF) + -- CMSP + [352] = "%.1f", -- PNT-BTN-CMSP-ARW1 (Edit Program Value) + [353] = "%.1f", -- PNT-BTN-CMSP-ARW2 (Edit Program Value) + [354] = "%.1f", -- PNT-BTN-CMSP-ARW3 (Edit Program Value) + [355] = "%.1f", -- PNT-BTN-CMSP-ARW4 (Edit Program Value) + [356] = "%1d", -- PNT-BTN-CMSP-BRT-UP/DN (Cycle Program or Value Up/Down) + [357] = "%.1f", -- PNT-BTN-CMSP-RTN (Save and Return Program) + [358] = "%1d", -- PNT-TMB-CMSP-JTSN (Jettison Countermeasures) + [359] = "%.3f", -- PNT-LEV-CMSP-BRT (Adjust Display Brightness) + [360] = "%0.1f", -- PNT-TMB-CMSP-MWS (Missile Warning System (MWS). Left mouse - ON/OFF, Right mouse - MENU (No Function)) + [361] = "%0.1f", -- PNT-TMB-CMSP-JMR (Electronic Countermeasure Jammer (JMR). Left mouse - ON/OFF, Right mouse - MENU (No Function)) + [362] = "%0.1f", -- PNT-TMB-CMSP-RWR (Radar Warning Receiver (RWR). Left mouse - ON/OFF, Right mouse - MENU) + [363] = "%0.1f", -- PNT-TMB-CMSP-DISP (Countermeasure Dispenser (DISP). Left mouse - ON/OFF, Right mouse - MENU) + [364] = "%0.1f", -- PNT-LEV-CMSP-MODE (Master CMS Mode Select) + -- CMSC + [365] = "%.1f", -- PNT-BTN-RWR-JMR (Select Jammer Program) + [366] = "%.1f", -- PNT-BTN-RWR-MWS (Cycle Missile Warning System Programs. No function) + [367] = "%.3f", -- PNT-LEV-RWR-BRT (Adjust Display Brightness) + [368] = "%.3f", -- PNT-LEV-RWR-AUD (Adjust RWR Volume) + [369] = "%.1f", -- PNT-BTN-RWR-PRI (Toggle between 5 and 16 Priority Threats Displayed) + [370] = "%.1f", -- PNT-BTN-RWR-SEP (Separate RWR Symbols) + [371] = "%.1f", -- PNT-BTN-RWR-UNK (Display Unknown Threats) + -- AHCP + [375] = "%0.1f", -- PNT-TMB-AHCP-MARM (Master Arm) + [376] = "%0.1f", -- PNT-TMB-AHCP-GUNPAC (Gun Arm Mode) + [377] = "%0.1f", -- PNT-TMB-AHCP-LARM (Laser Arm) + [378] = "%1d", -- PNT-TMB-AHCP-TGP (Targeting Pod Power On/Off) + [379] = "%0.1f", -- PNT-TMB-AHCP-ALT (Altimeter Source) + [380] = "%1d", -- PNT-TMB-AHCP-TIME (Day/Night HUD Mode) + [381] = "%1d", -- PNT-TMB-AHCP-NORM (NORM/Standby HUD Mode) + [382] = "%1d", -- PNT-TMB-AHCP-CICU (Turn On/Off CICU) + [383] = "%1d", -- PNT-TMB-AHCP-JTRS (JTRS Datalink On/Off) + [384] = "%0.1f", -- PNT-TMB-AHCP-IFFCC (Turn On/Off/Test IFFCC) + -- UFC + [385] = "%.1f", -- PNT-BTN-UFC-1 + [386] = "%.1f", -- PNT-BTN-UFC-2 + [387] = "%.1f", -- PNT-BTN-UFC-3 + [388] = "%.1f", -- PNT-BTN-UFC-4 + [389] = "%.1f", -- PNT-BTN-UFC-5 + [390] = "%.1f", -- PNT-BTN-UFC-6 + [391] = "%.1f", -- PNT-BTN-UFC-7 + [392] = "%.1f", -- PNT-BTN-UFC-8 + [393] = "%.1f", -- PNT-BTN-UFC-9 + [394] = "%.1f", -- PNT-BTN-UFC-HACK (Display Hack Time) + [395] = "%.1f", -- PNT-BTN-UFC-0 + [396] = "%.1f", -- PNT-BTN-UFC-SPC (Space) + [397] = "%.1f", -- PNT-BTN-UFC-FUNC (Select Function Mode) + [398] = "%.1f", -- PNT-BTN-UFC-LTR (Select Letter Mode) + [399] = "%.1f", -- PNT-BTN-UFC-CLR (Clear) + [400] = "%.1f", -- PNT-BTN-UFC-ENT (Enter) + [401] = "%.1f", -- PNT-BTN-UFC-MK (Create Overhead Mark Point) + [402] = "%.1f", -- PNT-BTN-UFC-ALT (Display and Adjust Altitude Alert Values) + [405] = "%1d", -- PNT-BTN-UFC-STEER-UP/DN (Cycle Steerpoint/Waypoint) + [406] = "%1d", -- PNT-BTN-UFC-DATA-UP/DN + [407] = "%1d", -- PNT-BTN-UFC-SEL-UP/DN + [408] = "%1d", -- PNT-BTN-UFC-DEPR-UP/DN (Adjust Depressible Pipper) + [409] = "%1d", -- PNT-BTN-UFC-INTEN-RGT/LFT (Adjust HUD Brightness (Hold rocker)) + -- SYS_CONTROLLER + [403] = "%.1f", -- PNT-BTN-UFC-MASTWARN (Master Caution Light) + -- CDU + [410] = "%.1f", -- PNT-BTN-CDU-ARW-L1 (LSK 3L) + [411] = "%.1f", -- PNT-BTN-CDU-ARW-L2 (LSK 5L) + [412] = "%.1f", -- PNT-BTN-CDU-ARW-L3 (LSK 7L) + [413] = "%.1f", -- PNT-BTN-CDU-ARW-L4 (LSK 9L) + [414] = "%.1f", -- PNT-BTN-CDU-ARW-R1 (LSK 3R) + [415] = "%.1f", -- PNT-BTN-CDU-ARW-R2 (LSK 5R) + [416] = "%.1f", -- PNT-BTN-CDU-ARW-R3 (LSK 7R) + [417] = "%.1f", -- PNT-BTN-CDU-ARW-R4 (LSK 9R) + [418] = "%.1f", -- PNT-BTN-CDU-SYS (Display System (SYS) Page) + [419] = "%.1f", -- PNT-BTN-CDU-NAV (Display Navigation (NAV) Page) + [420] = "%.1f", -- PNT-BTN-CDU-WP (Display Waypoint Menu (WP MENU) Page) + [421] = "%.1f", -- PNT-BTN-CDU-OSET (Display Offset (OFFSET) Page) + [422] = "%.1f", -- PNT-BTN-CDU-FPM (Display Flight Plan Menu (FPMENU) Page) + [423] = "%.1f", -- PNT-BTN-CDU-PREV (Go to previous page) + [424] = "%1d", -- PNT-BTN-CDU-DIMBRT-L/R (Display Brightness Adjustment (Not Functional)) + [425] = "%.1f", -- PNT-BTN-CDU-1 + [426] = "%.1f", -- PNT-BTN-CDU-2 + [427] = "%.1f", -- PNT-BTN-CDU-3 + [428] = "%.1f", -- PNT-BTN-CDU-4 + [429] = "%.1f", -- PNT-BTN-CDU-5 + [430] = "%.1f", -- PNT-BTN-CDU-6 + [431] = "%.1f", -- PNT-BTN-CDU-7 + [432] = "%.1f", -- PNT-BTN-CDU-8 + [433] = "%.1f", -- PNT-BTN-CDU-9 + [434] = "%.1f", -- PNT-BTN-CDU-0 + [435] = "%.1f", -- PNT-BTN-CDU-PNT + [436] = "%.1f", -- PNT-BTN-CDU-SLASH + [437] = "%.1f", -- PNT-BTN-CDU-A + [438] = "%.1f", -- PNT-BTN-CDU-B + [439] = "%.1f", -- PNT-BTN-CDU-C + [440] = "%.1f", -- PNT-BTN-CDU-D + [441] = "%.1f", -- PNT-BTN-CDU-E + [442] = "%.1f", -- PNT-BTN-CDU-F + [443] = "%.1f", -- PNT-BTN-CDU-G + [444] = "%.1f", -- PNT-BTN-CDU-H + [445] = "%.1f", -- PNT-BTN-CDU-I + [446] = "%.1f", -- PNT-BTN-CDU-J + [447] = "%.1f", -- PNT-BTN-CDU-K + [448] = "%.1f", -- PNT-BTN-CDU-L + [449] = "%.1f", -- PNT-BTN-CDU-M + [450] = "%.1f", -- PNT-BTN-CDU-N + [451] = "%.1f", -- PNT-BTN-CDU-O + [452] = "%.1f", -- PNT-BTN-CDU-P + [453] = "%.1f", -- PNT-BTN-CDU-Q + [454] = "%.1f", -- PNT-BTN-CDU-R + [455] = "%.1f", -- PNT-BTN-CDU-S + [456] = "%.1f", -- PNT-BTN-CDU-T + [457] = "%.1f", -- PNT-BTN-CDU-U + [458] = "%.1f", -- PNT-BTN-CDU-V + [459] = "%.1f", -- PNT-BTN-CDU-W + [460] = "%.1f", -- PNT-BTN-CDU-X + [461] = "%.1f", -- PNT-BTN-CDU-Y + [462] = "%.1f", -- PNT-BTN-CDU-Z + [463] = "%1d", -- PNT-BTN-CDU-PG-UP/DN (Page Up/Down To Additional Pages When Available) + [466] = "%.1f", -- PNT-BTN-CDU-MK (Create Overhead Mark Point) + [467] = "%.1f", -- PNT-BTN-CDU-BCK (Erase Single Character. Hold for repeated erase) + [468] = "%.1f", -- PNT-BTN-CDU-SPC (Insert Space Into Scratchpad) + [469] = "%1d", -- PNT-BTN-CDU-BLANC-L/R (Scroll Waypoint Names During Search) + [470] = "%.1f", -- PNT-BTN-CDU-CLR (Erase Entire Scratchpad) + [471] = "%.1f", -- PNT-BTN-CDU-FA (Fault Acknowledge/Clear Fault Display) + [472] = "%1d", -- PNT-BTN-CDU-PLUS (Increment/Decrement Data Indicated With +/- Symbol) + -- AAP + [473] = "%0.1f", -- PNT-LVR-STEER-PT-SEL-SWITCH (Use Steerpoint From Active Flight Plan) + [474] = "%1d", -- PNT-TMB-STEER-SPRING-LD-SWITCH (Toggle Steerpoint) + [475] = "%0.1f", -- PNT-LEV-PAGE-SEL-SWITCH (CDU Page Select) + [476] = "%1d", -- PTR-TMB-CDU-SWITCH (CDU Power On/Off) + [477] = "%1d", -- PTR-TMB-EGI-SWITCH (EGI Power On/Off) + -- UFC + [531] = "%.1f", -- PNT-BTN-UFC-FWD + [532] = "%.1f", -- PNT-BTN-UFC-MID + [533] = "%.1f", -- PNT-BTN-UFC-AFT + --Oxygen System Control Panel + [601] = "%1d", -- PTR-OXYGENCP-EMERGENCY (Oxygen Flow Emergency/Normal/Test Mask) + [602] = "%1d", -- PTR-OXYGENCP-OXYGEN-DILUTER (Oxygen Normal/100%) + [603] = "%1d", -- PTR-OXYGENCP-SUPPLY (Oxygen Supply On/Off) + -- Navigation Mode Select Panel + [605] = "%.1f", -- PTR-NMSP-HARS (HARS Backup Navigation Mode) + [607] = "%.1f", -- PTR-NMSP-EGI (EGI Navigation Mode) + [609] = "%.1f", -- PTR-NMSP-TISL (TISL No Function) + [611] = "%.1f", -- PTR-NMSP-STARTPT (STEERPT Mode) + [613] = "%.1f", -- PTR-NMSP-ANCHR (ANCHR Mode) + [615] = "%.1f", -- PTR-NMSP-TCN (TCN Mode) + [617] = "%.1f", -- PTR-NMSP-ILS (ILS Mode) + [621] = "%1d", -- PTR-NMSP-ABLE-STOW (ABLE-STOW ADI Localizer Bar) + --TISL Control Panel + [622] = "%0.1f", -- PTR-TISLCP-MODE (TISL Mode) + [623] = "%1d", -- PTR-TISLCP-SLANT-RNG (Slant range) + [624] = "%.3f", -- PTR-TISLCP-ALT-ABV-TGT-WH1 (Altitude above target tens of thousands of feet) + [626] = "%.3f", -- PTR-TISLCP-ALT-ABV-TGT-WH2 (Altitude above target Units of thousands of feet) + [628] = "%.1f", -- PTR-TISLCP-ENTER (ENTER) + [630] = "%.1f", -- + [632] = "%.1f", -- PTR-TISLCP-BITE (BITE) + [634] = "%.1f", -- + [636] = "%0.2f", -- PTR-TISLCP-CODE-WH1 (TISL Code wheel 1) + [638] = "%0.2f", -- PTR-TISLCP-CODE-WH2 (TISL Code wheel 2) + [640] = "%0.2f", -- PTR-TISLCP-CODE-WH3 (TISL Code wheel 3) + [642] = "%0.2f", -- PTR-TISLCP-CODE-WH4 (TISL Code wheel 4) + [644] = "%1d", -- PTR-TISLCP-TISL-AUX (TISL AUX) + -- Fuel System Control Panel + --Fuel Quantity Indicator and Selector + [645] = "%0.1f", -- PTR-FQIS-SELECT (Fuel display selector) + [646] = "%.1f", -- PTR-FQIS-TEST (Fuel Gauge Test) + -- CPT MECH + [651] = "%.1f", -- PTR-DOWNLOCK-OVERRIDE (Downlock Override) + [716] = "%1d", -- PNT-LNDGEAR (Landing Gear Lever) + --Light System Control Panel + [655] = "%0.1f", -- PTR-LIGHTS-LAND (Land Taxi Lights) + --STALL + [704] = "%.3f", -- PTR-STALLWCP-STALL (Stall Volume) + [705] = "%.3f", -- PTR-STALLWCP-PEAK (Peak Volume) + -- Canopy + [712] = "%0.2f", -- PTR-CANOPY-OPEN (Canopy Open/Hold/Close) + -- Auxiliary Landing Gear Handle + [718] = "%1d", -- PTR-ARM-DWNC-L (Auxiliary Landing Gear Handle) + [722] = "%.1f", -- PTR-BTN-ARM-DWNC-L (Auxiliary Landing Gear Handle Lock button) + -- Arm Seat Handle + [733] = "%1d", -- PTR-ARM-SEAT-HANDLE (Seat Arm Handle) + -- + [772] = "%1d", -- PTR-EMER-BRKARM (Emergency Brake) + -- Secure Voice Comms Panel + [778] = "%1d", -- PTR-ZEROIZE-COVER (Zeroise Cover) + [779] = "%1d", -- PTR-ZEROIZE-SWITCH (Zeroise Switch) + [780] = "%1d", -- PTR-DELAY-SWITCH (Delay Switch) + [781] = "%0.1f", -- PTR-LVR-PANKY58-PLAIN (C/RAD switch) + [782] = "%0.1f", -- PTR-LVR-PANKY58-1TO5 (Full switch) + [783] = "%0.1f", -- PTR-LVR-PANKY58-MODE (Mode switch) + [784] = "%1d", -- PTR-TMB-PANKY58-POWER (Power switch) +} + +----------------------------- +-- HIGH IMPORTANCE EXPORTS -- +-- done every export event -- +----------------------------- + +-- Pointed to by ProcessGlassCockpitDCSHighImportance, if the player aircraft is an A-10 +function ProcessGlassCockpitDCSConfigHighImportance(mainPanelDevice) + if gES_GlassCockpitType == 1 then + -- HELIOS Version 1.3 + -- Send Altimeter Values + SendData(2051, string.format("%0.4f;%0.4f;%0.5f", + mainPanelDevice:get_argument_value(52), + mainPanelDevice:get_argument_value(53), + mainPanelDevice:get_argument_value(51))) + -- Barometric Pressure Setting + SendData(2059, string.format("%0.2f;%0.2f;%0.2f;%0.3f", + mainPanelDevice:get_argument_value(56), + mainPanelDevice:get_argument_value(57), + mainPanelDevice:get_argument_value(58), + mainPanelDevice:get_argument_value(59))) + -- Calcuate HSI Value + SendData(2029, string.format("%0.2f;%0.2f;%0.4f", + mainPanelDevice:get_argument_value(29), + mainPanelDevice:get_argument_value(30), + mainPanelDevice:get_argument_value(31))) + -- Calculate Total Fuel + SendData(2090, string.format("%0.2f;%0.2f;%0.5f", + mainPanelDevice:get_argument_value(90), + mainPanelDevice:get_argument_value(91), + mainPanelDevice:get_argument_value(92))) + + elseif gES_GlassCockpitType == 2 then + -- HawgTouch version 1.6 + + -- FuelGauge + -- [90] = "%.4f", -- FuelQuantityCounterTenthOfThous + -- [91] = "%.4f", -- FuelQuantityCounterThousands + -- [92] = "%.4f", -- FuelQuantityCounterHundreds + -- [88] = "%.4f", -- Fuel Indicator, FuelQuantityLeft + -- [89] = "%.4f", -- Fuel Indicator, FuelQuantityRight + SendData(2000, string.format("%0.2f;%0.2f;%0.4f;%0.4f;%0.4f", + mainPanelDevice:get_argument_value(90), + mainPanelDevice:get_argument_value(91), + mainPanelDevice:get_argument_value(92), + mainPanelDevice:get_argument_value(88), + mainPanelDevice:get_argument_value(89))) + + -- HSI + --[[ + [34] = "%.4f", -- HSI Heading + [33] = "%.4f", -- HSI Bearing #1 + [35] = "%.4f", -- HSI Bearing #2 + [36] = "%.4f", -- HSI Heading Marker + [47] = "%.4f", -- HSI Course Arrow + [41] = "%.4f", -- HSI Deviation + [29] = "%.2f", -- HSI range_counter_100 + [30] = "%.2f", -- HSI range_counter_10 + [31] = "%.2f", -- HSI range_counter_1 + [42] = "%0.1f", -- HSI Bearing to_from_1 + [43] = "%0.1f", -- HSI Bearing to_from_2 + [46] = "%0.1f", -- HSI Bearing Flag + [40] = "%0.1f", -- HSI Power Flag + [32] = "%0.1f", -- HSI Range Flag + ]] + SendData(2001, string.format("%0.4f;%0.4f;%0.4f;%0.4f;%0.4f;%0.4f;%0.2f;%0.2f;%0.2f;%0.1f;%0.1f;%0.1f;%0.1f;%0.1f", + mainPanelDevice:get_argument_value(34), + mainPanelDevice:get_argument_value(33), + mainPanelDevice:get_argument_value(35), + mainPanelDevice:get_argument_value(36), + mainPanelDevice:get_argument_value(47), + mainPanelDevice:get_argument_value(41), + mainPanelDevice:get_argument_value(29), + mainPanelDevice:get_argument_value(30), + mainPanelDevice:get_argument_value(31), + mainPanelDevice:get_argument_value(42), + mainPanelDevice:get_argument_value(43), + mainPanelDevice:get_argument_value(46), + mainPanelDevice:get_argument_value(40), + mainPanelDevice:get_argument_value(32))) + -- Altimeter + -- [51] = "%.4f", -- Altimeter_100_footPtr + -- [52] = "%.4f", -- Altimeter_10000_footCount + -- [53] = "%.4f", -- Altimeter_1000_footCount + -- [54] = "%.4f", -- Altimeter_100_footCount + -- [59] = "%.4f", -- pressure_setting_0 + -- [58] = "%.4f", -- pressure_setting_1 + -- [57] = "%.4f", -- pressure_setting_2 + -- [56] = "%.4f", -- pressure_setting_3 + SendData(2002, string.format("%0.4f;%0.4f;%0.4f;%0.4f;%0.4f;%0.4f;%0.4f;%0.4f", + mainPanelDevice:get_argument_value(51), + mainPanelDevice:get_argument_value(52), + mainPanelDevice:get_argument_value(53), + mainPanelDevice:get_argument_value(54), + mainPanelDevice:get_argument_value(59), + mainPanelDevice:get_argument_value(58), + mainPanelDevice:get_argument_value(57), + mainPanelDevice:get_argument_value(56))) + -- ADI + --[[ + [17] = "%.4f", -- ADI Pitch + [18] = "%.4f", -- ADI Bank + [24] = "%.4f", -- ADI Slip Ball + [20] = "%.4f", -- ADI Bank Steering Bar + [21] = "%.4f", -- ADI Pitch Steering Bar + [23] = "%.4f", -- ADI Turn Needle + [27] = "%.4f", -- ADI Glide-Slope Indicator + [26] = "%0.1f", -- ADI Glide-Slope Warning Flag + [25] = "%0.1f", -- ADI Attitude Warning Flag + [19] = "%0.1f", -- ADI Course Warning Flag + ]] + SendData(2003, string.format("%0.4f;%0.4f;%0.4f;%0.4f;%0.4f;%0.4f;%0.4f;%0.1f;%0.1f;%0.1f", + mainPanelDevice:get_argument_value(17), + mainPanelDevice:get_argument_value(18), + mainPanelDevice:get_argument_value(24), + mainPanelDevice:get_argument_value(20), + mainPanelDevice:get_argument_value(21), + mainPanelDevice:get_argument_value(23), + mainPanelDevice:get_argument_value(27), + mainPanelDevice:get_argument_value(26), + mainPanelDevice:get_argument_value(25), + mainPanelDevice:get_argument_value(19))) + + -- Airspeed + local lAltimeter = math.round(mainPanelDevice:get_argument_value(52) * 10000, 1) + math.round(mainPanelDevice:get_argument_value(53) * 1000, 1) + math.round(mainPanelDevice:get_argument_value(54) * 100, 1) + lAltimeter = lAltimeter * 10 + -- [48] = "%.4f", -- AirspeedNeedle {0.0, 0.053, 0.146, 0.234, 0.322, 0.412, 0.517, 0.620, 0.719, 0.811, 0.906, 1.0} { 0, 50, 100, 150, 200, 250, 300, 350, 400, 450, 500, 550} + -- [49] = "%.4f", -- AirspeedDial {0.0, 1.0} {0.0, 100.0} + -- Barometric Altimeter in Feeds for calculate max Air Speed + SendData(2004, string.format("%0.4f;%0.4f;%d", + mainPanelDevice:get_argument_value(48), + mainPanelDevice:get_argument_value(49), + lAltimeter)) + -- Standby AID + -- [63] = "%.4f", -- Standby Attitude Indicator pitch {-1.0, 1.0} + -- [64] = "%.4f", -- Standby Attitude Indicator bank {-1.0, 1.0} + -- [65] = "%0.1f", -- Standby Attitude Indicator warning flag {0.0, 1.0} + SendData(2005, string.format("%0.4f;%0.4f;%d", + mainPanelDevice:get_argument_value(63), + mainPanelDevice:get_argument_value(64), + mainPanelDevice:get_argument_value(65))) + -- AOA + -- [4] = "%.4f", -- AOA {0.0, 1.0} {0.0, 30.0} + -- [55] = "%0.1f", -- AOA Power Flag {0.0, 1.0} + SendData(2006, string.format("%0.4f;%0.4f", + mainPanelDevice:get_argument_value(4), + mainPanelDevice:get_argument_value(55))) + -- Flap Indicator + -- [653] = "%.4f", -- FlapPositionIndicator {0,20} {0,2/3,1} + + -- Hydraulic Pressure + -- [647] = "%.4f", -- HydraulicPressureLeft {0.0,1.0} + -- [648] = "%.4f", -- HydraulicPressureRight {0.0,1.0} + -- Variometer VVI + -- [12] = "%.4f", -- Variometer {-1.0, -0.5, -0.29, 0.29, 0.5, 1.0} {-6000, -2000, -1000, 1000, 2000, 6000} + -- Engine Monitoring Instruments (EMI) + -- [76] = "%.4f", -- EngineLeftFanSpeed + -- [77] = "%.4f", -- EngineRightFanSpeed + -- [82] = "%.4f", -- Left Engine Oil Pressure + -- [83] = "%.4f", -- Right Engine Oil Pressure + -- [84] = "%.4f", -- EngineLeftFuelFlow + -- [85] = "%.4f", -- EngineRightFuelFlow + -- [13] = "%.4f", -- APU RPM + -- [14] = "%.4f", -- APU Temperature + + -- [70] = "%.4f", -- Left Engine Temperature (big needle) {0.005, 0.095, 0.183, 0.275, 0.365, 0.463, 0.560, 0.657, 0.759, 0.855, 0.995} { 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100} + -- [71] = "%.4f", -- EngineLeftTemperatureUnits (small needle) + SendData(2008, string.format("%0.4f;%0.4f", + mainPanelDevice:get_argument_value(70), + mainPanelDevice:get_argument_value(71))) + -- [73] = "%.4f", -- Right Engine Temperature (big needle) {0.005, 0.095, 0.183, 0.275, 0.365, 0.463, 0.560, 0.657, 0.759, 0.855, 0.995} { 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100} + -- [74] = "%.4f", -- EngineRightTemperatureUnits (small needle) + SendData(2009, string.format("%0.4f;%0.4f", + mainPanelDevice:get_argument_value(73), + mainPanelDevice:get_argument_value(74))) + + -- [78] = "%.4f", -- EngineLeftCoreSpeedTenth (big needle) + -- [79] = "%.4f", -- EngineLeftCoreSpeedUnits (small needle) + SendData(2010, string.format("%0.4f;%0.4f", + mainPanelDevice:get_argument_value(78), + mainPanelDevice:get_argument_value(79))) + -- [80] = "%.4f", -- EngineRightCoreSpeedTenth (big needle) + -- [81] = "%.4f", -- EngineRightCoreSpeedUnits (small needle) + SendData(2011, string.format("%0.4f;%0.4f", + mainPanelDevice:get_argument_value(80), + mainPanelDevice:get_argument_value(81))) + -- Accelerometer (G-meter) + -- [15] = "%.4f", -- Accelerometer_main {0.0, 1.0} {-5.0, 10.0} + -- [902] = "%.4f", -- Accelerometer_min {0.0, 1.0} {-5.0, 10.0} + -- [903] = "%.4f", -- Accelerometer_max {0.0, 1.0} {-5.0, 10.0} + SendData(2012, string.format("%0.4f;%0.4f;%0.4f", + mainPanelDevice:get_argument_value(15), + mainPanelDevice:get_argument_value(902), + mainPanelDevice:get_argument_value(903))) + -- Standby Compass + -- [6] = "%.4f", -- heading + -- [720] = "%.4f", -- pitch + -- [721] = "%.4f", -- bank + SendData(2013, string.format("%0.4f;%0.4f;%0.4f", + mainPanelDevice:get_argument_value(6), + mainPanelDevice:get_argument_value(720), + mainPanelDevice:get_argument_value(721))) + -- Digital Clock + ------------------------------------------------- + local lDigitalClock = list_indication(4) + lDigitalClock = lDigitalClock:gsub("-----------------------------------------", "") + lDigitalClock = lDigitalClock:gsub("txtHours", "") + lDigitalClock = lDigitalClock:gsub("txtColon", "") + lDigitalClock = lDigitalClock:gsub(":", "") + lDigitalClock = lDigitalClock:gsub("txtMinutes", "") + lDigitalClock = lDigitalClock:gsub("txtSeconds", "") + lDigitalClock = lDigitalClock:gsub("%c", "") + lDigitalClock = lDigitalClock:gsub("txt", "") + lDigitalClock = lDigitalClock:sub(1, 8) + if lDigitalClock:sub(7, 7) == "C" then + lDigitalClock = lDigitalClock:sub(1, 7) + end + SendData(2014, string.format("%s", lDigitalClock)) + + + --local lCDU = list_indication(3) + --WriteToLog('CDU: '..dump(lCDU)) + end +end + +function ProcessHARDWAREConfigHighImportance(mainPanelDevice) + + -- Misc lamps + SendDataHW("178", mainPanelDevice:get_argument_value(178)) -- L_AILERON_EMER_DISENGAGE + SendDataHW("179", mainPanelDevice:get_argument_value(179)) -- R_AILERON_EMER_DISENGAGE + SendDataHW("181", mainPanelDevice:get_argument_value(181)) -- L_ELEVATOR_EMER_DISENGAGE + SendDataHW("182", mainPanelDevice:get_argument_value(182)) -- R_ELEVATOR_EMER_DISENGAGE + SendDataHW("191", mainPanelDevice:get_argument_value(191)) -- TAKE_OFF_TRIM + SendDataHW("215", mainPanelDevice:get_argument_value(215)) -- L_ENG_FIRE + SendDataHW("216", mainPanelDevice:get_argument_value(216)) -- APU_FIRE + SendDataHW("217", mainPanelDevice:get_argument_value(217)) -- R_ENG_FIRE + SendDataHW("260", mainPanelDevice:get_argument_value(260)) -- TACAN_test_light {0.0, 1.0} + -- CMSC lamps + SendDataHW("372", mainPanelDevice:get_argument_value(372)) -- CMSC_MissileLaunchIndicator {0.0, 1.0} + SendDataHW("373", mainPanelDevice:get_argument_value(373)) -- CMSC_PriorityStatusIndicator {0.0, 1.0} + SendDataHW("374", mainPanelDevice:get_argument_value(374)) -- CMSC_UnknownStatusIndicator {0.0, 1.0} + -- Master Warning Lamp UFCP + SendDataHW("404", mainPanelDevice:get_argument_value(404)) -- MASTER_WARNING_STUB MASTER WARNING + -- Caution Panel LAMPS + SendDataHW("480", mainPanelDevice:get_argument_value(480)) -- ENG_START_CYCLE + SendDataHW("481", mainPanelDevice:get_argument_value(481)) -- L_HYD_PRESS + SendDataHW("482", mainPanelDevice:get_argument_value(482)) -- R_HYD_PRESS + SendDataHW("483", mainPanelDevice:get_argument_value(483)) -- GUN_UNSAFE + SendDataHW("484", mainPanelDevice:get_argument_value(484)) -- ANTISKID + SendDataHW("485", mainPanelDevice:get_argument_value(485)) -- L_HYD_RES + SendDataHW("486", mainPanelDevice:get_argument_value(486)) -- R_HYD_RES + SendDataHW("487", mainPanelDevice:get_argument_value(487)) -- OXY_LOW + SendDataHW("488", mainPanelDevice:get_argument_value(488)) -- ELEV_DISENG + SendDataHW("489", mainPanelDevice:get_argument_value(489)) -- VOID1 + SendDataHW("490", mainPanelDevice:get_argument_value(490)) -- SEAT_NOT_ARMED + SendDataHW("491", mainPanelDevice:get_argument_value(491)) -- BLEED_AIR_LEAK + SendDataHW("492", mainPanelDevice:get_argument_value(492)) -- AIL_DISENG + SendDataHW("493", mainPanelDevice:get_argument_value(493)) -- L_AIL_TAB + SendDataHW("494", mainPanelDevice:get_argument_value(494)) -- R_AIL_TAB + SendDataHW("495", mainPanelDevice:get_argument_value(495)) -- SERVICE_AIR_HOT + SendDataHW("496", mainPanelDevice:get_argument_value(496)) -- PITCH_SAS + SendDataHW("497", mainPanelDevice:get_argument_value(497)) -- L_ENG_HOT + SendDataHW("498", mainPanelDevice:get_argument_value(498)) -- R_ENG_HOT + SendDataHW("499", mainPanelDevice:get_argument_value(499)) -- WINDSHIELD_HOT + SendDataHW("500", mainPanelDevice:get_argument_value(500)) -- YAW_SAS + SendDataHW("501", mainPanelDevice:get_argument_value(501)) -- L_ENG_OIL_PRESS + SendDataHW("502", mainPanelDevice:get_argument_value(502)) -- R_ENG_OIL_PRESS + SendDataHW("503", mainPanelDevice:get_argument_value(503)) -- CICU + SendDataHW("504", mainPanelDevice:get_argument_value(504)) -- GCAS + SendDataHW("505", mainPanelDevice:get_argument_value(505)) -- L_MAIN_PUMP + SendDataHW("506", mainPanelDevice:get_argument_value(506)) -- R_MAIN_PUMP + SendDataHW("507", mainPanelDevice:get_argument_value(507)) -- VOID2 + SendDataHW("508", mainPanelDevice:get_argument_value(508)) -- LASTE + SendDataHW("509", mainPanelDevice:get_argument_value(509)) -- L_WING_PUMP + SendDataHW("510", mainPanelDevice:get_argument_value(510)) -- R_WING_PUMP + SendDataHW("511", mainPanelDevice:get_argument_value(511)) -- HARS + SendDataHW("512", mainPanelDevice:get_argument_value(512)) -- IFF_MODE_4 + SendDataHW("513", mainPanelDevice:get_argument_value(513)) -- L_MAIN_FUEL_LOW + SendDataHW("514", mainPanelDevice:get_argument_value(514)) -- R_MAIN_FUEL_LOW + SendDataHW("515", mainPanelDevice:get_argument_value(515)) -- L_R_TKS_UNEQUAL + SendDataHW("516", mainPanelDevice:get_argument_value(516)) -- EAC + SendDataHW("517", mainPanelDevice:get_argument_value(517)) -- L_FUEL_PRESS + SendDataHW("518", mainPanelDevice:get_argument_value(518)) -- R_FUEL_PRESS + SendDataHW("519", mainPanelDevice:get_argument_value(519)) -- NAV + SendDataHW("520", mainPanelDevice:get_argument_value(520)) -- STALL_SYS + SendDataHW("521", mainPanelDevice:get_argument_value(521)) -- L_CONV + SendDataHW("522", mainPanelDevice:get_argument_value(522)) -- R_CONV + SendDataHW("523", mainPanelDevice:get_argument_value(523)) -- CADC + SendDataHW("524", mainPanelDevice:get_argument_value(524)) -- APU_GEN + SendDataHW("525", mainPanelDevice:get_argument_value(525)) -- L_GEN + SendDataHW("526", mainPanelDevice:get_argument_value(526)) -- R_GEN + SendDataHW("527", mainPanelDevice:get_argument_value(527)) -- INST_INV + -- Angle of attack indicator + SendDataHW("540", mainPanelDevice:get_argument_value(540)) -- AOA_INDEXER_HIGH + SendDataHW("541", mainPanelDevice:get_argument_value(541)) -- AOA_INDEXER_NORM + SendDataHW("542", mainPanelDevice:get_argument_value(542)) -- AOA_INDEXER_LOW + -- NMSP Panel lamps + SendDataHW("606", mainPanelDevice:get_argument_value(606)) -- HARS + SendDataHW("608", mainPanelDevice:get_argument_value(608)) -- EGI + SendDataHW("610", mainPanelDevice:get_argument_value(610)) -- TISL + SendDataHW("612", mainPanelDevice:get_argument_value(612)) -- STRPT + SendDataHW("614", mainPanelDevice:get_argument_value(614)) -- ANCHR + SendDataHW("616", mainPanelDevice:get_argument_value(616)) -- TCN + SendDataHW("618", mainPanelDevice:get_argument_value(618)) -- ILS + SendDataHW("619", mainPanelDevice:get_argument_value(619)) -- UHF + SendDataHW("620", mainPanelDevice:get_argument_value(620)) -- FM + -- Landing Gear + SendDataHW("659", mainPanelDevice:get_argument_value(659)) -- GEAR_N_SAFE + SendDataHW("660", mainPanelDevice:get_argument_value(660)) -- GEAR_L_SAFE + SendDataHW("661", mainPanelDevice:get_argument_value(661)) -- GEAR_R_SAFE + -- Misc lamps + SendDataHW("662", mainPanelDevice:get_argument_value(662)) -- GUN_READY + SendDataHW("663", mainPanelDevice:get_argument_value(663)) -- NOSEWHEEL_STEERING + SendDataHW("664", mainPanelDevice:get_argument_value(664)) -- MARKER_BEACON + SendDataHW("665", mainPanelDevice:get_argument_value(665)) -- CANOPY_UNLOCKED + SendDataHW("730", mainPanelDevice:get_argument_value(730)) -- AIR_REFUEL_READY + SendDataHW("731", mainPanelDevice:get_argument_value(731)) -- AIR_REFUEL_LATCHED + SendDataHW("732", mainPanelDevice:get_argument_value(732)) -- AIR_REFUEL_DISCONNECT + SendDataHW("737", mainPanelDevice:get_argument_value(737)) -- HANDLE_GEAR_WARNING + -- IFF Panel lamps + SendDataHW("798", mainPanelDevice:get_argument_value(798)) -- IFF_reply_lamp {0, 1} + SendDataHW("799", mainPanelDevice:get_argument_value(799)) -- IFF_test_lamp {0, 1} + + -- Digital Clock + ------------------------------------------------- + local lDigitalClock = list_indication(4) + lDigitalClock = lDigitalClock:gsub("-----------------------------------------", "") + lDigitalClock = lDigitalClock:gsub("txtHours", "") + lDigitalClock = lDigitalClock:gsub("txtColon", "") + lDigitalClock = lDigitalClock:gsub(":", "") + lDigitalClock = lDigitalClock:gsub("txtMinutes", "") + lDigitalClock = lDigitalClock:gsub("txtSeconds", "") + lDigitalClock = lDigitalClock:gsub("%c", "") + SendDataHW("2010", string.format("%s", lDigitalClock:sub(1, 6))) -- with : lDigitalClock:sub(1, 7) +end + +----------------------------------------------------- +-- LOW IMPORTANCE EXPORTS -- +-- done every gExportLowTickInterval export events -- +----------------------------------------------------- + +-- Pointed to by ProcessGlassCockpitDCSConfigLowImportance, if the player aircraft is an A-10 +function ProcessGlassCockpitDCSConfigLowImportance(mainPanelDevice) + if gES_GlassCockpitType == 1 then + -- HELIOS Version 1.3 + -- Get Radio Frequencies + local lUHFRadio = GetDevice(54) + SendData(2000, string.format("%7.3f", lUHFRadio:get_frequency()/1000000)) + + -- TACAN Channel + SendData(2263, string.format("%0.2f;%0.2f;%0.2f", mainPanelDevice:get_argument_value(263), + mainPanelDevice:get_argument_value(264), + mainPanelDevice:get_argument_value(265))) + elseif gES_GlassCockpitType == 2 then + -- HawgTouch version 1.6 + -- TACAN Channel + SendData(2015, string.format("%0.1f;%0.1f;%0.1f;%0.1f", mainPanelDevice:get_argument_value(263), + mainPanelDevice:get_argument_value(264), + mainPanelDevice:get_argument_value(265), + mainPanelDevice:get_argument_value(266))) + -- ILS + SendData(2016, string.format("%0.1f;%0.1f;%0.1f;%0.1f;%0.1f", mainPanelDevice:get_argument_value(251), + mainPanelDevice:get_argument_value(252), + mainPanelDevice:get_argument_value(253), + mainPanelDevice:get_argument_value(254), + mainPanelDevice:get_argument_value(255))) + -- UHF Radio (AN/ARC-164 UHF) + local lUHFRadio = GetDevice(54) + --WriteToLog('lUHFRadio: '..dump(string.format("%7.3f", lUHFRadio:get_frequency()/1000000))) + SendData(2017, string.format("%7.3f", lUHFRadio:get_frequency()/1000000)) + -- AM Radio (AN/ARC-186(V) VHF AM) + local lAMRadio = GetDevice(55) + --WriteToLog('lAMRadio: '..dump(string.format("%7.3f", lAMRadio:get_frequency()/1000000))) + SendData(2018, string.format("%7.3f", lAMRadio:get_frequency()/1000000)) + -- FM Radio (AN/ARC-186(V) VHF FM) + local lFMRadio = GetDevice(56) + --WriteToLog('lFMRadio: '..dump(string.format("%7.3f", lFMRadio:get_frequency()/1000000))) + SendData(2019, string.format("%7.3f", lFMRadio:get_frequency()/1000000)) + -- Landing Gear Lamps + -- [659] = "%0.1f", -- GEAR_N_SAFE + -- [660] = "%0.1f", -- GEAR_L_SAFE + -- [661] = "%0.1f", -- GEAR_R_SAFE + SendData(2007, string.format("%0.1f;%0.1f;%0.1f", + mainPanelDevice:get_argument_value(659), + mainPanelDevice:get_argument_value(660), + mainPanelDevice:get_argument_value(661))) + -- CMSC 2020 + ------------------------------------------------- + --[372] -- CMSC_MissileLaunchIndicator {0.0, 1.0} -- bottom middle, red light + --[373] -- CMSC_PriorityStatusIndicator {0.0, 1.0} -- ower PRI button, green light + --[374] -- CMSC_UnknownStatusIndicator {0.0, 1.0} -- over UNK button, ... + local lCMSC = list_indication(8) + lCMSC = lCMSC:gsub("-----------------------------------------", "") + lCMSC = lCMSC:gsub("txt_CHAFF_FLARE", "") + lCMSC = lCMSC:gsub("txt_JMR", "") + lCMSC = lCMSC:gsub("txt_MWS", "") + lCMSC = lCMSC:gsub("%c%c(%C)", "%1") + lCMSC = lCMSC.."\n" + + local lCMSCTable = {} + lCMSCTable = string.split(lCMSC, "%c") + + if lCMSCTable[2] ~= nil then + SendData(2020, string.format("%s;%s;%s;%.1f;%.1f;%.1f", + lCMSCTable[1], -- txt_CHAFF_FLARE + lCMSCTable[2], -- txt_JMR + lCMSCTable[3], -- txt_MWS + mainPanelDevice:get_argument_value(372), -- CMSC_MissileLaunchIndicator {0.0, 1.0} + mainPanelDevice:get_argument_value(373), -- CMSC_PriorityStatusIndicator {0.0, 1.0} + mainPanelDevice:get_argument_value(374))) -- CMSC_UnknownStatusIndicator {0.0, 1.0} + else + SendData(2020, string.format(";;;%.1f;%.1f;%.1f", + mainPanelDevice:get_argument_value(372), -- CMSC_MissileLaunchIndicator {0.0, 1.0} + mainPanelDevice:get_argument_value(373), -- CMSC_PriorityStatusIndicator {0.0, 1.0} + mainPanelDevice:get_argument_value(374))) -- CMSC_UnknownStatusIndicator {0.0, 1.0} + end + + -- ILS Channel 2021 + ------------------------------------------------- + local lILSFrequencyMHz = {[0]="108",[0.1]="109",[0.2]="110",[0.3]="111"} + local lILSFrequencyKHz = {[0]="10",[0.1]="15",[0.2]="30",[0.3]="35",[0.4]="50",[0.5]="55",[0.6]="70",[0.7]="75",[0.8]="90",[0.9]="95"} + + SendData(2021, string.format("%.2f", + lILSFrequencyMHz[math.round(mainPanelDevice:get_argument_value(251), 1)].."."..lILSFrequencyKHz[math.round(mainPanelDevice:get_argument_value(252), 1)])) + + -- AN/ARC-186(V) VHF AM and Preset Channel + --------------------------------------------------- + local lVHF_AM_RADIO = GetDevice(55) + SendData(2022, string.format("%.3f", lVHF_AM_RADIO:get_frequency()/1000000)) + + --local lVHF_AM_RADIO_PRESET = {[0.0]="1",[0.01]="2",[0.02]="3",[0.03]="4",[0.04]="5",[0.05]="6",[0.06]="7",[0.07]="8",[0.08]="9",[0.09]="10",[0.10]="11",[0.11]="12",[0.12]="13",[0.13]="14",[0.14]="15",[0.15]="16",[0.16]="17",[0.17]="18",[0.18]="19",[0.19]="20",[0.20]="1"} + --SendDataHW("2003", lVHF_AM_RADIO_PRESET[math.round(mainPanelDevice:get_argument_value(137), 2)]) + + -- AN/ARC-186(V) VHF FM and Preset Channel + ------------------------------------------------- + local lVHF_FM_RADIO = GetDevice(56) + SendData(2023, string.format("%.3f", lVHF_FM_RADIO:get_frequency()/1000000)) + + -- Preset is buggy + --local lVHF_FM_RADIO_PRESET = {[0.0]="1",[0.01]="2",[0.02]="3",[0.03]="4",[0.04]="5",[0.05]="6",[0.06]="7",[0.07]="8",[0.08]="9",[0.09]="10",[0.10]="11",[0.11]="12",[0.12]="13",[0.13]="14",[0.14]="15",[0.15]="16",[0.16]="17",[0.17]="18",[0.18]="19",[0.19]="20",[0.20]="1"} + --SendDataHW("2005", lVHF_FM_RADIO_PRESET[math.round(mainPanelDevice:get_argument_value(151), 2, "ceil")]) + + -- TACAN Channel + ------------------------------------------------- + SendData(2024, (string.format("%0.2f", (mainPanelDevice:get_argument_value(263))) == "1.00" and "0" or "1")..math.round(mainPanelDevice:get_argument_value(264) * 10, 0)..math.round(mainPanelDevice:get_argument_value(265) * 10, 0)) + + end +end + +function ProcessHARDWAREConfigLowImportance(mainPanelDevice) + --[[ + not every frame export to hardware + Example from A-10C + Get Radio Frequencies + get data from device + local UHF_RADIO = GetDevice(54) + SendDataHW("ExportID", "Format") + SendDataHW("ExportID", "Format", HardwareConfigID) + SendDataHW("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000)) + SendDataHW("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000), 2) -- export to Hardware '2' Config + ]] + + -- AN/ARC-164 UHF and UHF Preset Channel + --------------------------------------------------- + local lUHF_RADIO = GetDevice(54) + if lUHF_RADIO:is_on() then + SendDataHW("2000", string.format("%.3f", lUHF_RADIO:get_frequency()/1000000)) + + local lPresetChannel = list_indication(10) + lPresetChannel = lPresetChannel:gsub("-----------------------------------------", "") + lPresetChannel = lPresetChannel:gsub("txtPresetChannel", "") + lPresetChannel = lPresetChannel:gsub("%c", "") + + SendDataHW("2001", string.format("%s", lPresetChannel)) + else + SendDataHW("2000", "-") + SendDataHW("2001", "-") + end + + -- AN/ARC-186(V) VHF AM and Preset Channel + --------------------------------------------------- + local lVHF_AM_RADIO = GetDevice(55) + SendDataHW("2002", string.format("%.3f", lVHF_AM_RADIO:get_frequency()/1000000)) + + local lVHF_AM_RADIO_PRESET = {[0.0]="1",[0.01]="2",[0.02]="3",[0.03]="4",[0.04]="5",[0.05]="6",[0.06]="7",[0.07]="8",[0.08]="9",[0.09]="10",[0.10]="11",[0.11]="12",[0.12]="13",[0.13]="14",[0.14]="15",[0.15]="16",[0.16]="17",[0.17]="18",[0.18]="19",[0.19]="20",[0.20]="1"} + SendDataHW("2003", lVHF_AM_RADIO_PRESET[math.round(mainPanelDevice:get_argument_value(137), 2)]) + + -- AN/ARC-186(V) VHF FM and Preset Channel + ------------------------------------------------- + local lVHF_FM_RADIO = GetDevice(56) + SendDataHW("2004", string.format("%.3f", lVHF_FM_RADIO:get_frequency()/1000000)) + + -- Preset is buggy + local lVHF_FM_RADIO_PRESET = {[0.0]="1",[0.01]="2",[0.02]="3",[0.03]="4",[0.04]="5",[0.05]="6",[0.06]="7",[0.07]="8",[0.08]="9",[0.09]="10",[0.10]="11",[0.11]="12",[0.12]="13",[0.13]="14",[0.14]="15",[0.15]="16",[0.16]="17",[0.17]="18",[0.18]="19",[0.19]="20",[0.20]="1"} + SendDataHW("2005", lVHF_FM_RADIO_PRESET[math.round(mainPanelDevice:get_argument_value(151), 2, "ceil")]) + + -- Pressure setting + -------------------------------------------------------- + local pressure_setting_3 = mainPanelDevice:get_argument_value(56) * 10000 -- {0.0, 10.0} {0.0, 1.0} + local pressure_setting_2 = mainPanelDevice:get_argument_value(57) * 1000 -- {0.0, 10.0} {0.0, 1.0} + local pressure_setting_1 = mainPanelDevice:get_argument_value(58) * 100 -- {0.0, 10.0} {0.0, 1.0} + local pressure_setting_0 = mainPanelDevice:get_argument_value(59) * 10 -- {0.0, 10.0} {0.0, 1.0} + local pressure_setting = ((pressure_setting_3 + pressure_setting_2 + pressure_setting_1 + pressure_setting_0) / 100) + SendDataHW("2006", string.format("%5.2f", pressure_setting)) + + -- Calculate Total Fuel + -------------------------------------------------------- + local lFuelQuantityCounterTenthOfThous = mainPanelDevice:get_argument_value(90) * 10000 -- {0.0, 10.0} {0.0, 1.0} + local lFuelQuantityCounterThousands = mainPanelDevice:get_argument_value(91) * 1000 -- {0.0, 10.0} {0.0, 1.0} + local lFuelQuantityCounterHundreds = mainPanelDevice:get_argument_value(92) * 100 -- {0.0, 10.0} {0.0, 1.0} + -- orginal + local lFuelQuantityCounter = ((lFuelQuantityCounterTenthOfThous + lFuelQuantityCounterThousands + lFuelQuantityCounterHundreds) / 10) + SendDataHW("2007", string.format("%0.0f", lFuelQuantityCounter).."00") + -- exact + --local lFuelQuantityCounter = ((lFuelQuantityCounterTenthOfThous + lFuelQuantityCounterThousands + lFuelQuantityCounterHundreds)) + --SendDataHW("2007", string.format("%1d", lFuelQuantityCounter).."0") + + -- TACAN Channel + ------------------------------------------------- + SendDataHW("2008", (string.format("%0.2f", (mainPanelDevice:get_argument_value(263))) == "1.00" and "0" or "1")..math.round(mainPanelDevice:get_argument_value(264) * 10, 0)..math.round(mainPanelDevice:get_argument_value(265) * 10, 0)) + + -- ILS Channel + ------------------------------------------------- + local lILSFrequencyMHz = {[0]="108",[0.1]="109",[0.2]="110",[0.3]="111"} + local lILSFrequencyKHz = {[0]="10",[0.1]="15",[0.2]="30",[0.3]="35",[0.4]="50",[0.5]="55",[0.6]="70",[0.7]="75",[0.8]="90",[0.9]="95"} + + SendDataHW("2009", lILSFrequencyMHz[math.round(mainPanelDevice:get_argument_value(251), 1)].."."..lILSFrequencyKHz[math.round(mainPanelDevice:get_argument_value(252), 1)]) + + -- generic Radio display and frequency rotarys + ------------------------------------------------- + genericRadio(nil, nil, gES_genericRadioHardwareID) + + -- NOT FOR ARCAZE + ------------------------------------------------- + --[[ + -- CMSP + ------------------------------------------------- + local lCMPS = list_indication(7) + lCMPS = lCMPS:gsub("-----------------------------------------", "") + lCMPS = lCMPS:gsub("txt_UP", "") + lCMPS = lCMPS:gsub("txt_DOWN1", "") + lCMPS = lCMPS:gsub("txt_DOWN2", "") + lCMPS = lCMPS:gsub("txt_DOWN3", "") + lCMPS = lCMPS:gsub("txt_DOWN4", "") + lCMPS = lCMPS:gsub("%c%c(%C)", "%1") + lCMPS = lCMPS.."\n" + + local lCMPSTable = {} + lCMPSTable = string.split(lCMPS, "%c") + + lCMPS = lCMPSTable[1].."\n"..table.concat(lCMPSTable, " ", 2) + SendDataHW("2011", lCMPS) + + + -- CMSC + ------------------------------------------------- + local lCMSC = list_indication(8) + lCMSC = lCMSC:gsub("-----------------------------------------", "") + lCMSC = lCMSC:gsub("txt_CHAFF_FLARE", "") + lCMSC = lCMSC:gsub("txt_JMR", "") + lCMSC = lCMSC:gsub("txt_MWS", "") + lCMSC = lCMSC:gsub("%c%c(%C)", "%1") + lCMSC = lCMSC.."\n" + + local lCMSCTable = {} + lCMSCTable = string.split(lCMSC, "%c") + + if lCMSCTable[2] ~= nil then + SendDataHW("2012", lCMSCTable[1]) -- txt_CHAFF_FLARE + SendDataHW("2013", lCMSCTable[2]) -- txt_JMR + SendDataHW("2014", lCMSCTable[3]) -- txt_MWS + else + SendDataHW("2012", "") -- txt_CHAFF_FLARE + SendDataHW("2013", "") -- txt_JMR + SendDataHW("2014", "") -- txt_MWS + end + ]] + + --===================================================================================== + --[[ + WriteToLog('list_cockpit_params(): '..dump(list_cockpit_params())) + WriteToLog('CMSP: '..dump(list_indication(7))) + + local ltmp1 = 0 + for ltmp2 = 0, 13, 1 do + ltmp1 = list_indication(ltmp2) + WriteToLog(ltmp2..': '..dump(ltmp1)) + --WriteToLog(ltmp2..' (metatable): '..dump(getmetatable(ltmp1))) + end + ]] +--[[ + -- LITENING_INTERFACE + local lLITENING_INTERFACE = GetDevice(11) + WriteToLog('lLITENING_INTERFACE:get_station '..dump(lLITENING_INTERFACE:get_station())) + --WriteToLog('lLITENING_INTERFACE:add_masked_region '..dump(lLITENING_INTERFACE:add_masked_region())) -- test the parameters + --WriteToLog('lLITENING_INTERFACE:set_laser_designation_code '..dump(lLITENING_INTERFACE:set_laser_designation_code())) -- test the parameters + --WriteToLog('lLITENING_INTERFACE:set_laser_spot_search_code '..dump(lLITENING_INTERFACE:set_laser_spot_search_code())) -- test the parameters + + -- ADI + local lADI = GetDevice(47) + WriteToLog('lADI:get_sideslip '..dump(lADI:get_sideslip())) + WriteToLog('lADI:get_bank '..dump(lADI:get_bank())) + WriteToLog('lADI:get_pitch '..dump(lADI:get_pitch())) + + -- SAI + local lSAI = GetDevice(48) + WriteToLog('lSAI:get_sideslip '..dump(lSAI:get_sideslip())) + WriteToLog('lSAI:get_bank '..dump(lSAI:get_bank())) + WriteToLog('lSAI:get_pitch '..dump(lSAI:get_pitch())) + + -- UHF_RADIO + local lUHF_RADIO = GetDevice(54) + WriteToLog('lUHF_RADIO:is_on '..dump(lUHF_RADIO:is_on())) + WriteToLog('lUHF_RADIO:get_frequency '..dump(lUHF_RADIO:get_frequency())) + --WriteToLog('lUHF_RADIO:set_frequency '..dump(lUHF_RADIO:set_frequency())) -- test the parameters + --WriteToLog('lUHF_RADIO:set_modulation '..dump(lUHF_RADIO:set_modulation())) -- test the parameters + --WriteToLog('lUHF_RADIO:set_channel '..dump(lUHF_RADIO:set_channel())) -- test the parameters + + -- VHF_AM_RADIO + local lVHF_AM_RADIO = GetDevice(55) + WriteToLog('lVHF_AM_RADIO:is_on '..dump(lVHF_AM_RADIO:is_on())) + WriteToLog('lVHF_AM_RADIO:get_frequency '..dump(lVHF_AM_RADIO:get_frequency())) + --WriteToLog('lVHF_AM_RADIO:set_frequency '..dump(lVHF_AM_RADIO:set_frequency())) -- test the parameters + --WriteToLog('lVHF_AM_RADIO:set_modulation '..dump(lVHF_AM_RADIO:set_modulation())) -- test the parameters + --WriteToLog('lVHF_AM_RADIO:set_channel '..dump(lVHF_AM_RADIO:set_channel())) -- test the parameters + + -- VHF_FM_RADIO + local lVHF_FM_RADIO = GetDevice(56) + WriteToLog('lVHF_FM_RADIO:is_on '..dump(lVHF_FM_RADIO:is_on())) + WriteToLog('lVHF_FM_RADIO:get_frequency '..dump(lVHF_FM_RADIO:get_frequency())) + --WriteToLog('lVHF_FM_RADIO:set_frequency '..dump(lVHF_FM_RADIO:set_frequency())) -- test the parameters + --WriteToLog('lVHF_FM_RADIO:set_modulation '..dump(lVHF_FM_RADIO:set_modulation())) -- test the parameters + --WriteToLog('lVHF_FM_RADIO:set_channel '..dump(lVHF_FM_RADIO:set_channel())) -- test the parameters + + -- INTERCOM + local lINTERCOM = GetDevice(58) + WriteToLog('lINTERCOM:is_communicator_available '..dump(lINTERCOM:is_communicator_available())) + WriteToLog('lINTERCOM:get_noise_level '..dump(lINTERCOM:get_noise_level())) + WriteToLog('lINTERCOM:get_signal_level '..dump(lINTERCOM:get_signal_level())) + --WriteToLog('lINTERCOM:set_communicator '..dump(lINTERCOM:set_communicator())) -- test the parameters + --WriteToLog('lINTERCOM:set_voip_mode '..dump(lINTERCOM:set_voip_mode())) -- test the parameters +]] +--[[ + local ltmp1 = 0 + for ltmp2 = 1, 73, 1 do + ltmp1 = GetDevice(ltmp2) + WriteToLog(ltmp2..': '..dump(ltmp1)) + WriteToLog(ltmp2..' (metatable): '..dump(getmetatable(ltmp1))) + end +]] +end + +----------------------------- +-- Custom functions -- +----------------------------- + +function genericRadio(key, value, hardware) + local lHardware = hardware or 1 + -- Werte werden per Encoder im Bereich von 0.0 bis 2.0 in 0.1 Schritten uebergeben + -- im jeweiligen Abschnitt muessen die Eingangsdaten auf den Zulaessigen Bereich eingeschraengt werden + local lRotaryFrequency_1, lRotaryFrequency_2, lVolume, lPreset, lLoad, lSquelch, lManualPreset, lPower, lDevice, lClickAction, lSetFrequency = nil + local lMainPanelDevice = GetDevice(0) + local lMaxRadios = 3 + + if gES_genericRadio == nil then + gES_genericRadio = 0 + end + if gES_genericRadioFrequency1 == nil then + gES_genericRadioFrequency1 = 0.0 + end + if gES_genericRadioFrequency2 == nil then + gES_genericRadioFrequency2 = 0.0 + end + if gES_genericRadioPresetChannel == nil then + gES_genericRadioPresetChannel = 0.0 + end + if gES_genericRadioPower == nil then + gES_genericRadioPower = {} + end + if gES_genericRadioPresetManual == nil then + gES_genericRadioPresetManual = {} + end + if gES_genericRadioSquelch == nil then + gES_genericRadioSquelch = {} + end + + if key == "3001" then + gES_genericRadio = tonumber(value) + end + if key == "3002" then + lRotaryFrequency_1 = tonumber(value) + end + if key == "3003" then + lRotaryFrequency_2 = tonumber(value) + end + if key == "3004" then + lVolume = tonumber(value) + end + if key == "3005" then + lPreset = tonumber(value) + end + if key == "3006" then + lLoad = tonumber(value) + end + if key == "3007" then + lSquelch = tonumber(value) + end + if key == "3008" then + lManualPreset = tonumber(value) + end + if key == "3009" then + lPower = tonumber(value) + end + + if gES_genericRadio > lMaxRadios then + WriteToLog("Radio Nr. "..gES_genericRadio.." not defined.") + return + end + + if gES_genericRadio == 1 then + -- AN/ARC-164 UHF ###.### + --------------------------------------------------- + local lDeviceID = 54 + local lUHF_RADIO = GetDevice(lDeviceID) + + -- check status of the radio + if gES_genericRadioPower[gES_genericRadio] == nil then + if lUHF_RADIO:is_on() then + gES_genericRadioPower[gES_genericRadio] = 1.0 + else + gES_genericRadioPower[gES_genericRadio] = 0.0 + end + end + if gES_genericRadioPresetManual[gES_genericRadio] == nil then + gES_genericRadioPresetManual[gES_genericRadio] = ((math.round(lMainPanelDevice:get_argument_value(167), 1) == 0) and 0 or 1) + end + if gES_genericRadioSquelch[gES_genericRadio] == nil then + gES_genericRadioSquelch[gES_genericRadio] = ((math.round(lMainPanelDevice:get_argument_value(170), 1) == 0) and 1 or 0) + end + + if lUHF_RADIO:is_on() then + local lPresetChannel = list_indication(10) + lPresetChannel = lPresetChannel:gsub("-----------------------------------------", "") + lPresetChannel = lPresetChannel:gsub("txtPresetChannel", "") + lPresetChannel = lPresetChannel:gsub("%c", "") + + local lUHF_RADIO_FREQUENCY = math.round(lUHF_RADIO:get_frequency()/1000000 , 3, "floor") + + SendDataHW("3000", string.format("%s%.3f", lPresetChannel, lUHF_RADIO_FREQUENCY), lHardware) + SendDataHW("3001", string.format("%s", lPresetChannel), lHardware) + SendDataHW("3002", string.format("%.3f", lUHF_RADIO_FREQUENCY), lHardware) + + if lRotaryFrequency_1 ~= nil and (lRotaryFrequency_1 >= 0.0 and lRotaryFrequency_1 <= 2.0) then + + local lFrequency = StrSplit(lUHF_RADIO_FREQUENCY, "%.") -- %. um den Punkt als Punkt zu suchen + + if type(lFrequency) == "table" and lFrequency[1] ~= nil then + lFrequency[1] = tonumber(lFrequency[1]) + if lFrequency[2] == nil then + lFrequency[2] = 0 + else + lFrequency[2] = tonumber(lFrequency[2]) + local ltmp = string.format("%.0f", lFrequency[2] / 25) + lFrequency[2] = ltmp * 25 + end + if lRotaryFrequency_1 < gES_genericRadioFrequency1 or lRotaryFrequency_1 == 0.0 or lRotaryFrequency_1 == 2.0 then + lFrequency[1] = lFrequency[1] - 1 + if lFrequency[1] == 219 then + lFrequency[1] = 314 + end + gES_genericRadioFrequency1 = lRotaryFrequency_1 + else + lFrequency[1] = lFrequency[1] + 1 + if lFrequency[1] == 315 then + lFrequency[1] = 220 + end + gES_genericRadioFrequency1 = lRotaryFrequency_1 + end + + lFrequency[2] = string.format("%.3f", lFrequency[2] / 1000) + local ltempFrequency = string.format("%.3f", lFrequency[1] + lFrequency[2]) + ltempFrequency = tonumber(ltempFrequency) + lSetFrequency = {DeviceID = lDeviceID, + Frequency = ltempFrequency * 1000000} + + else + WriteToLog("1. generic A-10C UHF Radio, don't split frequency: "..lFrequency) + end + end + + if lRotaryFrequency_2 ~= nil and (lRotaryFrequency_2 >= 0.0 and lRotaryFrequency_2 <= 2.0) then + + local lFrequency = StrSplit(lUHF_RADIO_FREQUENCY, "%.") + + if type(lFrequency) == "table" and lFrequency[1] ~= nil then + lFrequency[1] = tonumber(lFrequency[1]) + if lFrequency[2] == nil then + lFrequency[2] = 0 + else + lFrequency[2] = tonumber(lFrequency[2]) + local ltmp = string.format("%.0f", lFrequency[2] / 25) + lFrequency[2] = ltmp * 25 + end + if lRotaryFrequency_2 < gES_genericRadioFrequency2 or lRotaryFrequency_2 == 0.0 or lRotaryFrequency_2 == 2.0 then + lFrequency[2] = lFrequency[2] - 25 + if lFrequency[2] == -25 then + lFrequency[2] = 975 + end + gES_genericRadioFrequency2 = lRotaryFrequency_2 + else + lFrequency[2] = lFrequency[2] + 25 + if lFrequency[2] == 1000 then + lFrequency[2] = 0 + end + gES_genericRadioFrequency2 = lRotaryFrequency_2 + end + + lFrequency[2] = string.format("%.3f", lFrequency[2] / 1000) + local ltempFrequency = string.format("%.3f", lFrequency[1] + lFrequency[2]) + ltempFrequency = tonumber(ltempFrequency) + lSetFrequency = {DeviceID = lDeviceID, + Frequency = ltempFrequency * 1000000} + + else + WriteToLog("2. generic A-10C UHF Radio, don't split frequency: "..lFrequency) + end + end + if lPreset ~= nil and (lPreset >= 0.0 and lPreset <= 1.9) then + -- Preset 0.0 to 0.95 in 0.05 steps + lPreset = lPreset / 2 + lClickAction = {DeviceID = lDeviceID, + ButtonID = 3001, + Value = lPreset} + end + + else + SendDataHW("3000", "-", lHardware) + SendDataHW("3001", "-", lHardware) + SendDataHW("3002", "-", lHardware) + end + + if lVolume ~= nil and (lVolume >= 0.0 and lVolume <= 2.0) then + lVolume = lVolume / 2 + lClickAction = {DeviceID = lDeviceID, + ButtonID = 3011, + Value = lVolume} + end + if lLoad ~= nil and (lLoad == 0.0 or lLoad <= 1.0) then + lClickAction = {DeviceID = lDeviceID, + ButtonID = 3015, + Value = lLoad} + end + if lSquelch ~= nil and (lSquelch == 0.0 or lSquelch <= 1.0) then + if lSquelch == 1.0 and gES_genericRadioSquelch[gES_genericRadio] == 1.0 then + -- Squelch off + lSquelch = 1.0 + gES_genericRadioSquelch[gES_genericRadio] = 0 + elseif lSquelch == 1.0 and gES_genericRadioSquelch[gES_genericRadio] == 0 then + -- Squelch on + lSquelch = 0.0 + gES_genericRadioSquelch[gES_genericRadio] = 1.0 + end + lClickAction = {DeviceID = lDeviceID, + ButtonID = 3010, + Value = lSquelch} + end + if lManualPreset ~= nil and (lManualPreset == 0.0 or lManualPreset <= 1.0) then + if lManualPreset == 1.0 and gES_genericRadioPresetManual[gES_genericRadio] == 1.0 then + -- Manual + lManualPreset = 0.0 + gES_genericRadioPresetManual[gES_genericRadio] = 0 + elseif lManualPreset == 1.0 and gES_genericRadioPresetManual[gES_genericRadio] == 0 then + -- Preset + lManualPreset = 0.1 + gES_genericRadioPresetManual[gES_genericRadio] = 1.0 + end + lClickAction = {DeviceID = lDeviceID, + ButtonID = 3007, + Value = lManualPreset} + end + if lPower ~= nil and (lPower == 0.0 or lPower <= 1.0) then + if lPower == 1.0 and gES_genericRadioPower[gES_genericRadio] == 1.0 then + -- Power off + lPower = 0.0 + gES_genericRadioPower[gES_genericRadio] = 0 + elseif lPower == 1.0 and gES_genericRadioPower[gES_genericRadio] == 0 then + --Power on + lPower = 0.1 + gES_genericRadioPower[gES_genericRadio] = 1.0 + end + lClickAction = {DeviceID = lDeviceID, + ButtonID = 3008, + Value = lPower} + end + + elseif gES_genericRadio == 2 then + -- AN/ARC-186(V) VHF AM ###.### + --------------------------------------------------- + local lDeviceID = 55 + local lVHF_AM_RADIO = GetDevice(lDeviceID) + + -- check status of the radio + if gES_genericRadioPower[gES_genericRadio] == nil then + if lVHF_AM_RADIO:is_on() then + gES_genericRadioPower[gES_genericRadio] = 1.0 + else + gES_genericRadioPower[gES_genericRadio] = 0.0 + end + end + if gES_genericRadioPresetManual[gES_genericRadio] == nil then + gES_genericRadioPresetManual[gES_genericRadio] = ((math.round(lMainPanelDevice:get_argument_value(135), 1) == 0.1) and 1 or 0) + end + if gES_genericRadioSquelch[gES_genericRadio] == nil then + gES_genericRadioSquelch[gES_genericRadio] = ((math.round(lMainPanelDevice:get_argument_value(134), 1) == 1.0) and 0 or 1) + end + + local lVHF_AM_RADIO_PRESET = {[0.0]="01",[0.01]="02",[0.02]="03",[0.03]="04",[0.04]="05",[0.05]="06",[0.06]="07",[0.07]="08",[0.08]="09",[0.09]="10",[0.10]="11",[0.11]="12",[0.12]="13",[0.13]="14",[0.14]="15",[0.15]="16",[0.16]="17",[0.17]="18",[0.18]="19",[0.19]="20",[0.20]="01"} + local lVHF_AM_RADIO_FREQUENCY = math.round(lVHF_AM_RADIO:get_frequency()/1000000 , 3, "floor") + + local lPresetChannel = math.round(lMainPanelDevice:get_argument_value(137), 2) + + SendDataHW("3000", string.format("%s%.3f", lVHF_AM_RADIO_PRESET[lPresetChannel], lVHF_AM_RADIO_FREQUENCY), lHardware) + SendDataHW("3001", string.format("%s", lVHF_AM_RADIO_PRESET[lPresetChannel]), lHardware) + SendDataHW("3002", string.format("%.3f", lVHF_AM_RADIO_FREQUENCY), lHardware) + + if lRotaryFrequency_1 ~= nil and (lRotaryFrequency_1 >= 0.0 and lRotaryFrequency_1 <= 2.0) then + + local lFrequency = StrSplit(lVHF_AM_RADIO_FREQUENCY, "%.") + + if type(lFrequency) == "table" and lFrequency[1] ~= nil then + lFrequency[1] = tonumber(lFrequency[1]) + if lFrequency[2] == nil then + lFrequency[2] = 0 + else + lFrequency[2] = tonumber(lFrequency[2]) + local ltmp = string.format("%.0f", lFrequency[2] / 25) + lFrequency[2] = ltmp * 25 + end + if lRotaryFrequency_1 < gES_genericRadioFrequency1 or lRotaryFrequency_1 == 0.0 or lRotaryFrequency_1 == 2.0 then + lFrequency[1] = lFrequency[1] - 1 + if lFrequency[1] == 29 then + lFrequency[1] = 159 + end + gES_genericRadioFrequency1 = lRotaryFrequency_1 + else + lFrequency[1] = lFrequency[1] + 1 + if lFrequency[1] == 160 then + lFrequency[1] = 30 + end + gES_genericRadioFrequency1 = lRotaryFrequency_1 + end + + lFrequency[2] = string.format("%.3f", lFrequency[2] / 1000) + local ltempFrequency = string.format("%.3f", lFrequency[1] + lFrequency[2]) + ltempFrequency = tonumber(ltempFrequency) + lSetFrequency = {DeviceID = lDeviceID, + Frequency = ltempFrequency * 1000000} + + else + WriteToLog("1. generic A-10C VHF AM Radio, don't split frequency: "..lFrequency) + end + end + + if lRotaryFrequency_2 ~= nil and (lRotaryFrequency_2 >= 0.0 and lRotaryFrequency_2 <= 2.0) then + + local lFrequency = StrSplit(lVHF_AM_RADIO_FREQUENCY, "%.") + + if type(lFrequency) == "table" and lFrequency[1] ~= nil then + lFrequency[1] = tonumber(lFrequency[1]) + if lFrequency[2] == nil then + lFrequency[2] = 0 + else + lFrequency[2] = tonumber(lFrequency[2]) + local ltmp = string.format("%.0f", lFrequency[2] / 25) + lFrequency[2] = ltmp * 25 + end + if lRotaryFrequency_2 < gES_genericRadioFrequency2 or lRotaryFrequency_2 == 0.0 or lRotaryFrequency_2 == 2.0 then + lFrequency[2] = lFrequency[2] - 25 + if lFrequency[2] == -25 then + lFrequency[2] = 975 + end + gES_genericRadioFrequency2 = lRotaryFrequency_2 + else + lFrequency[2] = lFrequency[2] + 25 + if lFrequency[2] == 1000 then + lFrequency[2] = 0 + end + gES_genericRadioFrequency2 = lRotaryFrequency_2 + end + + lFrequency[2] = string.format("%.3f", lFrequency[2] / 1000) + local ltempFrequency = string.format("%.3f", lFrequency[1] + lFrequency[2]) + ltempFrequency = tonumber(ltempFrequency) + lSetFrequency = {DeviceID = lDeviceID, + Frequency = ltempFrequency * 1000000} + + else + WriteToLog("2. generic A-10C VHF AM Radio, don't split frequency: "..lFrequency) + end + end + if lVolume ~= nil and (lVolume >= 0.0 and lVolume <= 2.0) then + lVolume = lVolume / 2 + lClickAction = {DeviceID = lDeviceID, + ButtonID = 3005, + Value = lVolume} + end + if lPreset ~= nil and (lPreset >= 0.0 and lPreset <= 2.0) then + -- Preset 0.0 to 0.20 in 0.01 steps + if lPreset < gES_genericRadioPresetChannel or lPreset == 0.0 or lPreset == 2.0 then + lClickAction = {DeviceID = lDeviceID, + ButtonID = 3001, + Value = 0.01} + gES_genericRadioPresetChannel = lPreset + else + lClickAction = {DeviceID = lDeviceID, + ButtonID = 3002, + Value = -0.01} + gES_genericRadioPresetChannel = lPreset + end + end + if lLoad ~= nil and (lLoad == 0.0 or lLoad <= 1.0) then + lClickAction = {DeviceID = lDeviceID, + ButtonID = 3006, + Value = lLoad} + end + if lSquelch ~= nil and (lSquelch == 0.0 or lSquelch <= 1.0) then + if lSquelch == 1.0 and gES_genericRadioSquelch[gES_genericRadio] == 1.0 then + -- Squelch off + lSquelch = -1.0 + gES_genericRadioSquelch[gES_genericRadio] = 0 + elseif lSquelch == 1.0 and gES_genericRadioSquelch[gES_genericRadio] == 0 then + -- Squelch on + lSquelch = 0.0 + gES_genericRadioSquelch[gES_genericRadio] = 1.0 + end + lClickAction = {DeviceID = lDeviceID, + ButtonID = 3008, + Value = lSquelch} + end + if lManualPreset ~= nil and (lManualPreset == 0.0 or lManualPreset <= 1.0) then + if lManualPreset == 1.0 and gES_genericRadioPresetManual[gES_genericRadio] == 1.0 then + -- Manual on + lManualPreset = 0.2 + gES_genericRadioPresetManual[gES_genericRadio] = 0 + elseif lManualPreset == 1.0 and gES_genericRadioPresetManual[gES_genericRadio] == 0 then + -- Preset on + lManualPreset = 0.3 + gES_genericRadioPresetManual[gES_genericRadio] = 1.0 + end + lClickAction = {DeviceID = lDeviceID, + ButtonID = 3004, + Value = lManualPreset} + end + if lPower ~= nil and (lPower == 0.0 or lPower <= 1.0) then + if lPower == 1.0 and gES_genericRadioPower[gES_genericRadio] == 1.0 then + -- Power off + lPower = 0.0 + gES_genericRadioPower[gES_genericRadio] = 0 + elseif lPower == 1.0 and gES_genericRadioPower[gES_genericRadio] == 0 then + -- Power on + lPower = 0.1 + gES_genericRadioPower[gES_genericRadio] = 1.0 + end + lClickAction = {DeviceID = lDeviceID, + ButtonID = 3003, + Value = lPower} + end + + elseif gES_genericRadio == 3 then + -- AN/ARC-186(V) VHF FM ##.### + ------------------------------------------------- + local lDeviceID = 56 + local lVHF_FM_RADIO = GetDevice(lDeviceID) + + -- check status of the radio + if gES_genericRadioPower[gES_genericRadio] == nil then + if lVHF_FM_RADIO:is_on() then + gES_genericRadioPower[gES_genericRadio] = 1.0 + else + gES_genericRadioPower[gES_genericRadio] = 0.0 + end + end + if gES_genericRadioPresetManual[gES_genericRadio] == nil then + gES_genericRadioPresetManual[gES_genericRadio] = ((math.round(lMainPanelDevice:get_argument_value(149), 1) == 0.1) and 1 or 0) + end + if gES_genericRadioSquelch[gES_genericRadio] == nil then + gES_genericRadioSquelch[gES_genericRadio] = ((math.round(lMainPanelDevice:get_argument_value(148), 1) == 1.0) and 0 or 1) + end + + local lVHF_FM_RADIO_Frequency = math.round(lVHF_FM_RADIO:get_frequency()/1000000 , 3, "floor") + if lVHF_FM_RADIO_Frequency > 99.999 then + lVHF_FM_RADIO_Frequency = string.format("%.3f", lVHF_FM_RADIO_Frequency) + else + lVHF_FM_RADIO_Frequency = string.format("0%.3f", lVHF_FM_RADIO_Frequency) + end + -- Preset is buggy + local lVHF_FM_RADIO_PRESET = {[0.0]="01",[0.01]="02",[0.02]="03",[0.03]="04",[0.04]="05",[0.05]="06",[0.06]="07",[0.07]="08",[0.08]="09",[0.09]="10",[0.10]="11",[0.11]="12",[0.12]="13",[0.13]="14",[0.14]="15",[0.15]="16",[0.16]="17",[0.17]="18",[0.18]="19",[0.19]="20",[0.20]="01"} + + local lPresetChannel = math.round(lMainPanelDevice:get_argument_value(151), 2, "ceil") + + SendDataHW("3000", string.format("%s%s", lVHF_FM_RADIO_PRESET[lPresetChannel], lVHF_FM_RADIO_Frequency), lHardware) + SendDataHW("3001", string.format("%s", lVHF_FM_RADIO_PRESET[lPresetChannel]), lHardware) + SendDataHW("3002", string.format("%s", lVHF_FM_RADIO_Frequency), lHardware) + + if lRotaryFrequency_1 ~= nil and (lRotaryFrequency_1 >= 0.0 and lRotaryFrequency_1 <= 2.0) then + + local lFrequency = StrSplit(lVHF_FM_RADIO_Frequency, "%.") + + if type(lFrequency) == "table" and lFrequency[1] ~= nil then + lFrequency[1] = tonumber(lFrequency[1]) + if lFrequency[2] == nil then + lFrequency[2] = 0 + else + lFrequency[2] = tonumber(lFrequency[2]) + local ltmp = string.format("%.0f", lFrequency[2] / 25) + lFrequency[2] = ltmp * 25 + end + if lRotaryFrequency_1 < gES_genericRadioFrequency1 or lRotaryFrequency_1 == 0.0 or lRotaryFrequency_1 == 2.0 then + lFrequency[1] = lFrequency[1] - 1 + if lFrequency[1] == 29 then + lFrequency[1] = 76 + end + gES_genericRadioFrequency1 = lRotaryFrequency_1 + else + lFrequency[1] = lFrequency[1] + 1 + if lFrequency[1] == 77 then + lFrequency[1] = 30 + end + gES_genericRadioFrequency1 = lRotaryFrequency_1 + end + + lFrequency[2] = string.format("%.3f", lFrequency[2] / 1000) + local ltempFrequency = string.format("%.3f", lFrequency[1] + lFrequency[2]) + ltempFrequency = tonumber(ltempFrequency) + lSetFrequency = {DeviceID = lDeviceID, + Frequency = ltempFrequency * 1000000} + + else + WriteToLog("1. generic A-10C VHF FM Radio, don't split frequency: "..lFrequency) + end + end + + if lRotaryFrequency_2 ~= nil and (lRotaryFrequency_2 >= 0.0 and lRotaryFrequency_2 <= 2.0) then + + local lFrequency = StrSplit(lVHF_FM_RADIO_Frequency, "%.") + + if type(lFrequency) == "table" and lFrequency[1] ~= nil then + lFrequency[1] = tonumber(lFrequency[1]) + if lFrequency[2] == nil then + lFrequency[2] = 0 + else + lFrequency[2] = tonumber(lFrequency[2]) + local ltmp = string.format("%.0f", lFrequency[2] / 25) + lFrequency[2] = ltmp * 25 + end + if lRotaryFrequency_2 < gES_genericRadioFrequency2 or lRotaryFrequency_2 == 0.0 or lRotaryFrequency_2 == 2.0 then + lFrequency[2] = lFrequency[2] - 25 + if lFrequency[2] == -25 then + lFrequency[2] = 975 + end + gES_genericRadioFrequency2 = lRotaryFrequency_2 + else + lFrequency[2] = lFrequency[2] + 25 + if lFrequency[2] == 1000 then + lFrequency[2] = 0 + end + gES_genericRadioFrequency2 = lRotaryFrequency_2 + end + + lFrequency[2] = string.format("%.3f", lFrequency[2] / 1000) + local ltempFrequency = string.format("%.3f", lFrequency[1] + lFrequency[2]) + ltempFrequency = tonumber(ltempFrequency) + lSetFrequency = {DeviceID = lDeviceID, + Frequency = ltempFrequency * 1000000} + + else + WriteToLog("2. generic A-10C VHF FM Radio, don't split frequency: "..lFrequency) + end + end + if lVolume ~= nil and (lVolume >= 0.0 and lVolume <= 2.0) then + lVolume = lVolume / 2 + lClickAction = {DeviceID = lDeviceID, + ButtonID = 3005, + Value = lVolume} + end + if lPreset ~= nil and (lPreset >= 0.0 and lPreset <= 2.0) then + -- Preset 0.0 to 0.20 in 0.01 steps + if lPreset < gES_genericRadioPresetChannel or lPreset == 0.0 or lPreset == 2.0 then + lClickAction = {DeviceID = lDeviceID, + ButtonID = 3001, + Value = 0.01} + gES_genericRadioPresetChannel = lPreset + else + lClickAction = {DeviceID = lDeviceID, + ButtonID = 3002, + Value = -0.01} + gES_genericRadioPresetChannel = lPreset + end + end + if lLoad ~= nil and (lLoad == 0.0 or lLoad <= 1.0) then + lClickAction = {DeviceID = lDeviceID, + ButtonID = 3006, + Value = lLoad} + end + if lSquelch ~= nil and (lSquelch == 0.0 or lSquelch <= 1.0) then + if lSquelch == 1.0 and gES_genericRadioSquelch[gES_genericRadio] == 1.0 then + -- Squelch off + lSquelch = -1.0 + gES_genericRadioSquelch[gES_genericRadio] = 0 + elseif lSquelch == 1.0 and gES_genericRadioSquelch[gES_genericRadio] == 0 then + -- Squelch on + lSquelch = 0.0 + gES_genericRadioSquelch[gES_genericRadio] = 1.0 + end + lClickAction = {DeviceID = lDeviceID, + ButtonID = 3008, + Value = lSquelch} + end + if lManualPreset ~= nil and (lManualPreset == 0.0 or lManualPreset <= 1.0) then + if lManualPreset == 1.0 and gES_genericRadioPresetManual[gES_genericRadio] == 1.0 then + -- Manual on + lManualPreset = 0.2 + gES_genericRadioPresetManual[gES_genericRadio] = 0 + elseif lManualPreset == 1.0 and gES_genericRadioPresetManual[gES_genericRadio] == 0 then + -- Preset on + lManualPreset = 0.3 + gES_genericRadioPresetManual[gES_genericRadio] = 1.0 + end + lClickAction = {DeviceID = lDeviceID, + ButtonID = 3004, + Value = lManualPreset} + end + if lPower ~= nil and (lPower == 0.0 or lPower <= 1.0) then + if lPower == 1.0 and gES_genericRadioPower[gES_genericRadio] == 1.0 then + -- Power off + lPower = 0.0 + gES_genericRadioPower[gES_genericRadio] = 0 + elseif lPower == 1.0 and gES_genericRadioPower[gES_genericRadio] == 0 then + -- Power on + lPower = 0.1 + gES_genericRadioPower[gES_genericRadio] = 1.0 + end + lClickAction = {DeviceID = lDeviceID, + ButtonID = 3003, + Value = lPower} + end + + else + SendDataHW("3000", "-", lHardware) + SendDataHW("3001", "-", lHardware) + SendDataHW("3002", "-", lHardware) + SendDataHW("3010", 0, lHardware) + SendDataHW("3011", 0, lHardware) + SendDataHW("3012", 0, lHardware) + return + end + + SendDataHW("3010", gES_genericRadioPower[gES_genericRadio], lHardware) + SendDataHW("3011", gES_genericRadioPresetManual[gES_genericRadio], lHardware) + SendDataHW("3012", gES_genericRadioSquelch[gES_genericRadio], lHardware) + + if lClickAction ~= nil then + lDevice = GetDevice(lClickAction.DeviceID) + if type(lDevice) == "table" then + --WriteToLog("GetDevice("..lClickAction.DeviceID.."):performClickableAction("..lClickAction.ButtonID..", "..lClickAction.Value..") ") + lDevice:performClickableAction(lClickAction.ButtonID, lClickAction.Value) + end + elseif lSetFrequency ~= nil then + lDevice = GetDevice(lSetFrequency.DeviceID) + if type(lDevice) == "table" and lDevice:is_on() then + --WriteToLog("GetDevice("..lSetFrequency.DeviceID.."):set_frequency("..lSetFrequency.Frequency..") ") + lDevice:set_frequency(lSetFrequency.Frequency) + else + WriteToLog("GetDevice("..lSetFrequency.DeviceID..") is no table or Radio is not on") + end + end +end \ No newline at end of file diff --git a/ExportsModules/Bf-109K-4.lua b/ExportsModules/Bf-109K-4.lua new file mode 100644 index 0000000..718ba86 --- /dev/null +++ b/ExportsModules/Bf-109K-4.lua @@ -0,0 +1,401 @@ +-- Bf-109K-4 Kurfürst +-- Version 0.9.9 + +gES_FoundDCSModule = true + +gES_GlassCockpitConfigEveryFrameArguments = +{ + [1] = "%.4f", -- MW50 pressure {0.0, 3.0}kg/cm2 = {0.0, 1.0} + [2] = "%.4f", -- Airspeed Gauge {0, 100, 150, 200, 700, 750, 900, 1000} = {0.0, 0.1, 0.15, 0.2, 0.7, 0.75, 0.9, 1.0} + -- Artificial horizon Fl_22415 + [3] = "%.4f", -- turn indicator {-1.0, 1.0} + [4] = "%.4f", -- Bank {1.0, -1.0} + [5] = "%.4f", -- Pitch {1.0, -1.0} + [6] = "%.4f", -- Slipball {-1.0, 1.0} + [7] = "%.4f", -- Caged {0.0, 1.0} + --Altitude Gauge + [8] = "%.4f", -- Altimeter_FinePtr {0.0, 1000.0} = {0.0, 1.0} + [9] = "%.4f", -- Altimeter_CoarsePtr {0.0, 13000.0} = {0.0, 1.0} + [10] = "%.4f", -- Altimeter_Pressure {712.56, 780.07} = {0.0, 1.0} + --[11] = "%.4f", -- Pressure_Setter_Pinion {0.0, 1440.0} = {0.0, 1.0} + -- AN5730 remote compass + [13] = "%.4f", -- CompassHeading {0.0, 1.0} + --[12] = "%.4f", -- CommandedCourse {0.0, 1.0} + -- AFN2 blind landing system + [14] = "%.4f", -- AFN2_Horizontal_Needle {-1.0, 1.0} + [15] = "%.4f", -- AFN2_Vertical_Needle {0.0, 1.0} + [16] = "%1d", -- AFN2_Signal_Lamp {0.0, 1.0} + --Dual-Range Pressure Gauge + [25] = "%.4f", -- Fuel_Pressure {0.0, 2.0} -- kg/cm2 = {0.0, 1.0} + [26] = "%.4f", -- Oil_Pressure {0.0, 10.0} = {0, 1.0} + [27] = "%.4f", -- Coolant_Temperature {-1, 0, 130} = {-1, 0, 1} + [28] = "%.4f", -- Oil_Temperature {-1, 0, 130} = {-1, 0, 1} + [29] = "%.4f", -- Engine_RPM {400.0, 3600.0} = {0.0, 1.0} + -- propeller pitch indicator, changed 1hour every 6degrees of pitch change + [30] = "%.4f", -- Propeller_Pitch_Hour {0.0, 12.0} = {0.0, 1.0} + [31] = "%.4f", -- Propeller_Pitch_Minute {0.0, 60.0} = {0.0, 1.0} + -- Manifold_Pressure + [32] = "%.4f", -- Manifold_Pressure {0.6, 1.8} = {0.0, 1.0} + --fuel system + [33] = "%.4f", -- Fuel_Tank_Fuselage {-1.0, 0.0, 100.0, 150.0, 200.0, 250.0, 300.0, 350.0, 400.0} -- Liters = {-1.0, 0.0, 0.07, 0.175, 0.31, 0.52, 0.73, 0.88, 1.0} + --oxygen pressure indicator + [34] = "%.4f", -- Oxygen_Pressure {0.0, 250.0} = {0.0, 1.0} + [35] = "%.1f", -- Oxygen_Flow_Blinker {0.0, 1.0} + -- Variometer + [36] = "%.2f", -- Variometer {-30, -10, -5, 0, 5, 10, 30} = {-0.3, -0.1, -0.05, 0.0, 0.05, 0.1, 0.3} + --Weapon gauges + [40] = "%.4f", -- MG131_0_Shell_Counter {0.0, 500.0} = {0.0, 1.0} + [41] = "%.4f", -- MG131_1_Shell_Counter {0.0, 500.0} = {0.0, 1.0} + [42] = "%.4f", -- MG131_0_Klappanker {0.0, 60.0} = {0.0, 1.0} + [43] = "%.4f", -- MG131_1_Klappanker {0.0, 60.0} = {0.0, 1.0} + [44] = "%1d", -- LeftWing_MG151_Control_Lamp {0.0, 1.0} + [45] = "%1d", -- RightWing_MG151_Control_Lamp {0.0, 1.0} + -- Landing Gear Light + [56] = "%1d", -- LandingGearRedLight {0.0, 1.0} + [57] = "%1d", -- LandingGearGreenLightLeft {0.0, 1.0} + [58] = "%1d", -- LandingGearGreenLightRight {0.0, 1.0} + -- Pitot_Heat_Lamp + [135] = "%1d" -- Pitot_Heat_Lamp {0.0, 29.0} = {0.0, 1.0} + -- Fuel_Reserve_Lamp + --???[135] = "%1d" -- Fuel_Reserve_Lamp +} +gES_GlassCockpitConfigArguments = +{ + -- FuseBox Controls - Electrical Switches + -- RH Fuse Box Circuit Breakers + -- Left Row + -- A 100 - Generator Cut-Off Relay + [114] = "%1d", -- Generator On {0, 1} + [151] = "%1d", -- Generator OFF {0, 1} + -- D 100 - Heating CB + [115] = "%1d", -- Pitot/Windscreen Heating On {0, 1} + [152] = "%1d", -- Pitot/Windscreen Heating OFF {0, 1} + -- C 100 - Navigation Lights CB + [116] = "%1d", -- Nav. Lights On {0, 1} + [153] = "%1d", -- Nav. Lights OFF {0, 1} + -- C 101 - Instrument Panel Illumination CB {0, 1} + [117] = "%1d", -- UV Lights On {0, 1} + [154] = "%1d", -- UV Lights Off {0, 1} + -- V 101 - Drop Ordnance & Optional Armament CB + [118] = "%1d", -- Wing / Drop Ordnance On {0, 1} + [155] = "%1d", -- Wing / Drop Ordnance Off {0, 1} + -- V 100 - Systematic & Ignition CB + [119] = "%1d", -- Ignition On {0, 1} + [156] = "%1d", -- Ignition Off {0, 1} + -- Spotlights CB - TODO implement when landing lights rustsatz is available + --[] = "%1d", -- Spotlights On {0, 1} + --[] = "%1d", -- Spotlights Off {0, 1} + -- Right Row + -- A 101 - Battery Cut-Off Relay + [120] = "%1d", -- Battery On {0, 1} + [157] = "%1d", -- Battery Off {0, 1} + -- F 135 - Radio CB - Labelled "FuG 16" + [121] = "%1d", -- Radio On {0, 1} + [158] = "%1d", -- Radio Off {0, 1} + -- F 211 - IFF CB - Labelled "FuG 25a" + [122] = "%1d", -- IFF On {0, 1} + [159] = "%1d", -- IFF Off {0, 1} + -- E 101 - Fuel Pump CB - Labelled "Tankpumpe" + [123] = "%1d", -- Fuel Pump On {0, 1} + [160] = "%1d", -- Fuel Pump Off {0, 1} + -- Ignition Controls and Starter and Motor-Related Switches + -- Magneto Selector + [59] = "%.1f", -- Magnetos (Off, M1, M2, M1+M2) {0.0, 0.1, 0.2, 0.3} + -- Starter Handle Cover + [51] = "%.1d", -- Starter Handle Cover {0, 1} + -- Starter Turn Handle + [52] = "%.1d", -- Starter {0, 1} + -- WM-Kommandgerat Toggle + [62] = "%.1d", -- Governor Automation {0, 1} + -- Dashboard and Secondary Switches + -- A 104 - Kill Switch + [49] = "%.1d", -- Kill Switch {0, 1} + -- Button T - Gun Camera Trigger + [149] = "%.1d", -- Button T {0, 1} + -- SZKK3 Weapons Control Master Switch + [37] = "%.1d", -- Weapons Master {0, 1} + -- LH SZ 500 Ammo Counter + [38] = "%.1f", -- Left Ammo Counter Setter Pinion (axis) {0.0 - 0.0} + -- RH SZ 500 Ammo Counter + [39] = "%.1f", -- Right Ammo Counter Setter Pinion (axis) {0.0 - 0.0} + -- MW50 Operational Toggle + [60] = "%.1d", -- MW50 Boost {0, 1} + -- Wing Cannons Toggle + [61] = "%.1d", -- Wing Cannons {0, 1} + -- MK 108 / Wing Guns Toggle + [62] = "%.1d", -- MK 108 / R 21 {0, 1} + -- R 101 ZSK 244 A Bomb Panel Master Switch + -- Operated internally via ZSK 244 A Mode Control + -- R 101 ZSK 244 A Mode Selector + [64] = "%.1f", -- Bomb Fusing Selector (DIVE (INSTANT), DIVE (DELAYED), OFF, LEVEL (DELAYED), LEVEL (INSTANT)) {0.0, 0.25, 0.5, 0.75, 1.0} + -- Illumination Controls + -- C 102 LH UV Lamp Rheostat + [80] = "%.1f", -- Left UV Lamp Brightness (axis) {0.0 - 0.5} + -- C 103 RH UV Lamp Rheostat + [82] = "%.1f", -- Right UV Lamp Brightness (axis) {0.0 - 0.5} + -- Oxygen Apparatus Controls + -- Apparatus Connecting Valve + [127] = "%.1d", -- Oxygen Operating Valve {0, 1} + [126] = "%.1d", -- Oxygen Emergency By-Pass {0, 1} + -- Main Panel Controls + -- Undercarriage Controls + -- U/C Plungers Cover + [53] = "%.1d", -- Undercarriage Controls Cover {0, 1} + [54] = "%.1d", -- Undercarriage Raise {1.0, 1.0} + [55] = "%.1d", -- Undercarriage Lower {1.0, 1.0} + [63] = "%.1d", -- Undercarriage Emergency Release + -- Fuel and MW50 Systems Controls + -- Fuel Primer Hand Pump + [140] = "%.1d", -- Fuel Priming Pump {0, 1} + -- Schnellstop Lever + [88] = "%.1d", -- Engine Stop {0, 1} + -- Booster Pumps Lever + [87] = "%.1f", -- Booster Pumps (Off, P1, P2, P1+P2) {0.0, 0.1, 0.2, 0.3} + -- Stoff-Kraftstoff Ventilbatterie Lever + [96] = "%.1d", -- MW / Fuel {0, 1} + -- Fuel Jettison Knob + [112] = "%.1d", -- "Fuel / MW Jettison {0, 1} + -- Coolant System Controls + -- Radiator Mode Lever {0, 1} + [113] = "%.1f", -- Radiators Mode (Drive Off, Open, Automatic, Close) {0.0, 0.1, 0.2, 0.3} + -- LH Radiator Hose Cut-Off Pull Handle + [90] = "%.1d", -- LH Radiator Cut-Off {0, 1} + -- RH Radiator Hose Cut-Off Pull Handle + [91] = "%.1d", -- RH Radiator Cut-Off {0, 1} + -- Navigation Instruments + -- Altimeter + [11] = "%.2f", -- Altimeter Pressure Set (axis) 1.0 in 0.04 steps + -- Artificial Horizon + [7] = "%.2f", -- Horizon Cage (axis) {0.0, 0.511} in 0.04 steps + -- Repeater Compass + [12] = "%.2f", -- Course Set (axis) 0.0 in 0.04 steps + -- Instruments + -- Clock Scale + [21] = "%.8f", -- Scale Set (axis) 0.0 in 0.01612434 steps + -- Clock Setter Pinion + [22] = "%.1f", -- Adjusting Knob (axis) 0.0 in 0.1 steps + -- Clock Freeze Lever + [23] = "%.1d", -- Time Setting Lever {0, 1} + -- Clock Stopwatch Button + [24] = "%.1d", -- Start/Stop/Reset Chronometer + -- P 112 Gun Sight Brightness Rheostat {0, 1} + [48] = "%.1f", -- Gun Sight Brightness (axis) 0.5 in 0.1 steps + -- P 112 Gun Sight Folding Controls + [139] = "%.1d", -- Gunsight Fold {0, 1} + -- P 112 Gun Sight Smoked Screen Controls + [47] = "%.1d", -- Gunsight Smoked Screen {0, 1} + -- Radio Controls + -- FUG16 + [128] = "%.1f", -- FuG16ZY Preset Selector (1, 2, TR, SQ) {0.0, 0.1, 0.2, 0.3} + [129] = "%.2f", -- FuG16 ZY Fine Tune (axis) 0.5 in 0.05 steps + [130] = "%.2f", -- FuG16 ZY Volume (axis) 0.0 in 0.04 steps + [131] = "%.1d", -- "Mic. On/Off {0, 1} + -- FUG25 + [132] = "%.1f", -- FuG25 Mode Selector (1, 2) {0.0, 1.0} + [133] = "%.1d", -- FuG25 Test {0, 1} + -- Left Wall Controls + -- Tail Wheel Lock Handle + [97] = "%.1d", -- Tail Wheel Lock {0, 1} + -- Cockpit Open/Close Control + [136] = "%.1d", -- Canopy (Open/Close) {0, 1} + -- Cockpit Jettison Pull Handle + [83] = "%.1d", -- Jettison Canopy {0, 1} + -- Trim Wheel + [141] = "%.1d", -- Stabilizer Trim Nose Up {0, 1} + [142] = "%.1d", -- Stabilizer Trim Nose Down {0, 1} + -- Flaps Wheel + [143] = "%.1d", -- Extend Flaps {0, 1} + [144] = "%.1d", -- Retract Flaps {0, 1} + -- Notwurf / Ordinance Dump + [92] = "%.1d", -- Ordinance Emergency Release + -- Right Wall Controls + -- RH Cockpit Vent + --[99] = "%.1d", -- Cockpit Vent {0, 1} + -- Flare Gun Trigger + [72] = "%.1d", -- Fire Flare Gun + -- Engine Controls & Quadrant + -- Ground Crew Signal -- TODO remove + [145] = "%.1d", -- Signal Starter Crew {0, 1} + -- Propellor Control Rocker + [85] = "%.1f", -- Decrease RPM {1.0, -1.0} + -- Radio Transmit Button + [150] = "%.1d", -- Microphone On {0, 1} + -- E 103 Propellor Automation Switch + [89] = "%.1d", -- Governor Automation {0, 1} + -- Cold Weather Start Valve Handle + [86] = "%.1d" -- Cold Weather Start {0, 1} +} + +----------------------------- +-- HIGH IMPORTANCE EXPORTS -- +-- done every export event -- +----------------------------- + +-- Pointed to by ProcessGlassCockpitDCSHighImportance +function ProcessGlassCockpitDCSConfigHighImportance(mainPanelDevice) + if gES_GlassCockpitType == 1 then + -- HELIOS Version 1.3 + elseif gES_GlassCockpitType == 2 then + -- HawgTouch version 1.6 + -- LwMW50P + --SendData("1", string.format("%0.4f", mainPanelDevice:get_argument_value(1))) + -- LwASI + --SendData("2", string.format("%0.4f", mainPanelDevice:get_argument_value(2))) + -- ME4KH2OTemp + --SendData("27", string.format("%0.4f", mainPanelDevice:get_argument_value(27))) + -- ME4KOilTemp + --SendData("28", string.format("%0.4f", mainPanelDevice:get_argument_value(28))) + -- LwMAP + --SendData("32", string.format("%0.4f", mainPanelDevice:get_argument_value(32))) + -- ME4KFuel + --SendData("33", string.format("%0.4f", mainPanelDevice:get_argument_value(33))) + -- LwO2P + --SendData("34", string.format("%0.4f", mainPanelDevice:get_argument_value(34))) + -- LwBlink + --SendData("35", string.format("%0.4f", mainPanelDevice:get_argument_value(35))) + -- LwVSI + --SendData("36", string.format("%0.4f", mainPanelDevice:get_argument_value(36))) + -- LwALT + --Altimeter_km, Altimeter_m, Altimeter_Pressure + --[8] = "%.4f", -- Altimeter_FinePtr {0.0, 1000.0} = {0.0, 1.0} + --[9] = "%.4f", -- Altimeter_CoarsePtr {0.0, 13000.0} = {0.0, 1.0} + --[10] = "%.4f", -- Altimeter_Pressure {712.56, 780.07} = {0.0, 1.0} + --[11] = "%.4f", -- Pressure_Setter_Pinion {0.0, 1440.0} = {0.0, 1.0} + SendData("2000", string.format("%0.3f;%0.3f;%0.3f", mainPanelDevice:get_argument_value(9), + mainPanelDevice:get_argument_value(8), + mainPanelDevice:get_argument_value(10))) + -- LwAtt + --AHorizon_Bank, AHorizon_Pitch, TurnNeedle, Slipball + --[3] = "%.4f", -- turn indicator {-1.0, 1.0} + --[4] = "%.4f", -- Bank {1.0, -1.0} + --[5] = "%.4f", -- Pitch {1.0, -1.0} + --[6] = "%.4f", -- Slipball {-1.0, 1.0} + --[7] = "%.4f", -- Caged {0.0, 1.0} + SendData("2001", string.format("%0.3f;%0.3f;%0.3f;%0.3f", mainPanelDevice:get_argument_value(4), + mainPanelDevice:get_argument_value(5), + mainPanelDevice:get_argument_value(3), + mainPanelDevice:get_argument_value(6))) + -- LwHead + --CompassHeading, CommandedCourse + --[13] = "%.4f", -- CompassHeading {0.0, 1.0} + --[12] = "%.4f", -- CommandedCourse {0.0, 1.0} + SendData("2002", string.format("%0.3f;%0.3f", mainPanelDevice:get_argument_value(13), + mainPanelDevice:get_argument_value(12))) + -- LwClock, + -- No Id for Clock + --CLOCK_currtime_hours, CLOCK_currtime_minutes, CLOCK_currtime_seconds, CLOCK_chrono_minutes + --SendData("2003", string.format("%0.2f;%0.2f;%0.2f;%0.2f", mainPanelDevice:get_argument_value(), mainPanelDevice:get_argument_value(), mainPanelDevice:get_argument_value(), mainPanelDevice:get_argument_value())) + -- LwDblP + --Oil_Pressure; Fuel_Pressure; + --[25] = "%.4f", -- Fuel_Pressure {0.0, 2.0} -- kg/cm2 = {0.0, 1.0} + --[26] = "%.4f", -- Oil_Pressure {0.0, 10.0} = {0, 1.0} + SendData("2004", string.format("%0.3f;%0.3f", mainPanelDevice:get_argument_value(26), + mainPanelDevice:get_argument_value(25))) + -- LwAFN2 + --AFN2_Horizontal_Needle, AFN2_Vertical_Needle, AFN2_Signal_Lamp + --[14] = "%.4f", -- AFN2_Horizontal_Needle {0.0, 1.0} + --[15] = "%.4f", -- AFN2_Vertical_Needle {-1.0, 1.0} + --[16] = "%1d", -- AFN2_Signal_Lamp {0.0, 1.0} + SendData("2005", string.format("%0.3f;%0.3f;%0.3f", mainPanelDevice:get_argument_value(14), + mainPanelDevice:get_argument_value(15), + mainPanelDevice:get_argument_value(16))) + -- LwProp + --Propeller_Pitch_Hour; Propeller_Pitch_Minute + --[30] = "%.4f", -- Propeller_Pitch_Hour {0.0, 12.0} = {0.0, 1.0} + --[31] = "%.4f", -- Propeller_Pitch_Minute {0.0, 60.0} = {0.0, 1.0} + SendData("2006", string.format("%0.3f;%0.3f", mainPanelDevice:get_argument_value(30), + mainPanelDevice:get_argument_value(31))) + end +end + +function ProcessHARDWAREConfigHighImportance(mainPanelDevice) +-- Hier kommen alle Daten rein die ueber die Hardware in schneller folge ausgeben werden soll +-- In der Regel sind das die Statusanzeigen + +-- SendDataHW(), ist die Funktion zur Ausgabe der Werte an die Hardware +-- "178" ist die ID des Wertes die in der entsprechenden XML Datei festgelegt wird, sollte der DCS ID entsprechen +-- mainPanelDevice:get_argument_value() ist eine Funktion die die Werte der übergeben DCS ID aus dem Spiel ausliest +-- 178 ist die DCS ID von dem man die Werte haben will +-- Description + --SendDataHW("178", mainPanelDevice:get_argument_value(178)) -- L_AILERON_EMER_DISENGAGE + --SendDataHW("", mainPanelDevice:get_argument_value()) -- + + SendDataHW("16", mainPanelDevice:get_argument_value(16)) -- AFN2_Signal_Lamp + SendDataHW("35", mainPanelDevice:get_argument_value(35) > 0.8 and 1 or 0) -- Oxygen_Flow_Blinker + SendDataHW("42", mainPanelDevice:get_argument_value(42) > 0.8 and 1 or 0) -- MG131_0_Klappanker + SendDataHW("43", mainPanelDevice:get_argument_value(43) > 0.8 and 1 or 0) -- MG131_1_Klappanker + SendDataHW("44", mainPanelDevice:get_argument_value(44)) -- LeftWing_MG151_Control_Lamp + SendDataHW("45", mainPanelDevice:get_argument_value(45)) -- RightWing_MG151_Control_Lamp + SendDataHW("56", mainPanelDevice:get_argument_value(56)) -- LandingGearRedLight + SendDataHW("57", mainPanelDevice:get_argument_value(57)) -- LandingGearGreenLightLeft + SendDataHW("58", mainPanelDevice:get_argument_value(58)) -- LandingGearGreenLightRight + SendDataHW("135", mainPanelDevice:get_argument_value(135) > 0.8 and 1 or 0) -- Pitot_Heat_Lamp + -- ??? SendDataHW("135", mainPanelDevice:get_argument_value(135)) -- Fuel_Reserve_Lamp + -- Bomb lamps ???? +--[[ + WriteToLog('AFN2_Signal_Lamp: '..dump(mainPanelDevice:get_argument_value(16))) + WriteToLog('Oxygen_Flow_Blinker: '..dump(mainPanelDevice:get_argument_value(mainPanelDevice:get_argument_value(35)))) + WriteToLog('MG131_0_Klappanker: '..dump(mainPanelDevice:get_argument_value(42))) + WriteToLog('MG131_1_Klappanker: '..dump(mainPanelDevice:get_argument_value(43))) + WriteToLog('LeftWing_MG151_Control_Lamp: '..dump(mainPanelDevice:get_argument_value(44))) + WriteToLog('RightWing_MG151_Control_Lamp: '..dump(mainPanelDevice:get_argument_value(46))) + WriteToLog('LandingGearRedLight: '..dump(mainPanelDevice:get_argument_value(56))) + WriteToLog('LandingGearGreenLightLeft: '..dump(mainPanelDevice:get_argument_value(57))) + WriteToLog('LandingGearGreenLightRight: '..dump(mainPanelDevice:get_argument_value(58))) + WriteToLog('Pitot_Heat_Lamp: '..dump(mainPanelDevice:get_argument_value(135))) +]] +end + +----------------------------------------------------- +-- LOW IMPORTANCE EXPORTS -- +-- done every gExportLowTickInterval export events -- +----------------------------------------------------- + +-- Pointed to by ProcessGlassCockpitDCSConfigLowImportance +function ProcessGlassCockpitDCSConfigLowImportance(mainPanelDevice) +end + +function ProcessHARDWAREConfigLowImportance(mainPanelDevice) + --[[ + every frame export to hardware + Example from A-10C + Get Radio Frequencies + get data from device + local UHF_RADIO = GetDevice(54) + SendDataHW("ExportID", "Format") + SendDataHW("ExportID", "Format", HardwareConfigID) + SendDataHW("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000)) + SendDataHW("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000), 2) -- export to Hardware '2' Config + ]] + + local lRADIO = GetDevice(14) + SendDataHW("2000", string.format("%7.3f", lRADIO:get_frequency()/1000000)) + + --===================================================================================== + --[[ + WriteToLog('list_cockpit_params(): '..dump(list_cockpit_params())) + WriteToLog('CMSP: '..dump(list_indication(7))) + + local ltmp1 = 0 + for ltmp2 = 0, 13, 1 do + ltmp1 = list_indication(ltmp2) + WriteToLog(ltmp2..': '..dump(ltmp1)) + --WriteToLog(ltmp2..' (metatable): '..dump(getmetatable(ltmp1))) + end + ]] +--[[ + local ltmp1 = 0 + for ltmp2 = 1, 16, 1 do + ltmp1 = GetDevice(ltmp2) + WriteToLog(ltmp2..': '..dump(ltmp1)) + WriteToLog(ltmp2..' (metatable): '..dump(getmetatable(ltmp1))) + end +]] +end + +----------------------------- +-- Custom functions -- +----------------------------- + +function genericRadio(key, value, hardware) +end diff --git a/ExportsModules/Empty-DCS.lua b/ExportsModules/Empty-DCS.lua new file mode 100644 index 0000000..6949589 --- /dev/null +++ b/ExportsModules/Empty-DCS.lua @@ -0,0 +1,106 @@ +-- modul name +-- Version + +gES_FoundDCSModule = true + +gES_GlassCockpitConfigEveryFrameArguments = +{ +-- Hier kommen alle Anzeigen rein die in HELOS/HawgTouch angezeigt werden sollen +-- [4] DCS ID, e.g. 4 for AOA +-- "%.4f" Format des Rückgabewerte, z.B. "%.4f" eine Floatzahl mit 4 Nachkommastellen, "%0.1f" eine Floatzahl mit führender 0 und einer Nachkommstelle, "%1d" eine Einstellige dezimalzahl +-- -- AOA, Description of DCS ID + [4] = "%.4f", -- AOA + [] = "", -- +} +gES_GlassCockpitConfigArguments = +{ +-- Hier kommen alle Schalter rein die in HELOS/HawgTouch angezeigt werden sollen +-- [101] DCS ID from Button, e.g. 22 for PTR-EXT-STORES-JETT (mergency Jettison External Stores) +-- "%.1" Format des Wertes der an DCS gesendet werden soll, Beschreibung siehe oben +-- -- PTR-EXT-STORES-JETT (mergency Jettison External Stores) Description of DCS ID + [101] = "%.1f", -- PTR-EXT-STORES-JETT (mergency Jettison External Stores) + [] = "", -- +} + +----------------------------- +-- HIGH IMPORTANCE EXPORTS -- +-- done every export event -- +----------------------------- + +-- Pointed to by ProcessGlassCockpitDCSHighImportance +function ProcessGlassCockpitDCSConfigHighImportance(mainPanelDevice) + if gES_GlassCockpitType == 1 then + -- HELIOS Version 1.3 + elseif gES_GlassCockpitType == 2 then + -- HawgTouch version 1.6 + end +end + +function ProcessHARDWAREConfigHighImportance(mainPanelDevice) +-- Hier kommen alle Daten rein die ueber die Hardware in schneller folge ausgeben werden soll +-- In der Regel sind das die Statusanzeigen + +-- SendDataHW(), ist die Funktion zur Ausgabe der Werte an die Hardware +-- "178" ist die ID des Wertes die in der entsprechenden XML Datei festgelegt wird, sollte der DCS ID entsprechen +-- mainPanelDevice:get_argument_value() ist eine Funktion die die Werte der übergeben DCS ID aus dem Spiel ausliest +-- 178 ist die DCS ID von dem man die Werte haben will +-- Description + SendDataHW("178", mainPanelDevice:get_argument_value(178)) -- L_AILERON_EMER_DISENGAGE + SendDataHW("", mainPanelDevice:get_argument_value()) -- +end + +----------------------------------------------------- +-- LOW IMPORTANCE EXPORTS -- +-- done every gExportLowTickInterval export events -- +----------------------------------------------------- + +-- Pointed to by ProcessGlassCockpitDCSConfigLowImportance +function ProcessGlassCockpitDCSConfigLowImportance(mainPanelDevice) + if gES_GlassCockpitType == 1 then + -- HELIOS Version 1.3 + elseif gES_GlassCockpitType == 2 then + -- HawgTouch version 1.6 + end +end + +function ProcessHARDWAREConfigLowImportance(mainPanelDevice) + --[[ + every frame export to hardware + Example from A-10C + Get Radio Frequencies + get data from device + local UHF_RADIO = GetDevice(54) + SendDataHW("ExportID", "Format") + SendDataHW("ExportID", "Format", HardwareConfigID) + SendDataHW("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000)) + SendDataHW("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000), 2) -- export to Hardware '2' Config + ]] + + --===================================================================================== + --[[ + WriteToLog('list_cockpit_params(): '..dump(list_cockpit_params())) + WriteToLog('CMSP: '..dump(list_indication(7))) + + local ltmp1 = 0 + for ltmp2 = 0, 13, 1 do + ltmp1 = list_indication(ltmp2) + WriteToLog(ltmp2..': '..dump(ltmp1)) + --WriteToLog(ltmp2..' (metatable): '..dump(getmetatable(ltmp1))) + end + ]] +--[[ + local ltmp1 = 0 + for ltmp2 = 1, 73, 1 do + ltmp1 = GetDevice(ltmp2) + WriteToLog(ltmp2..': '..dump(ltmp1)) + WriteToLog(ltmp2..' (metatable): '..dump(getmetatable(ltmp1))) + end +]] +end + +----------------------------- +-- Custom functions -- +----------------------------- + +function genericRadio(key, value, hardware) +end diff --git a/ExportsModules/F-15C.lua b/ExportsModules/F-15C.lua new file mode 100644 index 0000000..1b3ab0f --- /dev/null +++ b/ExportsModules/F-15C.lua @@ -0,0 +1,1229 @@ +-- F-15C Export +-- Version 0.9.9 BETA + +gES_FoundFCModule = true + +-- auxiliary function +dofile(gES_ExportModulePath.."FC_AuxiliaryFuntions.lua") + +----------------------------------------- +-- FLAMING CLIFFS AIRCRAFT / F-15C -- +-- FC aircraft don't support GetDevice -- +----------------------------------------- + +function ProcessGlassCockpitFCHighImportanceConfig() + + local myData = LoGetSelfData() + + if (myData) then + local lLatitude = myData.LatLongAlt.Lat -- LATITUDE + local lLongitude = myData.LatLongAlt.Long -- LONGITUDE + local lBasicAtmospherePressure = LoGetBasicAtmospherePressure() -- BAROMETRIC PRESSURE + local lAltBar = LoGetAltitudeAboveSeaLevel() -- ALTITUDE SEA LEVEL (Meter) + local lAltRad = LoGetAltitudeAboveGroundLevel() -- ALTITUDE GROUND LEVEL (Meter) + --local lTrueAirSpeed = LoGetTrueAirSpeed() -- TRUE AIRSPEED (Meter/Second) + local lPitch, lBank, lYaw = LoGetADIPitchBankYaw() -- PITCH, BANK, YAW (Radian) + + local lHeading = myData.Heading -- HEADING (Radian) + local lVVI = LoGetVerticalVelocity() -- VERTICAL SPEED (Meter/Second) + local lIAS = LoGetIndicatedAirSpeed() -- INDICATED AIRSPEED (Meter/Second) + local lMachNumber = LoGetMachNumber() -- MACH + local lAoA = LoGetAngleOfAttack() -- ANGLE OF ATTACK AoA (Radian) + + local lGlide = LoGetGlideDeviation() -- VOR1 HORIZONTAL DEFLECTION (-1 +1) + local lSide = LoGetSideDeviation() -- VOR1 VERTICAL DEFLECTION (-1 +1) + --local lSlipBallPosition = LoGetSlipBallPosition() -- SLIP BALL (-1 +1) + local lAccelerationUnits = LoGetAccelerationUnits().y -- G-LOAD + --local lMagneticYaw = LoGetMagneticYaw() -- Magnetic Yaw(Radian) + + --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 lEngineFuelConsumptionLeft = LoGetEngineInfo().FuelConsumption.left + local lEngineFuelConsumptionRight = LoGetEngineInfo().FuelConsumption.right + local lEngineHydraulicPressureLeft = LoGetEngineInfo().HydraulicPressure.left + local lEngineHydraulicPressureRight = LoGetEngineInfo().HydraulicPressure.right + 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 + --lBasicAtmospherePressure = lBasicAtmospherePressure * 0.03937 -- BAROMETRIC PRESSURE (MM TO IN) + --lTrueAirSpeed = lTrueAirSpeed * 1.94 -- TRUE AIRSPEED (M/S TO KNOTS) + lAltBar = lAltBar --* 3.28084 -- ALTITUDE SEA LEVEL (MTS TO FT) + lAltRad = lAltRad * 3.28084 -- ALTITUDE GROUND LEVEL (MTS TO FT) + lVVI = lVVI --* 196.8504 -- VERTICAL SPEED (M/S TO FPM) + lIAS = lIAS * 1.9438444924574 -- INDICATED AIRSPEED (M/S TO KNOTS) + 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 - lHSI_ADF) + (360 - lHeading) + lHSI_RMI = 360 - lHSI_RMI + local lnavInfo = LoGetNavigationInfo() + + 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", lAccelerationUnits) ) + 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", (math.floor(lEngineFuelInternal) + (lEngineRPMleft /1000))) ) + SendData("10", string.format("%.2f", (math.floor(lEngineFuelExternal) + (lEngineRPMright /1000))) ) + SendData("11", string.format("%.2f", (math.floor(lEngineFuelInternal + lEngineFuelExternal) + (lEngineTempLeft/1000))) ) + if math.floor(lRoute.goto_point.world_point.x) < 0 then + SendData("12", string.format("%.4f", (math.floor(lRoute.goto_point.world_point.x) - (lEngineRPMright/1000)) ) ) --x coord + eng temp left in eng temp rifgt import data + else + SendData("12", string.format("%.4f", (math.floor(lRoute.goto_point.world_point.x) + (lEngineTempLeft/1000)) ) ) --x coord + eng temp left in eng temp rifgt import data + end + --SendData("12", string.format("%.2f", lEngineTempRight) ) + SendData("13", string.format("%.2f", lVVI) ) + SendData("14", string.format("%.2f", (math.floor(lDistanceToWay) + (lIAS /10000))) ) --distance to way + ias in IAS import data + SendData("15", string.format("%s", lnavInfo.SystemMode.master .." / ".. lnavInfo.SystemMode.submode)) -- HUD MODE and SUBMODE in distancetoway import data + --SendData("15", string.format("%.2f", lDistanceToWay) ) + SendData("16", string.format("%.2f", lAoA) ) + SendData("17", string.format("%.2f", lGlide) ) + SendData("18", string.format("%.2f", lSide) ) + + elseif gES_GlassCockpitType == 2 then + -- HawgTouch version 1.6 + + -- Barometrisic Altimeter + --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} + local lAltCounter = {[0] = 0.0, [1] = 0.1, [2] = 0.2, [3] = 0.3, [4] = 0.4, [5] = 0.5, [6] = 0.6, [7] = 0.7, [8] = 0.8, [9] = 0.9} + --local lAltBarTmp2 = string.format("%03d", ((lAltBar * 3.28084) / 100)) -- meter to feeds + lAltBar = lAltBar - (9.5 * (760 - lBasicAtmospherePressure)) -- 9.5 m per 1mmHg difference + local lAltBarTmp = lAltBar * 3.28084 -- meter to feeds + local lAltBarTmp2 = ((lAltBar * 3.28084) / 100) -- meter to feeds + + lAltBarTmp = lAltBarTmp / 1000 + lAltBarTmp = lAltBarTmp - math.round(lAltBarTmp, 0, "floor") + + local lAltCounter1 = 0 + local lAltCounter2 = 0 + local lAltCounter3 = 0 + local lAltCounter4 = 0 + local lAltBarTmp3 = string.format("%03d", lAltBarTmp2) + --[[ + if lAltBarTmp2 > 10000 then + lAltCounter1 = math.round((lAltBarTmp2 / 10000), 0, "floor") * 0.1 + lAltCounter1 = lAltCounter1 - math.round(lAltCounter1, 0, "floor") + end + if lAltBarTmp2 > 1000 then + lAltCounter2 = math.round((lAltBarTmp2 / 1000), 0, "floor") * 0.1 + lAltCounter2 = lAltCounter2 - math.round(lAltCounter1, 0, "floor") + end + if lAltBarTmp2 > 100 then + if lAltBarTmp2 > 100 then + lAltCounter3 = (math.round((lAltBarTmp2 - (math.round(lAltBarTmp2 / 100, 0, "floor") * 100)), 0, "floor") / 10) * 0.1 + else + lAltCounter3 = (lAltBarTmp2 / 100) * 0.1 + lAltCounter3 = lAltCounter3 - math.round(lAltCounter3, 0, "floor") + end + end + if lAltBarTmp2 > 10 then + lAltCounter4 = (lAltBarTmp2 - (math.round(lAltBarTmp2 / 10, 0, "floor") * 10)) * 0.1 + else + lAltCounter4 = lAltBarTmp2 --* 0.1 + end]] + lAltCounter4 = lAltBarTmp * 10 + if lAltCounter4 > 1.0 then + lAltCounter4 = lAltCounter4 - math.round(lAltCounter4, 0, "floor") + end + + -- AltBar {0.0,1.0} + -- AltBar_10000 {0.0,1.0} + -- AltBar_1000 {0.0,1.0} + -- AltBar_100 {0.0,1.0} + -- AltBar_10 {0.0,1.0} + SendData(1, string.format("%.4f;%.2f;%.2f;%.2f;%.2f", + lAltBarTmp, + --lAltCounter1, + --lAltCounter2, + --lAltCounter3, + --lAltCounter4, + lAltCounter[tonumber(string.sub(lAltBarTmp3, 1, 1))], + lAltCounter[tonumber(string.sub(lAltBarTmp3, 2, 2))], + lAltCounter[tonumber(string.sub(lAltBarTmp3, 3, 3))], + --lAltCounter[tonumber(string.sub(lAltBarTmp3, 4, 4))], + lAltCounter4)) + -- Barometrisic Altimeter end + + -- Air Speed Indicator (IAS, Mach) + --[[ + y_min = 0.0 -- minimaler Ausgabewert + y_max = 1.0 -- maximaler Ausgabewert + x_min = 0.0 -- minimaler Eingangswert + x_max = 514,44444443999953012349519517095 -- maximaler Eingangswert + x = 257.0 -- aktueller Eingangswert + + d_y = 1.0 -- Delta Ausgabewerte (y_max - y_min) + d_x = 514,44444443999953012349519517095 -- Delta Eingangswerte (x_max - x_min) + m = 0.0019438444924574 -- Steigung der linearen Funktion (d_y / d_x) + n = 0.0 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max) + + y = 0.4995680345615518 -- Ergebnis (m * x + n) + ]] + lIAS = 0.0019438444924574 * lIAS + + if lMachNumber < 1.01 then + --[[ + y_min = 0.0 0.1 -- minimaler Ausgabewert + y_max = 0.1 1.0 -- maximaler Ausgabewert + x_min = 0.0 1.0 -- minimaler Eingangswert + x_max = 1.0 3.6 -- maximaler Eingangswert + x = 0.5 2.0 -- aktueller Eingangswert + + d_y = 0.1 0.9 -- Delta Ausgabewerte (y_max - y_min) + d_x = 1.0 2.6 -- Delta Eingangswerte (x_max - x_min) + m = 0.1 0.34615384615384615384615384615385 -- Steigung der linearen Funktion (d_y / d_x) + n = 0.0 -0.24615384615384615384615384615385 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max) + + y = 0.05 0.44615384615384615384615384615384 -- Ergebnis (m * x + n) + ]] + + lMachNumber = 0.1 * lMachNumber + else + lMachNumber = 0.34615384615384615384615384615385 * lMachNumber + -0.24615384615384615384615384615385 + end + -- IAS {0.0,1.0} + -- MachNumber + SendData(2, string.format("%.4f;%.4f", lIAS, lMachNumber)) + -- Air Speed Indicator End + + -- RPM Engine Left + FC_OneNeedleGauge3Digits(lEngineRPMleft, 110, 0, 3) + + -- RPM Engine Right + FC_OneNeedleGauge3Digits(lEngineRPMright, 110, 0, 4) + + -- Oil Pressure Left, no value but similar to Engine RPM + --[[ + y_min = 0.0 0.76 -- minimaler Ausgabewert + y_max = 0.76 1.0 -- maximaler Ausgabewert + x_min = 0.0 74.0 -- minimaler Eingangswert + x_max = 74.0 95.0 -- maximaler Eingangswert + x = 74.0 90.0 -- aktueller Eingangswert + + d_y = 0.76 0.24 -- Delta Ausgabewerte (y_max - y_min) + d_x = 74.0 21.0 -- Delta Eingangswerte (x_max - x_min) + m = 0.01027027027027027027027027027027 0.01142857142857142857142857142857 -- Steigung der linearen Funktion (d_y / d_x) + n = 0.0 -0.08571428571428571428571428571415 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max) + + y = 0.7599999 0.943-- Ergebnis (m * x + n) + ]] + if lEngineRPMleft < 74 then + FC_OneNeedleGauge(1.027027027027027027027027027027 * lEngineRPMleft, 100, 11) + else + FC_OneNeedleGauge(1.142857142857142857142857142857 * lEngineRPMleft + -8.571428571428571428571428571415, 100, 11) + end + + -- Oil Pressure Right, no value but similar to Engine RPM + if lEngineRPMright < 74 then + FC_OneNeedleGauge(1.027027027027027027027027027027 * lEngineRPMright, 100, 12) + else + FC_OneNeedleGauge(1.142857142857142857142857142857 * lEngineRPMright + -8.571428571428571428571428571415, 100, 12) + end + + -- Engine Exhaust Nozzle Position Indicator Left, very imprecise + --[[ + y_min = 0.0 -- minimaler Ausgabewert + y_max = 0.76 -- maximaler Ausgabewert + x_min = 95.0 -- minimaler Eingangswert + x_max = 96.0 -- maximaler Eingangswert + x = 95.5 -- aktueller Eingangswert + + d_y = 0.76 -- Delta Ausgabewerte (y_max - y_min) + d_x = 1.0 -- Delta Eingangswerte (x_max - x_min) + m = 0.76 -- Steigung der linearen Funktion (d_y / d_x) + n = -72.2 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max) + + y = 0.5 -- Ergebnis (m * x + n) + ]] + if lEngineRPMleft > 95.0 then + FC_OneNeedleGauge((0.76 * lEngineRPMleft + -72.2) * 100, 100, 5) + else + FC_OneNeedleGauge(0, 100, 5) + end + + -- Engine Exhaust Nozzle Position Indicator Right, very imprecise + if lEngineRPMright > 95.0 then + FC_OneNeedleGauge((0.76 * lEngineRPMright + -72.2) * 100, 100, 6) + else + FC_OneNeedleGauge(0, 100, 6) + end + + -- Exaust Gas Temperature Left + FC_F15C_ExaustGasTemp(lEngineTempLeft - 1.4, 7) + + -- Exaust Gas Temperature Right + FC_F15C_ExaustGasTemp(lEngineTempLeft - 1.4, 8) + + -- Fuel Flow Left + FC_OneNeedleGauge3Digits((lEngineFuelConsumptionLeft * 2.2046223302272) * 3600, 10000, 2, 9) + + -- Fuel Flow Right + FC_OneNeedleGauge3Digits((lEngineFuelConsumptionRight * 2.2046223302272) * 3600, 10000, 2, 10) + + -- Hydraulic Pressure Left + FC_OneNeedleGauge(lEngineHydraulicPressureLeft, 100, 13) + + -- Hydraulic Pressure Right + FC_OneNeedleGauge(lEngineHydraulicPressureRight, 100, 14) + + -- VVI + FC_US_VVI(15) + + -- AOA + --FC_US_AOA(16) + --WriteToLog('lAoA 1: '..dump(lAoA)) + local lAoATmp = math.deg(lAoA) + 10 + --WriteToLog('lAoA 2: '..dump(lAoATmp)) + --[[ + y_min = 0.0 -- minimaler Ausgabewert + y_max = 1.0 -- maximaler Ausgabewert + x_min = 0.0 -- minimaler Eingangswert + x_max = 45.0 -- maximaler Eingangswert + x = 12.6 -- aktueller Eingangswert + + d_y = 1.0 -- Delta Ausgabewerte (y_max - y_min) + d_x = 45.0 -- Delta Eingangswerte (x_max - x_min) + m = 0.02222222222222222222222222222222 -- Steigung der linearen Funktion (d_y / d_x) + n = 0.0000000000000000000000000000001 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max) + + y = 0.2800000000000000000000000000001 -- Ergebnis (m * x + n) + ]] + lAoATmp = 0.02222222222222222222222222222222 * lAoATmp + 0.0000000000000000000000000000001 + SendData(16, string.format("%.4f;%d", lAoATmp, 0) ) + + -- G-LOAD + FC_US_GLOAD(17) + + -- Clock + FC_US_Clock(18) + + -- Standby Compass + FC_US_Compass(19) + + -- ADI + FC_US_ADI(20) + + -- Standby ADI + FC_US_stbyADI(21) + + -- HSI + FC_US_HSI(lDistanceToWay, 22) + + -- Hydraulic Pressure Util, no value but similar to Engine Hydraulic Pressure (left or right) + local lEngineHydraulicPressure = lEngineHydraulicPressureLeft + lEngineHydraulicPressure = lEngineHydraulicPressureRight > lEngineHydraulicPressureLeft and lEngineHydraulicPressureRight or lEngineHydraulicPressureLeft + FC_OneNeedleGauge(lEngineHydraulicPressure, 100, 23) + + -- Standby Barometrisic Altimeter + --lAltBarTmp = lAltBar - (9.5 * (760 - lBasicAtmospherePressure)) -- 9.5 m per 1mmHg difference, has been calculated + lAltBarTmp = lAltBar * 3.28084 -- meter to feeds + + local AltBar_kilofeet_needle = 0 + local AltBar_hektofeet_needle = 0 + local AltBar_dafeet_needle = 0 + + if lAltBarTmp > 1000 then + AltBar_kilofeet_needle = lAltBarTmp / 10000 + end + if lAltBarTmp > 10000 then + AltBar_hektofeet_needle = (lAltBarTmp - (math.round(lAltBarTmp / 10000, 0, "floor") * 10000)) / 1000 + else + AltBar_hektofeet_needle = lAltBarTmp / 1000 + end + if lAltBarTmp > 1000 then + AltBar_dafeet_needle = (lAltBarTmp - (math.round(lAltBarTmp / 1000, 0, "floor") * 1000)) / 100 + else + AltBar_dafeet_needle = lAltBarTmp / 100 + end + + --[[ + y_min = 0.0 -- minimaler Ausgabewert + y_max = 1.0 -- maximaler Ausgabewert + x_min = 0.0 -- minimaler Eingangswert + x_max = 10.0 -- maximaler Eingangswert + x = 2.5 -- aktueller Eingangswert + + d_y = 1.0 -- Delta Ausgabewerte (y_max - y_min) + d_x = 10.0 -- Delta Eingangswerte (x_max - x_min) + m = 0.1 -- Steigung der linearen Funktion (d_y / d_x) + n = 0.0 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max) + + y = 0.25 -- Ergebnis (m * x + n) + ]] + AltBar_kilofeet_needle = 0.1 * AltBar_kilofeet_needle + AltBar_hektofeet_needle = 0.1 * AltBar_hektofeet_needle + AltBar_dafeet_needle = 0.1 * AltBar_dafeet_needle + -- AltBar_kilofeet_needle {0.0,1.0} + -- AltBar_hektofeet_needle {0.0,1.0} + -- AltBar_dafeet_needle {0.0,1.0} + SendData(24, string.format("%.4f;%.4f;%0.4f", + AltBar_kilofeet_needle, + AltBar_hektofeet_needle, + AltBar_dafeet_needle)) + -- Standby Barometrisic Altimeter end + + -- Standby Air Speed Indicator (IAS, Mach) + -- value has been calculated (from top) + -- IAS {0.0,1.0} + SendData(25, string.format("%.4f", lIAS)) + -- Standby Air Speed Indicator End + end + else + WriteToLog("Unknown FC Error, no LoGetSelfData.") + end + +end + +function ProcessHARDWAREConfigHighImportance(mainPanelDevice) + --[[ + 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)) + ]] +end + +function ProcessGlassCockpitFCLowImportanceConfig() + local lEngineFuelInternal = LoGetEngineInfo().fuel_internal -- TANK1 (INT) (KG) + local lEngineFuelExternal = LoGetEngineInfo().fuel_external -- TANK2 (EXT) (KG) + local lEngineRPMleft = LoGetEngineInfo().RPM.left -- ENG1 RPM % + local lEngineRPMright = LoGetEngineInfo().RPM.right -- ENG2 RPM % + + local lMechInfo = LoGetMechInfo() -- mechanical components, e.g. Flaps, Wheelbrakes,... + local lPayloadInfo = LoGetPayloadInfo() -- Paylod, e.g. bombs, guns, rockets, fuel tanks,... + + if gES_GlassCockpitType == 1 then + -- HELIOS Version 1.3 + + elseif gES_GlassCockpitType == 2 then + -- HawgTouch version 1.6 + + -- Gear Lamps + local lGearValue = lMechInfo.gear.value + local lGear1, lGear2, lGear3 = 0, 0, 0 + + if lGearValue > 0.85 then + lGear1 = 1 + end + if lGearValue > 0.9 then + lGear2 = 1 + end + if lGearValue == 1.0 then + lGear3 = 1 + end + SendData(26, string.format("%d;%d;%d", + lGear1, -- GEAR_N_SAFE + lGear2, -- GEAR_L_SAFE + lGear3)) -- GEAR_R_SAFE + -- Gear Lamps end + + -- Fuel Indicator + local lEngineFuelTotal = (lEngineFuelInternal + lEngineFuelExternal) * 2.2046223302272 -- kg to lbs + local lFuelNeedle = lEngineFuelTotal / 12000 -- 12000 = scala + lFuelNeedle = (lFuelNeedle > 1.0 and 1.0 or lFuelNeedle) + --lEngineFuelTotal = math.round(lEngineFuelTotal, 0, "floor") + --[[ + local lFuelCounter1 = 0 + local lFuelCounter2 = 0 + local lFuelCounter3 = 0 + if lEngineFuelInternal > 100 then + lFuelCounter1 = math.round((lEngineFuelInternal / 100), 0, "floor") * 0.11 + lFuelCounter1 = lFuelCounter1 - math.round(lFuelCounter1, 0, "floor") + end + if lEngineFuelInternal > 10 then + if lEngineFuelInternal > 100 then + lFuelCounter2 = (math.round((lEngineFuelInternal - (math.round(lEngineFuelInternal / 100, 0, "floor") * 100)), 0, "floor") / 10) * 0.11 + else + lFuelCounter2 = (lEngineFuelInternal / 10) * 0.11 + lFuelCounter2 = lFuelCounter2 - math.round(lFuelCounter2, 0, "floor") + end + end + if lEngineFuelInternal > 10 then + lFuelCounter3 = (lEngineFuelInternal - (math.round(lEngineFuelInternal / 10, 0, "floor") * 10)) * 0.11 + else + lFuelCounter3 = lEngineFuelInternal * 0.11 + end + ]] + local lFuelCounterLeft = 1200 + local lFuelCounterRight = 1500 + + if lEngineRPMleft > 0 then + if lEngineRPMright > 0 then + if lEngineFuelTotal < 2700 then + lFuelCounterLeft = lEngineFuelTotal * 0.44444444444444444444444444444444 + end + else + if lEngineFuelTotal < 1200 then + lFuelCounterLeft = lEngineFuelTotal + end + end + end + if lEngineRPMright > 0 then + if lEngineRPMleft > 0 then + if lEngineFuelTotal < 2700 then + lFuelCounterRight = lEngineFuelTotal * 0.55555555555555555555555555555556 + end + else + if lEngineFuelTotal < 1500 then + lFuelCounterRight = lEngineFuelTotal + end + end + end + + --lFuelCounterLeft = math.round(lFuelCounterLeft, 0, "floor") + --lFuelCounterRight = math.round(lFuelCounterRight, 0, "floor") + + SendData(27, string.format("%04d;%04d;%05d;%.4f", + lFuelCounterLeft, + lFuelCounterRight, + lEngineFuelTotal, + lFuelNeedle)) + -- Fuel Indicator end + end +end + +function ProcessHARDWAREConfigLowImportance(mainPanelDevice) +-- where necessary, specify HardwareID, example SightingSystem(2) + SightingSystem() + FuelQuantityIndicator() + StatusLamp() + MechanicalDevicesIndicator() + FlareChaff() + WeaponStatusPanel() + RWRlite() +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 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 + lEngineInfo.fuel_external) * 2.2) / 100), 0, "ceil") * 100), lHardware ) -- total fuel in lbs + --SendDataHW("301", string.format("%d", lEngineInfo.fuel_internal * 2.2), lHardware ) -- internal fuel in lbs + --SendDataHW("302", string.format("%d", lEngineInfo.fuel_external * 2.2), lHardware ) -- external fuel in lbs + + --[[ + local lPayloadInfo = LoGetPayloadInfo() + if lPayloadInfo == nil then + return + end + SendDataHW("303", ((lPayloadInfo.Stations[5].count > 0 and lPayloadInfo.Stations[5].CLSID == "Fuel_Tank_FT600") and 1 or 0), lHardware ) -- weapon presend > 0 (panel 5) + SendDataHW("304", ((lPayloadInfo.Stations[6].count > 0 and lPayloadInfo.Stations[6].CLSID == "Fuel_Tank_FT600") and 1 or 0), lHardware ) -- weapon presend > 0 (panel 6) + SendDataHW("305", ((lPayloadInfo.Stations[7].count > 0 and lPayloadInfo.Stations[7].CLSID == "Fuel_Tank_FT600") and 1 or 0), lHardware ) -- weapon presend > 0 (panel 7) + SendDataHW("307", (lEngineInfo.fuel_internal < 600.0 and 1 or 0), lHardware ) -- Bingo Fuel + ]] +end + +function StatusLamp(hardware) + local lHardware = hardware or 1 + local lMCPState = LoGetMCPState() -- Warning Lights + + --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" + ]] + + if lMCPState ~= nil then + 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 ) + end + + local lEngineInfo = LoGetEngineInfo() + if lEngineInfo ~= nil then + --WriteToLog('lEngineInfo: '..dump(lEngineInfo)) + + SendDataHW("728", lEngineInfo.EngineStart.left, lHardware ) -- lamp start left engine 1 (0|1) + SendDataHW("729", lEngineInfo.EngineStart.right, lHardware ) -- lamp start right engine 1 (0|1) + + SendDataHW("730", lEngineInfo.RPM.left < 45 and 1 or 0, lHardware ) -- lamp generator left engine 1 (0|1) + SendDataHW("731", lEngineInfo.RPM.right < 45 and 1 or 0, lHardware ) -- lamp generator right engine 1 (0|1) + end +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: "30" + --[flare] = number: "30" + + SendDataHW("800", lSnares.chaff, lHardware ) + SendDataHW("801", lSnares.flare, lHardware ) +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 + WriteToLog('lMechInfo nil') + return + end + --[[ + [hook] = { + [status] = number: "0" + [value] = number: "0" + } + [parachute] = { + [status] = number: "0" + [value] = number: "0" + } + [controlsurfaces] = { + [eleron] = { + [left] = number: "0" + [right] = number: "-0.21084336936474" + } + [elevator] = { + [left] = number: "-0" + [right] = number: "-0" + } + [rudder] = { + [left] = number: "0" + [right] = number: "0" + } + } + [airintake] = { + [status] = number: "0" + [value] = number: "0" + } + [canopy] = { + [status] = number: "0" + [value] = number: "0" + } + [refuelingboom] = { + [status] = number: "0" + [value] = number: "0" + } + [wing] = { + [status] = number: "0" + [value] = number: "0" + } + [noseflap] = { + [status] = number: "0" + [value] = number: "0" + } + [gear] = { + [value] = number: "0" + [nose] = { + [rod] = number: "0" + } + [main] = { + [left] = { + [rod] = number: "0" + } + [right] = { + [rod] = number: "0" + } + } + [status] = number: "0" + } + [speedbrakes] = { + [status] = number: "0" + [value] = number: "0" + } + [wheelbrakes] = { + [status] = number: "0" + [value] = number: "0" + } + [flaps] = { + [status] = number: "0" + [value] = number: "0" + }]] + --SendDataHW("500", lMechInfo.gear.status ) + --SendDataHW("501", lMechInfo.gear.value ) + --SendDataHW("502", lMechInfo.gear.nose.rod ) -- zeigt an wie weit das Fahrwerk einsackt wenn das Flugzeug auf dem Boden ist + --SendDataHW("503", lMechInfo.gear.main.left.rod ) -- zeigt an wie weit das Fahrwerk einsackt wenn das Flugzeug auf dem Boden ist + --SendDataHW("504", lMechInfo.gear.main.right.rod ) -- zeigt an wie weit das Fahrwerk einsackt wenn das Flugzeug auf dem Boden ist + --SendDataHW("500", ((lMechInfo.gear.status == 1 and lMechInfo.gear.value < 1) and 1 or 0 ) ) -- gear warning light, go up + --SendDataHW("500", ((lMechInfo.gear.status == 0 and lMechInfo.gear.value > 0) and 1 or 0 ) ) -- gear warning light, go down + --SendDataHW("500", (((lMechInfo.gear.status == 1 and lMechInfo.gear.value < 1) or (lMechInfo.gear.status == 0 and lMechInfo.gear.value > 0)) and 1 or 0 ), lHardware ) -- gear warning light + SendDataHW("501", (lMechInfo.gear.value > 0.85 and 1 or 0), lHardware ) -- nose gear + SendDataHW("502", (lMechInfo.gear.value > 0.95 and 1 or 0), lHardware ) -- left gear + SendDataHW("503", (lMechInfo.gear.value == 1 and 1 or 0), lHardware ) -- right gear + + --SendDataHW("510", lMechInfo.speedbrakes.status ) -- speedbreakes on 1 (0|1) + SendDataHW("510", (lMechInfo.speedbrakes.value > 0.1 and 1 or 0), lHardware ) -- speedbreakes on > 0.1 (0 - 1) + + --SendDataHW("520", lMechInfo.wheelbrakes.status ) -- not in use + --SendDataHW("521", lMechInfo.wheelbrakes.value ) -- not in use + + local lGetTrueAirSpeed = LoGetTrueAirSpeed() + if lGetTrueAirSpeed == nil then + lGetTrueAirSpeed = 0 + end + --SendDataHW("530", lMechInfo.flaps.status ) -- flap switch off 0, 1. position 1, 2. position 2 (0|1|2) + --SendDataHW("531", lMechInfo.flaps.value ) -- flap 1. position > 0.25, 2. position > 0.93 (0 - 1) + SendDataHW("531", (lMechInfo.flaps.value > 0.25 and 1 or 0), lHardware ) -- flap 1. position + SendDataHW("532", (lMechInfo.flaps.value > 0.93 and 1 or 0), lHardware ) -- flap 2. position + SendDataHW("533", ((lMechInfo.flaps.value > 0.93 and lGetTrueAirSpeed > 340) and 1 or 0), lHardware ) -- Speed Warning for Flaps, same light as gear warning light, but blinking light +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: "{6D21ECEA-F85B-4E8D-9D51-31DC9B8AA4EF}" + [container] = boolean: "false" + [count] = number: "1" + [weapon] = { + [level3] = number: "45" + [level1] = number: "4" + [level4] = number: "25" + [level2] = number: "15" + } + } + [2] = { + [wstype] = { + [level3] = number: "32" + [level1] = number: "4" + [level4] = number: "117" + [level2] = number: "7" + } + [count] = number: "7" + [CLSID] = string: "{69926055-0DA8-4530-9F2F-C86B157EA9F6}" + [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: "147" + [level2] = number: "7" + } + } + [3] = { + [wstype] = { + [level3] = number: "32" + [level1] = number: "4" + [level4] = number: "135" + [level2] = number: "4" + } + [count] = number: "2" + [CLSID] = string: "LAU_88_AGM_65H_2_L" + [adapter] = { + [level3] = number: "47" + [level1] = number: "4" + [level4] = number: "4" + [level2] = number: "15" + } + [container] = boolean: "true" + [weapon] = { + [level3] = number: "8" + [level1] = number: "4" + [level4] = number: "138" + [level2] = number: "4" + } + } + [4] = { + [wstype] = { + [level3] = number: "32" + [level1] = number: "4" + [level4] = number: "114" + [level2] = number: "5" + } + [count] = number: "3" + [CLSID] = string: "BRU-42_3*BDU-33" + [adapter] = { + [level3] = number: "0" + [level1] = number: "0" + [level4] = number: "0" + [level2] = number: "0" + } + [container] = boolean: "true" + [weapon] = { + [level3] = number: "9" + [level1] = number: "4" + [level4] = number: "69" + [level2] = number: "5" + } + } + [5] = { + [CLSID] = string: "{5335D97A-35A5-4643-9D9B-026C75961E52}" + [container] = boolean: "false" + [count] = number: "1" + [weapon] = { + [level3] = number: "38" + [level1] = number: "4" + [level4] = number: "35" + [level2] = number: "5" + } + } + [6] = { + [CLSID] = string: "Fuel_Tank_FT600" + [container] = boolean: "false" + [count] = number: "1" + [weapon] = { + [level3] = number: "43" + [level1] = number: "1" + [level4] = number: "103" + [level2] = number: "3" + } + } + [7] = { + [CLSID] = string: "{5335D97A-35A5-4643-9D9B-026C75961E52}" + [container] = boolean: "false" + [count] = number: "1" + [weapon] = { + [level3] = number: "38" + [level1] = number: "4" + [level4] = number: "35" + [level2] = number: "5" + } + } + [8] = { + [wstype] = { + [level3] = number: "32" + [level1] = number: "4" + [level4] = number: "114" + [level2] = number: "5" + } + [count] = number: "3" + [CLSID] = string: "BRU-42_3*BDU-33" + [adapter] = { + [level3] = number: "0" + [level1] = number: "0" + [level4] = number: "0" + [level2] = number: "0" + } + [container] = boolean: "true" + [weapon] = { + [level3] = number: "9" + [level1] = number: "4" + [level4] = number: "69" + [level2] = number: "5" + } + } + [9] = { + [wstype] = { + [level3] = number: "32" + [level1] = number: "4" + [level4] = number: "106" + [level2] = number: "4" + } + [count] = number: "2" + [CLSID] = string: "{E6A6262A-CA08-4B3D-B030-E1A993B98453}" + [adapter] = { + [level3] = number: "47" + [level1] = number: "4" + [level4] = number: "4" + [level2] = number: "15" + } + [container] = boolean: "true" + [weapon] = { + [level3] = number: "8" + [level1] = number: "4" + [level4] = number: "77" + [level2] = number: "4" + } + } + [10] = { + [wstype] = { + [level3] = number: "32" + [level1] = number: "4" + [level4] = number: "117" + [level2] = number: "7" + } + [count] = number: "7" + [CLSID] = string: "{69926055-0DA8-4530-9F2F-C86B157EA9F6}" + [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: "147" + [level2] = number: "7" + } + } + [11] = { + [wstype] = { + [level3] = number: "32" + [level1] = number: "4" + [level4] = number: "50" + [level2] = number: "4" + } + [count] = number: "2" + [CLSID] = string: "{DB434044-F5D0-4F1F-9BA9-B73027E18DD3}" + [adapter] = { + [level3] = number: "0" + [level1] = number: "0" + [level4] = number: "0" + [level2] = number: "0" + } + [container] = boolean: "true" + [weapon] = { + [level3] = number: "7" + [level1] = number: "4" + [level4] = number: "22" + [level2] = number: "4" + } + } + } + [CurrentStation] = number: "0" + [Cannon] = { + [shells] = number: "1150" + } + ]] + --[[ + Weapon Panel + | + --------------------------------------------------- + | | | | | | | | | | | + 1 2 3 4 5 6 7 8 9 10 11 + ]] + -- Payload Info + -- weapon stations (panel) 1 (left) - 11 (right) reserved + SendDataHW("100", gES_PayloadInfo.Cannon.shells, lHardware ) -- count cannon shells + SendDataHW("101", (gES_PayloadInfo.Stations[1].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 1) + SendDataHW("102", (gES_PayloadInfo.Stations[2].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 2) + SendDataHW("103", (gES_PayloadInfo.Stations[3].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 3) + SendDataHW("104", (gES_PayloadInfo.Stations[4].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 4) + SendDataHW("105", (gES_PayloadInfo.Stations[5].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 5) + SendDataHW("106", (gES_PayloadInfo.Stations[6].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 6, center station) + SendDataHW("107", (gES_PayloadInfo.Stations[7].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 7) + SendDataHW("108", (gES_PayloadInfo.Stations[8].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 8) + SendDataHW("109", (gES_PayloadInfo.Stations[9].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 9) + SendDataHW("110", (gES_PayloadInfo.Stations[10].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 10) + SendDataHW("111", (gES_PayloadInfo.Stations[11].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 11) + -- weapon stations (panel) 1 (left) - 11 (right) empty + SendDataHW("121", (gES_PayloadInfo.Stations[1].count == 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 1) + SendDataHW("122", (gES_PayloadInfo.Stations[2].count == 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 2) + SendDataHW("123", (gES_PayloadInfo.Stations[3].count == 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 3) + SendDataHW("124", (gES_PayloadInfo.Stations[4].count == 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 4) + SendDataHW("125", (gES_PayloadInfo.Stations[5].count == 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 5) + SendDataHW("126", (gES_PayloadInfo.Stations[6].count == 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 6, center station) + SendDataHW("127", (gES_PayloadInfo.Stations[7].count == 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 7) + SendDataHW("128", (gES_PayloadInfo.Stations[8].count == 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 8) + SendDataHW("129", (gES_PayloadInfo.Stations[9].count == 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 9) + SendDataHW("130", (gES_PayloadInfo.Stations[10].count == 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 10) + SendDataHW("131", (gES_PayloadInfo.Stations[11].count == 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 11) + --SendDataHW("CurrentStation", gES_PayloadInfo.CurrentStation, lHardware ) + -- air-to-air missils panel 1 and 11, air combat modus, CurrentStation = 1, panel 1 and 11 on + -- wenn die Waffenstationen gleichmässig belegt sind, hat bei Auswahl CurrentStation immer den Wert der linken Station + -- bei ungleichmäßiger Belegung, hat CurrentStation immer den Wert der jeweiligen Station + -- Waffenbezeichnung als UUID, gES_PayloadInfo.Stations[X].CLSID + + -- defination + if gES_CurrentStationTmp == nil then + gES_CurrentStationTmp = -1 + end + + if gES_PayloadInfo.CurrentStation > 0 and + gES_CurrentStationTmp ~= gES_PayloadInfo.CurrentStation then + gES_CurrentStationTmp = gES_PayloadInfo.CurrentStation + + gTmpStationToPanel = {} + gTmpStationToPanel[1] = {Panel = 1, StationID = 101, CurrentID = 201, CurrentID2 = 221, HardwareID = lHardware } -- left + gTmpStationToPanel[2] = {Panel = 2, StationID = 102, CurrentID = 202, CurrentID2 = 222, HardwareID = lHardware } + gTmpStationToPanel[3] = {Panel = 3, StationID = 103, CurrentID = 203, CurrentID2 = 223, HardwareID = lHardware } + gTmpStationToPanel[4] = {Panel = 4, StationID = 104, CurrentID = 204, CurrentID2 = 224, HardwareID = lHardware } + gTmpStationToPanel[5] = {Panel = 5, StationID = 105, CurrentID = 205, CurrentID2 = 225, HardwareID = lHardware } + gTmpStationToPanel[6] = {Panel = 6, StationID = 106, CurrentID = 206, CurrentID2 = 226, HardwareID = lHardware } + gTmpStationToPanel[7] = {Panel = 7, StationID = 107, CurrentID = 207, CurrentID2 = 227, HardwareID = lHardware } + gTmpStationToPanel[8] = {Panel = 8, StationID = 108, CurrentID = 208, CurrentID2 = 228, HardwareID = lHardware } + gTmpStationToPanel[9] = {Panel = 9, StationID = 109, CurrentID = 209, CurrentID2 = 229, HardwareID = lHardware } + gTmpStationToPanel[10] = {Panel = 10, StationID = 110, CurrentID = 210, CurrentID2 = 230, HardwareID = lHardware } + gTmpStationToPanel[11] = {Panel = 11, StationID = 111, CurrentID = 211, CurrentID2 = 231, HardwareID = lHardware } -- right + + WeaponStatusPanel_Reset(201, 211, lHardware) + WeaponStatusPanel_Reset(221, 231, lHardware) + + SendDataHW(gTmpStationToPanel[gES_PayloadInfo.CurrentStation].CurrentID, 1, lHardware) -- eigentliche Auswahl + --WriteToLog('aktiv: '..gTmpStationToPanel[gES_PayloadInfo.CurrentStation].CurrentID) + if gES_PayloadInfo.Stations[gES_PayloadInfo.CurrentStation].container then + if gES_PayloadInfo.Stations[gES_PayloadInfo.CurrentStation].count > 1 then + SendDataHW(gTmpStationToPanel[gES_PayloadInfo.CurrentStation].CurrentID2, 1, lHardware) -- eigentliche Auswahl + --WriteToLog('aktiv2: '..gTmpStationToPanel[gES_PayloadInfo.CurrentStation].CurrentID2) + end + end + table.foreach(gES_PayloadInfo.Stations, WeaponStatusPanel_selectCurrentPayloadStation) -- zugehörige Stationen + elseif gES_PayloadInfo.CurrentStation == 0 and gES_CurrentStationTmp > 0 then + WeaponStatusPanel_Reset(201, 211, lHardware) + WeaponStatusPanel_Reset(221, 231, lHardware) + gES_CurrentStationTmp = -1 + end +end + +function RWRlite(hardware) + local lHardware = hardware or 1 + local lTWSInfo = LoGetTWSInfo() -- RWR Information + if lTWSInfo == nil then + return + end + + local lPriorityTmp = 0 + local lPrimaryThreatTmp = 0 + + if(#lTWSInfo.Emitters > 0) then + for EmitterIndex = 1, #lTWSInfo.Emitters, 1 do + if(lTWSInfo.Emitters[EmitterIndex].Priority > lPriorityTmp) then + lPriorityTmp = lTWSInfo.Emitters[EmitterIndex].Priority + lPrimaryThreatTmp = EmitterIndex + end + end + + for EmitterIndex = 1, #lTWSInfo.Emitters, 1 do + local lType = lTWSInfo.Emitters[EmitterIndex].Type + --WriteToLog('level: '..lType.level1..', '..lType.level2..', '..lType.level3..', '..lType.level4) + + local lAzimut = math.round(lTWSInfo.Emitters[EmitterIndex].Azimuth * 90, 1) + + if EmitterIndex == lPrimaryThreatTmp then + gES_RWRlite_FoundErmitter = true + + SendDataHW("400", (lType.level1 == 1 and 1 or 0), lHardware ) -- primary Air + + SendDataHW("401", ((lType.level1 == 2 and lType.level2 == 16) and 1 or 0), lHardware ) -- primary SAM + end + end + else + if gES_RWRlite_FoundErmitter ~= nil and gES_RWRlite_FoundErmitter then + SendDataHW("400", 0, lHardware ) -- primary Air + + SendDataHW("401", 0, lHardware ) -- primary SAM + end + end +end + +-- Helper functions + +function WeaponStatusPanel_selectCurrentPayloadStation(_index) + if gES_PayloadInfo.Stations[gES_PayloadInfo.CurrentStation].CLSID == gES_PayloadInfo.Stations[_index].CLSID and gES_PayloadInfo.CurrentStation ~= _index then + SendDataHW(gTmpStationToPanel[_index].CurrentID, 1, gTmpStationToPanel[_index].HardwareID) + --WriteToLog('aktiv3: '..gTmpStationToPanel[_index].CurrentID) + if gES_PayloadInfo.Stations[gES_PayloadInfo.CurrentStation].container then + if gES_PayloadInfo.Stations[gES_PayloadInfo.CurrentStation].count > 1 then + SendDataHW(gTmpStationToPanel[_index].CurrentID2, 1, gTmpStationToPanel[_index].HardwareID) + --WriteToLog('aktiv3: '..gTmpStationToPanel[_index].CurrentID2) + end + end + end +end + +function WeaponStatusPanel_Reset(lMinId, lMaxID, lHardware) +--WriteToLog('WeaponStatusPanel_Reset') + for lCounter = lMinId, lMaxID, 1 do + SendDataHW(lCounter, 0, lHardware) + end +end \ No newline at end of file diff --git a/ExportsModules/F-86F Sabre.lua b/ExportsModules/F-86F Sabre.lua new file mode 100644 index 0000000..ba0f651 --- /dev/null +++ b/ExportsModules/F-86F Sabre.lua @@ -0,0 +1,440 @@ +-- F-86 Export +-- Version 0.9.9 BETA + +gES_FoundDCSModule = true + +gES_GlassCockpitConfigEveryFrameArguments = +{ + -- Mechanic clock + [19] = "%.4f", -- CLOCK_currtime_hours {0.0, 12.0} = {0.0, 1.0} + [18] = "%.4f", -- CLOCK_currtime_minutes {0.0, 60.0} = {0.0, 1.0} + --[37] = "%.4f", -- CLOCK_currtime_seconds {0.0, 60.0} = {0.0, 1.0} + --[56] = "%.4f", -- CLOCK_flight_time_meter_status {0.0, 0.2} = {0.0, 1.0} + --[52] = "%.4f", -- CLOCK_flight_hours {0.0, 12.0} = {0.0, 1.0} + --[53] = "%.4f", -- CLOCK_flight_minutes {0.0, 60.0} = {0.0, 1.0} + [37] = "%.4f", -- CLOCK_seconds_meter_time_minutes {0.0, 60.0} = {0.0, 1.0} + [1006] = "%.4f", -- CLOCK_seconds_meter_time_seconds {0.0, 60.0} = {0.0, 1.0} + -- flight gauge + -- Airspeeed + [178] = "%.4f", -- Airspeeed {0.0, 25.7, 180.06, 334.4} = {0.0, 0.019, 0.494, 0.965} + [709] = "%.4f", -- AirspeeedDrum {0.0, 51.4444444} = {0.0, 1.0} + [8] = "%.4f", -- AirspeeedM1 {0.0, 25.7, 51.444, 308.67, 334.4} = {0.0, 0.02, 0.1, 0.6, 0.697} + -- Altimeter + [707] = "%.4f", -- Altimeter10000 {0 ,30480} = {0 ,1} + [523] = "%.4f", -- Altimeter1000 {0 ,3048} = {0 ,1} + [524] = "%.4f", -- Altimeter100 {0 ,304.8} = {0 ,1} + [700] = "%.4f", -- AltimeterHG {0 , 91.44} = {0 ,1} + -- Variometer + [24] = "%.4f", -- Variometer {-30.48, -10.16, -5.08, 0.0, 5.08, 10.16, 30.48} = {-1.0, -0.5, -0.29, 0.0, 0.29, 0.5, 1.0} + -- MachNumber + [179] = "%.4f", -- MachNumber {0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5} = {0.0515, 0.0855, 0.122, 0.161, 0.203, 0.248, 0.295, 0.342, 0.3915, 0.441, 0.493, 0.597, 0.699, 0.796, 0.883, 0.965} + -- TurnIndicator + [25] = "%.4f", -- TurnIndicator {-1.0, 1.0} + -- SlipIndicator + [31] = "%.4f", -- SlipIndicator {-1.0, 1.0} + -- Accelerometer + [6] = "%.4f", -- Accelerometer {-5, 0, 10} = {-0.5, 0, 1.0} + [1003] = "%.4f", -- AccelerometerMin {-5.0, 0.0} = {-0.5, 0.0} + [1002] = "%.4f", -- AccelerometerMax {0.0, 10} = {0.0, 1.0} + -- GyroCompass + [711] = "%.4f", -- GyroCompassNeedle {1.0, 0.0} + [712] = "%.4f", -- GyroCompassScale {0.0, 1.0} + -- AttitudeIndicator + [713] = "%.4f", -- AttitudeIndicatorOffFlag {0.0, 1.0} = {1.0, 0.0} + [605] = "%.4f", -- AttitudeIndicatorPitch {-0.27, 0.27} + [606] = "%.4f", -- AttitudeIndicatorBank {1.0, -1.0} + [81] = "%.4f", -- AttitudeIndicatorPitchSphere {-1.0, 1.0} + [1005] = "%.4f", -- AttitudeIndicatorBankNeedle {1.0, -1.0} + -- engine gauges + -- Tachometer + [16] = "%.4f", -- Tachometer {0.0, 0.5, 0.504, 1.1} = {0.012, 0.482, 0.5, 1.0} + -- ExhaustTemperature + [12] = "%.4f", -- ExhaustTemperature {0.0, 1000.0} = {0.0, 1.0} + -- OilPressure + [112] = "%.4f", -- OilPressure {0.0, 100.0} = {0.023, 1.0} + -- FuelFlow + [531] = "%.4f", -- FuelFlow {0.0, 1.2599} = {0.0, 1.0} + -- electric system + [601] = "%.4f", -- VoltageDC {0.0, 30.0} = {0.0, 0.3} + [602] = "%.4f", -- Loadmeter {0.0, 400.0} = {0.0, 1.0} + -- hydraulic system + [109] = "%.4f", -- HydPress {0.0, 1.0} = {0.0, 1.0} + -- fuel system + [22] = "%.4f", -- FuelQuantity {-500.0, 0.0, 45.36, 226.8, 453.6, 907.2, 1360.8, 1451.5} = {-1.0, 0.0, 0.012, 0.141, 0.31, 0.625, 0.938, 1.0} + -- oxygen system + [353] = "%.4f", -- OxygenPressure {0.0, 500.0} = {0, 1} + [705] = "%.1f", -- OxygenFlowBlinker {0.0, 1.0} + -- air system + [114] = "%.4f", -- CockpitAltimeter {0.0, 15240.0} = {0.0, 1.0} + -- radio compass + [804] = "%.4f", -- ARN6_Band {0.0, 3.0} = {0.0, 1.0} + [800] = "%.4f", -- ARN6_TuningMeter {0.0, 1.0} + [801] = "%.4f", -- ARN6_Tuning {0.0, 0.2} = {0.0, 1.0} + [600] = "%.4f", -- ARN6_Bearing {0.0, 1.0} + [814] = "%.4f", -- ARN6_Scale {1.0, 0.0} + [830] = "%.4f", -- ARN6_FreqScale {0.0, 1.0} + -- light system + [182] = "%.4f", -- IlluminationLights {0.0, 1.0} + [825] = "%.4f", -- StandByCompassLight {0.0, 1.0} + [180] = "%.4f", -- PrimaryInstLights {0.0, 1.0} + [185] = "%.4f", -- AuxiliaryInstrumentLights {0.0, 1.0} + [603] = "%.4f", -- LABS_roll_needle {-1.0, 1.0} + [604] = "%.4f", -- LABS_pitch_needle {-1.0, 1.0} + -- LAMPS + -- electric system + [617] = "%.1f", -- lamp_ELEC_GenOff {-1.0, 1.0} + [610] = "%.1f", -- lamp_ELEC_MainInstInverterOffSelectAlt {-1.0, 1.0} + [611] = "%.1f", -- lamp_ELEC_BothInstInvertersOff {-1.0, 1.0} + [612] = "%.1f", -- lamp_ELEC_MainRadarInverterOff {-1.0, 1.0} + -- hydraulic system + [614] = "%.1f", -- lamp_HYDRO_AltFltContSysOper {-1.0, 1.0} + [39] = "%.1f", -- lamp_HYDRO_LeftGear {-1.0, 1.0} + [41] = "%.1f", -- lamp_HYDRO_RightGear {-1.0, 1.0} + [40] = "%.1f", -- lamp_HYDRO_NoseGear {-1.0, 1.0} + -- fuel system + [625] = "%.1f", -- lamp_FUEL_OutbdTanksEmpty {-1.0, 1.0} + -- fire detection system + [615] = "%.1f", -- lamp_FIRE_DETECTION_FwdFireWarning {-1.0, 1.0} + [616] = "%.1f", -- lamp_FIRE_DETECTION_AftFireWarning {-1.0, 1.0} + -- control system + [613] = "%.1f" -- lamp_CONTROL_TakeOffPosInd {-1.0, 1.0} +} + +gES_GlassCockpitConfigArguments = +{ + -- cockpit mechanics + [718] = "%.1f", -- Canopy Switch, OPEN/OFF/CLOSE {-1.0, 1.0} + [818] = "%.1f", -- Emergency Jettison Handle, IN/OUT {0.0, 1.0} + [817] = "%.1f", -- Canopy Alternate Emergency Jettison Handle, IN/OUT {0.0, 1.0} + [816] = "%.1f", -- Canopy Declutch Handle, IN/OUT {0.0, 1.0} + -- electric + [653] = "%1d", -- Battery-Starter Switch, BATTERY/OFF/STARTER {-1, 1} + [643] = "%.1f", -- Instrument Power Switch, ALTERNATE/NORMAL {-1.0, 1.0} + [664] = "%.1f", -- Stop-Starter Button (Push to de-energize starter in case of malfunction) {0.0, 1.0} + [652] = "%1d", -- Engine Master Switch, ON/OFF {1} + [670] = "%.1f", -- Generator Switch, ON/OFF/RESET {1} + [687] = "%1d", -- Generator Warning Light (Push To Test) {1} + [680] = "%1d", -- Main Instrument (Three-phase) Inverter Failure Warning Light (Push to test) {1} + [681] = "%1d", -- Both Instrument (Main and alternate three-phase) Inverter Failure Warning Light (Push to test) {1} + [682] = "%1d", -- Main Radar (Single-phase) Inverter Failure Warning Light (Push to test) {1} + -- Circuit Breaker (left panel) + [760] = "%1d", -- Bomb Rocket Tank Salvo {0, 1} + [761] = "%1d", -- Bomb Sel. {0, 1} + [762] = "%1d", -- Gyr'Syn Compass {0, 1} + [763] = "%1d", -- 3f Inverter {0, 1} + [764] = "%1d", -- Turn Bank Ind. {0, 1} + [765] = "%1d", -- Rudder Trim & Take-Off Ind. {0, 1} + [766] = "%1d", -- Alt Ail. Trim {0, 1} + [767] = "%1d", -- Ail & Horiz. Trim & Alt Horiz. Trim {0, 1} + [768] = "%1d", -- LDG Light Control {0, 1} + [769] = "%1d", -- LDG Lights {0, 1} + [770] = "%1d", -- Fire Warn. {0, 1} + [771] = "%1d", -- Bus Tie-In Control {0, 1} + [772] = "%1d", -- Speed Brake {0, 1} + [773] = "%1d", -- Free Air & Oil Temp & Air Sel. {0, 1} + [774] = "%1d", -- LDG Gear Warn. {0, 1} + [775] = "%1d", -- LDG Gear Control {0, 1} + [776] = "%1d", -- LDG Gear Pos Ind. {0, 1} + [777] = "%1d", -- Fuel Booster AFT {0, 1} + [778] = "%1d", -- Alt Emerg. Hyd. Cont. & Hyd. Press Ind. {0, 1} + [779] = "%1d", -- Sight Power {0, 1} + [780] = "%1d", -- Sight Heater {0, 1} + [781] = "%1d", -- Sight A.C. Power Unit {0, 1} + [782] = "%1d", -- AN/ARN-6 Radio Compass {0, 1} + -- Circuit Breaker (right panel) + [783] = "%1d", -- Eng. Master Fuel Shut-Off {0, 1} + [784] = "%1d", -- Eng. Ign. {0, 1} + [785] = "%1d", -- Fuel Level {0, 1} + [786] = "%1d", -- Inv Gen. Failure Overvolt LTS Test {0, 1} + [787] = "%1d", -- Light Post IndCode {0, 1} + [788] = "%1d", -- Console & Ped LTS {0, 1} + [789] = "%1d", -- Fuel Boost FWD {0, 1} + [790] = "%1d", -- Wing Flap LH. {0, 1} + [791] = "%1d", -- Wing Flap RH. {0, 1} + [792] = "%1d", -- Light Fluor {0, 1} + [793] = "%1d", -- Sight Control {0, 1} + [794] = "%1d", -- AN/APC 3 Radio {0, 1} + [795] = "%1d", -- AN/APX-6 Radio IFF {0, 1} + -- Hydraulic Interface + [599] = "%1d", -- Landing Gear Handle, UP/DOWN {1, 0} + [710] = "%1d", -- Landing Gear Emergency-up Button (Ground-use only! Hold in until gear retracts completely) {1} + [631] = "%1d", -- Hydraulic Pressure Gage and Selector Switch, UTILITY/NORMAL/ALTERNATE {1} + [641] = "%1d", -- Speed Brake Emergency Lever {1, 0} + [684] = "%1d", -- Alternate-on Warning Light (Push to test) {1} + [706] = "%1d", -- Alternate Hydraulic Emergency Override Handle, IN/OUT {1, -1} + [647] = "%1d", -- Flight Control Switch, ALTERNATE ON/NORMAL/RESET {1} + [815] = "%1d", -- Landing Gear Warning Horn Cutout Button (Push to silence horn) {1} + -- Fuel Interface + [672] = "%1d", -- Fuel Densitometer Selection Switch, IN/OUT {2, -2} + [662] = "%.1f", -- Drop Tank Selector Switch {-0.1, 0.1} + [701] = "%1d", -- Drop Tank Jettison Button - Push to release drop tank(s) {1} + [695] = "%1d", -- Outboard Drop Tank Empty Indicator Light (Push to test) {1} + -- Oxygen Interface + [703] = "%1d", -- Oxygen Regulator Diluter Lever, NORMAL OXYGEN/100% OXYGEN {1, -1} + [704] = "%.4f", -- Oxygen Regulator Supply Lever (rotary) {0.0 to 1.0} in -0.5 steps + -- Fire Detection Interface + [635] = "%1d", -- Engine Fire Detector System Test Button {1,- 1} + [685] = "%1d", -- Forward Engine Compartment Fire-warning Light (Push to test) {1} + [686] = "%1d", -- Aft Engine Compartment Fire-warning Light (Push to test) {1} + -- Air Interface + [650] = "%1d", -- Cockpit Pressure Control Switch, PRESS/RAM {2, -2} + [651] = "%1d", -- Cockpit Pressure Schedule Selector Switch, 5 PSI/2.75 PSI {2, -2} + [646] = "%1d", -- Pitot Heater Switch, ON/OFF {2, -2} + [740] = "%.4f", -- Cockpit Air Temperature Control Rheostat (rotary) {0.0, 1.0} in 0.3 steps + --[736] = "%1d", -- Cockpit Air Temperature Control Switch Cover {1, -1} + [737] = "%.1f", -- Cockpit Air Temperature Control Switch, AUTO/OFF/HOT/COLD {-1.0, 1.0} + [645] = "%.1f", -- Engine Anti-Ice & Screen Switch, EXTEND/RET./ANTI-ICE {-1.0, 1.0} + [741] = "%1d", -- Air Outlet Selector Lever, FLOOR/BOTH/DEFROST {-1, 1} + -- Light Interface + [654] = "%1d", -- Compass Light Switch, ON/OFF {2, -2} + [813] = "%.1f", -- Instrument Panel Primary Light Rheostat (rotary) {0.0, 1.0} in 0.5 steps + [811] = "%.1f", -- Instrument Panel Auxiliary Light Rheostat (rotary) {0.0, 1.0} in 0.5 steps + [812] = "%.1f", -- Console and Panel Light Rheostat (rotary) {0.0, 1.0} in 0.5 steps + -- Nav Lights Interface + [661] = "%.1f", -- Landing & Taxi Lights Switch, EXTEND&ON/OFF/RETRACT {-1.0, 0.0, 1.0} + [656] = "%.1f", -- Position and Fuselage Light Selector Switch, STEADY/OFF/FLASH {-1.0, 0.0, 1.0} + [655] = "%1d", -- Exterior Lighting Dimmer Switch, BRIGHT/DIM {2, -2} + -- Engine Interface + [630] = "%1d", -- Emergency Fuel Switch, ON/OFF {2, -2} + --[732] = "%1d", -- Emergency (In-air) Ignition Switch Cover {1, -1} + [733] = "%.1f", -- Emergency (In-air) Ignition Switch, ON/OFF {1.0, 1.0} + -- Control Interface + [649] = "%.1f", -- Lateral Alternate Trim Switch, NORMAL/OFF/LEFT/RIGHT {-0.1, 0.1} + [648] = "%.1f", -- Rudder Trim Switch, LEFT/OFF/RIGHT {-1.0, 1.0} + --[738] = "%1d", -- Longitudinal Alternate Trim Switch Cover {1, -1} + [739] = "%.1f", -- Longitudinal Alternate Trim Switch, NORMAL GRIP CONT/OFF/NOSE UP/NOSE DOWN {-0.1, 0.0, 0.1} + [683] = "%1d", -- Take-off (Trim) Position Indicator Light (Push to test) {1} + [735] = "%1d", -- Wing Flaps Handle {-1, 1} + -- radio ARC-27 + [806] = "%.4f", -- AN/ARC-27 UHF Audio Volume Knob (rotary) {0.1, 0.9} in 0.5 steps + [807] = "%.1f", -- AN/ARC-27 UHF Preset Channel Selector {0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8} + [805] = "%.1f", -- AN/ARC-27 UHF Power Switch, OFF/T/R/T/R + G REC/ADF {0.0, 0.1, 0.2, 0.3} + -- radio compass ARN-6 + [802] = "%.4f", -- AN/ARN-6 Audio Volume Control (rotary) {0.1, 0.9} in 0.5 steps + [803] = "%.1f", -- AN/ARN-6 Frequency Band Switch {0.0, 0.1, 0.2, 0.3} + [667] = "%.1f", -- AN/ARN-6 Function Selector Switch, OFF/COMP/ANT./LOOP/CONT. {0.0, 0.1, 0.2, 0.3} + [666] = "%.1f", -- AN/ARN-6 LOOP L-R Switch {-1.0, 0.0, 1.0} + --[null] = "%.4f", -- AN/ARN-6 Tuning Crank {0.0, 1.0} in 0.01 steps + [657] = "%.1f", -- AN/ARN-6 Scale Light Switch, HI/OFF/LO {-0.1, 0.0, 0.1} + [826] = "%.4f", -- AN/ARN-6 East/West Variation Knob (rotary) {0.0, 1.0} in 0.05 steps + -- IFF APX-6 + [810] = "%.1f", -- AN/APX-6 IFF Master Switch, EMERGENCY/NORM/LOW/STDBY/OFF {0.0, 0.1, 0.2, 0.3, 0.4} + [659] = "%.1f", -- AN/APX-6 IFF Mode 2 Switch, MODE 2/OUT/I/P {-0.1, 0.0, 0.1} + [660] = "%.1f", -- AN/APX-6 IFF Mode 3 Switch, MODE 3/OUT {0.0, 0.1} + --[808] = "%1d", -- AN/APX-6 IFF Destruct Switch Cover {1, -1} + [809] = "%1d", -- AN/APX-6 IFF Destruct Switch, OFF/ON {0, -1} + -- baro altimeter + --[null] = "%.4f", -- Altimeter reference pressure adjusting knob (rotary) {0.0, 1.0} in 0.1 steps + -- gyromag compass + --[null] = "%.4f", -- Compass Correction (rotary) {0.0, 1.0} in 0.05 steps + [598] = "%.1f", -- Directional Indicator Fast Slaving Switch {0.0, 1.0} + -- attitude indicator + [714] = "%.1f", -- Pull to Cage Knob {0.0, 1.0} + -- accelerometer + [1004] = "%.1f", -- Accelerometer Reset Knob {0.0, 1.0} + -- CLOCK + --[null] = "%1d", -- Set Clock Knob + [831] = "%1d", -- Elapsed Time Mechanism Button {0, 1} + -- A4 Gun Sight + [716] = "%.4f", -- A-4 Sight Wing Span Adjustment Knob (rotary) {0.0, 1.0} in 0.1 steps + [715] = "%.4f", -- A-4 Sight Radar Range Sweep Rheostat (rotary) {0.0, 1.0} in 0.1 steps + [734] = "%.4f", -- A-4 Sight Reticle Dimmer Control (rotary) {0, 0.74} in -0.2 steps + [755] = "%1d", -- A-4 Sight Mechanical Caging Lever, CAGE/UNCAGE {0, 1} + [755] = "%.4f", -- A-4 Sight Mechanical Caging Lever, CAGE/UNCAGE (rotary) {0.001, 0.999} + [642] = "%1d", -- A-4 Sight Filament Selector Switch, SECONDARY/PRIMARY {2, -2} + [721] = "%.1f", -- Variable Sight Selector Unit - Sight Function Selector Lever, ROCKET/GUN/BOMB {0.0, 0.1, 0.2} + [720] = "%1d", -- Variable Sight Selector Unit - Target Speed Switch, HI/LO {1, -1} + [722] = "%.4f", -- Variable Sight Selector Unit - Rocket Depression Angle Selector (rotary) {0.0, 1.0} in 0.6 steps + [727] = "%.4f", -- Bomb-Target Wind Control Knob (rotary) {0.0, 1.0} in 0.6 steps + -- weapon system + [639] = "", -- Demolition Bomb Release Selector Switch, AUTO RELEASE/MANUAL RELEASE {2,-2} + [641] = "%.1f", -- Demolition Bomb Arming Switch (Fuze Selection), ARM NOSE&TAIL/OFF/TAIL ONLY {-1.0, 0.0, 1.0} + [752] = "%.1f", -- Demolition Bomb Sequence Selector Switch, ALL/OFF/LEFT/RIGHT {0.0, 0.1, 0.2, 0.3, 0.4, 0.5} + [638] = "%.1f", -- Rocket Fuze (Arming) Switch, DELAY/OFF/INSTANT {-1.0, 0.0, 1.0} + [637] = "%1d", -- Rocket Jettison Switch, READY/OFF {2, -2} + --[750] = "%1d", -- Rocket Release Selector Switch Cover {1, -1} + [751] = "%.1f", -- Rocket Release Selector Switch, SINGLE/OFF/AUTO {-1.0, 0.0, 1.0} + [668] = "%.1f", -- Gun Selector Switch {-0.2, 0.2} + [665] = "%.1f", -- Gun-Missile Selector Switch, OFF/SIGHT CAMERA & RADAR/GUNS/MISSILE {0, 0.3} + [636] = "%1d", -- Gun Heater Switch, HEATER/OFF {2,- 2} + [663] = "%1d", -- Manual Pip Control Switch, BOMB/NORMAL {2, -2} + [796] = "%.1f", -- Manual Pip Control Change Calibrated Dials (Presets) {0.0, 0.3, 0.6, 0.9} + [797] = "%.4f", -- Manual Pip Control Knob (rotary) {0.0, 1.0} in 0.1 steps + [729] = "%.4f", -- A-4 Sight Bombing Altimeter Target Altitude Knob (rotary) {0.0, 1.0} in 0.015 steps + [731] = "%.4f", -- A-4 Sight Bombing Altimeter Index Altitude Handle (rotary) {0.0, 1.0} in -0.015 steps + [632] = "%1d", -- LABS Gyro Caging Switch, UNCAGE/CAGE {2,- 2} + [633] = "%1d", -- LABS Start Switch, ON/OFF {2, -2} + [634] = "%1d", -- LABS Change-over Switch, LABS/A-4 {2, -2} + [702] = "%1d", -- Bomb-Rocket-Tank Jettison Button {0.0, 1.0} + [820] = "%.1f", -- Missile Control Switch, LH & RH/RH/SALVO {-1.0, 0.0, 1.0} + [821] = "%.4f", -- Tone Volume (rotary) {0.0, 1.0} in 0.1 steps + [822] = "%.1f", -- Safe Launch Button {0.0, 1.0} + [1001] = "%.1f" -- Rocket Intervalometer {0.0, 1.0} +} + +----------------------------- +-- HIGH IMPORTANCE EXPORTS -- +-- done every export event -- +----------------------------- + +-- Pointed to by ProcessGlassCockpitDCSHighImportance +function ProcessGlassCockpitDCSConfigHighImportance(mainPanelDevice) + if gES_GlassCockpitType == 1 then + -- HELIOS Version 1.3 + elseif gES_GlassCockpitType == 2 then + -- HawgTouch version 1.6 + + -- ACC + -- Accelerometer; AccelerometerMin; AccelerometerMax; + SendData(2001, string.format("%0.4f;%0.4f;%0.4f", + mainPanelDevice:get_argument_value(6), + mainPanelDevice:get_argument_value(1003), + mainPanelDevice:get_argument_value(1002))) + -- ADI + -- AttitudeIndicatorPitch; AttitudeIndicatorBank; AttitudeIndicatorPitchSphere; AttitudeIndicatorBankNeedle; AttitudeIndicatorOffFlag + SendData(2002, string.format("%.4f;%.4f;%.4f;%.4f;%.1f", + mainPanelDevice:get_argument_value(605), + mainPanelDevice:get_argument_value(606), + mainPanelDevice:get_argument_value(81), + mainPanelDevice:get_argument_value(1005), + mainPanelDevice:get_argument_value(713))) + -- Altimeter + -- Altimeter10000; Altimeter1000; Altimeter100; AltimeterHG + SendData(2003, string.format("%0.4f;%0.4f;%0.4f;%0.4f", + mainPanelDevice:get_argument_value(707), + mainPanelDevice:get_argument_value(523), + mainPanelDevice:get_argument_value(524), + mainPanelDevice:get_argument_value(700))) + -- Airspeed + -- Airspeed; AirspeedDrum; AirspeedM1 + SendData(2004, string.format("%0.4f;%0.4f;%0.4f", + mainPanelDevice:get_argument_value(178), + mainPanelDevice:get_argument_value(709), + mainPanelDevice:get_argument_value(8))) + -- RMI + -- ARN6_Bearing; ARN6_Scale + SendData(2008, string.format("%0.4f;%0.4f", + mainPanelDevice:get_argument_value(600), + mainPanelDevice:get_argument_value(814))) + -- Clock + -- CLOCK_currtime_hours; CLOCK_currtime_minutes; CLOCK_currtime_seconds; CLOCK_seconds_meter_time_minutes; CLOCK_seconds_meter_time_seconds + -- CLOCK_currtime_hours; CLOCK_currtime_minutes; <= Beta + SendData(2005, string.format("%0.4f;%0.4f", + mainPanelDevice:get_argument_value(19), + mainPanelDevice:get_argument_value(18))) + -- GyroCompass + -- GyroCompassNeedle; GyroCompassScale + SendData(2006, string.format("%0.4f;%0.4f", + mainPanelDevice:get_argument_value(711), + mainPanelDevice:get_argument_value(712))) + -- Labs + -- LABS_roll_needle; LABS_pitch_needle + SendData(2007, string.format("%0.4f;%0.4f", + mainPanelDevice:get_argument_value(603), + mainPanelDevice:get_argument_value(604))) + -- RMI + -- ARN6_Bearing; ARN6_Scale + SendData(2008, string.format("%0.4f;%0.4f", + mainPanelDevice:get_argument_value(600), + mainPanelDevice:get_argument_value(814))) + -- Gear + -- Left; Right; Front + SendData(2010, string.format("%0.4f;%0.4f;%0.4f", + mainPanelDevice:get_argument_value(39), + mainPanelDevice:get_argument_value(41), + mainPanelDevice:get_argument_value(40))) + end +end + +function ProcessHARDWAREConfigHighImportance(mainPanelDevice) +-- Hier kommen alle Daten rein die ueber die Hardware in schneller folge ausgeben werden soll +-- In der Regel sind das die Statusanzeigen + +-- SendDataHW(), ist die Funktion zur Ausgabe der Werte an die Hardware +-- "178" ist die ID des Wertes die in der entsprechenden XML Datei festgelegt wird, sollte der DCS ID entsprechen +-- mainPanelDevice:get_argument_value() ist eine Funktion die die Werte der �bergeben DCS ID aus dem Spiel ausliest +-- 178 ist die DCS ID von dem man die Werte haben will +-- Description + + -- light system + SendDataHW("182", mainPanelDevice:get_argument_value(182)) -- IlluminationLights {0.0, 1.0} + SendDataHW("825", mainPanelDevice:get_argument_value(825)) -- StandByCompassLight {0.0, 1.0} + SendDataHW("180", mainPanelDevice:get_argument_value(180)) -- PrimaryInstLights {0.0, 1.0} + SendDataHW("185", mainPanelDevice:get_argument_value(185)) -- AuxiliaryInstrumentLights {0.0, 1.0} + -- LAMPS + -- electric system + SendDataHW("617", mainPanelDevice:get_argument_value(617)) -- lamp_ELEC_GenOff {-1.0, 1.0} + SendDataHW("610", mainPanelDevice:get_argument_value(610)) -- lamp_ELEC_MainInstInverterOffSelectAlt {-1.0, 1.0} + SendDataHW("611", mainPanelDevice:get_argument_value(611)) -- lamp_ELEC_BothInstInvertersOff {-1.0, 1.0} + SendDataHW("612", mainPanelDevice:get_argument_value(612)) -- lamp_ELEC_MainRadarInverterOff {-1.0, 1.0} + -- hydraulic system + SendDataHW("614", mainPanelDevice:get_argument_value(614)) -- lamp_HYDRO_AltFltContSysOper {-1.0, 1.0} + SendDataHW("39", mainPanelDevice:get_argument_value(39)) -- lamp_HYDRO_LeftGear {-1.0, 1.0} + SendDataHW("41", mainPanelDevice:get_argument_value(41)) -- lamp_HYDRO_RightGear {-1.0, 1.0} + SendDataHW("40", mainPanelDevice:get_argument_value(40)) -- lamp_HYDRO_NoseGear {-1.0, 1.0} + -- fuel system + SendDataHW("625", mainPanelDevice:get_argument_value(625)) -- lamp_FUEL_OutbdTanksEmpty {-1.0, 1.0} + -- fire detection system + SendDataHW("615", mainPanelDevice:get_argument_value(615)) -- lamp_FIRE_DETECTION_FwdFireWarning {-1.0, 1.0} + SendDataHW("616", mainPanelDevice:get_argument_value(616)) -- lamp_FIRE_DETECTION_AftFireWarning {-1.0, 1.0} + -- control system + SendDataHW("613", mainPanelDevice:get_argument_value(613)) -- lamp_CONTROL_TakeOffPosInd {-1.0, 1.0} + +end + +----------------------------------------------------- +-- LOW IMPORTANCE EXPORTS -- +-- done every gExportLowTickInterval export events -- +----------------------------------------------------- + +-- Pointed to by ProcessGlassCockpitDCSConfigLowImportance +function ProcessGlassCockpitDCSConfigLowImportance(mainPanelDevice) + if gES_GlassCockpitType == 1 then + -- HELIOS Version 1.3 + elseif gES_GlassCockpitType == 2 then + -- HawgTouch version 1.6 + end +end + +function ProcessHARDWAREConfigLowImportance(mainPanelDevice) + --[[ + every frame export to hardware + Example from A-10C + Get Radio Frequencies + get data from device + local UHF_RADIO = GetDevice(54) + SendDataHW("ExportID", "Format") + SendDataHW("ExportID", "Format", HardwareConfigID) + SendDataHW("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000)) + SendDataHW("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000), 2) -- export to Hardware '2' Config + ]] + + --===================================================================================== + --[[ + WriteToLog('list_cockpit_params(): '..dump(list_cockpit_params())) + WriteToLog('CMSP: '..dump(list_indication(7))) + + local ltmp1 = 0 + for ltmp2 = 0, 13, 1 do + ltmp1 = list_indication(ltmp2) + WriteToLog(ltmp2..': '..dump(ltmp1)) + --WriteToLog(ltmp2..' (metatable): '..dump(getmetatable(ltmp1))) + end + ]] +--[[ + local ltmp1 = 0 + for ltmp2 = 1, 73, 1 do + ltmp1 = GetDevice(ltmp2) + WriteToLog(ltmp2..': '..dump(ltmp1)) + WriteToLog(ltmp2..' (metatable): '..dump(getmetatable(ltmp1))) + end +]] +end + +----------------------------- +-- Custom functions -- +----------------------------- + +function genericRadio(key, value, hardware) +end + diff --git a/ExportsModules/FC_AuxiliaryFuntions.lua b/ExportsModules/FC_AuxiliaryFuntions.lua new file mode 100644 index 0000000..2b51cd2 --- /dev/null +++ b/ExportsModules/FC_AuxiliaryFuntions.lua @@ -0,0 +1,2763 @@ +-- Flaming Cliffs Auxiliary Functons +-- Version 0.9.9 + +-- Weapon Panel for Su-25A and Su-25T +function FC_WeaponPanel_SU25(exportid) + local lExportID = exportid or 14 + + -- defination + gES_PayloadInfo = LoGetPayloadInfo() + if gES_PayloadInfo ~= nil then + if gES_CurrentStationTmp == nil then + gES_CurrentStationTmp = -1 + end + if gES_CannonContainer == nil then -- Find Cannon-Containers, aka SPPU_22 + gES_CannonContainer = {} + gES_CannonContainer.counter = 0 + table.foreach(gES_PayloadInfo.Stations, WeaponStatusPanel_FindCannonContainer) + end + if gES_TmpWeaponPanelActive == nil then + gES_TmpWeaponPanelActive = {[201] = 0, [202] = 0, [203] = 0, [204] = 0, [205] = 0, [206] = 0, [207] = 0, [208] = 0, [209] = 0, [210] = 0} + 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 } -- left + gES_TmpStationToPanel[2] = {Panel = 10, StationID = 110, CurrentID = 210 } -- right + gES_TmpStationToPanel[3] = {Panel = 2, StationID = 102, CurrentID = 202 } + gES_TmpStationToPanel[4] = {Panel = 9, StationID = 109, CurrentID = 209 } + gES_TmpStationToPanel[5] = {Panel = 3, StationID = 103, CurrentID = 203 } + gES_TmpStationToPanel[6] = {Panel = 8, StationID = 108, CurrentID = 208 } + gES_TmpStationToPanel[7] = {Panel = 4, StationID = 104, CurrentID = 204 } + gES_TmpStationToPanel[8] = {Panel = 7, StationID = 107, CurrentID = 207 } + gES_TmpStationToPanel[9] = {Panel = 5, StationID = 105, CurrentID = 205 } + gES_TmpStationToPanel[10] = {Panel = 6, StationID = 106, CurrentID = 206 } + + -- gES_TmpWeaponPanelActive reset + for i = 201, 210, 1 do + gES_TmpWeaponPanelActive[i] = 0 + end + + if gES_TmpStationToPanel[gES_PayloadInfo.CurrentStation] ~= nil then + gES_TmpWeaponPanelActive[gES_TmpStationToPanel[gES_PayloadInfo.CurrentStation].CurrentID] = 1 -- currrent value + + table.foreach(gES_PayloadInfo.Stations, WeaponStatusPanel_selectCurrentPayloadStationGlassCockpit) -- corresponding station + end + + end + + local lMainGun = 1.0 -- Full max 250 Rounds "F" + local lReserve = 1.0 + if gES_PayloadInfo.Cannon.shells == 0 then + lMainGun = 0.0 -- transversely striped + lReserve = 0.0 -- transversely striped + elseif gES_PayloadInfo.Cannon.shells < 65 then + lMainGun = 0.1 -- "E" + elseif gES_PayloadInfo.Cannon.shells < 125 then + lMainGun = 0.3 -- "1/2" -- "3/4" + elseif gES_PayloadInfo.Cannon.shells < 187 then + lMainGun = 0.6 -- "1/4" + end + + local lWeaponType = 0.0 -- transversely striped + if gES_PayloadInfo.CurrentStation > 0 then + if gES_PayloadInfo.Stations[gES_PayloadInfo.CurrentStation].weapon.level1 == 4 then + if gES_PayloadInfo.Stations[gES_PayloadInfo.CurrentStation].weapon.level2 == 4 then -- Weapon type Missle + lWeaponType = 0.1 -- MSL + elseif gES_PayloadInfo.Stations[gES_PayloadInfo.CurrentStation].weapon.level2 == 7 then -- Weapon type NURS with Container + if gES_PayloadInfo.Stations[gES_PayloadInfo.CurrentStation].weapon.level3 == 33 then -- Weapon type Rocket + lWeaponType = 0.2 -- RCT + end + elseif gES_PayloadInfo.Stations[gES_PayloadInfo.CurrentStation].weapon.level2 == 5 then -- Weapon type Bomb + lWeaponType = 0.3 -- BB + end + end + end + + local lOuterCannon = 0.0 -- transversely striped + local lInnerCannon = 0.0 -- transversely striped + if gES_CannonContainer.counter > 0 then + for i = 7, 10, 1 do + if gES_CannonContainer[i] == "{E92CBFE5-C153-11d8-9897-000476191836}" then -- SPPU_22 with 260 rounds + if i == 7 or i == 8 then + lOuterCannon = 1.0 -- Full max 260 Rounds "F" + if gES_PayloadInfo.Stations[i].count == 0 then + lOuterCannon = 0.0 -- transversely striped + gES_CannonContainer[i] = "empty" -- do not check + elseif gES_PayloadInfo.Stations[i].count < 65 then + lOuterCannon = 0.1 -- "E" + elseif gES_PayloadInfo.Stations[i].count < 130 then + lOuterCannon = 0.3 -- "3/4" -- "1/2" + elseif gES_PayloadInfo.Stations[i].count < 195 then + lOuterCannon = 0.6 -- "1/4" + end + else + lInnerCannon = 1.0 -- Full max 260 Rounds "F" + if gES_PayloadInfo.Stations[i].count == 0 then + lInnerCannon = 0.0 -- transversely striped + gES_CannonContainer[i] = "empty" -- do not check + elseif gES_PayloadInfo.Stations[i].count < 65 then + lInnerCannon = 0.1 -- "E" + elseif gES_PayloadInfo.Stations[i].count < 130 then + lInnerCannon = 0.3 -- "3/4" -- "1/2" + elseif gES_PayloadInfo.Stations[i].count < 195 then + lInnerCannon = 0.6 -- "1/4" + end + end + end + end + end + + --[[ + 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 + + -- MainCannon {transversely striped = 0.0, 1/4 = 01, 1/2 = 03, 3/4 = 0.6, Full = 1.0} + -- WeaponPresend1 {0, 1} + -- WeaponPresend2 {0, 1} + -- WeaponPresend3 {0, 1} + -- WeaponPresend4 {0, 1} + -- WeaponPresend5 {0, 1} + -- WeaponPresend6 {0, 1} + -- WeaponPresend7 {0, 1} + -- WeaponPresend8 {0, 1} + -- WeaponPresend9 {0, 1} + -- WeaponPresend10 {0, 1} + -- WeaponActive1 {0, 1} + -- WeaponActive2 {0, 1} + -- WeaponActive3 {0, 1} + -- WeaponActive4 {0, 1} + -- WeaponActive5 {0, 1} + -- WeaponActive6 {0, 1} + -- WeaponActive7 {0, 1} + -- WeaponActive8 {0, 1} + -- WeaponActive9 {0, 1} + -- WeaponActive10 {0, 1} + -- WeaponType {transversely striped = 0.0, Missle = 0.1, Rocket = 0.2, Bomb = 0.3} + -- OuterCannon {transversely striped = 0.0, 1/4 = 01, 1/2 = 03, 3/4 = 0.6, Full = 1.0} + -- 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} + SendData(lExportID, string.format("%.1f;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%.1f;%.1f;%.1f;%.1f", + lMainGun, -- main cannon shells + (gES_PayloadInfo.Stations[1].count > 0 and 1 or 0), -- weapon presend panel 1 + (gES_PayloadInfo.Stations[3].count > 0 and 1 or 0), -- weapon presend panel 2 + (gES_PayloadInfo.Stations[5].count > 0 and 1 or 0), -- weapon presend panel 3 + (gES_PayloadInfo.Stations[7].count > 0 and 1 or 0), -- weapon presend panel 4 + (gES_PayloadInfo.Stations[9].count > 0 and 1 or 0), -- weapon presend panel 5 + (gES_PayloadInfo.Stations[10].count > 0 and 1 or 0), -- weapon presend panel 6 + (gES_PayloadInfo.Stations[8].count > 0 and 1 or 0), -- weapon presend panel 7 + (gES_PayloadInfo.Stations[6].count > 0 and 1 or 0), -- weapon presend panel 8 + (gES_PayloadInfo.Stations[4].count > 0 and 1 or 0), -- weapon presend panel 9 + (gES_PayloadInfo.Stations[2].count > 0 and 1 or 0), -- weapon presend panel 10 + gES_TmpWeaponPanelActive[201], -- weapon active panel 1 + gES_TmpWeaponPanelActive[202], -- weapon active panel 2 + gES_TmpWeaponPanelActive[203], -- weapon active panel 3 + gES_TmpWeaponPanelActive[204], -- weapon active panel 4 + gES_TmpWeaponPanelActive[205], -- weapon active panel 5 + gES_TmpWeaponPanelActive[206], -- weapon active panel 6 + gES_TmpWeaponPanelActive[207], -- weapon active panel 7 + gES_TmpWeaponPanelActive[208], -- weapon active panel 8 + gES_TmpWeaponPanelActive[209], -- weapon active panel 9 + gES_TmpWeaponPanelActive[210], -- weapon active panel 10 + lWeaponType, -- current weapon type + lOuterCannon, -- outer cannon shells + lInnerCannon, -- inner cannon shells + lReserve)) -- reserve weapon + + end +end + +-- Weapon Panel for Su-27 and Su-33 +function FC_WeaponPanel_SU2733(exportid) + local lExportID = exportid or 13 + + -- defination + gES_PayloadInfo = LoGetPayloadInfo() + if gES_PayloadInfo ~= nil then + if gES_CurrentStationTmp == nil then + gES_CurrentStationTmp = -1 + end + + if gES_TmpWeaponPanelActive == nil then + gES_TmpWeaponPanelActive = {[201] = 0, [202] = 0, [203] = 0, [204] = 0, [205] = 0, [206] = 0, [207] = 0, [208] = 0, [209] = 0, [210] = 0} + 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 } -- left + gES_TmpStationToPanel[2] = {Panel = 10, StationID = 110, CurrentID = 210 } -- right + gES_TmpStationToPanel[3] = {Panel = 2, StationID = 102, CurrentID = 202 } + gES_TmpStationToPanel[4] = {Panel = 9, StationID = 109, CurrentID = 209 } + gES_TmpStationToPanel[5] = {Panel = 3, StationID = 103, CurrentID = 203 } + gES_TmpStationToPanel[6] = {Panel = 8, StationID = 108, CurrentID = 208 } + gES_TmpStationToPanel[7] = {Panel = 4, StationID = 104, CurrentID = 204 } + gES_TmpStationToPanel[8] = {Panel = 7, StationID = 107, CurrentID = 207 } + gES_TmpStationToPanel[9] = {Panel = 5, StationID = 105, CurrentID = 205 } + gES_TmpStationToPanel[10] = {Panel = 6, StationID = 106, CurrentID = 206 } + + -- gES_TmpWeaponPanelActive reset + for i = 201, 210, 1 do + gES_TmpWeaponPanelActive[i] = 0 + end + + if gES_TmpStationToPanel[gES_PayloadInfo.CurrentStation] ~= nil then + gES_TmpWeaponPanelActive[gES_TmpStationToPanel[gES_PayloadInfo.CurrentStation].CurrentID] = 1 -- currrent value + + table.foreach(gES_PayloadInfo.Stations, WeaponStatusPanel_selectCurrentPayloadStationGlassCockpit) -- corresponding station + end + + end + + local lWeaponType = 0.0 -- transversely striped + if gES_PayloadInfo.CurrentStation > 0 then + if gES_PayloadInfo.Stations[gES_PayloadInfo.CurrentStation].weapon.level1 == 4 then + if gES_PayloadInfo.Stations[gES_PayloadInfo.CurrentStation].weapon.level2 == 4 then -- Weapon type Missle + lWeaponType = 0.1 -- MSL + elseif gES_PayloadInfo.Stations[gES_PayloadInfo.CurrentStation].weapon.level2 == 7 then -- Weapon type NURS with Container + if gES_PayloadInfo.Stations[gES_PayloadInfo.CurrentStation].weapon.level3 == 33 then -- Weapon type Rocket + lWeaponType = 0.2 -- RCT + end + elseif gES_PayloadInfo.Stations[gES_PayloadInfo.CurrentStation].weapon.level2 == 5 then -- Weapon type Bomb + lWeaponType = 0.3 -- BB + end + end + end + + --[[ + 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 + + -- WeaponPresend1 {0, 1} + -- WeaponPresend2 {0, 1} + -- WeaponPresend3 {0, 1} + -- WeaponPresend4 {0, 1} + -- WeaponPresend5 {0, 1} + -- WeaponPresend6 {0, 1} + -- WeaponPresend7 {0, 1} + -- WeaponPresend8 {0, 1} + -- WeaponPresend9 {0, 1} + -- WeaponPresend10 {0, 1} + -- WeaponActive1 {0, 1} + -- WeaponActive2 {0, 1} + -- WeaponActive3 {0, 1} + -- WeaponActive4 {0, 1} + -- WeaponActive5 {0, 1} + -- WeaponActive6 {0, 1} + -- WeaponActive7 {0, 1} + -- WeaponActive8 {0, 1} + -- WeaponActive9 {0, 1} + -- WeaponActive10 {0, 1} + SendData(lExportID, string.format("%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d", + (gES_PayloadInfo.Stations[1].count > 0 and 1 or 0), -- weapon presend panel 1 + (gES_PayloadInfo.Stations[3].count > 0 and 1 or 0), -- weapon presend panel 2 + (gES_PayloadInfo.Stations[5].count > 0 and 1 or 0), -- weapon presend panel 3 + (gES_PayloadInfo.Stations[7].count > 0 and 1 or 0), -- weapon presend panel 4 + (gES_PayloadInfo.Stations[9].count > 0 and 1 or 0), -- weapon presend panel 5 + (gES_PayloadInfo.Stations[10].count > 0 and 1 or 0), -- weapon presend panel 6 + (gES_PayloadInfo.Stations[8].count > 0 and 1 or 0), -- weapon presend panel 7 + (gES_PayloadInfo.Stations[6].count > 0 and 1 or 0), -- weapon presend panel 8 + (gES_PayloadInfo.Stations[4].count > 0 and 1 or 0), -- weapon presend panel 9 + (gES_PayloadInfo.Stations[2].count > 0 and 1 or 0), -- weapon presend panel 10 + gES_TmpWeaponPanelActive[201], -- weapon active panel 1 + gES_TmpWeaponPanelActive[202], -- weapon active panel 2 + gES_TmpWeaponPanelActive[203], -- weapon active panel 3 + gES_TmpWeaponPanelActive[204], -- weapon active panel 4 + gES_TmpWeaponPanelActive[205], -- weapon active panel 5 + gES_TmpWeaponPanelActive[206], -- weapon active panel 6 + gES_TmpWeaponPanelActive[207], -- weapon active panel 7 + gES_TmpWeaponPanelActive[208], -- weapon active panel 8 + gES_TmpWeaponPanelActive[209], -- weapon active panel 9 + gES_TmpWeaponPanelActive[210])) -- weapon active panel 10 + + end +end + +-- radar warner SPO-15 for all russian planes +function FC_RadarWarning_SPO15(exportid) + local lExportID = exportid or 14 + + local lTWSInfo = LoGetTWSInfo() -- SPO15 Information + if lTWSInfo ~= nil then + --SendData("15", "1;0.3;0;0.1;1;0;0.1;0.5;0;0;0;0;0;1;0;0;1;0;0;1;0;0;0;1") + --Parameter (PowerOn, PrimaryDirection1, PrimaryDirection2, PrimaryType, TopHemisphere, BottomHemisphere, Lock, ErmitterPower, SecondaryLeftBack, SecondaryLeft90, SecondaryLeft50, SecondaryLeft30, SecondaryLeft10, SecondaryRight10, SecondaryRight30, SecondaryRight50, SecondaryRight90, SecondaryRightBack, SecondaryAIR, SecondaryLRR, SecondaryMRR, SecondarySRR, SecondaryEWR, SecondaryAWACS) + -- Alle Parameter ohne extra Angabe haben den Wert 0 oder 1 + --Power On + --den 1. Wert welche Primäre Richtung leuchtet (es können maximal 2 Richtungsleuchten nebeneinander leuchten) (von links hinten nach recht hinten durchnummeriert, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0 oder 0 für alle aus) + --den 2. Wert welche Primäre Richtung leuchtet (von links hinten nach recht hinten durchnummeriert, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0 oder 0 für alle aus) + --den Wert welche Primäre Typ leuchtet (es kann nur ein Primären Typ geben) (AIR = 0.1, LRR = 0.2, MRR = 0.3, SRR = 0.4, EWR = 0.5 oder AWACS = 0.6) + --den Wert ob Oben leuchtet + --den Wert ob Unten leuchtet + --den Wert ob Lock leuchtet (nichts = 0, Rackete im Anflug = 0.1 (blinken), Lock = 0.2 (dauerlicht)) + --den Wert welche maximale Ermitterstärke leuchtet (alle lampen bis dahin gehen an + das Dreieck) (0.00 bis 0.15) + --den Wert ob Richtung links hinten Sekundär leuchtet + --den Wert ob Richtung links 90 Sekundär leuchtet + -- ... also insgesamt 10 Sekundär Richtungen + --den Wert ob Richtung rechts 90 Sekundär leuchtet + --den Wert ob Richtung rechts hinten Sekundär leuchtet + --den Wert ob Sekundär AIR leuchte -- air plane or missil + --den Wert ob Sekundär LRR leuchte -- long range radar + --den Wert ob Sekundär MRR leuchte -- mid range radar + --den Wert ob Sekundär SRR leuchte -- short range radar + --den Wert ob Sekundär EWR leuchte -- early warning radar + --den Wert ob Sekundär AWACS leuchte + -- Die Beispieldaten sind ein Primäres Flugzeug auf 50° links oberhalb mir, noch recht weit weg aber am scannen, Sekundär Radar ist auf 10° und 90° rechts und es ist ein Long Range und Awacs Radar + + -- prüft ob ein Radarsender vorhadnen ist + if(#lTWSInfo.Emitters > 0) then + + local lPrimaryDirection1, lPrimaryDirection2, lPrimaryType, lTopHemisphere, lBottomHemisphere, lLock, lErmitterPower = 0,0,0,0,0,0,0 + local lSecondaryLeftBack, lSecondaryLeft90, lSecondaryLeft50, lSecondaryLeft30, lSecondaryLeft10, lSecondaryRight10, lSecondaryRight30, lSecondaryRight50, lSecondaryRight90, lSecondaryRightBack = 0,0,0,0,0,0,0,0,0,0 + local lSecondaryType = {AIR = 0, LRR = 0, MRR = 0, SRR = 0, EWR = 0, AWACS = 0} + local lPriorityTmp, lPrimaryThreatTmp = 0,0 + local lHemisphere = 0 + gES_SPO15_FoundErmitter = true + + -- sucht den Primär Sender raus + for EmitterIndex = 1, #lTWSInfo.Emitters, 1 do + if(lTWSInfo.Emitters[EmitterIndex].Priority > lPriorityTmp) then + lPriorityTmp = lTWSInfo.Emitters[EmitterIndex].Priority + lPrimaryThreatTmp = EmitterIndex + end + end + + for EmitterIndex = 1, #lTWSInfo.Emitters, 1 do + + local lAzimut = math.round(lTWSInfo.Emitters[EmitterIndex].Azimuth * 90, 1) + + if EmitterIndex == lPrimaryThreatTmp then + -- primary threat + -- direction to the threat + lPrimaryDirection1 = (lAzimut <= -170.0 and 0.1 or lPrimaryDirection1) -- left back side + lPrimaryDirection1 = ((lAzimut <= -90.0 and lAzimut >= -170.0 and lPrimaryDirection1 == 0 ) and 0.2 or lPrimaryDirection1) -- left 90 degree + lPrimaryDirection2 = ((lAzimut <= -90.0 and lAzimut >= -170.0 and lPrimaryDirection1 < 0.2) and 0.2 or lPrimaryDirection2) -- left 90 degree + lPrimaryDirection1 = ((lAzimut <= -55.0 and lAzimut >= -125.0 and lPrimaryDirection1 == 0 ) and 0.3 or lPrimaryDirection1) -- left 50 degree + lPrimaryDirection2 = ((lAzimut <= -55.0 and lAzimut >= -125.0 and lPrimaryDirection1 < 0.3) and 0.3 or lPrimaryDirection2) -- left 50 degree + lPrimaryDirection1 = ((lAzimut <= -30.0 and lAzimut >= -70.5 and lPrimaryDirection1 == 0 ) and 0.4 or lPrimaryDirection1) -- left 30 degree + lPrimaryDirection2 = ((lAzimut <= -30.0 and lAzimut >= -70.5 and lPrimaryDirection1 < 0.4 ) and 0.4 or lPrimaryDirection2) -- left 30 degree + lPrimaryDirection1 = ((lAzimut <= 5.0 and lAzimut >= -40.0 and lPrimaryDirection1 == 0 ) and 0.5 or lPrimaryDirection1) -- left 10 degree + lPrimaryDirection2 = ((lAzimut <= 5.0 and lAzimut >= -40.0 and lPrimaryDirection1 < 0.5 ) and 0.5 or lPrimaryDirection2) -- left 10 degree + lPrimaryDirection1 = ((lAzimut >= -5.0 and lAzimut <= 40.0 and lPrimaryDirection1 == 0 ) and 0.6 or lPrimaryDirection1) -- right 10 degree + lPrimaryDirection2 = ((lAzimut >= -5.0 and lAzimut <= 40.0 and lPrimaryDirection1 < 0.6 ) and 0.6 or lPrimaryDirection2) -- right 10 degree + lPrimaryDirection1 = ((lAzimut >= 30.0 and lAzimut <= 70.5 and lPrimaryDirection1 == 0 ) and 0.7 or lPrimaryDirection1) -- right 30 degree + lPrimaryDirection2 = ((lAzimut >= 30.0 and lAzimut <= 70.5 and lPrimaryDirection1 < 0.7 ) and 0.7 or lPrimaryDirection2) -- right 30 degree + lPrimaryDirection1 = ((lAzimut >= 55.0 and lAzimut <= 125.0 and lPrimaryDirection1 == 0 ) and 0.8 or lPrimaryDirection1) -- right 50 degree + lPrimaryDirection2 = ((lAzimut >= 55.0 and lAzimut <= 125.0 and lPrimaryDirection1 < 0.8 ) and 0.8 or lPrimaryDirection2) -- right 50 degree + lPrimaryDirection1 = ((lAzimut >= 90.0 and lAzimut <= 170.0 and lPrimaryDirection1 == 0 ) and 0.9 or lPrimaryDirection1) -- right 90 degree + lPrimaryDirection2 = ((lAzimut >= 90.0 and lAzimut <= 170.0 and lPrimaryDirection1 < 0.9 ) and 0.9 or lPrimaryDirection2) -- right 90 degree + lPrimaryDirection1 = ((lAzimut >= 170.0 and lPrimaryDirection1 == 0 ) and 1.0 or lPrimaryDirection1) -- right back side + lPrimaryDirection2 = ((lAzimut >= 170.0 and lPrimaryDirection1 < 1.0 ) and 1.0 or lPrimaryDirection2) -- right back side + + -- power of the threat + lErmitterPower = math.round(lTWSInfo.Emitters[EmitterIndex].Power * 0.15, 2) + 0.01 + + -- type of the threat + local lPrimaryTypeTmp = FC_FindRadarTypeForSPO15(lTWSInfo, lPrimaryThreatTmp) + if lPrimaryTypeTmp.AIR == 1 then + lPrimaryType = 0.1 + elseif lPrimaryTypeTmp.LRR == 1 then + lPrimaryType = 0.2 + elseif lPrimaryTypeTmp.MRR == 1 then + lPrimaryType = 0.3 + elseif lPrimaryTypeTmp.SRR == 1 then + lPrimaryType = 0.4 + elseif lPrimaryTypeTmp.EWR == 1 then + lPrimaryType = 0.5 + elseif lPrimaryTypeTmp.AWACS == 1 then + lPrimaryType = 0.6 + end + -- look or missil on air + lLock = lPrimaryTypeTmp.Lock + -- hemisphere + lTopHemisphere = lPrimaryTypeTmp.TopHemisphere -- top hemisphere + lBottomHemisphere = lPrimaryTypeTmp.BottomHemisphere -- bottom hemisphere + if lPrimaryTypeTmp.TopHemisphere == 1 and lPrimaryTypeTmp.BottomHemisphere == 0 then + lHemisphere = 0.1 + elseif lPrimaryTypeTmp.TopHemisphere == 0 and lPrimaryTypeTmp.BottomHemisphere == 1 then + lHemisphere = 0.2 + elseif lPrimaryTypeTmp.TopHemisphere == 1 and lPrimaryTypeTmp.BottomHemisphere == 1 then + lHemisphere = 0.3 + end + + lPrimaryTypeTmp = nil + end + + -- secundary threat + -- direction to the threat + lSecondaryLeftBack = (lAzimut <= -170.0 and 1 or lSecondaryLeftBack) -- left back side + lSecondaryLeft90 = ((lAzimut <= -90.0 and lAzimut >= -170.0 ) and 1 or lSecondaryLeft90) -- left 90 degree + lSecondaryLeft50 = ((lAzimut <= -55.0 and lAzimut >= -125.0 ) and 1 or lSecondaryLeft50) -- left 50 degree + lSecondaryLeft30 = ((lAzimut <= -30.0 and lAzimut >= -70.5 ) and 1 or lSecondaryLeft30) -- left 30 degree + lSecondaryLeft10 = ((lAzimut <= 5.0 and lAzimut >= -40.0 ) and 1 or lSecondaryLeft10) -- left 10 degree + lSecondaryRight10 = ((lAzimut >= -5.0 and lAzimut <= 40.0 ) and 1 or lSecondaryRight10) -- right 10 degree + lSecondaryRight30 = ((lAzimut >= 30.0 and lAzimut <= 70.5 ) and 1 or lSecondaryRight30) -- right 30 degree + lSecondaryRight50 = ((lAzimut >= 55.0 and lAzimut <= 125.0 ) and 1 or lSecondaryRight50) -- right 50 degree + lSecondaryRight90 = ((lAzimut >= 90.0 and lAzimut <= 170.0 ) and 1 or lSecondaryRight90) -- right 90 degree + lSecondaryRightBack = (lAzimut >= 170.0 and 1 or lSecondaryRightBack) -- right back side + + end + + lSecondaryType = FC_FindRadarTypeForSPO15(lTWSInfo) + -- Power {1} + -- PrimaryDirection1 {Off = 0.0, LeftBack = 0.1, Left90 = 0.2, Left50 = 0.3, Left30 = 0.4, Left10 = 0.5, Right10 = 0.6, Right30 = 0.7, Right50 = 0.8, Right90 = 0.9, RightBack = 1.0} + -- PrimaryDirection2 {Off = 0.0, LeftBack = 0.1, Left90 = 0.2, Left50 = 0.3, Left30 = 0.4, Left10 = 0.5, Right10 = 0.6, Right30 = 0.7, Right50 = 0.8, Right90 = 0.9, RightBack = 1.0} + -- PrimaryType {Off = 0.0, AIR = 0.1, LRR = 0.2, MRR = 0.3, SRR = 0.4, EWR = 0.5 oder AWACS = 0.6} + -- lHemisphere {0.0 = all off, 0.1 = TopHemisphere, 0.2 = BottomHemisphere, 0.3 = all on} -- TopHemisphere {0, 1} -- BottomHemisphere {0, 1} + -- Lock {off = 0.0, missile = 0.1 (flashing), Lock = 0.2} + -- ErmitterPower {Off = 0.0, LED1 = 0.01, LED2 = 0.02, ... LED15 = 0.15} + -- SecondaryLeftBack {0, 1} + -- SecondaryLeft90 {0, 1} + -- SecondaryLeft50 {0, 1} + -- SecondaryLeft30 {0, 1} + -- SecondaryLeft10 {0, 1} + -- SecondaryRight10 {0, 1} + -- SecondaryRight30 {0, 1} + -- SecondaryRight50 {0, 1} + -- SecondaryRight90 {0, 1} + -- SecondaryRightBack {0, 1} + -- SecondaryType_AIR {0, 1} + -- SecondaryType_LRR {0, 1} + -- SecondaryType_MRR {0, 1} + -- SecondaryType_SRR {0, 1} + -- SecondaryType_EWR {0, 1} + -- SecondaryType_AWACS {0, 1} + SendData(lExportID, string.format("%d;%.1f;%.1f;%.1f;%.1f;%.1f;%.2f;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d", + 1, + lPrimaryDirection1, + lPrimaryDirection2, + lPrimaryType, + lHemisphere, + lLock, + lErmitterPower, + lSecondaryLeftBack, + lSecondaryLeft90, + lSecondaryLeft50, + lSecondaryLeft30, + lSecondaryLeft10, + lSecondaryRight10, + lSecondaryRight30, + lSecondaryRight50, + lSecondaryRight90, + lSecondaryRightBack, + lSecondaryType.AIR, + lSecondaryType.LRR, + lSecondaryType.MRR, + lSecondaryType.SRR, + lSecondaryType.EWR, + lSecondaryType.AWACS)) + + else + SendData(lExportID, "1;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0") + end + end +end + +-- HSI for SU25T, SU-27, SU-33, MIG-29 +function FC_Russian_HSI(distancetoway, exportid) + local lDistanceToWay = distancetoway or 999 + local lExportID = exportid or 5 + + local lDefaultOne = 1.0 + local lDefaultNull = 0.0 + local lRadToDCSunsignd = math.pi * 2 + local lPitch,lBank,lYaw = LoGetADIPitchBankYaw() -- PITCH, BANK, YAW (Radian) + local lHSI_RMI = LoGetControlPanel_HSI().RMI_raw -- VOR1 OBS (Radian) + local lHSI_ADF = LoGetControlPanel_HSI().ADF_raw -- ADF OBS (Radian) + local lHSI_Curse = LoGetControlPanel_HSI().Course -- HSI Course (Radian) + local lGlide = LoGetGlideDeviation() -- VOR1 HORIZONTAL DEFLECTION (-1 +1) + local lSide = LoGetSideDeviation() -- VOR1 VERTICAL DEFLECTION (-1 +1) + local lHeading = LoGetSelfData().Heading -- HEADING (Radian) + lPitch, lBank = nil +--[[ + [Course] = number: "0.76548692098835" + [CourseDeviation] = number: "0" + [ADF_raw] = number: "5.5811524391174" + [BearingPointer] = number: "0.80134677481978" + [RMI_raw] = number: "5.4092655181885" + [HeadingPointer] = number: "0.098191173578347" + [Heading_raw] = number: "6.2831854820251" + ]] + --[[ + Ka-50 HSI + [112] = "%.4f", -- HSI_heading {0.0, 1.0} + [118] = "%.4f", -- HSI_commanded_course_needle {0.0, 1.0} + [124] = "%.4f", -- HSI_commanded_heading_needle {0.0, 1.0} + [115] = "%.4f", -- HSI_bearing_needle {0.0, 1.0} + [119] = "%0.1f", -- HSI_heading_warning_flag{0.0,1.0} + [114] = "%0.1f", -- HSI_course_warning_flag{0.0, 1.0} + [125] = "%0.1f", -- HSI_glideslope_warning_flag{0.0, 1.0} + [117] = "%0.4f", -- HSI_range_counter_100 {0.0,1.0} + [527] = "%0.4f", -- HSI_range_counter_10 {0.0,1.0} + [528] = "%0.4f", -- HSI_range_counter_1 {0.0,1.0} + [127] = "%.4f", -- HSI_longitudinal_deviation{-1.0, 1.0} + [128] = "%.4f", -- HSI_lateral_deviation{-1.0, 1.0} + [116] = "%0.1f", -- HSI_range_unavailable_flag{0.0, 1.0} + [121] = "%0.1f", -- HSI_course_unavailable_flag{0.0, 1.0} + ]] + 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 = math.round(lDistanceToWay / 1000, 1) + local lDistanceToWayTmp = string.format("%03d", lDistanceToWay) + local lRangeCounter1 = 0 + local lRangeCounter2 = 0 + local lRangeCounter3 = 0 + if lDistanceToWay > 100 then + lRangeCounter1 = math.round((lDistanceToWay / 100), 0, "floor") * 0.11 + lRangeCounter1 = lRangeCounter1 - math.round(lRangeCounter1, 0, "floor") + end + if lDistanceToWay > 10 then + if lDistanceToWay > 100 then + lRangeCounter2 = (math.round((lDistanceToWay - (math.round(lDistanceToWay / 100, 0, "floor") * 100)), 0, "floor") / 10) * 0.11 + else + lRangeCounter2 = (lDistanceToWay / 10) * 0.11 + lRangeCounter2 = lRangeCounter2 - math.round(lRangeCounter2, 0, "floor") + end + end + if lDistanceToWay > 10 then + lRangeCounter3 = (lDistanceToWay - (math.round(lDistanceToWay / 10, 0, "floor") * 10)) * 0.11 + else + lRangeCounter3 = lDistanceToWay * 0.11 + end + + lHeading = (lHeading / lRadToDCSunsignd) + -- HSI_heading {0.0, 1.0} + -- HSI_commanded_course_needle {0.0, 1.0} + -- HSI_commanded_heading_needle {0.0, 1.0} + -- HSI_bearing_needle {0.0, 1.0} + -- HSI_heading_warning_flag{0.0,1.0} + -- HSI_course_warning_flag{0.0, 1.0} + -- HSI_glideslope_warning_flag{0.0, 1.0} + -- HSI_range_counter_100 {0.0,1.0} + -- HSI_range_counter_10 {0.0,1.0} + -- HSI_range_counter_1 {0.0,1.0} + -- HSI_longitudinal_deviation{-1.0, 1.0} + -- 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", + lHeading, -- compass card + (lHeading + (lHSI_Curse / lRadToDCSunsignd)) - 1, -- doppel pfeil + lHeading, -- gelbes dreieck + 0 - (lHeading + (lHSI_ADF / lRadToDCSunsignd)), -- gelber pfeil + lDefaultNull, -- KC Flag + lDefaultOne, -- K Flag (left) + lDefaultOne, -- L Flag (left) + lAltCounter[tonumber(string.sub(lDistanceToWayTmp, 1, 1))], + lAltCounter[tonumber(string.sub(lDistanceToWayTmp, 2, 2))], + lRangeCounter3, + lGlide, + lSide, + lDefaultNull, -- ??? + lDefaultNull)) -- deaktiviert die Course Anzeige +end + +-- HSI for SU25A +function FC_Russian_HSI_old(exportid) + local lDistanceToWay = distancetoway or 999 + local lExportID = exportid or 5 + + local lDefaultOne = 1.0 + local lDefaultNull = 0.0 + local lRadToDCSunsignd = math.pi * 2 + local lHSI_ADF = LoGetControlPanel_HSI().ADF_raw -- ADF OBS (Radian) + local lHSI_Curse = LoGetControlPanel_HSI().Course -- HSI Course (Radian) + local lGlide = LoGetGlideDeviation() -- VOR1 HORIZONTAL DEFLECTION (-1 +1) + local lSide = LoGetSideDeviation() -- VOR1 VERTICAL DEFLECTION (-1 +1) + local lHeading = LoGetSelfData().Heading -- HEADING (Radian) +--[[ + [Course] = number: "0.76548692098835" + [CourseDeviation] = number: "0" + [ADF_raw] = number: "5.5811524391174" + [BearingPointer] = number: "0.80134677481978" + [RMI_raw] = number: "5.4092655181885" + [HeadingPointer] = number: "0.098191173578347" + [Heading_raw] = number: "6.2831854820251" + ]] + + lHeading = (lHeading / lRadToDCSunsignd) + -- HSI_heading {0.0, 1.0} compass card + -- HSI_commanded_course_needle {0.0, 1.0} (Required heading) white needle + -- HSI_bearing_needle {0.0, 1.0} (RMI bearing) yellow needle + -- Flag Г (T){0.0,1.0} + -- Flag К (K){0.0,1.0} + -- 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", + 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)) +end + +-- HSI-Distance for SU25A +function FC_Russian_HSI_Distance_old(distancetoway, exportid) + 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 = math.round(lDistanceToWay / 1000, 1) + local lDistanceToWayTmp = string.format("%03d", lDistanceToWay) + local lRangeCounter1 = 0 + local lRangeCounter2 = 0 + local lRangeCounter3 = 0 + if lDistanceToWay > 100 then + lRangeCounter1 = math.round((lDistanceToWay / 100), 0, "floor") * 0.11 + lRangeCounter1 = lRangeCounter1 - math.round(lRangeCounter1, 0, "floor") + end + if lDistanceToWay > 10 then + if lDistanceToWay > 100 then + lRangeCounter2 = (math.round((lDistanceToWay - (math.round(lDistanceToWay / 100, 0, "floor") * 100)), 0, "floor") / 10) * 0.11 + else + lRangeCounter2 = (lDistanceToWay / 10) * 0.11 + lRangeCounter2 = lRangeCounter2 - math.round(lRangeCounter2, 0, "floor") + end + end + if lDistanceToWay > 10 then + lRangeCounter3 = (lDistanceToWay - (math.round(lDistanceToWay / 10, 0, "floor") * 10)) * 0.11 + else + lRangeCounter3 = lDistanceToWay * 0.11 + end + + 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 +end + +-- ADI for SU-25, SU25T, SU-27, MIG-29A and MIG-29S +function FC_Russian_ADI_Old(exportid) + local lExportID = exportid or 4 + + local lDefaultNull = 0.0 + local lRadToDCSsignd = math.pi + local lNavInfoPitch = LoGetNavigationInfo().Requirements.pitch -- AP REQUIRED PITCH (Radian) + local lNavInfoRoll = LoGetNavigationInfo().Requirements.roll -- AP REQUIRED BANK (Radian) + local lPitch, lBank, lYaw = LoGetADIPitchBankYaw() -- PITCH, BANK, YAW (Radian) + local lSlipBallPosition = LoGetSlipBallPosition() -- SLIP BALL (-1 +1) +-- ADI (IKP-81) + --------------------------------------------------- + --[[ + [100] = "%.4f", -- ADI_Roll {-1.0,1.0} + [101] = "%.4f", -- ADI_Pitch {-math.pi/2.0,math.pi/2.0}{1.0,-1.0} + [102] = "%0.1f", -- ADI_steering_warning_flag {0.0,1.0} + [109] = "%0.1f", -- ADI_attitude_warning_flag {0.0,1.0} + [107] = "%.4f", -- ADI_bank_steering {-1.0,1.0} + [106] = "%.4f", -- ADI_pitch_steering {-1.0,1.0} + [111] = "%.4f", -- ADI_airspeed_deviation {-1.0,1.0} + [103] = "%.4f", -- ADI_track_deviation {-1.0,1.0} + [526] = "%.4f", -- ADI_height_deviation {-1.0,1.0} + [108] = "%.4f", -- ADI_sideslip {-1.0,1.0} + ]] + 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", + lBank, + lPitch, + lDefaultNull, + lDefaultNull, + lNavInfoRoll, + lNavInfoPitch, + lDefaultNull, + lDefaultNull, + lDefaultNull, + lSlipBallPosition)) +end + +-- ADI for SU-33 +function FC_Russian_ADI_New(exportid) + local lExportID = exportid or 4 + + local lDefaultNull = 0.0 + local lRadToDCSsignd = math.pi + local lNavInfoPitch = LoGetNavigationInfo().Requirements.pitch -- AP REQUIRED PITCH (Radian) + local lNavInfoRoll = LoGetNavigationInfo().Requirements.roll -- AP REQUIRED BANK (Radian) + local lPitch, lBank, lYaw = LoGetADIPitchBankYaw() -- PITCH, BANK, YAW (Radian) + local lSlipBallPosition = LoGetSlipBallPosition() -- SLIP BALL (-1 +1) +-- ADI + --------------------------------------------------- + --[[ + [100] = "%.4f", -- ADI_Roll {-1.0,1.0} + [101] = "%.4f", -- ADI_Pitch {-math.pi/2.0,math.pi/2.0}{1.0,-1.0} + [102] = "%0.1f", -- ADI_steering_warning_flag {0.0,1.0} + [109] = "%0.1f", -- ADI_attitude_warning_flag {0.0,1.0} + [107] = "%.4f", -- ADI_bank_steering {-1.0,1.0} + [106] = "%.4f", -- ADI_pitch_steering {-1.0,1.0} + [111] = "%.4f", -- ADI_airspeed_deviation {-1.0,1.0} + [103] = "%.4f", -- ADI_track_deviation {-1.0,1.0} + [526] = "%.4f", -- ADI_height_deviation {-1.0,1.0} + [108] = "%.4f", -- ADI_sideslip {-1.0,1.0} + ]] + 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 --(lRadToDCSsignd / 2) + SendData(lExportID, string.format("%.4f;%.4f;%.1f;%.1f;%.4f;%.4f;%.4f;%.4f;%.4f;%.4f", + lBank, + lPitch, + lDefaultNull, + lDefaultNull, + lNavInfoRoll, + lNavInfoPitch, + lDefaultNull, + lDefaultNull, + lDefaultNull, + lSlipBallPosition)) +end + +-- Radar Altimeter for SU-25A, SU25-T, SU-27, SU-33 +function FC_Russian_RadarAltimeter_1500m(warningflag, exportid) + local lWarning_Flag = warningflag or 100 + local lExportID = exportid or 7 + + local lScaleValue = 1500 + local lAltRad = LoGetAltitudeAboveGroundLevel() -- ALTITUDE GROUND LEVEL (Meter) + + lAltRad = lAltRad / lScaleValue -- (1500 m ist die maximalhoehe des Messgeraetes) + lAltRad = (lAltRad > 1.0 and 1.0 or lAltRad) -- the result is limited to 1.0 + local lDangerRALT = lWarning_Flag / lScaleValue -- 0.14 -- 50m ((50 * 1) / 350) + local lWarning_Flag = (lAltRad == 1.0 and 1.0 or 0.0) -- (Flag an wenn Hoehe auf 1.0 ist) + local lDangerRALT_Lamp = (lAltRad < lDangerRALT and 1.0 or 0.0) -- (Flag an wenn Hoehe niedriger als 0.14) + -- AltRad {0.0,1.0} + -- DangerRALT {0.0,1.0} + -- Warning_Flag {0, 1} + -- DangerRALT_Lamp {0, 1} + SendData(lExportID, string.format("%.4f;%.4f;%d;%d", + lAltRad, + lDangerRALT, + lWarning_Flag, + lDangerRALT_Lamp)) +end + +-- Radar Altimeter for MiG-29A, MiG-29S +function FC_Russian_RadarAltimeter_1000m(warningflag, exportid) + local lWarning_Flag = warningflag or 100 + local lExportID = exportid or 7 + + local lScaleValue = 1000 + local lAltRad = LoGetAltitudeAboveGroundLevel() -- ALTITUDE GROUND LEVEL (Meter) + + lAltRad = lAltRad / lScaleValue -- (1000 m ist die maximalhoehe des Messgeraetes) + lAltRad = (lAltRad > 1.0 and 1.0 or lAltRad) -- the result is limited to 1.0 + local lDangerRALT = lWarning_Flag / lScaleValue -- 0.14 -- 50m ((50 * 1) / 350) + local lWarning_Flag = (lAltRad == 1.0 and 1.0 or 0.0) -- (Flag an wenn Hoehe auf 1.0 ist) + local lDangerRALT_Lamp = (lAltRad < lDangerRALT and 1.0 or 0.0) -- (Flag an wenn Hoehe niedriger als 0.14) + -- AltRad {0.0,1.0} + -- DangerRALT {0.0,1.0} + -- Warning_Flag {0, 1} + -- DangerRALT_Lamp {0, 1} + SendData(lExportID, string.format("%.4f;%.4f;%d;%d", + lAltRad, + lDangerRALT, + lWarning_Flag, + lDangerRALT_Lamp)) +end + +-- Barometric Altimeter for +function FC_Russian_BarometricAltimeter(exportid) + local lExportID = exportid or 8 + + local lScaleValue = 1000 + local lBasicAtmospherePressure = LoGetBasicAtmospherePressure() -- BAROMETRIC PRESSURE (mm Hg) + local lAltBar = LoGetAltitudeAboveSeaLevel() -- ALTITUDE SEA LEVEL (Meter) + + 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} + local lAltBarTmp = string.format("%03d", lAltBar) + lAltBar = lAltBar + (9.5 * (760 - lBasicAtmospherePressure)) -- 9.5 m per 1mmHg difference , eventuell minus der Differenz + lBasicAtmospherePressure = string.format("%03d", lBasicAtmospherePressure) + + lAltBar = lAltBar / lScaleValue + lAltBar = lAltBar - math.round(lAltBar, 0, "floor") + + -- AltBar {0.0,1.0} + -- AltBar_1000 {0.0,1.0} + -- AltBar_100 {0.0,1.0} + -- AltBar_10 {0.0,1.0} + -- BasicAtmospherePressure_1000 {0.0,1.0} + -- BasicAtmospherePressure_100 {0.0,1.0} + -- BasicAtmospherePressure_10 {0.0,1.0} + -- Warning_Flag {0, 1} + SendData(lExportID, string.format("%.4f;%.2f;%.2f;%.2f;%.2f;%.2f;%.2f", + lAltBar, + lAltCounter[tonumber(string.sub(lAltBarTmp, 1, 1))], + lAltCounter[tonumber(string.sub(lAltBarTmp, 2, 2))], + lAltCounter[tonumber(string.sub(lAltBarTmp, 3, 3))], + lAltCounter[tonumber(string.sub(lBasicAtmospherePressure, 1, 1))], + lAltCounter[tonumber(string.sub(lBasicAtmospherePressure, 2, 2))], + lAltCounter[tonumber(string.sub(lBasicAtmospherePressure, 3, 3))], + 0)) +end + +-- Barometric Altimeter for +function FC_Russian_BarometricAltimeter(exportid) + local lExportID = exportid or 8 + + local lScaleValue = 1000 + local lBasicAtmospherePressure = LoGetBasicAtmospherePressure() -- BAROMETRIC PRESSURE (mm Hg) + local lAltBar = LoGetAltitudeAboveSeaLevel() -- ALTITUDE SEA LEVEL (Meter) + + 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} + local lAltBarTmp = string.format("%03d", lAltBar) + lAltBar = lAltBar + (9.5 * (760 - lBasicAtmospherePressure)) -- 9.5 m per 1mmHg difference , eventuell minus der Differenz + lBasicAtmospherePressure = string.format("%03d", lBasicAtmospherePressure) + + lAltBar = lAltBar / lScaleValue + lAltBar = lAltBar - math.round(lAltBar, 0, "floor") + + -- AltBar {0.0,1.0} + -- AltBar_1000 {0.0,1.0} + -- AltBar_100 {0.0,1.0} + -- AltBar_10 {0.0,1.0} + -- BasicAtmospherePressure_1000 {0.0,1.0} + -- BasicAtmospherePressure_100 {0.0,1.0} + -- BasicAtmospherePressure_10 {0.0,1.0} + -- Warning_Flag {0, 1} + SendData(lExportID, string.format("%.4f;%.2f;%.2f;%.2f;%.2f;%.2f;%.2f", + lAltBar, + lAltCounter[tonumber(string.sub(lAltBarTmp, 1, 1))], + lAltCounter[tonumber(string.sub(lAltBarTmp, 2, 2))], + lAltCounter[tonumber(string.sub(lAltBarTmp, 3, 3))], + lAltCounter[tonumber(string.sub(lBasicAtmospherePressure, 1, 1))], + lAltCounter[tonumber(string.sub(lBasicAtmospherePressure, 2, 2))], + lAltCounter[tonumber(string.sub(lBasicAtmospherePressure, 3, 3))], + 0)) +end + +-- Barometric Altimeter for SU-25A, SU25-T +function FC_Russian_BarometricAltimeter_late(exportid) + local lExportID = exportid or 8 + + local lBasicAtmospherePressure = LoGetBasicAtmospherePressure() -- BAROMETRIC PRESSURE (mm Hg) + local lAltBar = LoGetAltitudeAboveSeaLevel() -- ALTITUDE SEA LEVEL (Meter) + local lAltBar_kilometer_needle = 0 + local lAltBar_meter_needle = 0 + + lAltBar = lAltBar - ((9.5 * (760 - lBasicAtmospherePressure)) / 2) -- 9.5 m per 1mmHg difference + + if lAltBar > 10000 then + lAltBar_kilometer_needle = lAltBar / 100000 + else + lAltBar_kilometer_needle = lAltBar / 10000 + end + if lAltBar > 1000 then + lAltBar_meter_needle = lAltBar / 1000 + lAltBar_meter_needle = lAltBar_meter_needle - math.round(lAltBar_meter_needle, 0, "floor") + else + lAltBar_meter_needle = lAltBar / 1000 + end + lAltBar = lAltBar / 1000 + + -- AltBar_kilometer_needle {0.0,1.0} + -- 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", + lAltBar_kilometer_needle, + lAltBar_meter_needle, + lBasicAtmospherePressure, + lAltBar)) +end + +-- Barometric Altimeter for SU-27, SU-33 +function FC_Russian_BarometricAltimeter_20000(exportid) + local lExportID = exportid or 8 + + local lBasicAtmospherePressure = LoGetBasicAtmospherePressure() -- BAROMETRIC PRESSURE (mm Hg) + local lAltBar = LoGetAltitudeAboveSeaLevel() -- ALTITUDE SEA LEVEL (Meter) + local lAltBar_kilometer_needle = 0 + local lAltBar_meter_needle = 0 + + lAltBar = lAltBar - ((9.5 * (760 - lBasicAtmospherePressure)) / 2) -- 9.5 m per 1mmHg difference + + if lAltBar > 10000 then + lAltBar_kilometer_needle = lAltBar / 200000 + else + lAltBar_kilometer_needle = lAltBar / 20000 + end + if lAltBar > 1000 then + lAltBar_meter_needle = lAltBar / 1000 + lAltBar_meter_needle = lAltBar_meter_needle - math.round(lAltBar_meter_needle, 0, "floor") + else + lAltBar_meter_needle = lAltBar / 1000 + end + lBasicAtmospherePressure = (lBasicAtmospherePressure - 600) / 200 + + -- 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", + lAltBar_kilometer_needle, + lAltBar_meter_needle, + lBasicAtmospherePressure)) +end + +-- Barometric Altimeter for MiG-29A, MiG-29S +function FC_Russian_BarometricAltimeter_30000(exportid) + local lExportID = exportid or 8 + + local lBasicAtmospherePressure = LoGetBasicAtmospherePressure() -- BAROMETRIC PRESSURE (mm Hg) + local lAltBar = LoGetAltitudeAboveSeaLevel() -- ALTITUDE SEA LEVEL (Meter) + local lAltBar_kilometer_needle = 0 + local lAltBar_meter_needle = 0 + + lAltBar = lAltBar - ((9.5 * (760 - lBasicAtmospherePressure)) / 2) -- 9.5 m per 1mmHg difference + + if lAltBar > 10000 then + lAltBar_kilometer_needle = lAltBar / 300000 + else + lAltBar_kilometer_needle = lAltBar / 30000 + end + if lAltBar > 1000 then + lAltBar_meter_needle = lAltBar / 1000 + lAltBar_meter_needle = lAltBar_meter_needle - math.round(lAltBar_meter_needle, 0, "floor") + else + lAltBar_meter_needle = lAltBar / 1000 + end + lBasicAtmospherePressure = (lBasicAtmospherePressure - 600) / 200 + + -- 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", + lBasicAtmospherePressure, + lAltBar_meter_needle, + lAltBar_kilometer_needle)) +end + +-- Air Speed Indicator for SU-25A, SU-25T +function FC_Russian_AirSpeed_1100hkm(exportid) + local lExportID = exportid or 1 + + local lIAS = LoGetIndicatedAirSpeed() * 3.6 -- INDICATED AIRSPEED (Meter/Second to Km/h) + local lTAS = LoGetTrueAirSpeed() * 3.6 -- TRUE AIRSPEED (Meter/Second to Km/h) + + --[[ + y_min = 0.0 0.09 -- minimaler Ausgabewert + y_max = 0.09 1.0 -- maximaler Ausgabewert + x_min = 0 100 -- minimaler Eingangswert + x_max = 100 1100 -- maximaler Eingangswert + x = 50 700 -- aktueller Eingangswert + + d_y = 0.09 0.91 -- Delta Ausgabewerte (y_max - y_min) + d_x = 100 1000 -- Delta Eingangswerte (x_max - x_min) + m = 0.0009 0.00091 -- Steigung der linearen Funktion (d_y / d_x) + n = 0.0 -0.001 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max) + + y = 0,0171875 0,636 -- Ergebnis (m * x + n) + ]] + if lIAS > 100 then + lIAS = 0.00091 * lIAS + -0.001 + else + lIAS = 0.0009 * lIAS + end + + --[[ + y_min = 0.0 -- minimaler Ausgabewert + y_max = 1.0 -- maximaler Ausgabewert + x_min = 400 -- minimaler Eingangswert + x_max = 1100 -- maximaler Eingangswert + x = 800 -- aktueller Eingangswert + + d_y = 1.0 -- Delta Ausgabewerte (y_max - y_min) + d_x = 700 -- Delta Eingangswerte (x_max - x_min) + m = 0.00142857142857142857142857142857 -- Steigung der linearen Funktion (d_y / d_x) + n = -0.571428571428571428571428571427 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max) + + y = 0.571428571428571428571428571429 -- Ergebnis (m * x + n) + ]] + if lTAS > 400 then + lTAS = 0.00142857142857142857142857142857 * lTAS + -0.571428571428571428571428571427 + else + lTAS = 0.0 + end + + -- IAS {0.0,1.0} + -- TAS {0.0,1.0} + SendData(lExportID, string.format("%.4f;%.4f", lIAS, lTAS)) +end + +-- Air Speed Indicator for SU-27, SU-33 +function FC_Russian_AirSpeed_1600hkm(exportid) + local lExportID = exportid or 1 + + local lScaleValueIAS = 1600 + local lScaleValueMach = 3.5 + local lIAS = LoGetIndicatedAirSpeed() * 3.6 -- INDICATED AIRSPEED (Meter/Second to Km/h) + local lMACH = LoGetMachNumber() -- MACH + local lMACHtmp = 0 + local lIAStmp = 0 + + if lIAS > 0 and lIAS <= 100 then + --[[ + y_min = 0.0 -- minimaler Ausgabewert + y_max = 0.03125 -- maximaler Ausgabewert + x_min = 0 -- minimaler Eingangswert + x_max = 100 -- maximaler Eingangswert + x = 55 -- aktueller Eingangswert + + d_y = 0.03125 -- Delta Ausgabewerte (y_max - y_min) + d_x = 100 -- Delta Eingangswerte (x_max - x_min) + m = 0.0003125 -- Steigung der linearen Funktion (d_y / d_x) + n = 0.0 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max) + + y = 0,0171875 -- Ergebnis (m * x + n) + ]] + lIAStmp = 0.0003125 * lIAS + elseif lIAS > 100 and lIAS <= 500 then + --[[ + y_min = 0.03125 -- minimaler Ausgabewert + y_max = 0.427 -- maximaler Ausgabewert + x_min = 100 -- minimaler Eingangswert + x_max = 500 -- maximaler Eingangswert + x = 250 -- aktueller Eingangswert + + d_y = 0.39575 -- Delta Ausgabewerte (y_max - y_min) + d_x = 400 -- Delta Eingangswerte (x_max - x_min) + m = 0.000989375 -- Steigung der linearen Funktion (d_y / d_x) + n = -0.0676875 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max) + + y = 0,0171875 -- Ergebnis (m * x + n) + ]] + lIAStmp = 0.000989375 * lIAS + -0.0676875 + elseif lIAS > 500 and lIAS <= 600 then + --[[ + y_min = 0.427 -- minimaler Ausgabewert + y_max = 0.51 -- maximaler Ausgabewert + x_min = 500 -- minimaler Eingangswert + x_max = 600 -- maximaler Eingangswert + x = 550 -- aktueller Eingangswert + + d_y = 0.083 -- Delta Ausgabewerte (y_max - y_min) + d_x = 100 -- Delta Eingangswerte (x_max - x_min) + m = 0.00083 -- Steigung der linearen Funktion (d_y / d_x) + n = 0.012 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max) + + y = 0.4685 -- Ergebnis (m * x + n) + ]] + lIAStmp = 0.00083 * lIAS + 0.012 + elseif lIAS > 600 and lIAS <= 1000 then + --[[ + y_min = 0.51 -- minimaler Ausgabewert + y_max = 0.753 -- maximaler Ausgabewert + x_min = 600 -- minimaler Eingangswert + x_max = 1000 -- maximaler Eingangswert + x = 800 -- aktueller Eingangswert + + d_y = 0.243 -- Delta Ausgabewerte (y_max - y_min) + d_x = 400 -- Delta Eingangswerte (x_max - x_min) + m = 0.0006075 -- Steigung der linearen Funktion (d_y / d_x) + n = 0.1455 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max) + + y = 0.6315 -- Ergebnis (m * x + n) + ]] + lIAStmp = 0.0006075 * lIAS + 0.1455 + elseif lIAS > 1000 and lIAS <= 1200 then + --[[ + y_min = 0.753 -- minimaler Ausgabewert + y_max = 0.84375 -- maximaler Ausgabewert + x_min = 1000 -- minimaler Eingangswert + x_max = 1200 -- maximaler Eingangswert + x = 1100 -- aktueller Eingangswert + + d_y = 0.09075 -- Delta Ausgabewerte (y_max - y_min) + d_x = 200 -- Delta Eingangswerte (x_max - x_min) + m = 0.00045375 -- Steigung der linearen Funktion (d_y / d_x) + n = 0.29925 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max) + + y = 0.798375 -- Ergebnis (m * x + n) + ]] + lIAStmp = 0.00045375 * lIAS + 0.29925 + elseif lIAS > 1200 and lIAS <= 1600 then + --[[ + y_min = 0.84375 -- minimaler Ausgabewert + y_max = 1.0 -- maximaler Ausgabewert + x_min = 1200 -- minimaler Eingangswert + x_max = 1600 -- maximaler Eingangswert + x = 1400 -- aktueller Eingangswert + + d_y = 0.15625 -- Delta Ausgabewerte (y_max - y_min) + d_x = 400 -- Delta Eingangswerte (x_max - x_min) + m = 0.000390625 -- Steigung der linearen Funktion (d_y / d_x) + n = 0.375 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max) + + y = 0.921875 -- Ergebnis (m * x + n) + ]] + lIAStmp = 0.000390625 * lIAS + 0.375 + end + + if lMACH > 0.6 and lMACH <= 0.9 then + --[[ + y_min = 0.0 -- minimaler Ausgabewert + y_max = 0.273 -- maximaler Ausgabewert + x_min = 0.6 -- minimaler Eingangswert + x_max = 0.9 -- maximaler Eingangswert + x = 0.75 -- aktueller Eingangswert + + d_y = 0.273 -- Delta Ausgabewerte (y_max - y_min) + d_x = 0.3 -- Delta Eingangswerte (x_max - x_min) + m = 0.91 -- Steigung der linearen Funktion (d_y / d_x) + n = -0.546 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max) + + y = 0.1365 -- Ergebnis (m * x + n) + ]] + lMACHtmp = 0.91 * lMACH + -0.546 + elseif lMACH > 0.9 and lMACH <= 1.5 then + --[[ + y_min = 0.273 -- minimaler Ausgabewert + y_max = 0.545 -- maximaler Ausgabewert + x_min = 0.9 -- minimaler Eingangswert + x_max = 1.5 -- maximaler Eingangswert + x = 1.3 -- aktueller Eingangswert + + d_y = 0.272 -- Delta Ausgabewerte (y_max - y_min) + d_x = 0.6 -- Delta Eingangswerte (x_max - x_min) + m = 0.45333333333333333333333333333333 -- Steigung der linearen Funktion (d_y / d_x) + n = -0.135 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max) + + y = 0.45433333333333333333333333333333 -- Ergebnis (m * x + n) + ]] + lMACHtmp = 0.45333333333333333333333333333333 * lMACH + -0.135 + elseif lMACH > 1.5 and lMACH <= 3.5 then + --[[ + y_min = 0.545 -- minimaler Ausgabewert + y_max = 1.0 -- maximaler Ausgabewert + x_min = 1.5 -- minimaler Eingangswert + x_max = 3.5 -- maximaler Eingangswert + x = 2.3 -- aktueller Eingangswert + + d_y = 0.455 -- Delta Ausgabewerte (y_max - y_min) + d_x = 2.0 -- Delta Eingangswerte (x_max - x_min) + m = 0.2275 -- Steigung der linearen Funktion (d_y / d_x) + n = 0.20375 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max) + + y = 0.727 -- Ergebnis (m * x + n) + ]] + lMACHtmp = 0.2275 * lMACH + 0.20375 + end + + -- IAS {0.0,1.0} + -- MACH {0.0,1.0} + SendData(lExportID, string.format("%.4f;%.4f", lIAStmp, lMACHtmp)) +end + +-- Air Speed Indicator for MiG-29A, MiG-29S +function FC_Russian_AirSpeed_1000hkm(exportid) + local lExportID = exportid or 1 + + local lIAS = LoGetIndicatedAirSpeed() * 3.6 -- INDICATED AIRSPEED (Meter/Second to Km/h) + local lThousand = 0.0 + + if lIAS > 1000 then + lThousand = 1.0 + elseif lIAS > 950 then + --[[ + y_min = 0.0 -- minimaler Ausgabewert + y_max = 1.0 -- maximaler Ausgabewert + x_min = 950 -- minimaler Eingangswert + x_max = 1001 -- maximaler Eingangswert + x = 980 -- aktueller Eingangswert + + d_y = 1.0 -- Delta Ausgabewerte (y_max - y_min) + d_x = 51.0 -- Delta Eingangswerte (x_max - x_min) + m = 0.01960784313725490196078431372549 -- Steigung der linearen Funktion (d_y / d_x) + n = -18.627450980392156862745098039215 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max) + + y = 0.5882352941176470588235294117652 -- Ergebnis (m * x + n) + ]] + lThousand = 0.01960784313725490196078431372549 * lIAS + -18.627450980392156862745098039215 + end + --[[ + y_min = 0.0 -- minimaler Ausgabewert + y_max = 1.0 -- maximaler Ausgabewert + x_min = 0.0 -- minimaler Eingangswert + x_max = 1000 -- maximaler Eingangswert + x = 880 -- aktueller Eingangswert + + d_y = 1.0 -- Delta Ausgabewerte (y_max - y_min) + d_x = 1000.0 -- Delta Eingangswerte (x_max - x_min) + m = 0.001 -- Steigung der linearen Funktion (d_y / d_x) + n = 0.0 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max) + + y = 0.88 -- Ergebnis (m * x + n) + ]] + lIAS = 0.001 * lIAS + lIAS = (lIAS > 1.0 and 1.0 or lIAS) -- the result is limited to 1.0 + + -- IAS {0.0,1.0} + -- Thousand {0.0,1.0} + SendData(lExportID, string.format("%.4f;%.4f", lIAS, lThousand)) +end + +-- Vertical Velocity Indicator (Old Style) for SU-25, SU25T, SU-27, MIG-29A and MIG-29S +function FC_Russian_VVI_Old(exportid) + local lExportID = exportid or 6 + + local lVVI = LoGetVerticalVelocity() -- VERTICAL SPEED (Meter/Second) + local lPitch, lBank, lYaw = LoGetADIPitchBankYaw() -- PITCH, BANK, YAW (Radian) + lBank = math.deg(lBank) + local lSlipBallPosition = LoGetSlipBallPosition() -- SLIP BALL (-1 +1) + --local lTAS = LoGetTrueAirSpeed() -- TRUE AIRSPEED (Meter/Second) + --local lTurn = 0 + + if lVVI >= 0.0 then + lVVI = lVVI / 200 + lVVI = (lVVI > 1.0 and 1.0 or lVVI) -- the result is limited to 1.0 + else + lVVI = lVVI / 200 + lVVI = (lVVI < -1.0 and -1.0 or lVVI) -- the result is limited to -1.0 + end + + if lBank >= 0.0 then + lBank = lBank / 45 + lBank = (lBank > 1.0 and 1.0 or lBank) -- the result is limited to 1.0 + else + lBank = lBank / 45 + lBank = (lBank < -1.0 and -1.0 or lBank) -- the result is limited to -1.0 + end + --lTurn = lTAS / 187.628865979 -- TRUE AIRSPEED (Meter/Second) / 187.628865979 m/s = Turn-Winkel or True Airspeed in Knots/min / 364 Knots + --WriteToLog('lTurn: '..dump(lTurn)) + --WriteToLog('lVVI: '..dump(lVVI)..', lBank :'..dump(lBank)) + -- 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", + lVVI, + lBank, + lSlipBallPosition)) +end + +-- VVI for SU-33 +function FC_Russian_VVI_New(exportid) + local lExportID = exportid or 6 + + local lVVI = LoGetVerticalVelocity() -- VERTICAL SPEED (Meter/Second) + + --[[ + y_min = 0.0 0.325 -- minimaler Ausgabewert + y_max = 0.325 1.0 -- maximaler Ausgabewert + x_min = 0.0 20.0 -- minimaler Eingangswert + x_max = 20.0 60.0 -- maximaler Eingangswert + x = 5.0 40.0 -- aktueller Eingangswert + + d_y = 0.325 0.675 -- Delta Ausgabewerte (y_max - y_min) + d_x = 20.0 40.0 -- Delta Eingangswerte (x_max - x_min) + m = 0.01625 0.016875 -- Steigung der linearen Funktion (d_y / d_x) + n = 0.0 -0.0125 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max) + + y = 0.08125 0,6625 -- Ergebnis (m * x + n) + ]] + + if lVVI >= 0.0 then + if lVVI >= 0.0 and lVVI < 20.0 then + lVVI = 0.01625 * lVVI + else + lVVI = 0.016875 * lVVI + -0.0125 + end + else + if lVVI <= 0.0 and lVVI < -20.0 then + lVVI = 0.01625 * lVVI + else + lVVI = 0.016875 * lVVI + -0.0125 + end + end + + SendData(lExportID, string.format("%.4f", lVVI)) +end + +-- Airintake for SU-27 and SU-33 +function FC_Russian_AirIntake(exportid) + local lExportID = exportid or 21 + + local lAirI = LoGetMechInfo().airintake.value + + SendData(lExportID, string.format("%.4f;%.4f", lAirI, lAirI)) +end + +-- AOA Indicator and Accelerometer (AOA, GLoad) for SU-25, SU25T +function FC_Russian_AOA_Su25(exportid) + local lExportID = exportid or 3 + + local lAoA = LoGetAngleOfAttack() -- ANGLE OF ATTACK AoA (Radian) + local lAccelerationUnits = LoGetAccelerationUnits().y -- G-LOAD + + -- AOA Indicator and Accelerometer (AOA, GLoad) + if lAoA > 0.0 then -- positive AOA + --[[ + y_min = 0.0 -- minimaler Ausgabewert + y_max = 1.0 -- maximaler Ausgabewert + x_min = 0.0 -- minimaler Eingangswert + x_max = 0.67224794626236 -- maximaler Eingangswert + x = 0.336 -- aktueller Eingangswert + + d_y = 1.0 -- Delta Ausgabewerte (y_max - y_min) + d_x = 0.67224794626236 -- Delta Eingangswerte (x_max - x_min) + m = 1.4875463815991002393091135769939 -- Steigung der linearen Funktion (d_y / d_x) + n = 0.0 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max) + + y = 0.727 -- Ergebnis (m * x + n) + ]] + lAoA = 1.4875463815991002393091135769939 * lAoA + else + --[[ + y_min = 0.0 -- minimaler Ausgabewert + y_max = -0.28 -- maximaler Ausgabewert + x_min = 0.0 -- minimaler Eingangswert + x_max = -0.17499999701977 -- maximaler Eingangswert + x = -0.1 -- aktueller Eingangswert + + d_y = -0.28 -- Delta Ausgabewerte (y_max - y_min) + d_x = -0.17499999701977 -- Delta Eingangswerte (x_max - x_min) + m = 1.6000000272478176068843626660856 -- Steigung der linearen Funktion (d_y / d_x) + n = 0.0 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max) + + y = -0.16000000272478176068843626660856 -- Ergebnis (m * x + n) + ]] + lAoA = 1.6000000272478176068843626660856 * lAoA + end + + if lAccelerationUnits > 0.0 then -- positive AOA + --[[ + y_min = 0.0 -- minimaler Ausgabewert + y_max = 1.0 -- maximaler Ausgabewert + x_min = 0.0 -- minimaler Eingangswert + x_max = 11.0 -- maximaler Eingangswert + x = 2.5 -- aktueller Eingangswert + + d_y = 1.0 -- Delta Ausgabewerte (y_max - y_min) + d_x = 11.0 -- Delta Eingangswerte (x_max - x_min) + m = 0.09090909090909090909090909090909 -- Steigung der linearen Funktion (d_y / d_x) + n = 0.0 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max) + + y = 0,22727272727272727272727272727273 -- Ergebnis (m * x + n) + ]] + lAccelerationUnits = 0.09090909090909090909090909090909 * lAccelerationUnits + else + --[[ + y_min = 0.0 -- minimaler Ausgabewert + y_max = -0.40625 -- maximaler Ausgabewert + x_min = 0.0 -- minimaler Eingangswert + x_max = -2.2125720977783 -- maximaler Eingangswert + x = -0.5 -- aktueller Eingangswert + + d_y = -0.40625 -- Delta Ausgabewerte (y_max - y_min) + d_x = -2.2125720977783 -- Delta Eingangswerte (x_max - x_min) + m = 0.18360983599491558834620754850374 -- Steigung der linearen Funktion (d_y / d_x) + n = 2.559143240842e-33 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max) + + y = -0.09180491799745779417310377425187 -- Ergebnis (m * x + n) + ]] + lAccelerationUnits = 0.18360983599491558834620754850374 * lAccelerationUnits + 2.559143240842e-33 + end + + SendData(lExportID, string.format("%.4f;%.4f", + lAoA, + lAccelerationUnits) ) +end + +-- AOA Indicator and Accelerometer (AOA, GLoad) for SU-27, SU33 +function FC_Russian_AOA_Su2733(exportid) + local lExportID = exportid or 3 + + local lAoA = LoGetAngleOfAttack() -- ANGLE OF ATTACK AoA (Radian) + local lAccelerationUnits = LoGetAccelerationUnits().y -- G-LOAD + + if lAoA > 0.0 then -- positive AOA + --[[ + y_min = 0.0 -- minimaler Ausgabewert + y_max = 1.0 -- maximaler Ausgabewert + x_min = 0.0 -- minimaler Eingangswert + x_max = 0.68 -- maximaler Eingangswert + x = 0.4 -- aktueller Eingangswert + + d_y = 1.0 -- Delta Ausgabewerte (y_max - y_min) + d_x = 0.68 -- Delta Eingangswerte (x_max - x_min) + m = 1,4705882352941176470588235294118 -- Steigung der linearen Funktion (d_y / d_x) + n = 0.0 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max) + + y = 0,58823529411764705882352941176471 -- Ergebnis (m * x + n) + ]] + lAoA = 1.4705882352941176470588235294118 * lAoA + else + --[[ + y_min = 0.0 -- minimaler Ausgabewert + y_max = -0.28 -- maximaler Ausgabewert + x_min = 0.0 -- minimaler Eingangswert + x_max = -0.2 -- maximaler Eingangswert + x = -0.1 -- aktueller Eingangswert + + d_y = -0.28 -- Delta Ausgabewerte (y_max - y_min) + d_x = -0.2 -- Delta Eingangswerte (x_max - x_min) + m = 1.4 -- Steigung der linearen Funktion (d_y / d_x) + n = 0.0 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max) + + y = -0.14 -- Ergebnis (m * x + n) + ]] + lAoA = 1.6000000272478176068843626660856 * lAoA + end + + if lAccelerationUnits > 0.0 then -- positive AOA + --[[ + y_min = 0.0 -- minimaler Ausgabewert + y_max = 1.0 -- maximaler Ausgabewert + x_min = 0.0 -- minimaler Eingangswert + x_max = 11.0 -- maximaler Eingangswert + x = 2.5 -- aktueller Eingangswert + + d_y = 1.0 -- Delta Ausgabewerte (y_max - y_min) + d_x = 11.0 -- Delta Eingangswerte (x_max - x_min) + m = 0.09090909090909090909090909090909 -- Steigung der linearen Funktion (d_y / d_x) + n = 0.0 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max) + + y = 0.22727272727272727272727272727273 -- Ergebnis (m * x + n) + ]] + lAccelerationUnits = 0.09090909090909090909090909090909 * lAccelerationUnits + else + --[[ + y_min = 0.0 -- minimaler Ausgabewert + y_max = -0.40625 -- maximaler Ausgabewert + x_min = 0.0 -- minimaler Eingangswert + x_max = -4.2 -- maximaler Eingangswert + x = -0.5 -- aktueller Eingangswert + + d_y = -0.40625 -- Delta Ausgabewerte (y_max - y_min) + d_x = -4.2 -- Delta Eingangswerte (x_max - x_min) + m = 0.09672619047619047619047619047619 -- Steigung der linearen Funktion (d_y / d_x) + n = 0.0 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max) + + y = -0.09180491799745779417310377425187 -- Ergebnis (m * x + n) + ]] + lAccelerationUnits = 0.09672619047619047619047619047619 * lAccelerationUnits + end + + SendData(lExportID, string.format("%.4f;%.4f", + lAoA, + lAccelerationUnits) ) +end + +-- AOA Indicator and Accelerometer (AOA, GLoad) for MiG-29A, MiG-29S +function FC_Russian_AOA_MiG29(exportid) + local lExportID = exportid or 3 + + local lAoA = LoGetAngleOfAttack() -- ANGLE OF ATTACK AoA (Radian) + local lAccelerationUnits = LoGetAccelerationUnits().y -- G-LOAD + + if lAoA > 0.0 then -- positive AOA + --[[ + y_min = 0.0 -- minimaler Ausgabewert + y_max = 1.0 -- maximaler Ausgabewert + x_min = 0.0 -- minimaler Eingangswert + x_max = 0.68 -- maximaler Eingangswert + x = 0.4 -- aktueller Eingangswert + + d_y = 1.0 -- Delta Ausgabewerte (y_max - y_min) + d_x = 0.68 -- Delta Eingangswerte (x_max - x_min) + m = 1,4705882352941176470588235294118 -- Steigung der linearen Funktion (d_y / d_x) + n = 0.0 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max) + + y = 0,58823529411764705882352941176471 -- Ergebnis (m * x + n) + ]] + lAoA = 1.4705882352941176470588235294118 * lAoA + else + --[[ + y_min = 0.0 -- minimaler Ausgabewert + y_max = -0.28 -- maximaler Ausgabewert + x_min = 0.0 -- minimaler Eingangswert + x_max = -0.2 -- maximaler Eingangswert + x = -0.1 -- aktueller Eingangswert + + d_y = -0.28 -- Delta Ausgabewerte (y_max - y_min) + d_x = -0.2 -- Delta Eingangswerte (x_max - x_min) + m = 1.4 -- Steigung der linearen Funktion (d_y / d_x) + n = 0.0 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max) + + y = -0.14 -- Ergebnis (m * x + n) + ]] + lAoA = 1.6000000272478176068843626660856 * lAoA + end + + if lAccelerationUnits > 0.0 then -- positive AOA + --[[ + y_min = 0.0 -- minimaler Ausgabewert + y_max = 1.0 -- maximaler Ausgabewert + x_min = 0.0 -- minimaler Eingangswert + x_max = 11.0 -- maximaler Eingangswert + x = 2.5 -- aktueller Eingangswert + + d_y = 1.0 -- Delta Ausgabewerte (y_max - y_min) + d_x = 11.0 -- Delta Eingangswerte (x_max - x_min) + m = 0.09090909090909090909090909090909 -- Steigung der linearen Funktion (d_y / d_x) + n = 0.0 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max) + + y = 0.22727272727272727272727272727273 -- Ergebnis (m * x + n) + ]] + lAccelerationUnits = 0.09090909090909090909090909090909 * lAccelerationUnits + else + --[[ + y_min = 0.0 -- minimaler Ausgabewert + y_max = -0.40625 -- maximaler Ausgabewert + x_min = 0.0 -- minimaler Eingangswert + x_max = -4.2 -- maximaler Eingangswert + x = -0.5 -- aktueller Eingangswert + + d_y = -0.40625 -- Delta Ausgabewerte (y_max - y_min) + d_x = -4.2 -- Delta Eingangswerte (x_max - x_min) + m = 0.09672619047619047619047619047619 -- Steigung der linearen Funktion (d_y / d_x) + n = 0.0 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max) + + y = -0.09180491799745779417310377425187 -- Ergebnis (m * x + n) + ]] + lAccelerationUnits = 0.09672619047619047619047619047619 * lAccelerationUnits + end + + SendData(lExportID, string.format("%.4f;%.4f", + lAoA, + lAccelerationUnits) ) +end + +-- Russian Clock ACS-1 for KA-50, SU-25A, MIG-29A , MIG-29S +function FC_Russian_Clock_ACS1(exportid) + local lExportID = exportid or 12 + + local lDefaultOne = 1.0 + local lDefaultNull = 0.0 + + local lCurrentClock = LoGetMissionStartTime() + LoGetModelTime() -- in seconds + local lCurrentHours = lCurrentClock / 43200 -- (3600 * 12) + lCurrentHours = lCurrentHours - math.round(lCurrentHours, 0, "floor") + local lCurrentMinutes = lCurrentClock / 3600 -- (60 * 60) + lCurrentMinutes = lCurrentMinutes - math.round(lCurrentMinutes, 0, "floor") + local lCurrentSeconds = lCurrentClock / 60 + lCurrentSeconds = lCurrentSeconds - math.round(lCurrentSeconds, 0, "floor") + local lFlightTimeHours = LoGetModelTime() / 43200 + lFlightTimeHours = lFlightTimeHours - math.round(lFlightTimeHours, 0, "floor") + local lFlightTimeMinutes = LoGetModelTime() / 3600 + lFlightTimeMinutes = lFlightTimeMinutes - math.round(lFlightTimeMinutes, 0, "floor") + -- currtime_hours {0.0,1.0} + -- currtime_minutes {0.0,1.0} + -- currtime_seconds {0.0,1.0} + -- flight_time_meter_status{0.0,0.2} + -- flight_hours {0.0,1.0} + -- 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", + lCurrentHours, + lCurrentMinutes, + lCurrentSeconds, + lDefaultNull, -- red/white flag + lFlightTimeHours, + lFlightTimeMinutes, + lDefaultNull, + lDefaultNull)) +end + +-- Russian Clock (latest Model) for SU-25T, SU-27, SU-33 +function FC_Russian_Clock_late(exportid) + local lExportID = exportid or 12 + + local lDefaultOne = 1.0 + local lDefaultNull = 0.0 + + local lCurrentClock = LoGetMissionStartTime() + LoGetModelTime() -- in seconds + local lCurrentHours = lCurrentClock / 43200 -- (3600 * 12) + lCurrentHours = lCurrentHours - math.round(lCurrentHours, 0, "floor") + local lCurrentMinutes = lCurrentClock / 3600 -- (60 * 60) + lCurrentMinutes = lCurrentMinutes - math.round(lCurrentMinutes, 0, "floor") + local lCurrentSeconds = lCurrentClock / 60 + lCurrentSeconds = lCurrentSeconds - math.round(lCurrentSeconds, 0, "floor") + local lFlightTimeHours = LoGetModelTime() / 43200 + lFlightTimeHours = lFlightTimeHours - math.round(lFlightTimeHours, 0, "floor") + local lFlightTimeMinutes = LoGetModelTime() / 3600 + lFlightTimeMinutes = lFlightTimeMinutes - math.round(lFlightTimeMinutes, 0, "floor") + -- currtime_hours {0.0,1.0} + -- currtime_minutes {0.0,1.0} + -- currtime_seconds {0.0,1.0} + -- flight_time_meter_status{0.0,0.2} + -- 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", + lCurrentHours, + lCurrentMinutes, + lCurrentSeconds, + lDefaultNull, -- red/white flag + lFlightTimeHours, + lFlightTimeMinutes, + lCurrentSeconds)) +end + +-- Russian Enging RPM (Tachometer) for SU-25A+T, SU-27, SU-33, MIG-29 +function FC_Russian_EngineRPM(exportid) + local lExportID = exportid or 9 + + local lScaleValue = 110 + local lEngineRPMleft = LoGetEngineInfo().RPM.left -- ENG1 RPM % + local lEngineRPMright = LoGetEngineInfo().RPM.right -- ENG2 RPM % + + lEngineRPMleft = lEngineRPMleft / lScaleValue + lEngineRPMleft = (lEngineRPMleft > 1.0 and 1.0 or lEngineRPMleft) -- the result is limited to 1.0 + lEngineRPMright = lEngineRPMright / lScaleValue + 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)) +end + +-- Russian Exthaus Gas Temperature 1.000GradC for SU-25A, SU25T, MIG-29 +function FC_Russian_EGT_1000gc(egttemp, exportid) + local lEGTtemp = egttemp or 1 + local lExportID = exportid or 10 + + --[[ + y_min = 0.0 0.068 -- minimaler Ausgabewert + y_max = 0.068 1.0 -- maximaler Ausgabewert + x_min = 0 200 -- minimaler Eingangswert + x_max = 200 1080 -- maximaler Eingangswert + x = 100 650 -- aktueller Eingangswert + + d_y = 0.068 0.932 -- Delta Ausgabewerte (y_max - y_min) + d_x = 200 880 -- Delta Eingangswerte (x_max - x_min) + m = 0.00034 0.00105909090909090909090909090909 -- Steigung der linearen Funktion (d_y / d_x) + n = 0 -0.1438181818181818181818181818172 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max) + + y = 0.034 0.5445909090909090909090909090913 -- Ergebnis (m * x + n) + ]] + + if lEGTtemp < 200 then + lEGTtemp = 0.00034 * lEGTtemp + else + lEGTtemp = 0.00105909090909090909090909090909 * lEGTtemp + -0.1438181818181818181818181818172 + end + + -- ExthausGasTemperature {0.0,1.0} + SendData(lExportID, string.format("%.4f", lEGTtemp)) +end + +-- Russian Mechanical Device Indicator for SU-25A+T +function FC_Russian_MDI_SU25(exportid) + local lExportID = exportid or 2 + + local lMechInfo = LoGetMechInfo() -- mechanical components, e.g. Flaps, Wheelbrakes,... + if lMechInfo == nil then + return + end + local lTrueAirSpeed = LoGetTrueAirSpeed() + if lTrueAirSpeed == nil then + return + end + + local lWarningLight = 0.0 + lWarningLight = ((lMechInfo.flaps.value > 0.93 and lTrueAirSpeed > 340) and 1.0 or 0.0) -- Speed Warning for Flaps, same light as gear warning light, but blinking light + lWarningLight = (((lMechInfo.gear.status == 1 and lMechInfo.gear.value < 1) or (lMechInfo.gear.status == 0 and lMechInfo.gear.value > 0)) and 1.0 or lWarningLight ) -- gear warning light + -- WarningLight {0.0 = Off, 0.1 = blinking light, 0.2 = on} + -- WarningLight {0.0 = Off, no blinking light, 1.0 = on} + -- nose gear {0, 1} + -- left gear {0, 1} + -- right gear {0, 1} + -- 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", + 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 +end + +-- Russian System Test EKRAN +function FC_EKRAN(exportid) + local lExportID = exportid or 16 + + local lMCPState = LoGetMCPState() -- Warning Lights + if lMCPState == nil then + return + end + local lDisplayWindow = "" -- Message + local lFAILlight = "" -- FAILURE + local lMEMORYlight = "" -- MEMORY + local lTURNlight = "" -- TURN + if gDisplayWindow == nil then + gFC_EKRAN_active = {false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false} + gDisplayWindow = "" + end + + if lMCPState.LeftTailPlaneFailure and not gFC_EKRAN_active[1] then + lDisplayWindow = "LEFT\nTAIL\nPLANE\nFAILURE" + gFC_EKRAN_active[1] = true + elseif lMCPState.RightTailPlaneFailure and not gFC_EKRAN_active[2] then + lDisplayWindow = "RIGHT\nTAIL\nPLANE\nFAILURE" + gFC_EKRAN_active[2] = true + elseif lMCPState.MasterWarning and not gFC_EKRAN_active[3] then + ---lDisplayWindow = "MASTER\nWARNING" -- don't display + gFC_EKRAN_active[3] = true + elseif lMCPState.LeftEngineFailure and not gFC_EKRAN_active[4] then + lDisplayWindow = "LEFT\nENGINE\nFAILURE" + gFC_EKRAN_active[4] = true + elseif lMCPState.RightEngineFailure and not gFC_EKRAN_active[5] then + lDisplayWindow = "RIGHT\nENGINE\nFAILURE" + gFC_EKRAN_active[5] = true + elseif lMCPState.RightAileronFailure and not gFC_EKRAN_active[6] then + lDisplayWindow = "RIGHT\nAILERON\nFAILURE" + gFC_EKRAN_active[6] = true + elseif lMCPState.LeftMainPumpFailure and not gFC_EKRAN_active[7] then + lDisplayWindow = "LEFT\nMAIN\nPUMP\nFAILURE" + gFC_EKRAN_active[7] = true + elseif lMCPState.RightMainPumpFailure and not gFC_EKRAN_active[8] then + lDisplayWindow = "RIGHT\nMAIN\nPUMP\nFAILURE" + gFC_EKRAN_active[8] = true + elseif lMCPState.LeftWingPumpFailure and not gFC_EKRAN_active[9] then + lDisplayWindow = "LEFT\nWING\nPUMP\nFAILURE" + gFC_EKRAN_active[10] = true + elseif lMCPState.RightWingPumpFailure and not gFC_EKRAN_active[10] then + lDisplayWindow = "RIGHT\nWING\nPUMP\nFAILURE" + gFC_EKRAN_active[10] = true + elseif lMCPState.EOSFailure and not gFC_EKRAN_active[11] then + lDisplayWindow = "EOS\nFAILURE" + gFC_EKRAN_active[11] = true + elseif lMCPState.ECMFailure and not gFC_EKRAN_active[12] then + lDisplayWindow = "ECM\nFAILURE" + gFC_EKRAN_active[12] = true + elseif lMCPState.CannonFailure and not gFC_EKRAN_active[13] then + lDisplayWindow = "CANNON\nFAILURE" + gFC_EKRAN_active[13] = true + elseif lMCPState.MLWSFailure and not gFC_EKRAN_active[14] then + lDisplayWindow = "MLWS\nFAILURE" + gFC_EKRAN_active[14] = true + elseif lMCPState.ACSFailure and not gFC_EKRAN_active[15] then + lDisplayWindow = "ACS\nFAILURE" + gFC_EKRAN_active[15] = true + elseif lMCPState.RadarFailure and not gFC_EKRAN_active[16] then + lDisplayWindow = "RADAR\nFAILURE" + gFC_EKRAN_active[16] = true + elseif lMCPState.HelmetFailure and not gFC_EKRAN_active[17] then + lDisplayWindow = "HELMET\nFAILURE" + gFC_EKRAN_active[17] = true + elseif lMCPState.HUDFailure and not gFC_EKRAN_active[18] then + lDisplayWindow = "HUD\nFAILURE" + gFC_EKRAN_active[18] = true + elseif lMCPState.MFDFailure and not gFC_EKRAN_active[19] then + lDisplayWindow = "MFD\nFAILURE" + gFC_EKRAN_active[19] = true + elseif lMCPState.RWSFailure and not gFC_EKRAN_active[20] then + lDisplayWindow = "RWS\nFAILURE" + gFC_EKRAN_active[20] = true + elseif lMCPState.GearFailure and not gFC_EKRAN_active[21] then + lDisplayWindow = "GEAR\nFAILURE" + gFC_EKRAN_active[21] = true + elseif lMCPState.HydraulicsFailure and not gFC_EKRAN_active[22] then + lDisplayWindow = "HYDRAULICS\nFAILURE" + gFC_EKRAN_active[22] = true + elseif lMCPState.AutopilotFailure and not gFC_EKRAN_active[23] then + --lDisplayWindow = "AUTOPILOT\nFAILURE" -- bug in DCS, error is always active + gFC_EKRAN_active[23] = true + elseif lMCPState.FuelTankDamage and not gFC_EKRAN_active[24] then + lDisplayWindow = "FUEL\nTANK\nDAMAGE" + gFC_EKRAN_active[24] = true + end + + if lDisplayWindow ~= "" then + gDisplayWindow = lDisplayWindow + end + if gDisplayWindow ~= "" then + lFAILlight = " FAILURE" + end + -- DisplayWindow (main message) + -- FAILlight (failure text) + -- MEMORYlight (memmory text) + -- TURNlight (turn text) + SendData(lExportID, string.format("%s;%s;%s;%s", + gDisplayWindow, + lFAILlight, + lMEMORYlight, + lTURNlight)) +end + +-- ADI for A-10A, F-15C +function FC_US_ADI(exportid) + local lExportID = exportid or 20 + + local lDefaultNull = 0.0 + local lRadToDCSsignd = math.pi + local lNavInfoPitch = LoGetNavigationInfo().Requirements.pitch -- AP REQUIRED PITCH (Radian) + local lNavInfoRoll = LoGetNavigationInfo().Requirements.roll -- AP REQUIRED BANK (Radian) + local lPitch, lBank, lYaw = LoGetADIPitchBankYaw() -- PITCH, BANK, YAW (Radian) + local lSlipBallPosition = LoGetSlipBallPosition() -- SLIP BALL (-1 +1) + local lGlide = LoGetGlideDeviation() -- VOR1 HORIZONTAL DEFLECTION (-1 +1) + --local lSide = LoGetSideDeviation() -- VOR1 VERTICAL DEFLECTION (-1 +1) + --[[ ADI from A-10C + [17] = "%.4f", -- ADI Pitch + [18] = "%.4f", -- ADI Bank + [24] = "%.4f", -- ADI Slip Ball + [20] = "%.4f", -- ADI Bank Steering Bar + [21] = "%.4f", -- ADI Pitch Steering Bar + [23] = "%.4f", -- ADI Turn Needle + [27] = "%.4f", -- ADI Glide-Slope Indicator + [26] = "%0.1f", -- ADI Glide-Slope Warning Flag + [25] = "%0.1f", -- ADI Attitude Warning Flag + [19] = "%0.1f", -- ADI Course Warning Flag + ]] + lNavInfoPitch = lNavInfoPitch / lRadToDCSsignd + lNavInfoRoll = lNavInfoRoll / lRadToDCSsignd + lNavInfoPitch = (lNavInfoPitch > 0.0 and (0 - lNavInfoPitch) or (lNavInfoPitch - lNavInfoPitch - lNavInfoPitch)) + lPitch = lPitch / (lRadToDCSsignd / 1.5) + lPitch = (lPitch > 0.0 and (0 - lPitch) or (lPitch - lPitch - lPitch)) -- pitch muss negiert werden + lBank = lBank / lRadToDCSsignd + SendData(lExportID, string.format("%.4f;%.4f;%.1f;%.1f;%.4f;%.4f;%.4f;%.1f;%.1f;%.1f", + lPitch, + lBank, + lSlipBallPosition, + lNavInfoRoll, + lNavInfoPitch, + lBank, -- as Turn Needle + lGlide, + lDefaultNull, + lDefaultNull, + lDefaultNull)) +end + +-- Standby ADI for A-10A, F-15C +function FC_US_stbyADI(exportid) + local lExportID = exportid or 21 + + local lDefaultNull = 0.0 + local lRadToDCSsignd = math.pi + local lPitch, lBank, lYaw = LoGetADIPitchBankYaw() -- PITCH, BANK, YAW (Radian) + --local lSide = LoGetSideDeviation() -- VOR1 VERTICAL DEFLECTION (-1 +1) + -- [63] = "%.4f", -- Standby Attitude Indicator pitch {-1.0, 1.0} + -- [64] = "%.4f", -- Standby Attitude Indicator bank {-1.0, 1.0} + -- [65] = "%0.1f", -- Standby Attitude Indicator warning flag {0.0, 1.0} + lPitch = lPitch / (lRadToDCSsignd / 1.5) + --lPitch = (lPitch > 0.0 and (0 - lPitch) or (lPitch + lPitch + lPitch)) -- pitch muss negiert werden + lBank = lBank / lRadToDCSsignd + lBank = (lBank > 0.0 and (0 - lBank) or (lBank - lBank - lBank)) -- Bank muss negiert werden + SendData(lExportID, string.format("%.4f;%.4f;%.1f", + lPitch, + lBank, + lDefaultNull)) +end + +-- HSI for A-10A, F-15C +function FC_US_HSI(distancetoway, exportid) + local lDistanceToWay = distancetoway or 999 + local lExportID = exportid or 22 + + local lDefaultOne = 1.0 + local lDefaultNull = 0.0 + local lRadToDCSunsignd = math.pi * 2 + local lPitch,lBank,lYaw = LoGetADIPitchBankYaw() -- PITCH, BANK, YAW (Radian) + local lHSI_RMI = LoGetControlPanel_HSI().RMI_raw -- VOR1 OBS (Radian) + local lHSI_ADF = LoGetControlPanel_HSI().ADF_raw -- ADF OBS (Radian) + local lHSI_Curse = LoGetControlPanel_HSI().Course -- HSI Course (Radian) + local lHeading = LoGetSelfData().Heading -- HEADING (Radian) + lPitch, lBank = nil +--[[ + [Course] = number: "0.76548692098835" + [CourseDeviation] = number: "0" + [ADF_raw] = number: "5.5811524391174" + [BearingPointer] = number: "0.80134677481978" + [RMI_raw] = number: "5.4092655181885" + [HeadingPointer] = number: "0.098191173578347" + [Heading_raw] = number: "6.2831854820251" + ]] + --[[ HSI A-10C + [34] = "%.4f", -- HSI Heading + [33] = "%.4f", -- HSI Bearing #1 + [35] = "%.4f", -- HSI Bearing #2 + [36] = "%.4f", -- HSI Heading Marker + [47] = "%.4f", -- HSI Course Arrow + [41] = "%.4f", -- HSI Deviation + [29] = "%.2f", -- HSI range_counter_100 + [30] = "%.2f", -- HSI range_counter_10 + [31] = "%.2f", -- HSI range_counter_1 + [42] = "%0.1f", -- HSI Bearing to_from_1 + [43] = "%0.1f", -- HSI Bearing to_from_2 + [46] = "%0.1f", -- HSI Bearing Flag + [40] = "%0.1f", -- HSI Power Flag + [32] = "%0.1f", -- HSI Range Flag + ]] + lDistanceToWay = lDistanceToWay * 0.00062136994937697 -- meter to miles + --lDistanceToWay = math.round(lDistanceToWay / 1000, 1) + local lRangeCounter1 = 0 + local lRangeCounter2 = 0 + local lRangeCounter3 = 0 + if lDistanceToWay > 100 then + lRangeCounter1 = math.round((lDistanceToWay / 100), 0, "floor") * 0.11 + lRangeCounter1 = lRangeCounter1 - math.round(lRangeCounter1, 0, "floor") + end + if lDistanceToWay > 10 then + if lDistanceToWay > 100 then + lRangeCounter2 = (math.round((lDistanceToWay - (math.round(lDistanceToWay / 100, 0, "floor") * 100)), 0, "floor") / 10) * 0.11 + else + lRangeCounter2 = (lDistanceToWay / 10) * 0.11 + lRangeCounter2 = lRangeCounter2 - math.round(lRangeCounter2, 0, "floor") + end + end + if lDistanceToWay > 10 then + lRangeCounter3 = (lDistanceToWay - (math.round(lDistanceToWay / 10, 0, "floor") * 10)) * 0.11 + else + lRangeCounter3 = lDistanceToWay * 0.11 + end + + lHeading = 1.0 - (lHeading / lRadToDCSunsignd) + lHSI_Curse = (lHSI_Curse / lRadToDCSunsignd) + lHSI_ADF = (lHSI_ADF / lRadToDCSunsignd) + -- HSI Heading {0.0, 1.0} + -- HSI Bearing #1 {0.0, 1.0} + -- HSI Bearing #2 {0.0, 1.0} + -- HSI Heading Marker {0.0, 1.0} + -- HSI Course Arrow {0.0, 1.0} + -- HSI Deviation {0.0, 1.0} + -- HSI range_counter_100 + -- HSI range_counter_10 + -- HSI range_counter_1 + -- HSI Bearing to_from_1 + -- HSI Bearing to_from_2 + -- HSI Bearing Flag + -- HSI Power Flag + -- HSI Range Flag + SendData(lExportID, string.format("%.4f;%.1f;%.1f;%.1f;%.4f;%.4f;%.3f;%.3f;%.3f;%.1f;%.1f;%.1f;%.1f;%.1f", + lHeading, -- compass card + lHSI_Curse, -- Bearing #1 + lHSI_Curse, -- Bearing #2 + lDefaultNull, + lHSI_Curse, + lHSI_ADF, + lRangeCounter1, + lRangeCounter2, + lRangeCounter3, + lDefaultNull, + lDefaultNull, + lDefaultNull, + lDefaultNull, + lDefaultNull)) -- deaktiviert die Course Anzeige +end + +-- VVI for A-10A, F-15C +function FC_US_VVI(exportid) + local lExportID = exportid or 15 + local lVVITmp = LoGetVerticalVelocity() * 196.8504 -- VERTICAL SPEED (Meter/Second to Foots/Minute) + -- {-1.0, -0.5, -0.29, 0.29, 0.5, 1.0} + --{-6000, -2000, -1000, 1000, 2000, 6000} + --WriteToLog('lVVITmp 1: '..dump(lVVITmp)) + if lVVITmp >= 0.0 then + --[[ + y_min = 0.0 0.29 0.503 0.765 -- minimaler Ausgabewert + y_max = 0.29 0.503 0.765 1.0 -- maximaler Ausgabewert + x_min = 0.0 1000.0 2000.0 4000.0 -- minimaler Eingangswert + x_max = 1000.0 2000.0 4000.0 6000.0 -- maximaler Eingangswert + x = 500.0 1600.0 2250.0 5500.0 -- aktueller Eingangswert + + d_y = 0.29 0.213 0.262 0.235 -- Delta Ausgabewerte (y_max - y_min) + d_x = 1000.0 1000.0 2000.0 2000.0 -- Delta Eingangswerte (x_max - x_min) + m = 0.00029 0.000213 0.000131 0.0001175 -- Steigung der linearen Funktion (d_y / d_x) + n = 0.0 0.077 0.241 0.295 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max) + + y = 0.145 0.4178 0.53575 0.94125 -- Ergebnis (m * x + n) + ]] + if lVVITmp >= 4000 then + lVVITmp = 0.0001175 * lVVITmp + 0.295 + elseif lVVITmp >= 2000 then + lVVITmp = 0.000131 * lVVITmp + 0.241 + elseif lVVITmp >= 1000 then + lVVITmp = 0.000213 * lVVITmp + 0.077 + else + lVVITmp = 0.00029 * lVVITmp + end + lVVITmp = (lVVITmp > 1.0 and 1.0 or lVVITmp) -- the result is limited to 1.0 + else + --[[ + y_min = -0.0 -0.29 -0.503 -0.765 -- minimaler Ausgabewert + y_max = -0.29 -0.503 -0.765 -1.0 -- maximaler Ausgabewert + x_min = -0.0 -1000.0 -2000.0 -4000.0 -- minimaler Eingangswert + x_max = -1000.0 -2000.0 -4000.0 -6000.0 -- maximaler Eingangswert + x = -500.0 -1600.0 -2250.0 -5500.0 -- aktueller Eingangswert + + d_y = -0.29 -0.213 -0.262 -0.235 -- Delta Ausgabewerte (y_max - y_min) + d_x = -1000.0 -1000.0 -2000.0 -2000.0 -- Delta Eingangswerte (x_max - x_min) + m = 0.00029 0.000213 0.000131 0.0001175 -- Steigung der linearen Funktion (d_y / d_x) + n = 0.0 -0.077 -0.241 -0.295 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max) + + y = -0.145 -0.4178 -0.53575 -0.94125 -- Ergebnis (m * x + n) + ]] + if lVVITmp <= 0 and lVVITmp > -1000 then + lVVITmp = 0.00029 * lVVITmp + elseif lVVITmp <= -1000 and lVVITmp > -2000 then + lVVITmp = 0.000213 * lVVITmp + -0.077 + elseif lVVITmp <= -2000 and lVVITmp > -4000 then + lVVITmp = 0.000131 * lVVITmp + -0.241 + else + lVVITmp = 0.0001175 * lVVITmp + -0.295 + end + + lVVITmp = (lVVITmp < -1.0 and -1.0 or lVVITmp) -- the result is limited to -1.0 + end + SendData(lExportID, string.format("%.4f", lVVITmp)) +end + +-- AOA Indicator (AOA) for A-10A, F-15C +function FC_US_AOA(exportid) + local lExportID = exportid or 16 + local lRadToDCSsignd = math.pi + local lAoA = LoGetAngleOfAttack() -- ANGLE OF ATTACK AoA (Radian) +--WriteToLog('lAoA 1: '..dump(lAoA)) + lAoA = (lAoA / 0.3) + 0.38 + --lAoA = ((lAoA / lRadToDCSsignd) * 10) + 0.38 + --[[ + lAoA = lAoA / (lRadToDCSsignd / 10) + if lAoA >= 0.0 then + lAoA = lAoA + 0.4 + lAoA = lAoA / 18 + else + lAoA = lAoA + 0.4 + lAoA = lAoA / 12 + end + ]] +--WriteToLog('lAoA 2: '..dump(lAoA)) + SendData(lExportID, string.format("%.4f", lAoA) ) +end + +-- Accelerometer (GLoad) for A-10A, F-15C +function FC_US_GLOAD(exportid) + local lExportID = exportid or 17 + + local lAccelerationUnits = LoGetAccelerationUnits().y -- G-LOAD + + lAccelerationUnits = (lAccelerationUnits / 15) + 0.33 + + SendData(lExportID, string.format("%.4f;0;0", lAccelerationUnits) ) +end + +-- US Clock for A-10A, F-15C +function FC_US_Clock(exportid) + local lExportID = exportid or 18 + + local lDefaultOne = 1.0 + local lDefaultNull = 0.0 + + local lCurrentClock = LoGetMissionStartTime() + LoGetModelTime() -- in seconds + local lCurrentHours = lCurrentClock / 43200 -- (3600 * 12) + lCurrentHours = lCurrentHours - math.round(lCurrentHours, 0, "floor") + local lCurrentMinutes = lCurrentClock / 3600 -- (60 * 60) + lCurrentMinutes = lCurrentMinutes - math.round(lCurrentMinutes, 0, "floor") + local lCurrentSeconds = lCurrentClock / 60 + lCurrentSeconds = lCurrentSeconds - math.round(lCurrentSeconds, 0, "floor") + -- currtime_hours {0.0,1.0} + -- currtime_minutes {0.0,1.0} + -- currtime_seconds {0.0,1.0} + SendData(lExportID, string.format("%.4f;%.4f;%.4f", + lCurrentHours, + lCurrentMinutes, + lCurrentSeconds)) +end + +-- US Standby Compass for A-10A, F-15C +function FC_US_Compass(exportid) + local lExportID = exportid or 19 + + local lDefaultNull = 0.0 + local lHeading = math.deg(LoGetSelfData().Heading) -- HEADING (Radian to Grad) + --local lHeading = math.deg(LoGetMagneticYaw()) -- HEADING (Radian to Grad) + --lHeading = 360 - lHeading -- muss umgerechnet werden?? + + --[[ + y_min = 1.0 -- minimaler Ausgabewert + y_max = -1.0 -- maximaler Ausgabewert + x_min = 0.0 -- minimaler Eingangswert + x_max = 360.00 -- maximaler Eingangswert + x = 185.5 -- aktueller Eingangswert + + d_y = -2.0 -- Delta Ausgabewerte (y_max - y_min) + d_x = 360.0 -- Delta Eingangswerte (x_max - x_min) + m = -0,00555555555555555555555555555556 -- Steigung der linearen Funktion (d_y / d_x) + n = 1.0 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max) + + y = 0.4995680345615518 -- Ergebnis (m * x + n) + ]] + lHeading = -0.00555555555555555555555555555556 * lHeading + 1.0 + + SendData(lExportID, string.format("%0.4f;%0.4f;%0.4f", + lHeading, -- heading + lDefaultNull, -- pitch + lDefaultNull)) -- bank +end + +-- US F-15C Exaust Gas Temperature +function FC_F15C_ExaustGasTemp(value, exportid) + local lValue = value or 1 + local lExportID = exportid or 1 + local lValueTmp = lValue + + local lCounter = {[0] = 0.0, [1] = 0.1, [2] = 0.2, [3] = 0.3, [4] = 0.4, [5] = 0.5, [6] = 0.6, [7] = 0.7, [8] = 0.8, [9] = 0.9} + local lCounter3 = 0 + local lValueTmp2 = lValueTmp + + lValueTmp2 = lValueTmp2 / 100 + lValueTmp2 = string.format("%02d", lValueTmp2) + + if lValueTmp > 100 then + lCounter3 = (lValueTmp - (math.round(lValueTmp / 100, 0, "floor") * 100)) * 0.01 + else + lCounter3 = lValueTmp * 0.01 + end + + --[[ + y_min = 0.0 0.08 -- minimaler Ausgabewert + y_max = 0.08 1.0 -- maximaler Ausgabewert + x_min = 0 200 -- minimaler Eingangswert + x_max = 200 1400 -- maximaler Eingangswert + x = 100 650 -- aktueller Eingangswert + + d_y = 0.08 0.92 -- Delta Ausgabewerte (y_max - y_min) + d_x = 200 1200 -- Delta Eingangswerte (x_max - x_min) + m = 0.0004 7.6666666666666666666666666666667e-4 -- Steigung der linearen Funktion (d_y / d_x) + n = 0 -0.07333333333333333333333333333333 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max) + + y = 0.04 0,425 -- Ergebnis (m * x + n) + ]] + + if lValueTmp > 200 then + lValue = 7.6666666666666666666666666666667e-4 * lValueTmp + -0.07333333333333333333333333333333 + else + lValue = 0.0004 * lValueTmp + end + + SendData(lExportID, string.format("%.4f;%.2f;%.2f;%.2f", + lValue, + lCounter[tonumber(string.sub(lValueTmp2, 1, 1))], + lCounter[tonumber(string.sub(lValueTmp2, 2, 2))], + lCounter3)) +end + +-- A-10A Exaust Gas Temperature +function FC_A10A_ExaustGasTemp(value, exportid) + local lValue = value or 1 + local lExportID = exportid or 1 + local lValueTmp = lValue + + --[[ + y_min = 0.0 -- minimaler Ausgabewert + y_max = 1.0 -- maximaler Ausgabewert + x_min = 100.0 -- minimaler Eingangswert + x_max = 1100.00 -- maximaler Eingangswert + x = 605.5 -- aktueller Eingangswert + + d_y = 1.0 -- Delta Ausgabewerte (y_max - y_min) + d_x = 1000.0 -- Delta Eingangswerte (x_max - x_min) + m = 0.001 -- Steigung der linearen Funktion (d_y / d_x) + n = -0.1 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max) + + y = 0.5055 -- Ergebnis (m * x + n) + ]] + lValue = 0.001 * lValue + -0.1 + + local lv1, lValueTmp = math.modf(lValueTmp / 100) -- 100 = Secound Scala + + SendData(lExportID, string.format("%.4f;%.4f", lValue, lValueTmp)) +end + +-- Gauges with 2 needles (small and large), +-- for example: +-- A-10A RPM Engine +-- Su-27/33 Exthaus Gas Temperature 1.200GradC +function FC_TwoNeedlesGauge(value, mainscala, secondscale, exportid) + local lValue = value or 1 + local lMainScala = mainscala or 100 + local lSecondScale = secondscale or 10 + local lExportID = exportid or 1 + local lValueTmp = lValue + + lValue = lValue / lMainScala + lValue = (lValue > 1.0 and 1.0 or lValue) -- the result is limited to 1.0 + + --lValueTmp = lValueTmp - (math.round((lValueTmp / lSecondScale), 0, "floor") * lSecondScale) + --lValueTmp = lValueTmp / lSecondScale + --lValueTmp = (lValueTmp > 1.0 and 1.0 or lValueTmp) -- the result is limited to 1.0 + local lv1, lValueTmp = math.modf(lValueTmp / lSecondScale) + + SendData(lExportID, string.format("%.4f;%.4f", lValue, lValueTmp)) +end + +-- Gauges with 1 needle, +-- for example: +-- A-10A RPM FAN, RPM APU, Exaust Gas Temperature APU, Fuel Flow, Oil Pressure, Hydraulic Pressure +-- F-15C Oil Pressure, Hydraulic Pressure, Engine Exhaust Nozzle Position Indicator +-- Su-25A/T, Russian Hydraulic Pressure Gauges +function FC_OneNeedleGauge(value, scala, exportid) + local lValue = value or 1 + local lScala = scala or 100 + local lExportID = exportid or 1 + + 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)) +end + +-- Gauges with 1 needle and 2 digits display +-- for example: +-- +function FC_OneNeedleGauge2Digits(value, scala, fixdigits, exportid) + local lValue = value or 1 + local lScala = scala or 100 + local lExportID = exportid or 1 + local lFixDigits = fixdigits or 0 + local lValueTmp = lValue + + --local lCounter = {[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} + local lCounter = {[0] = 0.0, [1] = 0.1, [2] = 0.2, [3] = 0.3, [4] = 0.4, [5] = 0.5, [6] = 0.6, [7] = 0.7, [8] = 0.8, [9] = 0.9} + + local lCounter1 = 0 + local lCounter2 = 0 + local lFormat = 2 - lFixDigits + lFormat = "%0"..lFormat.."d" + + local lValueTmp2 = string.format(lFormat, lValueTmp) + --[[ + if lValueTmp > 10 then + if lValueTmp > 100 then + lCounter1 = (math.round((lValueTmp - (math.round(lValueTmp / 100, 0, "floor") * 100)), 0, "floor") / 10) * 0.1 + else + lCounter1 = (lValueTmp / 10) * 0.1 + lCounter1 = lCounter2 - math.round(lCounter2, 0, "floor") + end + end]] + if lValueTmp > 10 then + lCounter2 = (lValueTmp - (math.round(lValueTmp / 10, 0, "floor") * 10)) * 0.1 + else + lCounter2 = lValueTmp * 0.1 + end + + + lValue = lValue / lScala + lValue = (lValue > 1.0 and 1.0 or lValue) -- the result is limited to 1.0 + + SendData(lExportID, string.format("%.4f;%.2f;%.2f", + lValue, + lCounter[tonumber(string.sub(lValueTmp2, 1, 1))], + lCounter2)) +end + +-- Gauges with 1 needle and 3 digits display +-- for example: +-- F-15C RPM, Fuel Flow +function FC_OneNeedleGauge3Digits_alt(value, scala, fixdigits, exportid) + local lValue = value or 1 + local lScala = scala or 100 + local lExportID = exportid or 1 + local lFixDigits = fixdigits or 0 + local lValueTmp = lValue + + local lCounter = {[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} + --local lCounter = {[0] = 0.0, [1] = 0.1, [2] = 0.2, [3] = 0.3, [4] = 0.4, [5] = 0.5, [6] = 0.6, [7] = 0.7, [8] = 0.8, [9] = 0.9} + + local lCounter3 = 0 + local lValueTmp2 = lValueTmp + + if lFixDigits > 0 then + lValueTmp2 = lValueTmp2 / math.pow(10, lFixDigits) + end + + lValueTmp2 = string.format("%03d", lValueTmp2) + + if lValueTmp > 1000 then + lCounter3 = (lValueTmp - (math.round(lValueTmp / 1000, 0, "floor") * 1000)) * math.pow(0.1, lFixDigits + 1) --0.1 + else + lCounter3 = lValueTmp * math.pow(0.1, lFixDigits + 1) --0.1 + end + + lValue = lValue / lScala + lValue = (lValue > 1.0 and 1.0 or lValue) -- the result is limited to 1.0 + + SendData(lExportID, string.format("%.4f;%.2f;%.2f;%.2f", + lValue, + lCounter[tonumber(string.sub(lValueTmp2, 1, 1))], + lCounter[tonumber(string.sub(lValueTmp2, 2, 2))], + lCounter3)) +end + +-- Gauges with 1 needle and 3 digits display +-- for example: +-- F-15C RPM, Fuel Flow +function FC_OneNeedleGauge3Digits(value, scala, fixdigits, exportid) + local lValue = value or 1 + local lScala = scala or 100 + local lExportID = exportid or 1 + local lFixDigits = fixdigits or 0 + local lValueTmp = lValue + local lFactor = string.len(tostring(lScala)) - 2 + lFactor = math.pow(10, lFactor) + + local lCounter = {[0] = 0.0, [1] = 0.1, [2] = 0.2, [3] = 0.3, [4] = 0.4, [5] = 0.5, [6] = 0.6, [7] = 0.7, [8] = 0.8, [9] = 0.9} + + local lValueTmp2 = lValueTmp + + if lFixDigits > 0 then + lValueTmp2 = lValueTmp2 / math.pow(10, lFixDigits) + end + + lValueTmp2 = string.format("%03d", lValueTmp2) + + local lv1, lCounter3 = math.modf(lValueTmp / lFactor) + + lValue = lValue / lScala + lValue = (lValue > 1.0 and 1.0 or lValue) -- the result is limited to 1.0 + + SendData(lExportID, string.format("%.4f;%.2f;%.2f;%.2f", + lValue, + lCounter[tonumber(string.sub(lValueTmp2, 1, 1))], + lCounter[tonumber(string.sub(lValueTmp2, 2, 2))], + lCounter3)) +end + +-- Gauges with 1 needle and 4 digits display +-- for example: +-- +function FC_OneNeedleGauge4Digits(value, scala, fixdigits, exportid) + local lValue = value or 1 + local lScala = scala or 100 + local lExportID = exportid or 1 + local lFixDigits = fixdigits or 0 + local lValueTmp = lValue + + --local lCounter = {[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} + local lCounter = {[0] = 0.0, [1] = 0.1, [2] = 0.2, [3] = 0.3, [4] = 0.4, [5] = 0.5, [6] = 0.6, [7] = 0.7, [8] = 0.8, [9] = 0.9} + + local lCounter1 = 0 + local lCounter2 = 0 + local lCounter3 = 0 + local lCounter4 = 0 + local lValueTmp2 = lValueTmp + if lFixDigits > 0 then + lValueTmp2 = lValueTmp2 / math.pow(10, lFixDigits) + end + lValueTmp2 = string.format("%04d", lValueTmp2) + --[[ + if lValueTmp > 10000 then + lCounter1 = math.round((lValueTmp / 1000), 0, "floor") * 0.1 + lCounter1 = lCounter1 - math.round(lCounter1, 0, "floor") + end + if lValueTmp > 1000 then + if lValueTmp > 100 then + lCounter2 = (math.round((lValueTmp - (math.round(lValueTmp / 100, 0, "floor") * 100)), 0, "floor") / 10) * 0.1 + else + lCounter2 = (lValueTmp / 10) * 0.1 + lCounter2 = lCounter2 - math.round(lCounter2, 0, "floor") + end + end + if lValueTmp > 100 then + if lValueTmp > 10 then + lCounter3 = (math.round((lValueTmp - (math.round(lValueTmp / 100, 0, "floor") * 100)), 0, "floor") / 10) * 0.1 + else + lCounter3 = (lValueTmp / 10) * 0.1 + lCounter3 = lCounter3 - math.round(lCounter3, 0, "floor") + end + end]] + if lValueTmp > 10 then + lCounter4 = (lValueTmp - (math.round(lValueTmp / 10, 0, "floor") * 10)) * 0.1 + else + lCounter4 = lValueTmp * 0.1 + end + + + lValue = lValue / lScala + lValue = (lValue > 1.0 and 1.0 or lValue) -- the result is limited to 1.0 + + SendData(lExportID, string.format("%.4f;%.2f;%.2f;%.2f;%.2f", + lValue, + lCounter[tonumber(string.sub(lValueTmp2, 1, 1))], + lCounter[tonumber(string.sub(lValueTmp2, 2, 2))], + lCounter[tonumber(string.sub(lValueTmp2, 3, 3))], + lCounter4)) +end + + +-- Auxiliary Functions for Hardware export + +function SPO15RWR(hardware) +-- The RWR display indicates any threat radars illuminating ("painting") the aircraft. +-- Information is presented as symbols representing the type and direction to the threat. +-- Six illuminated symbols at the bottom of the display notify the pilot of the threat radar type. +-- The system indicates both enemy and friendly radars +-- +--[[ +LoGetTWSInfo() -- return Threat Warning System status (result the table ) +result_of_LoGetTWSInfo = +{ + Mode = , -- current mode (0 - all ,1 - lock only,2 - launch only + Emitters = {table of emitters} +} +emitter_table = +{ + ID =, -- world ID + Type = {level1,level2,level3,level4}, -- world database classification of emitter + Power =, -- power of signal + Azimuth =, + Priority =,-- priority of emitter (int) + SignalType =, -- string with vlues: "scan" ,"lock", "missile_radio_guided","track_while_scan"; +}]] + + local lHardware = hardware or 1 + local lTWSInfo = LoGetTWSInfo() -- SPO15 Information + if lTWSInfo == nil then + return + end + --WriteToLog('lTWSInfo: '..dump(lTWSInfo)) + --[[ + [Emitters] = { + [1] = { + [Type] = { + [level3] = number: "105" + [level1] = number: "2" + [level4] = number: "46" + [level2] = number: "16" + } + [Azimuth] = number: "1.8300691843033" + [Power] = number: "0.92326503992081" + [ID] = number: "16777472" + [Priority] = number: "230.92445373535" + [SignalType] = string: "lock" + } + [2] = { + [Type] = { + [level3] = number: "101" + [level1] = number: "2" + [level4] = number: "39" + [level2] = number: "16" + } + [Azimuth] = number: "2.6759564876556" + [Power] = number: "0.90609884262085" + [ID] = number: "16777728" + [Priority] = number: "140.90609741211" + [SignalType] = string: "scan" + } + } + [Mode] = number: "0" + ]] + + local lPriorityTmp = 0 + local lPrimaryThreatTmp = 0 + local lActiveLamp = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0} -- 10 x for direction + if(#lTWSInfo.Emitters > 0) then + + gES_SPO15_FoundErmitter = true + + for EmitterIndex = 1, #lTWSInfo.Emitters, 1 do + if(lTWSInfo.Emitters[EmitterIndex].Priority > lPriorityTmp) then + lPriorityTmp = lTWSInfo.Emitters[EmitterIndex].Priority + lPrimaryThreatTmp = EmitterIndex + end + end + + for EmitterIndex = 1, #lTWSInfo.Emitters, 1 do + + local lAzimut = math.round(lTWSInfo.Emitters[EmitterIndex].Azimuth * 90, 1) + + if EmitterIndex == lPrimaryThreatTmp then + -- primary threat + -- direction to the threat + SendDataHW("401", (lAzimut <= -170.0 and 1 or 0), lHardware ) -- left back side + SendDataHW("402", ((lAzimut <= -90.0 and lAzimut >= -170.0 ) and 1 or 0), lHardware ) -- left 90 degree + SendDataHW("403", ((lAzimut <= -55.0 and lAzimut >= -125.0 ) and 1 or 0), lHardware ) -- left 50 degree + SendDataHW("404", ((lAzimut <= -30.0 and lAzimut >= -70.0 ) and 1 or 0), lHardware ) -- left 30 degree + SendDataHW("405", ((lAzimut <= 5.0 and lAzimut >= -40.0 ) and 1 or 0), lHardware ) -- left 10 degree + SendDataHW("406", ((lAzimut >= -5.0 and lAzimut <= 40.0 ) and 1 or 0), lHardware ) -- right 10 degree + SendDataHW("407", ((lAzimut >= 30.0 and lAzimut <= 70.0 ) and 1 or 0), lHardware ) -- right 30 degree + SendDataHW("408", ((lAzimut >= 55.0 and lAzimut <= 125.0 ) and 1 or 0), lHardware ) -- right 50 degree + SendDataHW("409", ((lAzimut >= 90.0 and lAzimut <= 170.0 ) and 1 or 0), lHardware ) -- right 90 degree + SendDataHW("410", (lAzimut >= 170.0 and 1 or 0), lHardware ) -- right back side + + -- power of the threat + local lPower = math.round(lTWSInfo.Emitters[EmitterIndex].Power * 15, 0, "ceil") + 1 + --WriteToLog("lPower: "..lPower) + SendDataHW("411", (lPower <= 1 and 0 or 1), lHardware ) -- 1. power lamp + SendDataHW("412", (lPower <= 2 and 0 or 1), lHardware ) -- 2. power lamp + SendDataHW("413", (lPower <= 3 and 0 or 1), lHardware ) -- 3. power lamp + SendDataHW("414", (lPower <= 4 and 0 or 1), lHardware ) -- 4. power lamp + SendDataHW("415", (lPower <= 5 and 0 or 1), lHardware ) -- 5. power lamp + SendDataHW("416", (lPower <= 6 and 0 or 1), lHardware ) -- 6. power lamp + SendDataHW("417", (lPower <= 7 and 0 or 1), lHardware ) -- 7. power lamp + SendDataHW("418", (lPower <= 8 and 0 or 1), lHardware ) -- 8. power lamp + SendDataHW("419", (lPower <= 9 and 0 or 1), lHardware ) -- 9. power lamp + SendDataHW("420", (lPower <= 10 and 0 or 1), lHardware ) -- 10. power lamp + SendDataHW("421", (lPower <= 11 and 0 or 1), lHardware ) -- 11. power lamp + SendDataHW("422", (lPower <= 12 and 0 or 1), lHardware ) -- 12. power lamp + SendDataHW("423", (lPower <= 13 and 0 or 1), lHardware ) -- 13. power lamp + SendDataHW("424", (lPower <= 14 and 0 or 1), lHardware ) -- 14. power lamp + SendDataHW("425", (lPower <= 15 and 0 or 1), lHardware ) -- 15. power lamp + + -- type of the threat + local lPrimaryTypeTmp = FC_FindRadarTypeForSPO15(lTWSInfo, lPrimaryThreatTmp) + SendDataHW("430", (lPrimaryTypeTmp.AIR == 1 and 1 or 0), lHardware ) -- primary Air or Weapon + SendDataHW("431", (lPrimaryTypeTmp.LRR == 1 and 1 or 0), lHardware ) -- long range radar + SendDataHW("432", (lPrimaryTypeTmp.MRR == 1 and 1 or 0), lHardware ) -- mid range radar + SendDataHW("433", (lPrimaryTypeTmp.SRR == 1 and 1 or 0), lHardware ) -- short range radar + SendDataHW("434", (lPrimaryTypeTmp.EWR == 1 and 1 or 0), lHardware ) -- EWR + SendDataHW("435", (lPrimaryTypeTmp.AWACS == 1 and 1 or 0), lHardware ) -- AWACS + + -- look or missil on air + if lPrimaryTypeTmp.Lock == 0.1 then + SendDataHW("440", 0, lHardware ) + SendDataHW("441", 1, lHardware ) -- blinking lights on + elseif lPrimaryTypeTmp.Lock == 0.2 then + SendDataHW("440", 1, lHardware ) + SendDataHW("441", 0, lHardware ) -- blinking lights off + end + -- hemisphere + SendDataHW("442", lPrimaryTypeTmp.TopHemisphere, lHardware ) -- top hemisphere + SendDataHW("443", lPrimaryTypeTmp.BottomHemisphere, lHardware ) -- bottom hemisphere + + lPrimaryTypeTmp = nil + + end + + lActiveLamp = SPO15RWR_SendDataHW(lActiveLamp, 1, "451", lAzimut <= -170.0, lHardware ) -- left back side + lActiveLamp = SPO15RWR_SendDataHW(lActiveLamp, 2, "452", (lAzimut <= -90.0 and lAzimut >= -170.0 ), lHardware ) -- left 90 degree + lActiveLamp = SPO15RWR_SendDataHW(lActiveLamp, 3, "453", (lAzimut <= -55.0 and lAzimut >= -125.0 ), lHardware ) -- left 50 degree + lActiveLamp = SPO15RWR_SendDataHW(lActiveLamp, 4, "454", (lAzimut <= -30.0 and lAzimut >= -70.0 ), lHardware ) -- left 30 degree + lActiveLamp = SPO15RWR_SendDataHW(lActiveLamp, 5, "455", (lAzimut <= 5.0 and lAzimut >= -40.0 ), lHardware ) -- left 10 degree + lActiveLamp = SPO15RWR_SendDataHW(lActiveLamp, 6, "456", (lAzimut >= -5.0 and lAzimut <= 40.0 ), lHardware ) -- right 10 degree + lActiveLamp = SPO15RWR_SendDataHW(lActiveLamp, 7, "457", (lAzimut >= 30.0 and lAzimut <= 70.0 ), lHardware ) -- right 30 degree + lActiveLamp = SPO15RWR_SendDataHW(lActiveLamp, 8, "458", (lAzimut >= 55.0 and lAzimut <= 125.0 ), lHardware ) -- right 50 degree + lActiveLamp = SPO15RWR_SendDataHW(lActiveLamp, 9, "459", (lAzimut >= 90.0 and lAzimut <= 170.0 ), lHardware ) -- right 90 degree + lActiveLamp = SPO15RWR_SendDataHW(lActiveLamp, 10, "460", lAzimut >= 170.0, lHardware ) -- right back side + + end + + -- type of the secondary threat + local lSecondaryTypeTmp = FC_FindRadarTypeForSPO15(lTWSInfo) + SendDataHW("470", (lSecondaryTypeTmp.AIR == 1 and 1 or 0), lHardware ) -- primary Air or Weapon + SendDataHW("471", (lSecondaryTypeTmp.LRR == 1 and 1 or 0), lHardware ) -- long range radar + SendDataHW("472", (lSecondaryTypeTmp.MRR == 1 and 1 or 0), lHardware ) -- mid range radar + SendDataHW("473", (lSecondaryTypeTmp.SRR == 1 and 1 or 0), lHardware ) -- short range radar + SendDataHW("474", (lSecondaryTypeTmp.EWR == 1 and 1 or 0), lHardware ) -- EWR + SendDataHW("475", (lSecondaryTypeTmp.AWACS == 1 and 1 or 0), lHardware ) -- AWACS + lSecondaryTypeTmp = nil + + else + lPriorityTmp = 0 + lPrimaryThreatTmp = 0 + + if gES_SPO15_FoundErmitter ~= nil and gES_SPO15_FoundErmitter then + SPO15RWR_Reset(401, 480, lHardware) + end + end + --[[ +level: 2, 16, 101, 39 +lNameByType: string: "hawk sr" + +alle Level -> wsTypes.lua +oder +Nummer 101 -> AN-MPQ-51 HAWK SR.lua +Nummer 39 -> TechnicsTable.sht + +lNameByType: string: "hawk sr" -> db_sensors.lua + + ]] +end + + +-- Auxiliary Functions + +function FC_FindRadarTypeForSPO15(lTWSInfo, PrimaryThreat) + local lPrimaryThreat = PrimaryThreat or 0 + local lReturn = {AIR = 0, LRR = 0, MRR = 0, SRR = 0, EWR = 0, AWACS = 0, Lock = 0, TopHemisphere = 0, BottomHemisphere = 0} + + for EmitterIndex = 1, #lTWSInfo.Emitters, 1 do + if lPrimaryThreat ~= 0 then + EmitterIndex = lPrimaryThreat + end + local lType = lTWSInfo.Emitters[EmitterIndex].Type + --WriteToLog('level: '..lType.level1..', '..lType.level2..', '..lType.level3..', '..lType.level4) + local lNameByType = LoGetNameByType(lType.level1, lType.level2, lType.level3, lType.level4) -- world database classification of emitter, args 4 (number : level1,level2,level3,level4), result string + --WriteToLog('lNameByType: '..dump(lNameByType)) + + -- threat type + if (lType.level1 == 1 or lType.level1 == 4) and + not(lType.level4 == 26 or -- level4 26: A-50 + lType.level4 == 27 or -- level4 27: E-3 + lType.level4 == 41) then -- level4 41: E-2C + lReturn.AIR = 1 -- primary Air or Weapon + end + + if lType.level1 == 2 or lType.level1 == 3 then + -- ground or navy + if lType.level2 == 16 then + local lAn, lEn + -- Ground SAM + lAn, lEn = string.find("s300 sr,s300 tr,an/mpq-53", lNameByType, 0, true) + -- long range radar + if lAn ~= nil then + lReturn.LRR = 1 + end + + lAn, lEn = string.find("p19,snr-125,kub,hawk sr,hawk tr,buk sr,buk tr,5n66m sr", lNameByType, 0, true) + -- mid range radar + if lAn ~= nil then + lReturn.MRR = 1 + end + + lAn, lEn = string.find("M163 Vulcan,shilka zsu-23-4,gepard,roland ads,roland radar,osa 9a33 ln,2c6m,9a331,Dog Ear Radar", lNameByType, 0, true) + -- short range radar + if lAn ~= nil then + lReturn.SRR = 1 + end +--[[ if lType.level4 == 27 or -- Dog Ear Radar + lType.level4 == 31 or -- roland ads + lType.level4 == 32 or -- roland radar + lType.level4 == 38 then -- gepard + lReturn.SRR = 1 + end +]] + lAn, lEn = string.find("1l13 ewr station,55G6", lNameByType, 0, true) + -- EWR + if lAn ~= nil then + lReturn.EWR = 1 + end + + elseif lType.level2 == 12 then + local lAn, lEn + -- Ship + lAn, lEn = string.find("FFG-7 Oliver H. Perry class,SG-47 Ticonderoga class", lNameByType, 0, true) + -- long range radar + if lAn ~= nil then + lReturn.LRR = 1 + end + + lAn, lEn = string.find("CVN-70 Vinson", lNameByType, 0, true) + -- short range radar + if lAn ~= nil then + lReturn.SRR = 1 + end + end + elseif lType.level1 == 1 and lType.level2 == 1 and lType.level3 == 5 then + if lType.level4 == 26 or lType.level4 == 27 or lType.level4 == 41 then + -- AWACS + -- level4 26: A-50 + -- level4 27: E-3 + -- level4 41: E-2C + lReturn.AWACS = 1 + end + end + -- primary threat handling only + if lPrimaryThreat ~= 0 then + if lTWSInfo.Emitters[lPrimaryThreat].SignalType == "lock" then + -- look + lReturn.Lock = 0.2 + + lReturn.TopHemisphere = 1 -- top hemisphere + lReturn.BottomHemisphere = 1 -- bottom hemisphere + elseif lTWSInfo.Emitters[lPrimaryThreat].SignalType == "missile_radio_guided" then + -- Rocket on air + lReturn.Lock = 0.1 + elseif lTWSInfo.Emitters[lPrimaryThreat].SignalType == "scan" then + -- beep + elseif lTWSInfo.Emitters[lPrimaryThreat].SignalType == "track_while_scan" then + -- ??? + else + lReturn.Lock = 0 + end + + local lErmitterObject = LoGetObjectById(lTWSInfo.Emitters[lPrimaryThreat].ID) + local lErmitterObjectAlt = 0 + + if lErmitterObject then + lErmitterObjectAlt = lErmitterObject.LatLongAlt.Alt + end + + local lSelfData = LoGetSelfData() + local lSelfDataAlt = math.round(lSelfData.LatLongAlt.Alt, 0) + + if lErmitterObjectAlt and lSelfDataAlt then + --WriteToLog('lErmitterObjectAlt: '..lErmitterObjectAlt..', lSelfDataAlt: '..lSelfDataAlt) + if lErmitterObjectAlt > (lSelfDataAlt + 200) then + lReturn.TopHemisphere = 1 -- top hemisphere + elseif lErmitterObjectAlt < (lSelfDataAlt - 200) then + lReturn.BottomHemisphere = 1 -- bottom hemisphere + else + lReturn.TopHemisphere = 1 -- top hemisphere + lReturn.BottomHemisphere = 1 -- bottom hemisphere + end + end + + lErmitterObject, lErmitterObjectAlt, lSelfData, lSelfDataAlt = nil + + break + end + end + + return lReturn +end + +function WeaponStatusPanel_selectCurrentPayloadStation(_index) + if gES_PayloadInfo.Stations[gES_PayloadInfo.CurrentStation].CLSID == gES_PayloadInfo.Stations[_index].CLSID and gES_PayloadInfo.CurrentStation ~= _index then + SendDataHW(gES_TmpStationToPanel[_index].CurrentID, 1, gES_TmpStationToPanel[_index].HardwareID) + end +end + +function SPO15RWR_Reset(lMinId, lMaxID, lHardware) +--WriteToLog('SPO15RWR_Reset') + for lCounter = lMinId, lMaxID, 1 do + SendDataHW(lCounter, 0, lHardware) + end + + gES_SPO15_FoundErmitter = false +end + +function SPO15RWR_SendDataHW(lActiveLamp, lLamp, lKey, lValue, lHardware) +--WriteToLog('SPO15RWR_SendDataHW: '..dump(lActiveLamp)..', '..dump(lLamp)..', '..dump(lKey)..', '..dump(lValue)) + if lActiveLamp[lLamp] == 0 then + if lValue then + SendDataHW(lKey, 1, lHardware ) + lActiveLamp[lLamp] = 1 + end + end + + return lActiveLamp +end + +function WeaponStatusPanel_Reset(lMinId, lMaxID, lHardware) +--WriteToLog('WeaponStatusPanel_Reset') + for lCounter = lMinId, lMaxID, 1 do + SendDataHW(lCounter, 0, lHardware) + end +end + +function WeaponStatusPanel_selectCurrentPayloadStationGlassCockpit(_index) + if gES_PayloadInfo.Stations[gES_PayloadInfo.CurrentStation].CLSID == gES_PayloadInfo.Stations[_index].CLSID and gES_PayloadInfo.CurrentStation ~= _index then + gES_TmpWeaponPanelActive[gES_TmpStationToPanel[_index].CurrentID] = 1 + end +end + +function WeaponStatusPanel_FindCannonContainer(_index) + if gES_PayloadInfo.Stations[_index].weapon.level1 == 4 and -- weapon + gES_PayloadInfo.Stations[_index].weapon.level2 == 6 then -- Shell + gES_CannonContainer[_index] = gES_PayloadInfo.Stations[_index].CLSID + gES_CannonContainer.counter = gES_CannonContainer.counter + 1 + end +end \ No newline at end of file diff --git a/ExportsModules/FW-190D9.lua b/ExportsModules/FW-190D9.lua new file mode 100644 index 0000000..b37ff9b --- /dev/null +++ b/ExportsModules/FW-190D9.lua @@ -0,0 +1,320 @@ +-- FW-190D9 Dora +-- Version 0.9.9 + +gES_FoundDCSModule = true + +gES_GlassCockpitConfigEveryFrameArguments = +{ + -- Flight Instruments + [36] = "%.4f", -- AirspeedNeedle {0, 100, 150, 200, 250, 300, 350, 400, 500, 600, 700, 750, 800, 850, 900} = {0.0, 0.038, 0.088, 0.150, 0.216, 0.278, 0.333, 0.395, 0.530, 0.660, 0.777,0.836, 0.892, 0.938, 0.988} + [42] = "%.4f", -- Variometer {-30, -20, -10, -5, 5, 10, 20, 30} = {-1, -0.770, -0.558, -0.338,0.338,0.558, 0.770, 1.0} + --TrimmNeedle + [76] = "%.4f", -- TrimmNeedle {-1.0, 1.0} + --ADF + [29] = "%.4f", -- ADF_Vertical {-1.0, 1.0} + [30] = "%.4f", -- ADF_Horizont {-1.0, 1.0} + -- Altimeter + [35] = "%.4f", -- Altimeter_km {0.0, 10.0} = {0.0, 1.0} + [32] = "%.4f", -- Altimeter_m {0.0, 1000.0} = {0.0, 1.0} + [33] = "%.4f", -- Altimeter_Pressure {712.56, 780.07} = {0.0, 1.0} + -- Artificial horizon + [37] = "%.4f", -- AHorizon_Pitch {0.33, -0.33} + [38] = "%.4f", -- AHorizon_Bank {1.0, -1.0} + [40] = "%.4f", -- TurnNeedle {-1.0, 1.0} + [41] = "%.4f", -- Slipball {-1.0, 1.0} + --oxygen pressure indicator + [112] = "%.4f", -- Oxygen_Pressure {0.0, 250.0} = {0.0, 1.0} + [113] = "%.4f", -- Oxygen_Flow_Blinker {0.0, 1.0} + --Remote compass + [45] = "%.4f", -- CompassHeading {0.0, 1.0} + [44] = "%.4f", -- CommandedCourse {0.0, 1.0} + -- Engine + [46] = "%.4f", -- Manifold_Pressure {0.5, 2.5} = {0.0, 1.0} + [47] = "%.4f", -- Engine_RPM {0.0, 500.0, 1000.0, 1500, 2000, 2500, 3000, 3500, 3600.0} = {0.0, 0.032, 0.082, 0.206, 0.390, 0.601, 0.789, 0.961, 0.983} + [96] = "%.4f", -- Coolant_Temperature {10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0, 110.0, 120.0, 130.0} = {0.070, 0.131, 0.206, 0.289, 0.377, 0.468, 0.564, 0.655, 0.738, 0.811, 0.892, 0.946, 1.0} + [97] = "%.4f", -- Oil_Temperature {10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0, 110.0, 120.0, 130.0} = {0.070, 0.131, 0.206, 0.289, 0.377, 0.468, 0.564, 0.655, 0.738, 0.811, 0.892, 0.946, 1.0} + [95] = "%.4f", -- Oil_Pressure {0.0, 15.0} -- at = {0, 1.0} + [106] = "%.4f", -- MW50_Pressure {0.0, 0.1, 0.2, 0.3, 0.7, 0.8, 0.9, 1.0} -- at = {0.0, 0.068, 0.169, 0.273, 0.680, 0.780, 0.880, 1.0} + -- Fuel + [94] = "%.4f", -- Fuel_Pressure {0.0, 3.0} -- at = {0.0, 1.0} + [98] = "%.4f", -- FuelScaleUpper {0.0, 50.0, 100.0, 150.0, 200.0, 250.0, 300.0} = {0.0, 0.130, 0.308, 0.50, 0.7, 0.87, 1.0} + --???[98] = "%.4f", -- FuelScaleLower {0.0, 50.0, 100.0, 150.0, 200.0, 230.0, 250.0} = {0.0, 0.098, 0.328, 0.576, 0.833, 0.950, 1.0} + [100] = "%.4f", -- Fuel_Low_Fwd {0.0, 1.0} + [101] = "%.4f", -- Fuel_Low_Rear {0.0, 1.0} + [195] = "%.4f", -- Fluor_Light {0.0, 1.0} + --Clock + [21] = "%.4f", -- CLOCK_currtime_hours {0.0, 12.0} = {0.0, 1.0} + [22] = "%.4f", -- CLOCK_currtime_minutes {0.0, 60.0} = {0.0, 1.0} + [23] = "%.4f", -- CLOCK_currtime_seconds {0.0, 60.0} = {0.0, 1.0} + [27] = "%.4f", -- CLOCK_chrono_minutes {0.0, 15.0} = {0.0, 1.0} + --Ammon Counter + [52] = "%.4f", -- Ammo_Counter_1 {0.0, 500.0} = {0.0, 1.0} + [55] = "%.4f", -- Ammo_Counter_2 {0.0, 500.0} = {0.0, 1.0} + [58] = "%.4f", -- Ammo_Counter_3 {0.0, 500.0} = {0.0, 1.0} + [61] = "%.4f", -- Ammo_Counter_4 {0.0, 500.0} = {0.0, 1.0} + -- Gun_Fire + [50] = "%.4f", -- Gun_Fire_1 {0.0, 1.0} + [164] = "%.4f", -- Gun_Fire_2 {0.0, 1.0} + [165] = "%.4f", -- Gun_Fire_3 {0.0, 1.0} + [166] = "%.4f", -- Gun_Fire_4 {0.0, 1.0} + --Target System + [133] = "%.4f", -- TargetDist {0.0, 10.0, 100.0, 300.0, 600.0, 700.0, 800.0, 1000.0} = {0.0, 0.0, 0.323, 0.568, 0.709, 0.813, 0.917, 1.0} + --Bomb Lamps + [196] = "%1d", -- BombLamp_1 {0.0, 1.0} + [197] = "%1d", -- BombLamp_2 {0.0, 1.0} + [198] = "%1d", -- BombLamp_3 {0.0, 1.0} + [199] = "%1d", -- BombLamp_4 {0.0, 1.0} + [137] = "%1d", -- RocketEmCvr {0.0, 1.0} + --Gear Lamps + [68] = "%1d", -- L_GEAR_UP {0.0, 1.0} + [69] = "%1d", -- L_GEAR_DOWN {0.0, 1.0} + [70] = "%1d", -- R_GEAR_UP {0.0, 1.0} + [71] = "%1d", -- R_GEAR_DOWN {0.0, 1.0} + --Flaps Lamps + [72] = "%1d", -- FLAPS_UP {0.0, 1.0} + [73] = "%1d", -- FLAPS_START {0.0, 1.0} + [74] = "%1d" -- FLAPS_DOWN {0.0, 1.0} +} +gES_GlassCockpitConfigArguments = +{ + [159] = "%.2f", -- Radiator Flaps Control (axis) 1.0 in 0.4 steps + [160] = "%1d", -- Cold Start/Wind Screen Washer {0, 1} + --Engine Control Panel + [75] = "%.1f", -- Magneto Switch (Off, M1, M2, M1+M2) {0.0, 0.3, 0.6, 0.9} + [104] = "%1d", -- Starter Switch Cover {0, 1} + [105] = "%.1f", -- Starter Switch. Left Button - Starter Power. Right Button - Magnetic Clutch {0.0, 0.5, 1.0} + [91] = "%1d", -- MBG Emergency Mode Handle {0, 1} + [85] = "%1d", -- MW-50 Switch {0, 1} + --Fuel system + [90] = "%.1f", -- Fuel Tank Selector Valve (CLOSE/FORWARD/AFT/BOTH) {0.0, 0.1, 0.2, 0.3} + [99] = "%.1f", -- Fuel Gauge Selector (FORWARD/NONE/AFT) {0.0, 0.5, 1.0} + --[161] = "%1d", -- "MW-B4 Selector (Not Functional) + [162] = "%1d", -- Primer Pump {0, 1} + --electric system + [79] = "%1d", -- Electric Kill-switch + [163] = "%1d", -- Emergency Equipment Destruction {0, 1} + --Circuit Breakers + [138] = "%1d", -- Circuit Breakers Cover {0, 1} + [141] = "%1d", -- Flaps, Trimmer, Artificial Horizon Power On {0, 1} + [142] = "%1d", -- Flaps, Trimmer, Artificial Horizon Power Off {0, 1} + [143] = "%1d", -- Landing Gear Power On {0, 1} + [144] = "%1d", -- Landing Gear Power Off {0, 1} + [145] = "%1d", -- Pitot and Heating Cover On {0, 1} + [146] = "%1d", -- Pitot and Heating Cover Off {0, 1} + [147] = "%1d", -- FuG25a On {0, 1} + [148] = "%1d", -- FuG25a Off {0, 1} + [149] = "%1d", -- FuG16ZY On {0, 1} + [150] = "%1d", -- FuG16ZY Off {0, 1} + [151] = "%1d", -- Instrument Lights, Gun-sight, Indicators, Compass, Starter On {0, 1} + [152] = "%1d", -- Instrument Lights, Gun-sight, Indicators, Compass, Starter Off {0, 1} + [153] = "%1d", -- Generator On {0, 1} + [154] = "%1d", -- Generator Off {0, 1} + [155] = "%1d", -- Battery On {0, 1} + [156] = "%1d", -- Battery Off {0, 1} + --Circuit Breakers of additional panel + [121] = "%1d", -- Navigation Lights On {0, 1} + [120] = "%1d", -- Navigation Lights Off {0, 1} + [123] = "%1d", -- Forward Tank Pump On {0, 1} + [122] = "%1d", -- Forward Tank Pump Off {0, 1} + [125] = "%1d", -- Rear Tank Pump On {0, 1} + [124] = "%1d", -- Rear Tank Pump Off {0, 1} + [127] = "%1d", -- Auxiliary Tank Pump On {0, 1} + [126] = "%1d", -- Auxiliary Tank Pump Off {0, 1} + [129] = "%1d", -- MW-50 On {0, 1} + [128] = "%1d", -- MW-50 Off {0, 1} + --canopy + [115] = "%1d", -- Canopy Emergency Release Handle {0, 1} + [114] = "%.2f", -- Canopy Hand Crank (axis) + -- Throttle + [200] = "", -- Throttle Lock {0, 1} + --gauges + [34] = "%.2f", -- Altimeter Pressure Set (axis) + [39] = "%.2f", -- Horizon Cage (axis) {0.0 - 0.511 in 0.04 steps} + [43] = "%.2f", -- Course Set (axis) + --flaps + [62] = "%1d", -- Flaps Up {0, 1} + [63] = "%1d", -- Flaps Take Off {0, 1} + [64] = "%1d", -- Flaps Landing {0, 1} + --Landing Gears Retraction + [65] = "%1d", -- Landing Gears Retraction {0, 1} + [66] = "%1d", -- Landing Gears Retraction Cover {0, 1} + [67] = "%1d", -- Landing Gears Extending {0, 1} + [89] = "%1d", -- Landing Gear Emergency Release Handle {0, 1} + --Trimmer + [77] = "%1d", -- Stabilizer Trimmer Up/Down {-1, 0, 1} + --Clock + [24] = "%.2f", -- Turnable Bezel (axis) in 0.2 steps + [25] = "%.2f", -- Wind/Set Knob (axis) in 0.1 steps + [26] = "%1d", -- Start - Stop Button {0, 1} + [28] = "%1d", -- Stopwatch Button {0, 1} + --weapons + [48] = "%.2f", -- Master Arm + [51] = "%.2f", -- Set Gun 1 Ammunition Count (axis) in 0.4 steps + [54] = "%.2f", -- Set Gun 2 Ammunition Count (axis) in 0.4 steps + [57] = "%.2f", -- Set Gun 3 Ammunition Count (axis) in 0.4 steps + [60] = "%.2f", -- Set Gun 4 Ammunition Count (axis) in 0.4 steps + [107] = "%1d", -- Main Rocket Switch {0, 1} + [108] = "%1d", -- Rocket Emergency Release {0, 1} + [109] = "%.2f", -- Bomb Fusing Selector {0.0, 0.1, 0.2, 0.3, 0.4} + [92] = "%1d", -- Jettison Fuselage Stores {0, 1} + --Gunsight + [132] = "%1d", -- EZ42 Power Switch {0, 1} + [131] = "%.2f", -- Target Wingspan (axis) in 0.1 steps + [134] = "%1d", -- Gunsight Night Filter {0, 1} + [4] = "%.2f", -- Target Distance (axis) in 0.1 steps + [135] = "%.2f", -- Gunsight Brightness (axis) in 0.1 steps + [191] = "%.2f", -- Aiming correction 1 (axis) in 0.1 steps + --Instrument Lights Brightness + [78] = "", -- Instrument Lights Brightness (axis) in 0.4 steps + --Radio + [81] = "%.1f", -- Radio Channel Selector {0.0, 0.1, 0.2, 0.3} + [83] = "%.2f", -- Radio Volume (axis) in 0.04 steps + [84] = "%1d", -- FT FT / Y ZF Mode Switch {0, 1} + [82] = "%.2f", -- Radio Tuning (+/-30 kHz) (axis) in 0.04 steps + --Oxygen + [110] = "%.2f", -- Oxygen Flow Valve (axis) in 0.04 steps + [190] = "%1d", -- Oxygen Emergency Knob {0, 1} + --IFF + [86] = "%1d", -- IFF Channel Selector {-1, 0, 1} + [88] = "%1d" -- IFF Check {0, 1} +} + +----------------------------- +-- HIGH IMPORTANCE EXPORTS -- +-- done every export event -- +----------------------------- + +-- Pointed to by ProcessGlassCockpitDCSHighImportance +function ProcessGlassCockpitDCSConfigHighImportance(mainPanelDevice) + if gES_GlassCockpitType == 1 then + -- HELIOS Version 1.3 + elseif gES_GlassCockpitType == 2 then + -- HawgTouch Version 1.6 + -- Altimeter_km, Altimeter_m, Altimeter_Pressure + SendData("2000", string.format("%0.3f;%0.3f;%0.3f", + mainPanelDevice:get_argument_value(35), + mainPanelDevice:get_argument_value(32), + mainPanelDevice:get_argument_value(33))) + + -- LwAtt - AHorizon_Bank, AHorizon_Pitch, TurnNeedle, Slipball + SendData("2001", string.format("%0.3f;%0.3f;%0.3f;%0.3f", + mainPanelDevice:get_argument_value(38), + mainPanelDevice:get_argument_value(37), + mainPanelDevice:get_argument_value(40), + mainPanelDevice:get_argument_value(41))) + + -- LwHead - CompassHeading, CommandedCourse liefert nur 0.000 + SendData("2002", string.format("%0.3f;%0.3f", + mainPanelDevice:get_argument_value(45), + mainPanelDevice:get_argument_value(44))) + + -- LwClock - CLOCK_currtime_hours, CLOCK_currtime_minutes, CLOCK_currtime_seconds, CLOCK_chrono_minutes + SendData("2003", string.format("%0.3f;%0.3f;%0.3f;%0.3f", + mainPanelDevice:get_argument_value(21), + mainPanelDevice:get_argument_value(22), + mainPanelDevice:get_argument_value(23), + mainPanelDevice:get_argument_value(27))) + + -- LwDblP - Oil_Pressure; Fuel_Pressure; + SendData("2004", string.format("%0.3f;%0.3f", + mainPanelDevice:get_argument_value(95), + mainPanelDevice:get_argument_value(94))) + + -- now not ID + -- LwAFN2 - AFN2_Horizontal_Needle, AFN2_Vertical_Needle, AFN2_Signal_Lamp + --SendData("2005", string.format("%0.3f;%0.3f;%0.3f", + -- mainPanelDevice:get_argument_value(), + -- mainPanelDevice:get_argument_value(), + -- mainPanelDevice:get_argument_value())) + + -- Gear - L_GEAR_UP, L_GEAR_DOWN, R_GEAR_UP, R_GEAR_DOWN, FLAPS_UP, FLAPS_START, FLAPS_DOWN + SendData("2007", string.format("%0.3f;%0.3f;%0.3f;%0.3f;%0.3f;%0.3f;%0.3f", + mainPanelDevice:get_argument_value(68), + mainPanelDevice:get_argument_value(69), + mainPanelDevice:get_argument_value(70), + mainPanelDevice:get_argument_value(71), + mainPanelDevice:get_argument_value(72), + mainPanelDevice:get_argument_value(73), + mainPanelDevice:get_argument_value(74))) + -- Ammo counter 1 + SendData("2008", string.format("%0.3f;%0.3f", + mainPanelDevice:get_argument_value(52), + mainPanelDevice:get_argument_value(50))) + -- Ammo counter 2 + SendData("2009", string.format("%0.3f;%0.3f", + mainPanelDevice:get_argument_value(55), + mainPanelDevice:get_argument_value(164))) + -- Ammo counter 3 + SendData("2010", string.format("%0.3f;%0.3f", + mainPanelDevice:get_argument_value(58), + mainPanelDevice:get_argument_value(165))) + -- Ammo counter 4 + SendData("2011", string.format("%0.3f;%0.3f", + mainPanelDevice:get_argument_value(61), + mainPanelDevice:get_argument_value(166))) + end +end + +function ProcessHARDWAREConfigHighImportance(mainPanelDevice) +-- Hier kommen alle Daten rein die ueber die Hardware in schneller folge ausgeben werden soll +-- In der Regel sind das die Statusanzeigen + +-- SendDataHW(), ist die Funktion zur Ausgabe der Werte an die Hardware +-- "178" ist die ID des Wertes die in der entsprechenden XML Datei festgelegt wird, sollte der DCS ID entsprechen +-- mainPanelDevice:get_argument_value() ist eine Funktion die die Werte der �bergeben DCS ID aus dem Spiel ausliest +-- 178 ist die DCS ID von dem man die Werte haben will +-- Description +-- SendDataHW("178", mainPanelDevice:get_argument_value(178)) -- L_AILERON_EMER_DISENGAGE +-- SendDataHW("", mainPanelDevice:get_argument_value()) -- +end + +----------------------------------------------------- +-- LOW IMPORTANCE EXPORTS -- +-- done every gExportLowTickInterval export events -- +----------------------------------------------------- + +-- Pointed to by ProcessGlassCockpitDCSConfigLowImportance +function ProcessGlassCockpitDCSConfigLowImportance(mainPanelDevice) +end + +function ProcessHARDWAREConfigLowImportance(mainPanelDevice) + --[[ + every frame export to hardware + Example from A-10C + Get Radio Frequencies + get data from device + local UHF_RADIO = GetDevice(54) + SendDataHW("ExportID", "Format") + SendDataHW("ExportID", "Format", HardwareConfigID) + SendDataHW("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000)) + SendDataHW("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000), 2) -- export to Hardware '2' Config + ]] + + --===================================================================================== + --[[ + WriteToLog('list_cockpit_params(): '..dump(list_cockpit_params())) + WriteToLog('CMSP: '..dump(list_indication(7))) + + local ltmp1 = 0 + for ltmp2 = 0, 13, 1 do + ltmp1 = list_indication(ltmp2) + WriteToLog(ltmp2..': '..dump(ltmp1)) + --WriteToLog(ltmp2..' (metatable): '..dump(getmetatable(ltmp1))) + end + ]] +--[[ + local ltmp1 = 0 + for ltmp2 = 1, 73, 1 do + ltmp1 = GetDevice(ltmp2) + WriteToLog(ltmp2..': '..dump(ltmp1)) + WriteToLog(ltmp2..' (metatable): '..dump(getmetatable(ltmp1))) + end +]] +end + +----------------------------- +-- Custom functions -- +----------------------------- + +function genericRadio(key, value, hardware) +end diff --git a/ExportsModules/Ka-50.lua b/ExportsModules/Ka-50.lua new file mode 100644 index 0000000..1958a5e --- /dev/null +++ b/ExportsModules/Ka-50.lua @@ -0,0 +1,2015 @@ +-- Ka-50 Export +-- Version 0.9.9 BETA + +gES_FoundDCSModule = true + +gES_GlassCockpitConfigEveryFrameArguments = +{ + -- LAMPS + --------------------------------------------------- + [44] = "%0.1f", -- lamp_MasterWarning {0.0,0.3} + [46] = "%0.1f", -- lamp_RotorRPM {0.0,1.0} + [47] = "%0.1f", -- lamp_UNDERFIREwarning {0.0,1.0} + [48] = "%0.1f", -- lamp_LowerGear {0.0,1.0} + [78] = "%0.1f", -- lamp_RPM_leftEngineMax {0.0,1.0} + [79] = "%0.1f", -- lamp_RPM_rightEngineMax {0.0,1.0} + [80] = "%0.1f", -- lamp_NyMax {0.0,1.0} + [81] = "%0.1f", -- lamp_vibr_leftEngine {0.0,1.0} + [82] = "%0.1f", -- lamp_vibr_rightEngine {0.0,1.0} + [83] = "%0.1f", -- lamp_IAS_max {0.0,1.0} + [84] = "%0.1f", -- lamp_mainTransmission {0.0,1.0} + [85] = "%0.1f", -- lamp_Fire {0.0,1.0} + [86] = "%0.1f", -- lamp_IFFfailure {0.0,1.0} + -- VVI + --------------------------------------------------- + [24] = "%.4f", -- vy (Vertical Velocity Indicator) {-1.0,1.0} + -- ADI (IKP-81) + --------------------------------------------------- + [100] = "%.4f", -- ADI_Roll {-1.0,1.0} + [101] = "%.4f", -- ADI_Pitch {-math.pi/2.0,math.pi/2.0}{1.0,-1.0} + [102] = "%0.1f", -- ADI_steering_warning_flag {0.0,1.0} + [109] = "%0.1f", -- ADI_attitude_warning_flag {0.0,1.0} + [107] = "%.4f", -- ADI_bank_steering {-1.0,1.0} + [106] = "%.4f", -- ADI_pitch_steering {-1.0,1.0} + [111] = "%.4f", -- ADI_airspeed_deviation {-1.0,1.0} + [103] = "%.4f", -- ADI_track_deviation {-1.0,1.0} + [526] = "%.4f", -- ADI_height_deviation {-1.0,1.0} + [108] = "%.4f", -- ADI_sideslip {-1.0,1.0} + -- Barometric Altimeter (VM_15PV) + -------------------------------------------------- + [87] = "%.4f", -- VM_15PV_BALT_thousands {0.0,1.0} + [88] = "%0.2f", -- VM_15PV_BaroPressure {0.0,1.0} + [89] = "%.4f", -- VM_15PV_BALT_CommandedAlt {0.0,1.0} + -- HSI (PNP-72-16) + --------------------------------------------------- + [112] = "%.4f", -- HSI_heading {0.0, 1.0} + [118] = "%.4f", -- HSI_commanded_course_needle {0.0, 1.0} + [124] = "%.4f", -- HSI_commanded_heading_needle {0.0, 1.0} + [115] = "%.4f", -- HSI_bearing_needle {0.0, 1.0} + [119] = "%0.1f", -- HSI_heading_warning_flag{0.0,1.0} + [114] = "%0.1f", -- HSI_course_warning_flag{0.0, 1.0} + [125] = "%0.1f", -- HSI_glideslope_warning_flag{0.0, 1.0} + [117] = "%0.4f", -- HSI_range_counter_100 {0.0,1.0} + [527] = "%0.4f", -- HSI_range_counter_10 {0.0,1.0} + [528] = "%0.4f", -- HSI_range_counter_1 {0.0,1.0} + [127] = "%.4f", -- HSI_longitudinal_deviation{-1.0, 1.0} + [128] = "%.4f", -- HSI_lateral_deviation{-1.0, 1.0} + [116] = "%0.1f", -- HSI_range_unavailable_flag{0.0, 1.0} + [121] = "%0.1f", -- HSI_course_unavailable_flag{0.0, 1.0} + -- Rotor Pitch + --------------------------------------------------- + [53] = "%.4f", -- RotorPitch {0.0,1.0} + -- Rotor RPM + --------------------------------------------------- + [52] = "%.4f", -- RotorRPM {0.0,1.0} + -- Radar Altimeter ( A_036) + --------------------------------------------------- + [94] = "%.4f", -- A_036_RALT {0.0,1.0} + [93] = "%.4f", -- A_036_DangerRALT {0.0,1.0} + [95] = "%0.1f", -- A_036_warning_flag {0.0,1.0} + [92] = "%0.1f", -- A_036_DangerRALT_lamp {0.0,1.0} + -- Indicated Airspeed + --------------------------------------------------- + [51] = "%.4f", -- IAS {0.0,1.0} + -- Accelerometer (ADP_4) + --------------------------------------------------- + [97] = "%0.2f", -- ADP_4_acceleration {0.0,1.0} + [98] = "%0.2f", -- ADP_4_max_achieved_acc {0.0,1.0} + [99] = "%0.2f", -- ADP_4_min_achieved_acc {0.0,1.0} + -- Mechanic Clock + --------------------------------------------------- + [68] = "%.4f", -- CLOCK_currtime_hours {0.0,1.0} + [69] = "%.4f", -- CLOCK_currtime_minutes {0.0,1.0} + [70] = "%.4f", -- CLOCK_currtime_seconds {0.0,1.0} + [75] = "%0.1f", -- CLOCK_flight_time_meter_status{0.0,0.2} + [72] = "%.4f", -- CLOCK_flight_hours {0.0,1.0} + [531] = "%.4f", -- CLOCK_flight_minutes {0.0,1.0} + [73] = "%.4f", -- CLOCK_seconds_meter_time_minutes {0.0,1.0} + [532] = "%.4f", -- CLOCK_seconds_meter_time_seconds {0.0,1.0} + -- backup ADI (AGR-81) + --------------------------------------------------- + [142] = "%.4f", -- AGR_81_Roll {1.0, -1.0} + [143] = "%.4f", -- AGR_81_Pitch {-1.0, 1.0} + [144] = "%.4f", -- AGR_81_sideslip {-1.0, 1.0} + [145] = "%0.1f", -- AGR_81_failure_flag{0.0, 1.0} + -- Engines temperature + --------------------------------------------------- + [133] = "%.4f", -- LeftEngineTemperatureHund {0.0,1.0} + [566] = "%.4f", -- LeftEngineTemperatureTenth {0.0,1.0} + [134] = "%.4f", -- RightEngineTemperatureHund {0.0,1.0} + [567] = "%.4f", -- RightEngineTemperatureHund {0.0,1.0} + -- Engine RPM + --------------------------------------------------- + [135] = "%.4f", -- LeftEngineRPM {0.0,1.0} + [136] = "%.4f", -- RightEngineRPM {0.0,1.0} + -- Fuel tanks + --------------------------------------------------- + [138] = "%.4f", -- RearTankAmount {0.0,1.0} + [137] = "%.4f", -- ForwardTankAmount {0.0,1.0} + [139] = "%0.1f", -- lamp_ForwardTankTest {0.0,1.0} + [140] = "%0.1f", -- lamp_RearTankTest {0.0,1.0} + -- PUI-800 Weapon panel + --------------------------------------------------- + [392] = "%0.1f", -- lamp_PUI800_Sta1_WeapIsPresent{0.0, 1.0} + [393] = "%0.1f", -- lamp_PUI800_Sta2_WeapIsPresent{0.0, 1.0} + [394] = "%0.1f", -- lamp_PUI800_Sta3_WeapIsPresent{0.0, 1.0} + [395] = "%0.1f", -- lamp_PUI800_Sta4_WeapIsPresent{0.0, 1.0} + [388] = "%0.1f", -- lamp_PUI800_Sta1_WeapIsReady{0.0, 1.0} + [389] = "%0.1f", -- lamp_PUI800_Sta2_WeapIsReady{0.0, 1.0} + [390] = "%0.1f", -- lamp_PUI800_Sta3_WeapIsReady{0.0, 1.0} + [391] = "%0.1f", -- lamp_PUI800_Sta4_WeapIsReady{0.0, 1.0} + -- LGCP - Landing gear control panel + --------------------------------------------------- + [63] = "%0.1f", -- LGCP_Lamp_NoseGearUp {0.0,1.0} + [64] = "%0.1f", -- LGCP_Lamp_NoseGearDown {0.0,1.0} + [61] = "%0.1f", -- LGCP_Lamp_RightMainGearUp {0.0,1.0} + [62] = "%0.1f", -- LGCP_Lamp_RightMainGearDown {0.0,1.0} + [59] = "%0.1f", -- LGCP_Lamp_LeftMainGearUp {0.0,1.0} + [60] = "%0.1f", -- LGCP_Lamp_LeftMainGearDown{0.0, 1.0} + -- LAMPS + --------------------------------------------------- + [170] = "%0.1f", -- lamp_H_RALT_stab {0.0,1.0} + [175] = "%0.1f", -- lamp_Hover {0.0,1.0} + [172] = "%0.1f", -- lamp_Descent {0.0,1.0} + [165] = "%0.1f", -- lamp_RouteHeadingSteering {0.0,1.0} + [171] = "%0.1f", -- lamp_RouteCourseSteering {0.0,1.0} + [176] = "%0.1f", -- lamp_Waypoint {0.0,1.0} + [166] = "%0.1f", -- lamp_EndOfRoute {0.0,1.0} + [164] = "%0.1f", -- lamp_RoughNAVcalc {0.0,1.0} + [178] = "%0.1f", -- lamp_Burst {0.0,1.0} + [173] = "%0.1f", -- lamp_CannonMovingBarr {0.0,1.0} + [177] = "%0.1f", -- lamp_CannonMovingBarr2 {0.0,1.0} + [211] = "%0.1f", -- lamp_FuelCrossfeedOn {0.0,1.0} + [187] = "%0.1f", -- lamp_CouplerOff {0.0,1.0} + [204] = "%0.1f", -- lamp_ActuatorsOilPress {0.0,1.0} + [213] = "%0.1f", -- lamp_LockOff {0.0,1.0} + -- Magnetic Compass (KI-13) + --------------------------------------------------- + [11] = "%.4f", -- KI_13_course {-1,1} + [12] = "%.4f", -- KI_13_pitch {-1,1} + [14] = "%.4f", -- KI_13_bank {-1,1} + -- LAMPS + --------------------------------------------------- + [167] = "%0.1f", -- lamp_WeapSysBUS_ON {0.0,1.0} + [180] = "%0.1f", -- lamp_TrainingMode {0.0,1.0} + [179] = "%0.1f", -- lamp_OBZOR_800 {0.0,1.0} + [188] = "%0.1f", -- lamp_RANET {0.0,1.0} + [189] = "%0.1f", -- lamp_CC_test {0.0,1.0} + [206] = "%0.1f", -- lamp_CC_failure {0.0,1.0} + [212] = "%0.1f", -- lamp_DC_AC_Inverter {0.0,1.0} + [205] = "%0.1f", -- lamp_I_251V {0.0,1.0} + [181] = "%0.1f", -- lamp_AntiIceLeftEngine {0.0,1.0} + [190] = "%0.1f", -- lamp_DustProtectLeftEngine {0.0,1.0} + [207] = "%0.1f", -- lamp_BackupModeLeftEngine {0.0,1.0} + [183] = "%0.1f", -- lamp_AntiIceRotors {0.0,1.0} + [182] = "%0.1f", -- lamp_AntiIceRightEngine {0.0,1.0} + [191] = "%0.1f", -- lamp_DustProtectRightEngine {0.0,1.0} + [208] = "%0.1f", -- lamp_BackupModeRightEngine {0.0,1.0} + [184] = "%0.1f", -- lamp_VUO_Heat {0.0,1.0} + [200] = "%0.1f", -- lamp_ForwardTank {0.0,1.0} + [209] = "%0.1f", -- lamp_LeftValveClosed {0.0,1.0} + [185] = "%0.1f", -- lamp_LeftOuterTank {0.0,1.0} + [202] = "%0.1f", -- lamp_LeftInnerTank {0.0,1.0} + [201] = "%0.1f", -- lamp_RearTank {0.0,1.0} + [210] = "%0.1f", -- lamp_RightValveClosed {0.0,1.0} + [186] = "%0.1f", -- lamp_RightOuterTank {0.0,1.0} + [203] = "%0.1f", -- lamp_RightInnerTank {0.0,1.0} + -- DATALINK + --------------------------------------------------- + [159] = "%0.1f", -- PRC_button_SEND {0.0,0.3} + [150] = "%0.1f", -- PRC_button_ESCAPE {0.0,0.3} + [161] = "%0.1f", -- PRC_button_ERASE {0.0,0.3} + [15] = "%0.1f", -- PRC_button_CLEAN {0.0,0.3} + [16] = "%0.1f", -- PRC_button_WINGMAN_ALL {0.0,0.3} + [17] = "%0.1f", -- PRC_button_WINGMAN_1 {0.0,0.3} + [18] = "%0.1f", -- PRC_button_WINGMAN_2 {0.0,0.3} + [19] = "%0.1f", -- PRC_button_WINGMAN_3 {0.0,0.3} + [20] = "%0.1f", -- PRC_button_WINGMAN_4 {0.0,0.3} + [21] = "%0.1f", -- PRC_button_TARGET_1 {0.0,0.3} + [22] = "%0.1f", -- PRC_button_TARGET_2 {0.0,0.3} + [23] = "%0.1f", -- PRC_button_TARGET_3 {0.0,0.3} + [50] = "%0.1f", -- PRC_button_TARGET_POINT {0.0,0.3} + -- Laser warning system + --------------------------------------------------- + [25] = "%0.1f", -- LWS_LampAzimuth_0 {0.0,1.0} + [28] = "%0.1f", -- LWS_LampAzimuth_90 {0.0,1.0} + [26] = "%0.1f", -- LWS_LampAzimuth_180 {0.0,1.0} + [27] = "%0.1f", -- LWS_LampAzimuth_270 {0.0,1.0} + [31] = "%0.1f", -- LWS_LampAzimuth_UpperHemisphere {0.0,1.0} + [32] = "%0.1f", -- LWS_LampAzimuth_LowerHemisphere {0.0,1.0} + [33] = "%0.1f", -- LWS_LampAzimuth_LaserRangefinder {0.0,1.0} + [34] = "%0.1f", -- LWS_LampAzimuth_LaserTargetingSystem {0.0,1.0} + [582] = "%0.1f", -- LWS_LampReady {0.0,1.0} + -- UV-26 + --------------------------------------------------- + [541] = "%0.1f", -- UV26_lampLeftBoard {0.0,1.0} + [542] = "%0.1f", -- UV26_lampRightBoard {0.0,1.0} + -- PVI (Nav Control Panel) + --------------------------------------------------- + [315] = "%0.1f", -- PVI_button_WPT{0.0, 0.3} + [519] = "%0.1f", -- PVI_button_INSREALN{0.0, 0.3} + [316] = "%0.1f", -- PVI_button_FIXPT{0.0, 0.3} + [520] = "%0.1f", -- PVI_button_PRECALN{0.0, 0.3} + [317] = "%0.1f", -- PVI_button_AERDR{0.0, 0.3} + [521] = "%0.1f", -- PVI_button_NORMALN{0.0, 0.3} + [318] = "%0.1f", -- PVI_button_TGT{0.0, 0.3} + [313] = "%0.1f", -- PVI_button_ENTER{0.0, 0.3} + [314] = "%0.1f", -- PVI_button_CANCEL{0.0, 0.3} + [522] = "%0.1f", -- PVI_button_INITCOORD{0.0, 0.3} + [319] = "%0.1f", -- PVI_button_FILAMBDA{0.0, 0.3} + [320] = "%0.1f", -- PVI_button_FIZ{0.0, 0.3} + [321] = "%0.1f", -- PVI_button_DU{0.0, 0.3} + [322] = "%0.1f", -- PVI_button_FII{0.0, 0.3} + [323] = "%0.1f", -- PVI_button_BRGRNG{0.0, 0.3} + [330] = "%0.1f", -- PPR_button_K{0.0, 0.3} + [332] = "%0.1f", -- PPR_button_H{0.0, 0.3} + [331] = "%0.1f", -- PPR_button_T{0.0, 0.3} + [333] = "%0.1f", -- PPR_button_B{0.0, 0.3} + [334] = "%0.1f", -- PPR_button_DIR{0.0, 0.3} + -- RadioCommunicator R-828 + --------------------------------------------------- + [375] = "%0.1f", -- Radio_ASU_lamp{0.0,1.0} + -- RadioCommunicator R-800 + --------------------------------------------------- + [419] = "%0.1f", -- Radio_Test_lamp {0.0,1.0} + [577] = "%.3f", -- R800Rotary1 {0.0,1.0} + [574] = "%.2f", -- R800Rotary2 {0.0,1.0} + [575] = "%.2f", -- R800Rotary3 {0.0,1.0} + [576] = "%.2f", -- R800Rotary4 {0.0,1.0} + -- WEAPON INTERFACE + --------------------------------------------------- + [437] = "%0.1f", -- PRC_button_AUTO_TURN {0.0,0.3} + [438] = "%0.1f", -- PRC_button_AIRBORNE_TARGET {0.0,0.3} + [439] = "%0.1f", -- PRC_button_FORWARD_HEMISPHERE {0.0,0.3} + [440] = "%0.1f", -- PRC_button_GROUND_MOVING_TARGET {0.0,0.3} + [441] = "%0.1f", -- PRC_button_CLEAR {0.0,0.3} + -- Engines start panel + --------------------------------------------------- + [163] = "%0.1f", -- lamp_EnginesStartValve{0.0, 1.0} + -- APU control panel + --------------------------------------------------- + [162] = "%0.1f", -- lamp_APUValveOpen{0.0, 1.0}{0.0, 1.0} + [168] = "%0.1f", -- lamp_APUOilPres{0.0, 1.0}{0.0, 1.0} + [169] = "%0.1f", -- lamp_APUStoppedByRPM{0.0, 1.0} + [174] = "%0.1f", -- lamp_APU_IsON{0.0, 1.0} + -- APU Temperature + --------------------------------------------------- + [6] = "%.4f", -- APUTemperature {0.0, 900.0} = {0.0, 1.0} + -- Right Side Panel + --------------------------------------------------- + [586] = "%0.1f", -- lamp_AC_Ground_Power{0.0, 1.0} + [261] = "%0.1f", -- lamp_DC_Ground_Power{0.0, 1.0} + -- Eject system + --------------------------------------------------- + [461] = "%0.1f", -- EjectSystemTestLamp{0.0, 1.0} + -- Fire Extinguishers panel + --------------------------------------------------- + [237] = "%0.1f", -- lamp_Exting_LeftEngineFire{0.0, 1.0} + [239] = "%0.1f", -- lamp_Exting_APU_Fire{0.0, 1.0} + [568] = "%0.1f", -- lamp_Exting_HydraulicsFire{0.0, 1.0} + [241] = "%0.1f", -- lamp_Exting_RightEngineFire{0.0, 1.0} + [243] = "%0.1f", -- lamp_Exting_VentilatorFire{0.0, 1.0} + [244] = "%0.1f", -- lamp_Exting_Lamp1{0.0, 1.0} + [245] = "%0.1f", -- lamp_Exting_Lamp2{0.0, 1.0} + -- Engines mode indicator + --------------------------------------------------- + [592] = "%.4f", -- EnginesMode {0.0,1.0} + [234] = "%0.2f", -- LeftEngineMode{0.0,1.0} + [235] = "%0.2f", -- RightEngineMode {0.0,1.0} + -- Oil pressure and temperature indicators group (Right Panel) + --------------------------------------------------- + [252] = "%.4f", -- NeedleOilPressureEngineLeft {0.0,1.0} + [253] = "%.4f", -- NeedleOilPressureEngineRight {0.0, 1.0} + [254] = "%.4f", -- NeedleOilPressureGearBox {0.0,1.0} + [255] = "%.4f", -- NeedleOilTemperatureEngineLeft {0.0,1.0} + [256] = "%.4f", -- NeedleOilTemperatureEngineRight {0.0,1.0} + [257] = "%.4f", -- NeedleOilTemperatureGearBox {0.0,1.0} + -- Right Back Panel + --------------------------------------------------- + [469] = "%0.1f", -- lamp_flap_hydro_1{0.0, 1.0} + [470] = "%0.1f", -- lamp_flap_hydro_2{0.0, 1.0} + -- Hydraulics Gauges (Back Panel) + --------------------------------------------------- + [471] = "%.4f", -- hydro_common_pressure {0.0,1.0} + [472] = "%.4f", -- hydro_main_pressure {0.0,1.0} + [473] = "%.4f", -- hydro_acc_brake_pressure {0.0,1.0} + [474] = "%.4f", -- hydro_gear_brake_pressure {0.0,1.0} + [475] = "%.4f", -- hydro_common_temperature {0.0,1.0} + [476] = "%.4f", -- hydro_main_temperature {0.0,1.0} + -- Latitude Entry Panel (PShK_7) + --------------------------------------------------- + [342] = "%0.1f", -- PShK7_LampAuto {0.0,1.0} + [339] = "%0.4f", -- PShK7_Latitude_counter_tenth {0.0,10.0} + [594] = "%0.4f", -- PShK7_Latitude_counter_units {0.0,10.0} + -- Magnetic Variation Entry Panel (ZMS_3) + --------------------------------------------------- + [337] = "%0.4f", -- ZMS3_MagVar_counter_hundreds_tenth {-1.0,1.0} + [596] = "%0.4f", -- ZMS3_MagVar_counter_units {0.0,1.0} + -- Ambient Temperature + --------------------------------------------------- + [587] = "%0.4f" -- Ambient Temperature {-60, 50} = {-0.946, 0.788} +} + +gES_GlassCockpitConfigArguments = +{ + -- ADI + --------------------------------------------------- + [110] = "%.1f", -- TEST-IKP-PTR (ADI Test Button) {0.0,1.0} + -- HSI + --------------------------------------------------- + [113] = "%.1f", -- TEST-PNP-PTR03 (HSI test Button) + [54] = "%1d", -- ZPU-ZK-PTR (HSI Desired track angle - Desired heading, Auto - Manual) {0,1} + --laser ranger + --------------------------------------------------- + [56] = "%1d", -- LDP-LD-PTR (Laser rangefinder / designator - mode switch) + [57] = "%1d", -- LD-LDP-COVER-PTR (Laser rangefinder Cover) + [55] = "%.1f", -- CHOP-LDP-PTR (Laser designator reset) + -- RADIOALTIMETER + --------------------------------------------------- + [96] = "%.1f", -- TEST-RADIO-HIGHT-PTR (Radar altimeter test) + -- CPT MECH + --------------------------------------------------- + [572] = "%.1f", -- G--PTR (Accelerometer reset) + -- SYSTEM CONTROLLER + --------------------------------------------------- + [45] = "%.1f", -- CONTROL-ALARM-PTR (Lamps test) + -- STANDBY ADI (AGR-81) + --------------------------------------------------- + [230] = "%1d", -- RES-AG-PTR (Standby Attitude Indicator power switch) + -- Engines Start-Up Control Panel + --------------------------------------------------- + [131] = "%.1f", -- CONTROL-TEMP-WORK-PTR (Running engines exhaust gas temperature indicator test button) + [132] = "%.1f", -- CONTROL-TEMP-NOTWORK-PTR (Stopped engines exhaust gas temperature indicator test button) + -- FUEL SYSTEM + --------------------------------------------------- + [616] = "%.1f", -- CONTROL-OIL-PTR (Fuel quantity indicator self test button) + -- ABRIS Display + --------------------------------------------------- + [512] = "%.1f", -- PTR_BTN-ABRIS-01 (ABRIS Pushbutton 1) {start value 0.01 the same index for -2,-3,-4,-5,-6,-7,-8,-9,-RCL,-ENTR with increment 0.01} + [513] = "%.1f", -- PTR_BTN-ABRIS-02 (ABRIS Pushbutton 2) + [514] = "%.1f", -- PTR_BTN-ABRIS-03 (ABRIS Pushbutton 3) + [515] = "%.1f", -- PTR_BTN-ABRIS-04 (ABRIS Pushbutton 4) + [516] = "%.1f", -- PTR_BTN-ABRIS-05 (ABRIS Pushbutton 5) + [523] = "%.1f", -- ABRIS_SHUNT_PTR (ABRIS Cursor Control (rot/push)) + [517] = "%.3f", -- ABRIS_BRIGHTNESS_PTR (ABRIS Brightness) {0.0,1.0} (0.05) + [130] = "%0.1f", -- ABRIS-POWER_PTR (ABRIS Power) + -- HUD + --------------------------------------------------- + [8] = "%.3f", -- PTR_HUD-BRIGHTNESS (HUD Brightness) + [9] = "%1d", -- PTR_HUD-TMB-SETKA02 (HUD Modes Reticle/Night/Day) + [7] = "%.1f", -- PTR-HUD-TEST (HUD Test) + [510] = "%0.1f", -- PTR_HUD-FILTER (HUD Filter) + -- PUI-800 Weapons Control Panel + --------------------------------------------------- + [387] = "%1d", -- MASTER-ARM-PTR (Master Arm) + [402] = "%.1f", -- UI800-AVARCHOP-PTR (External stores jettison) + [396] = "%1d", -- MASTER-EXPLODE-PTR (Jettison arm mode - arm fuse/disarm fuse) + [403] = "%1d", -- PUI800-AUTO-PTR (Manual/Auto weapon system control switch) + [399] = "%1d", -- PUI800-OFBR-PTR (Cannon round selector switch HE/AP) + [400] = "%0.1f", -- SR-PTR (Weapon mode switch - Burst Length) + [398] = "%1d", -- MT-PTR (Cannon rate of fire setting) + [397] = "%.1f", -- MASTER-UNLOAD-PTR (Expedite emergency ATGM launch) + -- PUR Weapons Aux Panel + -- SHKVAL + --------------------------------------------------- + [404] = "%1d", -- PUR-BACKGROUND-PTR (IT-23 Black-White indication switch) + [406] = "%.3f", -- PUR-LIGHTIT-PTR (IT-23 display brightness) + [407] = "%.3f", -- PUR-CONTRAST-PTR (IT-23 display contrast) + -- SHKVAL windscreen wiper + [224] = "%.1f", -- WIPER-PTR (SHKVAL windscreen wiper) + -- HELMET + [405] = "%.3f", -- PUR-LIGHTNVU-PTR (Helmet device brightness) + -- WEAPON SYSTEM + [408] = "%0.1f", -- PUR-LIT-PTR (Laser code selector) + [409] = "%1d", -- PUR-OGR-INF-PTR (HUD/TV declutter switch) + -- Outside illumination + --------------------------------------------------- + [382] = "%0.1f", -- LANDING LIGHTS-DIR-LIGHT-PTR (Light landing-search. On/Retraction/Off) + [383] = "%1d", -- LANDING LIGHTS-BASE-RESERV-PTR (Lights landing-search change. Main/Reserved) + -- ALMAZ system + --------------------------------------------------- + [384] = "%.1f", -- SPEECH-INFO-OFF-PTR01 (Voice message system messages off) + [385] = "%.1f", -- SPEECH-INFO-RETRY-PTR (Voice message system messages repeat) + [386] = "%0.1f", -- SPEECH-INFO-AVAR-PTR (Voice message system emergency on) + [442] = "%.1f", -- SPEECH-BIT-PTR (Voice message system check) + -- CPT MECH + --------------------------------------------------- + [65] = "%1d", -- GEAR-PTR (Gear lever) + [66] = "%1d", -- AVAR-GEAR-PTR (Main/Common hydraulics for emergency gear) + [67] = "%1d", -- AVAR-GEAR-COVER-PTR (Main/Common hydraulics for emergency gear Cover) + -- OVERHEAD PANEL + --------------------------------------------------- + [146] = "%0.1f", -- ANO-PTR (Navigation Lights 10\% / 30\% / 100\% / Off) + [147] = "%0.1f", -- WINDSCREEN-WIPER-PTR (Windshield wiper switch) + [539] = "%1d", -- PPD-DUAS-PTR (Pitot static port and AoA sensors heat switch) + [151] = "%1d", -- PVD-CLOCK-PTR (Pitot ram air and clock heat switch) + [153] = "%1d", -- POS-ROTORS-PTR (Rotor de-icing system switch) + [154] = "%0.1f", -- POS-ENGINE-PZU-PTR (Engines de-icing / dust-protection systems switch) + [156] = "%.1f", -- KONTR-PVD-PTR (Pitot heat system test) + -- Laser Warning System + --------------------------------------------------- + [35] = "%.1f", -- L-140-RESET-PTR (LWS Reset button) + [583] = "%1d", -- L140-SWITCH (LWS Power switch) + [584] = "%.1f", -- L140-CNOB (LWS self-test button) + -- UV-26 CMD Control Panel + --------------------------------------------------- + [36] = "%0.1f", -- UV26-BOARD-PTR (CMD Select Left/Both/Right board flares dispensers) + [37] = "%0.1f", -- UV26-PROGR-PTR (CMD Amount flares counter/Programming) + [38] = "%.1f", -- UV26-SERIES-PTR (CMD Num of sequences) + [39] = "%.1f", -- UV26-BURST-PTR (CMD Num in sequence) + [41] = "%.1f", -- UV26-INTERVAL-PTR (CMD Dispense interval) + [43] = "%.1f", -- UV26-START-PTR (CMD Start dispense) + [42] = "%.1f", -- UV26-CANCELPRG-PTR (CMD Reset to default program) + [40] = "%.1f", -- UV26-STOP-PTR (CMD Stop dispense) + -- UV-26 related (REAR PANEL) + [496] = "%1d", -- UV26-POWER-PTR (CMD Power) + [497] = "%1d", -- UV26-POWER-COVER-PTR (CMD Power Cover) + [498] = "%1d", -- UV26-TEST-PTR (CMD BIT) + [499] = "%1d", -- UV26-TEST-COVER-PTR (CMD BIT Cover) + -- PVI NAV Panel + --------------------------------------------------- + [312] = "%0.1f", -- PVI-0-PTR (NAV '0' Btn) + [303] = "%0.1f", -- PVI-1-PTR (NAV '1' Btn) + [304] = "%0.1f", -- PVI-2-PTR (NAV '2' Btn) + [305] = "%0.1f", -- PVI-3-PTR (NAV '3' Btn) + [306] = "%0.1f", -- PVI-4-PTR (NAV '4' Btn) + [307] = "%0.1f", -- PVI-5-PTR (NAV '5' Btn) + [308] = "%0.1f", -- PVI-6-PTR (NAV '6' Btn) + [309] = "%0.1f", -- PVI-7-PTR (NAV '7' Btn) + [310] = "%0.1f", -- PVI-8-PTR (NAV '8' Btn) + [311] = "%0.1f", -- PVI-9-PTR (NAV '9' Btn) + [324] = "%0.1f", -- PVI-SWITCH-PTR (NAV Master modes) + [325] = "%1d", -- PVI_I251V_PTR (NAV INU fixtaking method) + [326] = "%1d", -- PVI_VCU_PTR (NAV Datalink power) + [327] = "%.3f", -- PVI-BRIGHTNESS-PTR (NAV Brightness) + -- DATALINK + --------------------------------------------------- + -- Datalink Mode Controls + [328] = "%0.1f", -- DTLK-SELF-ID-PTR (Datalink self ID) + [329] = "%0.1f", -- DTLK-MASTER-MODES-PTR (Datalink Master mode) + -- PPR - Autopilot Control Panel + -- AUTOPILOT + --------------------------------------------------- + [335] = "%0.1f", -- BAR-RV-PTR (Autopilot BARO/RALT altitude hold mode) + -- NAV SYSTEM + [336] = "%0.1f", -- ZK-LZP-PTR (Autopilot Desired heading - Desired track) + --ARK-22 + --------------------------------------------------- + [381] = "%0.2f", -- IANDING LIGHTS-DIR-LIGHT-PTR01 (ADF Inner-Auto-Outer NDB switch) + [355] = "%.1f", -- ARK-CONTROL-PTR (ADF Test) + [354] = "%1d", -- TLF-TLG-PTR (TLF-TLG modes) + [353] = "%.3f", -- VARK-VOLUME-PTR (ADF Volume) + [356] = "%1d", -- TLF-TLG-PTR01 (COMPASS-ANTENNA modes) + [357] = "%0.1f", -- VARK-VOLUME-PTR01 (ADF channel switch) + --R-828 + --------------------------------------------------- + [371] = "%0.1f", -- CHANNEL-PTR (R-828 (VHF-1) Radio channel selector) + [372] = "%.3f", -- RADIO-VOLUME-PTR (R-828 (VHF-1) Radio Volume) + [373] = "%.1f", -- ASU-PTR (R-828 (VHF-1) Tuner button) + [374] = "%1d", -- RADIO-PSH-SWITCH-PTR (R-828 (VHF-1) Squelch) + -- Signal Flares + --------------------------------------------------- + [376] = "%.1f", -- SIGNAL-FLARE-1-PTR (Signal flare red) + [377] = "%.1f", -- SIGNAL-FLARE-2-PTR (Signal flare green) + [378] = "%.1f", -- SIGNAL-FLARE-3-PTR (Signal flare white) + [379] = "%.1f", -- SIGNAL-FLARE-4-PTR (Signal flare yellow) + [380] = "%1d", -- SIGNAL-FLARE-SWITCH-PTR (Signal flare system power) + --R-800 + --------------------------------------------------- + [418] = "%.1f", -- START-PANEL-CONTROL-PTR (R-800 (VHF-2) BIT button) + [417] = "%1d", -- CONTR-RADIO-CHM-AM-PTR (R-800 (VHF-2) AM-FM toggle switch) + [421] = "%1d", -- CONTR-RADIO-AP-PTR (R-800 (VHF-2) Emergency receiver) + [422] = "%1d", -- CONTR-RADIO-ARK-PTR (R-800 (VHF-2) ADF switch) + [420] = "%1d", -- CONTR-RADIO-50-100-PTR01 (R-800 (VHF-2) Data transfer rate switch) + [423] = "%1d", -- CONTR-RADIO-PSH-PTR (R-800 (VHF-2) Squelch) + -- PVR + --------------------------------------------------- + -- WEAPONS + [432] = "%1d", -- PVR-DRILL-PTR (Training mode) + [431] = "%0.1f", -- PVR-MODE-PTR (Weapon system mode selector) + [436] = "%1d", -- PVR-AS-PM-PTR (Automatic Tracking / gun sight) + -- K041 + [433] = "%1d", -- K-041-PTR (K-041 Targeting-navigation system power switch) + -- LASERRANGER + [435] = "%1d", -- PVR-IZL-PTR (Laser standby ON/OFF switch) + -- HELMET + [434] = "%1d", -- PVR-OBZ-PTR (Helmet-mounted sight system power switch) + -- SHKVAL + [301] = "%0.1f", -- V-SCAN-PTR (Shkval scan rate) + -- Engines Start-Up Control Panel + --------------------------------------------------- + [412] = "%.1f", -- START-PANEL-START-PTR (Start-up selected engine button) + [413] = "%.1f", -- START-PANEL-STOP-START-PTR ("Interrupt start-up button) + [414] = "%.1f", -- START-PANEL-STOP-START-PTR01 (Stop APU button) + [415] = "%0.1f", -- START-PANEL-ROLLING-PTR (Engine Startup/Crank/False Start selector) + [416] = "%0.1f", -- START-ENGINE-SELECTOR-PTR (Engine selector) + [554] = "%1d", -- EMERGENCY-BRAKE ENGINE-LEFT-PTR (Left engine cut-off valve) + [555] = "%1d", -- EMERGENCY-BRAKE ENGINE-RIGHT-PTR (Right engine cut-off valve) + [556] = "%1d", -- BRAKE-ROTOR-LOW-PTR01 (Rotor brake) + --Radio switcher + --------------------------------------------------- + [428] = "%0.2f", -- RADIO-RATE-PTR (SPU-9 Radio communicator selector) + -- Right Side Panel + --------------------------------------------------- + -- ELECTRICS POWER + [262] = "%1d", -- ENERG-AER-RIT-PTR (DC ground power) + [263] = "%1d", -- ENERG-COVER-AER-RIT-PTR (DC ground power Cover) + [543] = "%1d", -- ENERG-AKK2-PTR (Battery 2) + [544] = "%1d", -- ENERG-COVER-AKK2-PTR (Battery 2 Cover) + [264] = "%1d", -- ENERG-AKK1-PTR (Battery 1) + [265] = "%1d", -- ENERG-COVER-AKK1-PTR (Battery 1 Cover) + [267] = "%1d", -- RAMP-POWER-PTR (AC ground power) + [268] = "%1d", -- GEN-LEFT-PTR (AC left generator) + [269] = "%1d", -- GEN-RIGHT-PTR (AC right generator) + [270] = "%01.f", -- CONVERTER-PTR (DC/AC inverter) {0.0, 0.2} + -- FUEL SYSTEM + [271] = "%1d", -- FUEL-PUMP-FRONT-PTR (Forward fuel tank pumps) + [272] = "%1d", -- FUEL-PUMP-BACK-PTR (Rear fuel tank pumps) + [273] = "%1d", -- FUEL-PUMP-INNER-PTR (Inner external fuel tanks pumps) + [274] = "%1d", -- FUEL-PUMP-OUTER-PTR (Outer external fuel tanks pumps) + [275] = "%1d", -- FUEL-METER-PTR (Fuelmeter power) + [276] = "%1d", -- PAV-CRANE-ENGINE-LEFT-PTR (Left engine fuel shutoff valve) + [277] = "%1d", -- PAV-CRANE-COVER-ENGINE-LEFT-PTR (Left engine fuel shutoff valve) + [278] = "%1d", -- PAV-CRANE-ENGINE-RIGHT-PTR (Right engine fuel shutoff valve) + [279] = "%1d", -- PAV-CRANE-COVER-ENGINE-RIGHT-PTR (Right engine fuel shutoff valve) + [280] = "%1d", -- PAV-CRANE-VSU-PTR (APU fuel shutoff valve) + [281] = "%1d", -- PAV-CRANE-COVER-VSU-PTR (APU fuel shutoff valve Cover) + [282] = "%1d", -- PAV-CRANE-CYKLIZATION-PTR (Fuel crossfeed valve) + [283] = "%1d", -- PAV-CRANE-COVER-CYKLIZATION-PTR (Fuel crossfeed valve Cover) + -- COMMS POWER + [284] = "%1d", -- COMM-PWR-AVSK-PTR (Intercom) + [285] = "%1d", -- COMM-PWR-UKV-1-PTR (VHF-1 (R828) power switch) + [286] = "%1d", -- COMM-PWR-UKV-2-PTR (VHF-2 (R-800) power switch) + [287] = "%1d", -- COMM-PWR-TLK-PTR (Radio equipment datalink TLK power switch) + [288] = "%1d", -- COMM-PWR-UKV-TLK-PTR (Radio equipment datalink UHF TLK power switch) + [289] = "%1d", -- COMM-PWR-SA-TLF-PTR (Radio equipment datalink SA-TLF power switch) + -- WEAPON SYS + [547] = "%1d", -- SUO-PTR (Weapons Control system) + [548] = "%1d", -- SUO-COVER-PTR (Weapons Control system Cover) + -- EJECT SYSTEM + [214] = "%1d", -- RIGHT-EMERG-SW1-PTR (Ejecting system power 1) + [215] = "%1d", -- RIGHT-EMERG-SW2-PTR (Ejecting system power 2) + [216] = "%1d", -- RIGHT-EMERG-SW3-PTR (Ejecting system power 3) + [217] = "%1d", -- RIGHT-COVER-EMERG-VACATION-PTR (Ejecting system power Cover) + [462] = "%0.1f", -- CONTR-SAPROTATE-PTR (Ejecting system circuit selector) + [460] = "%.1f", -- CONTR-SAP-PTR (Ejecting system circuit test) + -- HYDRAULICS + [220] = "%1d", -- HYDRO-PTR (Main hydraulics) + [221] = "%1d", -- HYDRO-COVER-PTR02 (Main hydraulics Cover) + -- IFF + [218] = "%1d", -- SRO-PTR (IFF power) + [219] = "%1d", -- COVER-SRO-PTR (IFF power Cover) + -- NAV SYSTEM + [222] = "%1d", -- PNK-PTR (Navigation system power) + [229] = "%0.1f", -- GYRO-MAG-MAN-HEADING-PTR (Gyro/Mag/Manual heading) + -- Outside illumination + [228] = "%1d", -- FLASHER-PTR (Anticollision Light) + [296] = "%1d", -- CONTUR-LIGHT-PTR (Tip Lights) + [297] = "%0.1f", -- FORMATION-PTR (Formation Lights) + -- ENGINES + [290] = "%1d", -- ERD-LEFT-PTR (EEG Left engine Electronic Engine Governor) + [291] = "%1d", -- ERD-LEFT-COVER-PTR (EEG Left engine Electronic Engine Governor Cover) + [292] = "%1d", -- ERD-RIGHT-PTR (EEG Right engine Electronic Engine Governor) + [293] = "%1d", -- ERD-RIGHT-COVER-PTR (EEG Right engine Electronic Engine Governor Cover) + [294] = "%1d", -- PAV-CRANE-VSU-PTR01 (EEG gas generator test Operate switch) + [569] = "%1d", -- PAV-CRANE-COVER-VSU-PTR01 (EEG gas generator test Operate switch Cover) + [295] = "%0.1f", -- PAV-CRANE-VSU-PTR02 (EEG power turbine channel 1 test Operate EEG power turbine channel 2 test, three-switch contactor) + [570] = "%0.1f", -- PAV-CRANE-COVER-VSU-PTR02 (EEG power turbine channel 1 test Operate EEG power turbine channel 2 test, three-switch contactor Cover) + [457] = "%.1f", -- RT-12-6-LEFT-PTR (Left EGT control threshold governor button) + [458] = "%.1f", -- RT-12-6-RIGHT-PTR (Right EGT control threshold governor button) + [459] = "%.1f", -- RT-12-6-IV-PTR (Engines vibrations monitoring system control button) + -- Lighting + [300] = "%1d", -- DESK-PTR (Lighting cockpit panel switch) + [299] = "%1d", -- DEVICES-PTR (Lighting night vision cockpit switch) + [298] = "%1d", -- AGR-PKP-PTR (Lighting ADI and SAI switch) + -- Fire Extinguishers Control Panel + [236] = "%.1f", -- PUI800-AVARCHOP-PTR01 (Left engine extinguisher) + [238] = "%.1f", -- PUI800-AVARCHOP-PTR02 (APU extinguisher) + [240] = "%.1f", -- PUI800-AVARCHOP-PTR03 (Right engine extinguisher) + [242] = "%.1f", -- PUI800-AVARCHOP-PTR04 (Ventilator extinguisher) + [248] = "%0.1f", -- FIREEXT-PTR (Fire extinguisher Work Off Test switch) + [249] = "%0.1f", -- FIREEXT-COVER-PTR (Fire extinguisher Work Off Test switch Cover) + [250] = "%1d", -- FIREEXT-INDICATION-PTR (Fire signaling) + [246] = "%1d", -- BALOONS-PTR (Fire extinguisher First (Auto) / Second (Manual) selector) + [247] = "%1d", -- BALOONS-COVER-PTR (Fire extinguisher First (Auto) / Second (Manual) selector Cover) + -- Misc. systems + [258] = "%0.1f", -- REDUCTOR-PTR (Reducing gear box oil pressure indication selector) + [259] = "%1d", -- HANGER-PTR (Sling load Auto/Manual) + -- Auxiliary panel + --------------------------------------------------- + -- Preflight Set and Check Panel + [483] = "%0.1f", -- PPK-BBTZ-PTR (ATGM Temperature selector) + [484] = "%0.1f", -- PPK-NRAKS-PTR (Unguided rocket and gun pods ballistics data settings selector) + [485] = "%1d", -- PPK-RNP-PTR (Systems BIT selector) + [486] = "%1d", -- KCVM-PTR (Control computers BIT switch) + [489] = "%.1f", -- AKS-PTR (Self test system push-button) + [490] = "%1d", -- VnK-PTR (Emergency INU alignment switch) + [491] = "%1d", -- ROPE-PTR (Stabilisation and indication of hanger cable switch) + [492] = "%1d", -- FKP-PTR (Video Tape Recorder switch) + [487] = "%1d", -- IKV-PTR (INU Power switch) + [488] = "%1d", -- HEAT_IKV-PTR (INU Heater switch) + [452] = "%1d", -- P-CONTR-VMG-HYDRO-PTR (Power plant, hydraulics, EKRAN self-test systems switch) + [453] = "%1d", -- P-CONTR-VMG-HYDRO-COVER-PTR (Power plant, hydraulics, EKRAN self-test systems switch Cover) + -- PShK_7 (Latitude Entry Panel) + [340] = "%.3f", -- LATITUDE-PTR (Latitude selection rotaty) + [341] = "%1d", -- N-S-PTR (North/South latitude selection) + -- ZMS_3 (Magnetic Variation Entry Panel) + [338] = "%.3f" -- DCLIN-PTR (Magnetic variation selection rotaty) +} + +-- Lookup tables for weapons store type display +gES_Ka50StationTypes = +{ + ["9A4172"] = "NC", + ["S-8KOM"] = "HP", + ["S-13"] = "HP", + ["UPK-23-250"] = "NN", + ["AO-2.5RT"] = "A6", + ["PTAB-2.5KO"] = "A6", + ["FAB-250"] = "A6", + ["FAB-500"] = "A6" +} + +-- State data +gKa50Trigger = 0 + +----------------------------------------------------- +-- LOW IMPORTANCE EXPORTS -- +-- done every gExportLowTickInterval export events -- +----------------------------------------------------- + +-- Pointed to by ProcessGlassCockpitDCSLowImportance, if the player aircraft is a Ka-50 +function ProcessGlassCockpitDCSConfigLowImportance(mainPanelDevice) + -- function for HELIOS and HawgTouch + + local lWeaponSystem = GetDevice(12) + local lEKRAN = GetDevice(10) + local lCannonAmmoCount = "" + local lStationNumbers = lWeaponSystem:get_selected_weapon_stations() + local lStationCount = "" + local lStationType = "" + local lTargetingPower = mainPanelDevice:get_argument_value(433) + local lTrigger = mainPanelDevice:get_argument_value(615) + if lTrigger == 0 then + gKa50Trigger = 1 + end + if lTrigger == -1 then + gKa50Trigger = 0 + end + + if lTargetingPower == 1 then + lCannonAmmoCount = string.format("%02d",string.match(lWeaponSystem:get_selected_gun_ammo_count() / 10,"(%d+)")) + + if #lStationNumbers ~= 0 and gKa50Trigger == 0 then + lStationCount = 0 + for i=1,#lStationNumbers do + lStationCount = lStationCount + lWeaponSystem:get_weapon_count_on_station(lStationNumbers[i]) + end + + lStationCount = string.format("%02d", lStationCount); + + lStationType = gES_Ka50StationTypes[lWeaponSystem:get_weapon_type_on_station(lStationNumbers[1])] + if lStationType == nil then + lStationType = "" + end + end + end + + local lEkranSendString = "" + local lEkranText = lEKRAN:get_actual_text_frame() + if lEkranText ~= "" then + lEkranSendString = string.sub(lEkranText,1,8).."\n"..string.sub(lEkranText,12,19).."\n"..string.sub(lEkranText,23,30).."\n"..string.sub(lEkranText,34,41) + end + + if gES_GlassCockpitType == 1 then + -- HELIOS Version 1.3 + SendData("2001",lStationType) + SendData("2002",lStationCount) + SendData("2003",lCannonAmmoCount) + SendData("2004",lEkranSendString) + elseif gES_GlassCockpitType == 2 then + -- HawgTouch version 1.6 + --SendData("2016",lEkranSendString) + local lFAILlight = "" -- FAILURE + local lMEMORYlight = "" -- MEMORY + local lTURNlight = "" -- TURN + if lEkranSendString ~= "" then + lFAILlight = "FAILURE" + end + -- DisplayWindow (main message) + -- FAILlight (failure text) + -- MEMORYlight (memmory text) + -- TURNlight (turn text) + SendData("2016", string.format("%s;%s;%s;%s", + lEkranSendString, + lFAILlight, + lMEMORYlight, + lTURNlight)) + --[[ + -- PUI-800 Weapon panel + --------------------------------------------------- + [392] = "%0.1f", -- lamp_PUI800_Sta1_WeapIsPresent{0.0, 1.0} + [393] = "%0.1f", -- lamp_PUI800_Sta2_WeapIsPresent{0.0, 1.0} + [394] = "%0.1f", -- lamp_PUI800_Sta3_WeapIsPresent{0.0, 1.0} + [395] = "%0.1f", -- lamp_PUI800_Sta4_WeapIsPresent{0.0, 1.0} + [388] = "%0.1f", -- lamp_PUI800_Sta1_WeapIsReady{0.0, 1.0} + [389] = "%0.1f", -- lamp_PUI800_Sta2_WeapIsReady{0.0, 1.0} + [390] = "%0.1f", -- lamp_PUI800_Sta3_WeapIsReady{0.0, 1.0} + [391] = "%0.1f", -- lamp_PUI800_Sta4_WeapIsReady{0.0, 1.0} + ]] + SendData("2014", string.format("%.1f;%.1f;%.1f;%.1f;%.1f;%.1f;%.1f;%.1f;%s;%s;%s", + mainPanelDevice:get_argument_value(392), + mainPanelDevice:get_argument_value(393), + mainPanelDevice:get_argument_value(394), + mainPanelDevice:get_argument_value(395), + mainPanelDevice:get_argument_value(388), + mainPanelDevice:get_argument_value(389), + mainPanelDevice:get_argument_value(390), + mainPanelDevice:get_argument_value(391), + lStationType, + lStationCount, + lCannonAmmoCount)) + -- LGCP - Landing gear control panel + --------------------------------------------------- + --[[ + [63] = "%0.1f", -- LGCP_Lamp_NoseGearUp {0.0,1.0} + [64] = "%0.1f", -- LGCP_Lamp_NoseGearDown {0.0,1.0} + [61] = "%0.1f", -- LGCP_Lamp_RightMainGearUp {0.0,1.0} + [62] = "%0.1f", -- LGCP_Lamp_RightMainGearDown {0.0,1.0} + [59] = "%0.1f", -- LGCP_Lamp_LeftMainGearUp {0.0,1.0} + [60] = "%0.1f", -- LGCP_Lamp_LeftMainGearDown{0.0, 1.0} + ]] + SendData("2013", string.format("%.1f;%.1f;%.1f;%.1f;%.1f;%.1f", + mainPanelDevice:get_argument_value(63), + mainPanelDevice:get_argument_value(64), + mainPanelDevice:get_argument_value(61), + mainPanelDevice:get_argument_value(62), + mainPanelDevice:get_argument_value(59), + mainPanelDevice:get_argument_value(60))) + + -- Master Warning and Rotor RPM Lamp + SendData("44", mainPanelDevice:get_argument_value(44) > 0.0 and 1 or 0) -- lamp_MasterWarning {0.0,0.3} + SendData("46", mainPanelDevice:get_argument_value(46) > 0.0 and 1 or 0) -- lamp_RotorRPM {0.0,1.0} + end +end + +-- Pointed to by ProcessHARDWARELowImportance, if the player aircraft is a Ka-50 +function ProcessHARDWAREConfigLowImportance(mainPanelDevice) + -- Radio comunication + -- ARK_22 (ADF) Frequncy + local lARK_22 = GetDevice(46) + SendDataHW("2000", string.format("%1d", lARK_22:get_channel())) + + -- R_800 + local lR_800 = GetDevice(48) + SendDataHW("2001", string.format("%7.3f", lR_800:get_frequency()/1000000)) + + -- R_828 Channel + local lR_828 = {[0.0]="1",[0.1]="2",[0.2]="3",[0.3]="4",[0.4]="5",[0.5]="6",[0.6]="7",[0.7]="8",[0.8]="9",[0.9]="10"} + SendDataHW("2002", lR_828[math.round(mainPanelDevice:get_argument_value(371), 1)]) + + -- R_828 Frequency + local lR_828_F = GetDevice(49) + if lR_828_F:is_on() then + SendDataHW("2003", string.format("%7.3f", lR_828_F:get_frequency()/1000000)) + else + SendDataHW("2003", "-") + end + + -- Weapos + local lWeaponSystem = GetDevice(12) + local lCannonAmmoCount = " " + local lStationNumbers = lWeaponSystem:get_selected_weapon_stations() + local lStationCount = " " + local lStationType = " " + local lTargetingPower = mainPanelDevice:get_argument_value(433) + local lTrigger = mainPanelDevice:get_argument_value(615) + if lTrigger == 0 then + gKa50Trigger = 1 + end + if lTrigger == -1 then + gKa50Trigger = 0 + end + + if lTargetingPower == 1 then + lCannonAmmoCount = string.format("%02d",string.match(lWeaponSystem:get_selected_gun_ammo_count() / 10,"(%d+)")) + + if #lStationNumbers ~= 0 and gKa50Trigger == 0 then + lStationCount = 0 + for i=1,#lStationNumbers do + lStationCount = lStationCount + lWeaponSystem:get_weapon_count_on_station(lStationNumbers[i]) + end + + lStationCount = string.format("%02d", lStationCount); + + lStationType = gES_Ka50StationTypes[lWeaponSystem:get_weapon_type_on_station(lStationNumbers[1])] + if lStationType == nil then + lStationType = " " + end + end + end + + --SendDataHW("2004",lStationType) + SendDataHW("2005",lStationCount) + SendDataHW("2006",lCannonAmmoCount) + + local lUV26 = list_indication(7) + lUV26 = lUV26:gsub("-----------------------------------------", "") + lUV26 = lUV26:gsub("txt_digits", "") + lUV26 = lUV26:gsub("%c", "") + + SendDataHW("2007", string.format("%s", lUV26)) + + + local lPVI800 = list_indication(5) + --[[ + txt_VIT Inhalt obere Zeile + txt_NIT Inhalt untere Zeile + txt_OIT_PPM Punkt obere Zeile + txt_OIT_NOT Punkt untere Zeile + txt_VIT_apostrophe1 1. Apostroph obere Zeile 3. Ziffer + txt_VIT_apostrophe2 2. Apostroph obere Zeile 5. Ziffer + txt_NIT_apostrophe1 1. Apostroph untere Zeile 3. Ziffer + txt_NIT_apostrophe2 2. Apostroph untere Zeile 5. Ziffer + ]] + local ltxt_upper_row, ltxt_lower_row = "" + local lpos1, pos2, lpos3, pos4, ltxt_VIT, ltxt_NIT, ltxt_OIT_PPM, ltxt_OIT_NOT + local ltxt_VIT_apostrophe1, ltxt_VIT_apostrophe2, ltxt_NIT_apostrophe1, ltxt_NIT_apostrophe2 = false + lpos1, pos2 = lPVI800:find("txt_VIT%c", 1) + if pos2 ~= nil then + lpos3, pos4 = lPVI800:find("-----------------------------------------", pos2) + if lpos3 ~= nil then + ltxt_VIT = lPVI800:sub(pos2 + 1, lpos3 - 2) + else + ltxt_VIT = lPVI800:sub(pos2 + 1) + end + end + lpos1, pos2 = lPVI800:find("txt_NIT%c", 1) + if pos2 ~= nil then + lpos3, pos4 = lPVI800:find("-----------------------------------------", pos2) + if lpos3 ~= nil then + ltxt_NIT = lPVI800:sub(pos2 + 1, lpos3 - 2) + else + ltxt_NIT = lPVI800:sub(pos2 + 1) + end + end + lpos1, pos2 = lPVI800:find("txt_OIT_PPM%c", 1) + if pos2 ~= nil then + lpos3, pos4 = lPVI800:find("-----------------------------------------", pos2) + if lpos3 ~= nil then + ltxt_OIT_PPM = lPVI800:sub(pos2 + 1, lpos3 - 2) + else + ltxt_OIT_PPM = lPVI800:sub(pos2 + 1) + end + end + lpos1, pos2 = lPVI800:find("txt_OIT_NOT%c", 1) + if pos2 ~= nil then + lpos3, pos4 = lPVI800:find("-----------------------------------------", pos2) + if lpos3 ~= nil then + ltxt_OIT_NOT = lPVI800:sub(pos2 + 1, lpos3 - 2) + else + ltxt_OIT_NOT = lPVI800:sub(pos2 + 1) + end + end + lpos1, pos2 = lPVI800:find("txt_VIT_apostrophe1", 1) + if pos2 ~= nil then + ltxt_VIT_apostrophe1 = true + end + lpos1, pos2 = lPVI800:find("txt_VIT_apostrophe2", 1) + if pos2 ~= nil then + ltxt_VIT_apostrophe2 = true + end + lpos1, pos2 = lPVI800:find("txt_NIT_apostrophe1", 1) + if pos2 ~= nil then + ltxt_NIT_apostrophe1 = true + end + lpos1, pos2 = lPVI800:find("txt_NIT_apostrophe2", 1) + if pos2 ~= nil then + ltxt_NIT_apostrophe2 = true + end + + if ltxt_VIT ~= nil then + ltxt_VIT = ltxt_VIT:gsub("%c", "") + ltxt_upper_row = ltxt_VIT:sub(1, 3) + if ltxt_VIT_apostrophe1 then + ltxt_upper_row = ltxt_upper_row.."." + end + ltxt_upper_row = ltxt_upper_row..ltxt_VIT:sub(4, 5) + if ltxt_VIT_apostrophe2 then + ltxt_upper_row = ltxt_upper_row.."." + end + ltxt_upper_row = ltxt_upper_row..ltxt_VIT:sub(6) + end + + if ltxt_NIT ~= nil then + ltxt_NIT = ltxt_NIT:gsub("%c", "") + ltxt_lower_row = ltxt_NIT:sub(1, 3) + if ltxt_NIT_apostrophe1 then + ltxt_lower_row = ltxt_lower_row.."." + end + ltxt_lower_row = ltxt_lower_row..ltxt_NIT:sub(4, 5) + if ltxt_NIT_apostrophe2 then + ltxt_lower_row = ltxt_lower_row.."." + end + ltxt_lower_row = ltxt_lower_row..ltxt_NIT:sub(6) + end + + if ltxt_VIT ~= nil then + ltxt_upper_row = ltxt_upper_row..string.rep(" ", 7 - ltxt_VIT:len()) + else + ltxt_upper_row = string.rep(" ", 7) + end + + if ltxt_OIT_PPM ~= nil then + ltxt_OIT_PPM = ltxt_OIT_PPM:gsub("%c", "") + ltxt_upper_row = ltxt_upper_row..ltxt_OIT_PPM + else + ltxt_upper_row = ltxt_upper_row.." " + end + + if ltxt_NIT ~= nil then + ltxt_lower_row = ltxt_lower_row..string.rep(" ", 7 - ltxt_NIT:len()) + else + ltxt_lower_row = string.rep(" ", 7) + end + + if ltxt_OIT_NOT ~= nil then + ltxt_OIT_NOT = ltxt_OIT_NOT:gsub("%c", "") + ltxt_lower_row = ltxt_lower_row..ltxt_OIT_NOT + else + ltxt_lower_row = ltxt_lower_row.." " + end + + SendDataHW("2008", string.format("%s", ltxt_upper_row)) + SendDataHW("2009", string.format("%s", ltxt_lower_row)) + + --[[ + --WriteToLog('list_cockpit_params(): '..dump(list_cockpit_params())) + + local ltmp1 = 0 + for ltmp2 = 1, 14, 1 do + ltmp1 = list_indication(ltmp2) + WriteToLog(ltmp2..': '..dump(ltmp1)) + --WriteToLog(ltmp2..' (metatable): '..dump(getmetatable(ltmp1))) + end + ]] +end + +----------------------------- +-- HIGH IMPORTANCE EXPORTS -- +-- done every export event -- +----------------------------- + +-- Pointed to by ProcessGlassCockpitDCSHighImportance, if the player aircraft is a Ka-50 +function ProcessGlassCockpitDCSConfigHighImportance(mainPanelDevice) + if gES_GlassCockpitType == 1 then + -- HELIOS Version 1.3 + + + elseif gES_GlassCockpitType == 2 then + -- HawgTouch version 1.6 + + -- ADI (IKP-81) + --------------------------------------------------- + --[[ + [100] = "%.4f", -- ADI_Roll {-1.0,1.0} + [101] = "%.4f", -- ADI_Pitch {-math.pi/2.0,math.pi/2.0}{1.0,-1.0} + [102] = "%0.1f", -- ADI_steering_warning_flag {0.0,1.0} + [109] = "%0.1f", -- ADI_attitude_warning_flag {0.0,1.0} + [107] = "%.4f", -- ADI_bank_steering {-1.0,1.0} + [106] = "%.4f", -- ADI_pitch_steering {-1.0,1.0} + [111] = "%.4f", -- ADI_airspeed_deviation {-1.0,1.0} + [103] = "%.4f", -- ADI_track_deviation {-1.0,1.0} + [526] = "%.4f", -- ADI_height_deviation {-1.0,1.0} + [108] = "%.4f", -- ADI_sideslip {-1.0,1.0} + ]] + SendData("2000", string.format("%.4f;%.4f;%.1f;%.1f;%.4f;%.4f;%.4f;%.4f;%.4f;%.4f", + mainPanelDevice:get_argument_value(100), + mainPanelDevice:get_argument_value(101), + mainPanelDevice:get_argument_value(102), + mainPanelDevice:get_argument_value(109), + mainPanelDevice:get_argument_value(107), + mainPanelDevice:get_argument_value(106), + mainPanelDevice:get_argument_value(111), + mainPanelDevice:get_argument_value(103), + mainPanelDevice:get_argument_value(526), + mainPanelDevice:get_argument_value(108))) + -- VVI + --------------------------------------------------- + --[24] = "%.4f", -- vy (Vertical Velocity Indicator) {-1.0,1.0} + -- Barometric Altimeter (VM_15PV) + -------------------------------------------------- + --[[ + [87] = "%.4f", -- VM_15PV_BALT_thousands {0.0,1.0} + [573] = "%.4f", -- VM_15PV_BALT_tenth {0.0,1.0} + [88] = "%0.2f", -- VM_15PV_BaroPressure {0.0,1.0} + [89] = "%.4f", -- VM_15PV_BALT_CommandedAlt {0.0,1.0} + ]] + SendData("2001", string.format("%.4f;%.4f;%.2f;%.4f", + mainPanelDevice:get_argument_value(87), + mainPanelDevice:get_argument_value(573), + mainPanelDevice:get_argument_value(88), + mainPanelDevice:get_argument_value(89))) + --WriteToLog('VM_15PV_BALT_thousands '..dump(mainPanelDevice:get_argument_value(87))..', VM_15PV_BALT_tenth '..dump(mainPanelDevice:get_argument_value(573))..', VM_15PV_BaroPressure '..dump(mainPanelDevice:get_argument_value(88))..', VM_15PV_BALT_CommandedAlt '..dump(mainPanelDevice:get_argument_value(89))) + -- HSI (PNP-72-16) + --------------------------------------------------- + --[[ + [112] = "%.4f", -- HSI_heading {0.0, 1.0} + [118] = "%.4f", -- HSI_commanded_course_needle {0.0, 1.0} + [124] = "%.4f", -- HSI_commanded_heading_needle {0.0, 1.0} + [115] = "%.4f", -- HSI_bearing_needle {0.0, 1.0} + [119] = "%0.1f", -- HSI_heading_warning_flag{0.0,1.0} + [114] = "%0.1f", -- HSI_course_warning_flag{0.0, 1.0} + [125] = "%0.1f", -- HSI_glideslope_warning_flag{0.0, 1.0} + [117] = "%0.4f", -- HSI_range_counter_100 {0.0,1.0} + [527] = "%0.4f", -- HSI_range_counter_10 {0.0,1.0} + [528] = "%0.4f", -- HSI_range_counter_1 {0.0,1.0} + [127] = "%.4f", -- HSI_longitudinal_deviation{-1.0, 1.0} + [128] = "%.4f", -- HSI_lateral_deviation{-1.0, 1.0} + [116] = "%0.1f", -- HSI_range_unavailable_flag{0.0, 1.0} + [121] = "%0.1f", -- HSI_course_unavailable_flag{0.0, 1.0} + ]] + SendData("2002", string.format("%.4f;%.4f;%.4f;%.4f;%.1f;%.1f;%.1f;%.4f;%.4f;%.4f;%.4f;%.4f;%.1f;%.1f", + mainPanelDevice:get_argument_value(112), + mainPanelDevice:get_argument_value(118), + mainPanelDevice:get_argument_value(124), + mainPanelDevice:get_argument_value(115), + mainPanelDevice:get_argument_value(119), + mainPanelDevice:get_argument_value(114), + mainPanelDevice:get_argument_value(125), + mainPanelDevice:get_argument_value(117), + mainPanelDevice:get_argument_value(527), + mainPanelDevice:get_argument_value(528), + mainPanelDevice:get_argument_value(127), + mainPanelDevice:get_argument_value(128), + mainPanelDevice:get_argument_value(116), + mainPanelDevice:get_argument_value(121))) + --WriteToLog('HSI_heading '..dump(mainPanelDevice:get_argument_value(118))) + -- Rotor Pitch + --------------------------------------------------- + --[53] = "%.4f", -- RotorPitch {0.0,1.0} + -- Rotor RPM + --------------------------------------------------- + --[52] = "%.4f", -- RotorRPM {0.0,1.0} + -- Radar Altimeter ( A_036) + --------------------------------------------------- + --[[ + [94] = "%.4f", -- A_036_RALT {0.0,1.0} + [93] = "%.4f", -- A_036_DangerRALT {0.0,1.0} + [95] = "%0.1f", -- A_036_warning_flag {0.0,1.0} + [92] = "%0.1f", -- A_036_DangerRALT_lamp {0.0,1.0} + ]] + SendData("2003", string.format("%.4f;%.4f;%.1f;%.1f", + mainPanelDevice:get_argument_value(94), + mainPanelDevice:get_argument_value(93), + mainPanelDevice:get_argument_value(95), + mainPanelDevice:get_argument_value(92))) + -- Indicated Airspeed + --------------------------------------------------- + ---[51] = "%.4f", -- IAS {0.0,1.0} + --SendData("51", string.format("%.4f", mainPanelDevice:get_argument_value(51))) + --WriteToLog('IAS '..dump(mainPanelDevice:get_argument_value(51))) + -- Accelerometer (ADP_4) + --------------------------------------------------- + --[[ + [97] = "%0.2f", -- ADP_4_acceleration {0.0,1.0} + [98] = "%0.2f", -- ADP_4_max_achieved_acc {0.0,1.0} + [99] = "%0.2f", -- ADP_4_min_achieved_acc {0.0,1.0} + ]] + SendData("2004", string.format("%.2f;%.2f;%.2f", + mainPanelDevice:get_argument_value(97), + mainPanelDevice:get_argument_value(98), + mainPanelDevice:get_argument_value(99))) + -- Mechanic Clock + --------------------------------------------------- + --[[ + [68] = "%.4f", -- CLOCK_currtime_hours {0.0,1.0} + [69] = "%.4f", -- CLOCK_currtime_minutes {0.0,1.0} + [70] = "%.4f", -- CLOCK_currtime_seconds {0.0,1.0} + [75] = "%0.1f", -- CLOCK_flight_time_meter_status{0.0,0.2} + [72] = "%.4f", -- CLOCK_flight_hours {0.0,1.0} + [531] = "%.4f", -- CLOCK_flight_minutes {0.0,1.0} + [73] = "%.4f", -- CLOCK_seconds_meter_time_minutes {0.0,1.0} + [532] = "%.4f", -- CLOCK_seconds_meter_time_seconds {0.0,1.0} + ]] + SendData("2005", string.format("%.4f;%.4f;%.4f;%.1f;%.4f;%.4f;%.4f;%.4f", + mainPanelDevice:get_argument_value(68), + mainPanelDevice:get_argument_value(69), + mainPanelDevice:get_argument_value(70), + mainPanelDevice:get_argument_value(75), + mainPanelDevice:get_argument_value(72), + mainPanelDevice:get_argument_value(531), + mainPanelDevice:get_argument_value(73), + mainPanelDevice:get_argument_value(532))) + -- backup ADI (AGR-81) + --------------------------------------------------- + --[[ + [142] = "%.4f", -- AGR_81_Roll {1.0, -1.0} + [143] = "%.4f", -- AGR_81_Pitch {-1.0, 1.0} + [144] = "%.4f", -- AGR_81_sideslip {-1.0, 1.0} + [145] = "%0.1f", -- AGR_81_failure_flag{0.0, 1.0} + ]] + SendData("2006", string.format("%.4f;%.4f;%.4f;%.1f", + mainPanelDevice:get_argument_value(142), + mainPanelDevice:get_argument_value(143), + mainPanelDevice:get_argument_value(144), + mainPanelDevice:get_argument_value(145))) + -- Engines temperature + --------------------------------------------------- + --[[ + [133] = "%.4f", -- LeftEngineTemperatureHund {0.0,1.0} + [566] = "%.4f", -- LeftEngineTemperatureTenth {0.0,1.0} + [134] = "%.4f", -- RightEngineTemperatureHund {0.0,1.0} + [567] = "%.4f", -- RightEngineTemperatureHund {0.0,1.0} + ]] + SendData("2007", string.format("%.4f;%.4f;%.4f;%.4f", + mainPanelDevice:get_argument_value(133), + mainPanelDevice:get_argument_value(566), + mainPanelDevice:get_argument_value(134), + mainPanelDevice:get_argument_value(567))) + -- Engine RPM + --------------------------------------------------- + --[[ + [135] = "%.4f", -- LeftEngineRPM {0.0,1.0} + [136] = "%.4f", -- RightEngineRPM {0.0,1.0} + ]] + SendData("2008", string.format("%.4f;%.4f", + mainPanelDevice:get_argument_value(135), + mainPanelDevice:get_argument_value(136))) + -- Fuel tanks + --------------------------------------------------- + --[[ + [137] = "%.4f", -- ForwardTankAmount {0.0,1.0} + [138] = "%.4f", -- RearTankAmount {0.0,1.0} + [139] = "%0.1f", -- lamp_ForwardTankTest {0.0,1.0} + [140] = "%0.1f", -- lamp_RearTankTest {0.0,1.0} + ]] + SendData("2009", string.format("%.4f;%.4f;%.1f;%.1f", + mainPanelDevice:get_argument_value(137), + mainPanelDevice:get_argument_value(138), + mainPanelDevice:get_argument_value(139), + mainPanelDevice:get_argument_value(140))) + -- Magnetic Compass (KI-13) + --------------------------------------------------- + --[[ + [11] = "%.4f", -- KI_13_course {-1,1} + [12] = "%.4f", -- KI_13_pitch {-1,1} + [14] = "%.4f", -- KI_13_bank {-1,1} + ]] + SendData("2010", string.format("%.4f;%.4f;%.4f", + mainPanelDevice:get_argument_value(11), + mainPanelDevice:get_argument_value(12), + mainPanelDevice:get_argument_value(14))) + -- Oil pressure and temperature indicators group (Right Panel) + --------------------------------------------------- + --[[ + [252] = "%.4f", -- NeedleOilPressureEngineLeft {0.0,1.0} + [253] = "%.4f", -- NeedleOilPressureEngineRight {0.0, 1.0} + [254] = "%.4f", -- NeedleOilPressureGearBox {0.0,1.0} + [255] = "%.4f", -- NeedleOilTemperatureEngineLeft {0.0,1.0} + [256] = "%.4f", -- NeedleOilTemperatureEngineRight {0.0,1.0} + [257] = "%.4f", -- NeedleOilTemperatureGearBox {0.0,1.0} + ]] + --SendData("2011", string.format("%.4f;%.4f;%.4f;%.4f;%.4f;%.4f", + -- mainPanelDevice:get_argument_value(252), + -- mainPanelDevice:get_argument_value(253), + -- mainPanelDevice:get_argument_value(254), + -- mainPanelDevice:get_argument_value(255), + -- mainPanelDevice:get_argument_value(256), + -- mainPanelDevice:get_argument_value(257))) + -- Hydraulics Gauges (Back Panel) + --------------------------------------------------- + --[[ + [471] = "%.4f", -- hydro_common_pressure {0.0,1.0} + [472] = "%.4f", -- hydro_main_pressure {0.0,1.0} + [473] = "%.4f", -- hydro_acc_brake_pressure {0.0,1.0} + [474] = "%.4f", -- hydro_gear_brake_pressure {0.0,1.0} + [475] = "%.4f", -- hydro_common_temperature {0.0,1.0} + [476] = "%.4f", -- hydro_main_temperature {0.0,1.0} + ]] + --SendData("2012", string.format("%.4f;%.4f;%.4f;%.4f;%.4f;%.4f", + -- mainPanelDevice:get_argument_value(471), + -- mainPanelDevice:get_argument_value(472), + -- mainPanelDevice:get_argument_value(473), + -- mainPanelDevice:get_argument_value(474), + -- mainPanelDevice:get_argument_value(475), + -- mainPanelDevice:get_argument_value(476))) + --WriteToLog('hydro_common_temperature '..dump(mainPanelDevice:get_argument_value(475))..', hydro_main_temperature '..dump(mainPanelDevice:get_argument_value(476))) + -- APU Temperature + --------------------------------------------------- + --[6] = "%.4f", -- APUTemperature {0.0, 900.0} = {0.0, 1.0} + -- ambientTemperature + --------------------------------------------------- + --[587] = "%0.3f" -- ambientTemperature {-60, 50} = {-0.946, 0.788} + -- Engines mode indicator + --------------------------------------------------- + --[[ + [592] = "%.4f", -- EnginesMode {0.0,1.0} + [234] = "%0.2f", -- LeftEngineMode{0.0,1.0} + [235] = "%0.2f", -- RightEngineMode {0.0,1.0} + ]] + SendData("2015", string.format("%.4f;%.4f;%.4f", + mainPanelDevice:get_argument_value(592), + mainPanelDevice:get_argument_value(234), + mainPanelDevice:get_argument_value(235))) + --WriteToLog('EnginesMode '..dump(mainPanelDevice:get_argument_value(592))..', LeftEngineMode '..dump(mainPanelDevice:get_argument_value(234))..', RightEngineMode '..dump(mainPanelDevice:get_argument_value(235))) + end +end + +-- Pointed to by ProcessHARDWAREHighImportance, if the player aircraft is a Ka-50 +function ProcessHARDWAREConfigHighImportance(mainPanelDevice) + --[[ + every frame export to hardware + Example from A-10C + Get Radio Frequencies + get data from device + local UHF_RADIO = GetDevice(54) + SendDataHW("ExportID", "Format") + SendDataHW("ExportID", "Format", HardwareConfigID) + SendDataHW("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000)) + SendDataHW("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000), 2) -- export to Hardware '2' Config + ]] + + --SendDataHW("2006",UV26Display()) + + -- LAMPS + --------------------------------------------------- + SendDataHW("44", mainPanelDevice:get_argument_value(44) > 0.0 and 1 or 0) -- lamp_MasterWarning {0.0,0.3} + SendDataHW("46", mainPanelDevice:get_argument_value(46) > 0.0 and 1 or 0) -- lamp_RotorRPM {0.0,1.0} + SendDataHW("47", string.format("%0.1f", mainPanelDevice:get_argument_value(47))) -- lamp_UNDERFIREwarning {0.0,1.0} + SendDataHW("48", string.format("%0.1f", mainPanelDevice:get_argument_value(48))) -- lamp_LowerGear {0.0,1.0} + SendDataHW("78", string.format("%0.1f", mainPanelDevice:get_argument_value(78))) -- lamp_RPM_leftEngineMax {0.0,1.0} + SendDataHW("79", string.format("%0.1f", mainPanelDevice:get_argument_value(79))) -- lamp_RPM_rightEngineMax {0.0,1.0} + SendDataHW("80", string.format("%0.1f", mainPanelDevice:get_argument_value(80))) -- lamp_NyMax {0.0,1.0} + SendDataHW("81", string.format("%0.1f", mainPanelDevice:get_argument_value(81))) -- lamp_vibr_leftEngine {0.0,1.0} + SendDataHW("82", string.format("%0.1f", mainPanelDevice:get_argument_value(82))) -- lamp_vibr_rightEngine {0.0,1.0} + SendDataHW("83", string.format("%0.1f", mainPanelDevice:get_argument_value(83))) -- lamp_IAS_max {0.0,1.0} + SendDataHW("84", string.format("%0.1f", mainPanelDevice:get_argument_value(84))) -- lamp_mainTransmission {0.0,1.0} + SendDataHW("85", string.format("%0.1f", mainPanelDevice:get_argument_value(85))) -- lamp_Fire {0.0,1.0} + SendDataHW("86", string.format("%0.1f", mainPanelDevice:get_argument_value(86))) -- lamp_IFFfailure {0.0,1.0} + -- Fuel tanks + --------------------------------------------------- + SendDataHW("139", string.format("%0.1f", mainPanelDevice:get_argument_value(139))) -- lamp_ForwardTankTest {0.0,1.0} + SendDataHW("140", string.format("%0.1f", mainPanelDevice:get_argument_value(140))) -- lamp_RearTankTest {0.0,1.0} + -- PUI-800 Weapon panel + --------------------------------------------------- + SendDataHW("392", string.format("%0.1f", mainPanelDevice:get_argument_value(392))) -- lamp_PUI800_Sta1_WeapIsPresent{0.0, 1.0} + SendDataHW("393", string.format("%0.1f", mainPanelDevice:get_argument_value(393))) -- lamp_PUI800_Sta2_WeapIsPresent{0.0, 1.0} + SendDataHW("394", string.format("%0.1f", mainPanelDevice:get_argument_value(394))) -- lamp_PUI800_Sta3_WeapIsPresent{0.0, 1.0} + SendDataHW("395", string.format("%0.1f", mainPanelDevice:get_argument_value(395))) -- lamp_PUI800_Sta4_WeapIsPresent{0.0, 1.0} + SendDataHW("388", string.format("%0.1f", mainPanelDevice:get_argument_value(388))) -- lamp_PUI800_Sta1_WeapIsReady{0.0, 1.0} + SendDataHW("389", string.format("%0.1f", mainPanelDevice:get_argument_value(389))) -- lamp_PUI800_Sta2_WeapIsReady{0.0, 1.0} + SendDataHW("390", string.format("%0.1f", mainPanelDevice:get_argument_value(390))) -- lamp_PUI800_Sta3_WeapIsReady{0.0, 1.0} + SendDataHW("391", string.format("%0.1f", mainPanelDevice:get_argument_value(391))) -- lamp_PUI800_Sta4_WeapIsReady{0.0, 1.0} + -- LGCP - Landing gear control panel + --------------------------------------------------- + SendDataHW("63", string.format("%0.1f", mainPanelDevice:get_argument_value(63))) -- LGCP_Lamp_NoseGearUp {0.0,1.0} + SendDataHW("64", string.format("%0.1f", mainPanelDevice:get_argument_value(64))) -- LGCP_Lamp_NoseGearDown {0.0,1.0} + SendDataHW("61", string.format("%0.1f", mainPanelDevice:get_argument_value(61))) -- LGCP_Lamp_RightMainGearUp {0.0,1.0} + SendDataHW("62", string.format("%0.1f", mainPanelDevice:get_argument_value(62))) -- LGCP_Lamp_RightMainGearDown {0.0,1.0} + SendDataHW("59", string.format("%0.1f", mainPanelDevice:get_argument_value(59))) -- LGCP_Lamp_LeftMainGearUp {0.0,1.0} + SendDataHW("60", string.format("%0.1f", mainPanelDevice:get_argument_value(60))) -- LGCP_Lamp_LeftMainGearDown{0.0, 1.0} + -- LAMPS + --------------------------------------------------- + SendDataHW("170", string.format("%0.1f", mainPanelDevice:get_argument_value(170))) -- lamp_H_RALT_stab {0.0,1.0} + SendDataHW("175", string.format("%0.1f", mainPanelDevice:get_argument_value(175))) -- lamp_Hover {0.0,1.0} + SendDataHW("172", string.format("%0.1f", mainPanelDevice:get_argument_value(172))) -- lamp_Descent {0.0,1.0} + SendDataHW("165", string.format("%0.1f", mainPanelDevice:get_argument_value(165))) -- lamp_RouteHeadingSteering {0.0,1.0} + SendDataHW("171", string.format("%0.1f", mainPanelDevice:get_argument_value(171))) -- lamp_RouteCourseSteering {0.0,1.0} + SendDataHW("176", string.format("%0.1f", mainPanelDevice:get_argument_value(176))) -- lamp_Waypoint {0.0,1.0} + SendDataHW("166", string.format("%0.1f", mainPanelDevice:get_argument_value(166))) -- lamp_EndOfRoute {0.0,1.0} + SendDataHW("164", string.format("%0.1f", mainPanelDevice:get_argument_value(164))) -- lamp_RoughNAVcalc {0.0,1.0} + SendDataHW("178", string.format("%0.1f", mainPanelDevice:get_argument_value(178))) -- lamp_Burst {0.0,1.0} + SendDataHW("173", string.format("%0.1f", mainPanelDevice:get_argument_value(173))) -- lamp_CannonMovingBarr {0.0,1.0} + SendDataHW("177", string.format("%0.1f", mainPanelDevice:get_argument_value(177))) -- lamp_CannonMovingBarr2 {0.0,1.0} + SendDataHW("211", string.format("%0.1f", mainPanelDevice:get_argument_value(211))) -- lamp_FuelCrossfeedOn {0.0,1.0} + SendDataHW("187", string.format("%0.1f", mainPanelDevice:get_argument_value(187))) -- lamp_CouplerOff {0.0,1.0} + SendDataHW("204", string.format("%0.1f", mainPanelDevice:get_argument_value(204))) -- lamp_ActuatorsOilPress {0.0,1.0} + SendDataHW("213", string.format("%0.1f", mainPanelDevice:get_argument_value(213))) -- lamp_LockOff {0.0,1.0} + -- LAMPS + --------------------------------------------------- + SendDataHW("167", string.format("%0.1f", mainPanelDevice:get_argument_value(167))) -- lamp_WeapSysBUS_ON {0.0,1.0} + SendDataHW("180", string.format("%0.1f", mainPanelDevice:get_argument_value(180))) -- lamp_TrainingMode {0.0,1.0} + SendDataHW("179", string.format("%0.1f", mainPanelDevice:get_argument_value(179))) -- lamp_OBZOR_800 {0.0,1.0} + SendDataHW("188", string.format("%0.1f", mainPanelDevice:get_argument_value(188))) -- lamp_RANET {0.0,1.0} + SendDataHW("189", string.format("%0.1f", mainPanelDevice:get_argument_value(189))) -- lamp_CC_test {0.0,1.0} + SendDataHW("206", string.format("%0.1f", mainPanelDevice:get_argument_value(206))) -- lamp_CC_failure {0.0,1.0} + SendDataHW("212", string.format("%0.1f", mainPanelDevice:get_argument_value(212))) -- lamp_DC_AC_Inverter {0.0,1.0} + SendDataHW("205", string.format("%0.1f", mainPanelDevice:get_argument_value(205))) -- lamp_I_251V {0.0,1.0} + SendDataHW("181", string.format("%0.1f", mainPanelDevice:get_argument_value(181))) -- lamp_AntiIceLeftEngine {0.0,1.0} + SendDataHW("190", string.format("%0.1f", mainPanelDevice:get_argument_value(190))) -- lamp_DustProtectLeftEngine {0.0,1.0} + SendDataHW("207", string.format("%0.1f", mainPanelDevice:get_argument_value(207))) -- lamp_BackupModeLeftEngine {0.0,1.0} + SendDataHW("183", string.format("%0.1f", mainPanelDevice:get_argument_value(183))) -- lamp_AntiIceRotors {0.0,1.0} + SendDataHW("182", string.format("%0.1f", mainPanelDevice:get_argument_value(182))) -- lamp_AntiIceRightEngine {0.0,1.0} + SendDataHW("191", string.format("%0.1f", mainPanelDevice:get_argument_value(191))) -- lamp_DustProtectRightEngine {0.0,1.0} + SendDataHW("208", string.format("%0.1f", mainPanelDevice:get_argument_value(208))) -- lamp_BackupModeRightEngine {0.0,1.0} + SendDataHW("184", string.format("%0.1f", mainPanelDevice:get_argument_value(184))) -- lamp_VUO_Heat {0.0,1.0} + SendDataHW("200", string.format("%0.1f", mainPanelDevice:get_argument_value(200))) -- lamp_ForwardTank {0.0,1.0} + SendDataHW("209", string.format("%0.1f", mainPanelDevice:get_argument_value(209))) -- lamp_LeftValveClosed {0.0,1.0} + SendDataHW("185", string.format("%0.1f", mainPanelDevice:get_argument_value(185))) -- lamp_LeftOuterTank {0.0,1.0} + SendDataHW("202", string.format("%0.1f", mainPanelDevice:get_argument_value(202))) -- lamp_LeftInnerTank {0.0,1.0} + SendDataHW("201", string.format("%0.1f", mainPanelDevice:get_argument_value(201))) -- lamp_RearTank {0.0,1.0} + SendDataHW("210", string.format("%0.1f", mainPanelDevice:get_argument_value(210))) -- lamp_RightValveClosed {0.0,1.0} + SendDataHW("186", string.format("%0.1f", mainPanelDevice:get_argument_value(186))) -- lamp_RightOuterTank {0.0,1.0} + SendDataHW("203", string.format("%0.1f", mainPanelDevice:get_argument_value(203))) -- lamp_RightInnerTank {0.0,1.0} + -- DATALINK + --------------------------------------------------- + SendDataHW("159", mainPanelDevice:get_argument_value(159) > 0.0 and 1 or 0) -- PRC_button_SEND {0.0,0.3} + SendDataHW("150", mainPanelDevice:get_argument_value(150) > 0.0 and 1 or 0) -- PRC_button_ESCAPE {0.0,0.3} + SendDataHW("161", mainPanelDevice:get_argument_value(161) > 0.0 and 1 or 0) -- PRC_button_ERASE {0.0,0.3} + SendDataHW("15", mainPanelDevice:get_argument_value(15) > 0.0 and 1 or 0) -- PRC_button_CLEAN {0.0,0.3} + SendDataHW("16", mainPanelDevice:get_argument_value(16) > 0.0 and 1 or 0) -- PRC_button_WINGMAN_ALL {0.0,0.3} + SendDataHW("17", mainPanelDevice:get_argument_value(17) > 0.0 and 1 or 0) -- PRC_button_WINGMAN_1 {0.0,0.3} + SendDataHW("18", mainPanelDevice:get_argument_value(18) > 0.0 and 1 or 0) -- PRC_button_WINGMAN_2 {0.0,0.3} + SendDataHW("19", mainPanelDevice:get_argument_value(19) > 0.0 and 1 or 0) -- PRC_button_WINGMAN_3 {0.0,0.3} + SendDataHW("20", mainPanelDevice:get_argument_value(20) > 0.0 and 1 or 0) -- PRC_button_WINGMAN_4 {0.0,0.3} + SendDataHW("21", mainPanelDevice:get_argument_value(21) > 0.0 and 1 or 0) -- PRC_button_TARGET_1 {0.0,0.3} + SendDataHW("22", mainPanelDevice:get_argument_value(22) > 0.0 and 1 or 0) -- PRC_button_TARGET_2 {0.0,0.3} + SendDataHW("23", mainPanelDevice:get_argument_value(23) > 0.0 and 1 or 0) -- PRC_button_TARGET_3 {0.0,0.3} + SendDataHW("50", mainPanelDevice:get_argument_value(50) > 0.0 and 1 or 0) -- PRC_button_TARGET_POINT {0.0,0.3} + -- Laser warning system + --------------------------------------------------- + SendDataHW("25", string.format("%0.1f", mainPanelDevice:get_argument_value(25))) -- LWS_LampAzimuth_0 {0.0,1.0} + SendDataHW("28", string.format("%0.1f", mainPanelDevice:get_argument_value(28))) -- LWS_LampAzimuth_90 {0.0,1.0} + SendDataHW("26", string.format("%0.1f", mainPanelDevice:get_argument_value(26))) -- LWS_LampAzimuth_180 {0.0,1.0} + SendDataHW("27", string.format("%0.1f", mainPanelDevice:get_argument_value(27))) -- LWS_LampAzimuth_270 {0.0,1.0} + SendDataHW("31", string.format("%0.1f", mainPanelDevice:get_argument_value(31))) -- LWS_LampAzimuth_UpperHemisphere {0.0,1.0} + SendDataHW("32", string.format("%0.1f", mainPanelDevice:get_argument_value(32))) -- LWS_LampAzimuth_LowerHemisphere {0.0,1.0} + SendDataHW("33", string.format("%0.1f", mainPanelDevice:get_argument_value(33))) -- LWS_LampAzimuth_LaserRangefinder {0.0,1.0} + SendDataHW("34", string.format("%0.1f", mainPanelDevice:get_argument_value(34))) -- LWS_LampAzimuth_LaserTargetingSystem {0.0,1.0} + SendDataHW("582", string.format("%0.1f", mainPanelDevice:get_argument_value(582))) -- LWS_LampReady {0.0,1.0} + -- UV-26 + --------------------------------------------------- + SendDataHW("541", string.format("%0.1f", mainPanelDevice:get_argument_value(541))) -- UV26_lampLeftBoard {0.0,1.0} + SendDataHW("542", string.format("%0.1f", mainPanelDevice:get_argument_value(542))) -- UV26_lampRightBoard {0.0,1.0} + -- PVI (Nav Control Panel) + --------------------------------------------------- + SendDataHW("315", mainPanelDevice:get_argument_value(315) > 0.0 and 1 or 0) -- PVI_button_WPT{0.0, 0.3} + SendDataHW("519", mainPanelDevice:get_argument_value(519) > 0.0 and 1 or 0) -- PVI_button_INSREALN{0.0, 0.3} + SendDataHW("316", mainPanelDevice:get_argument_value(316) > 0.0 and 1 or 0) -- PVI_button_FIXPT{0.0, 0.3} + SendDataHW("520", mainPanelDevice:get_argument_value(520) > 0.0 and 1 or 0) -- PVI_button_PRECALN{0.0, 0.3} + SendDataHW("317", mainPanelDevice:get_argument_value(317) > 0.0 and 1 or 0) -- PVI_button_AERDR{0.0, 0.3} + SendDataHW("521", mainPanelDevice:get_argument_value(521) > 0.0 and 1 or 0) -- PVI_button_NORMALN{0.0, 0.3} + SendDataHW("318", mainPanelDevice:get_argument_value(318) > 0.0 and 1 or 0) -- PVI_button_TGT{0.0, 0.3} + SendDataHW("313", mainPanelDevice:get_argument_value(313) > 0.0 and 1 or 0) -- PVI_button_ENTER{0.0, 0.3} + SendDataHW("314", mainPanelDevice:get_argument_value(314) > 0.0 and 1 or 0) -- PVI_button_CANCEL{0.0, 0.3} + SendDataHW("522", mainPanelDevice:get_argument_value(522) > 0.0 and 1 or 0) -- PVI_button_INITCOORD{0.0, 0.3} + SendDataHW("319", mainPanelDevice:get_argument_value(319) > 0.0 and 1 or 0) -- PVI_button_FILAMBDA{0.0, 0.3} + SendDataHW("320", mainPanelDevice:get_argument_value(320) > 0.0 and 1 or 0) -- PVI_button_FIZ{0.0, 0.3} + SendDataHW("321", mainPanelDevice:get_argument_value(321) > 0.0 and 1 or 0) -- PVI_button_DU{0.0, 0.3} + SendDataHW("322", mainPanelDevice:get_argument_value(322) > 0.0 and 1 or 0) -- PVI_button_FII{0.0, 0.3} + SendDataHW("323", mainPanelDevice:get_argument_value(323) > 0.0 and 1 or 0) -- PVI_button_BRGRNG{0.0, 0.3} + SendDataHW("330", mainPanelDevice:get_argument_value(330) > 0.0 and 1 or 0) -- PPR_button_K{0.0, 0.3} + SendDataHW("332", mainPanelDevice:get_argument_value(332) > 0.0 and 1 or 0) -- PPR_button_H{0.0, 0.3} + SendDataHW("331", mainPanelDevice:get_argument_value(331) > 0.0 and 1 or 0) -- PPR_button_T{0.0, 0.3} + SendDataHW("333", mainPanelDevice:get_argument_value(333) > 0.0 and 1 or 0) -- PPR_button_B{0.0, 0.3} + SendDataHW("334", mainPanelDevice:get_argument_value(334) > 0.0 and 1 or 0) -- PPR_button_DIR{0.0, 0.3} + -- RadioCommunicator R-828 + --------------------------------------------------- + SendDataHW("375", string.format("%0.1f", mainPanelDevice:get_argument_value(375))) -- Radio_ASU_lamp{0.0,1.0} + -- RadioCommunicator R-800 + --------------------------------------------------- + SendDataHW("419", string.format("%0.1f", mainPanelDevice:get_argument_value(419))) -- Radio_Test_lamp {0.0,1.0} + -- WEAPON INTERFACE + --------------------------------------------------- + SendDataHW("437", mainPanelDevice:get_argument_value(437) > 0.0 and 1 or 0) -- PRC_button_AUTO_TURN {0.0,0.3} + SendDataHW("438", mainPanelDevice:get_argument_value(438) > 0.0 and 1 or 0) -- PRC_button_AIRBORNE_TARGET {0.0,0.3} + SendDataHW("439", mainPanelDevice:get_argument_value(439) > 0.0 and 1 or 0) -- PRC_button_FORWARD_HEMISPHERE {0.0,0.3} + SendDataHW("440", mainPanelDevice:get_argument_value(440) > 0.0 and 1 or 0) -- PRC_button_GROUND_MOVING_TARGET {0.0,0.3} + SendDataHW("441", mainPanelDevice:get_argument_value(441) > 0.0 and 1 or 0) -- PRC_button_CLEAR {0.0,0.3} + -- Engines start panel + --------------------------------------------------- + SendDataHW("163", string.format("%0.1f", mainPanelDevice:get_argument_value(163))) -- lamp_EnginesStartValve{0.0, 1.0} + -- APU control panel + --------------------------------------------------- + SendDataHW("162", string.format("%0.1f", mainPanelDevice:get_argument_value(162))) -- lamp_APUValveOpen{0.0, 1.0}{0.0, 1.0} + SendDataHW("168", string.format("%0.1f", mainPanelDevice:get_argument_value(168))) -- lamp_APUOilPres{0.0, 1.0}{0.0, 1.0} + SendDataHW("169", string.format("%0.1f", mainPanelDevice:get_argument_value(169))) -- lamp_APUStoppedByRPM{0.0, 1.0} + SendDataHW("174", string.format("%0.1f", mainPanelDevice:get_argument_value(174))) -- lamp_APU_IsON{0.0, 1.0} + -- Right Side Panel + --------------------------------------------------- + SendDataHW("586", string.format("%0.1f", mainPanelDevice:get_argument_value(586))) -- lamp_AC_Ground_Power{0.0, 1.0} + SendDataHW("261", string.format("%0.1f", mainPanelDevice:get_argument_value(261))) -- lamp_DC_Ground_Power{0.0, 1.0} + -- Eject system + --------------------------------------------------- + SendDataHW("461", string.format("%0.1f", mainPanelDevice:get_argument_value(461))) -- EjectSystemTestLamp{0.0, 1.0} + -- Fire Extinguishers panel + --------------------------------------------------- + SendDataHW("237", string.format("%0.1f", mainPanelDevice:get_argument_value(237))) -- lamp_Exting_LeftEngineFire{0.0, 1.0} + SendDataHW("239", string.format("%0.1f", mainPanelDevice:get_argument_value(239))) -- lamp_Exting_APU_Fire{0.0, 1.0} + SendDataHW("568", string.format("%0.1f", mainPanelDevice:get_argument_value(568))) -- lamp_Exting_HydraulicsFire{0.0, 1.0} + SendDataHW("241", string.format("%0.1f", mainPanelDevice:get_argument_value(241))) -- lamp_Exting_RightEngineFire{0.0, 1.0} + SendDataHW("243", string.format("%0.1f", mainPanelDevice:get_argument_value(243))) -- lamp_Exting_VentilatorFire{0.0, 1.0} + SendDataHW("244", string.format("%0.1f", mainPanelDevice:get_argument_value(244))) -- lamp_Exting_Lamp1{0.0, 1.0} + SendDataHW("245", string.format("%0.1f", mainPanelDevice:get_argument_value(245))) -- lamp_Exting_Lamp2{0.0, 1.0} + -- Right Back Panel + --------------------------------------------------- + SendDataHW("469", string.format("%0.1f", mainPanelDevice:get_argument_value(469))) -- lamp_flap_hydro_1{0.0, 1.0} + SendDataHW("470", string.format("%0.1f", mainPanelDevice:get_argument_value(470))) -- lamp_flap_hydro_2{0.0, 1.0} + -- Latitude Entry Panel (PShK_7) + --------------------------------------------------- + SendDataHW("342", string.format("%0.1f", mainPanelDevice:get_argument_value(342))) -- PShK7_LampAuto {0.0,1.0} + + -- generic Radio display and frequency rotarys + ------------------------------------------------- + genericRadio(nil, nil, gES_genericRadioHardwareID) + +--[[ + -- ENGINE_INTERFACE + local lENGINE_INTERFACE = GetDevice(4) + WriteToLog('lENGINE_INTERFACE:get_left_engine_temp '..dump(lENGINE_INTERFACE:get_left_engine_temp())) + WriteToLog('lENGINE_INTERFACE:get_left_engine_rpm '..dump(lENGINE_INTERFACE:get_left_engine_rpm())) + WriteToLog('lENGINE_INTERFACE:get_right_engine_temp '..dump(lENGINE_INTERFACE:get_right_engine_temp())) + WriteToLog('lENGINE_INTERFACE:get_right_engine_rpm '..dump(lENGINE_INTERFACE:get_right_engine_rpm())) + WriteToLog('lENGINE_INTERFACE:get_apu_temp '..dump(lENGINE_INTERFACE:get_apu_temp())) + + -- ABRIS + local lABRIS = GetDevice(9) + WriteToLog('lABRIS:get_active_route '..dump(lABRIS:get_active_route())) + WriteToLog('lABRIS:get_edited_route '..dump(lABRIS:get_edited_route())) + WriteToLog('lABRIS:get_sns_mode '..dump(lABRIS:get_sns_mode())) + WriteToLog('lABRIS:get_current_route '..dump(lABRIS:get_current_route())) + --WriteToLog('lABRIS:get_current_route_segment_info '..dump(lABRIS:get_current_route_segment_info())) -- DCS Error + WriteToLog('lABRIS:get_mode '..dump(lABRIS:get_mode())) + WriteToLog('lABRIS:print_to_console '..dump(lABRIS:print_to_console())) + --WriteToLog('lABRIS:replace_last_console_line '..dump(lABRIS:replace_last_console_line())) -- DCS Error + + -- EKRAN + local lEKRAN = GetDevice(10) + WriteToLog('lEKRAN:get_actual_text_frame '..dump(lEKRAN:get_actual_text_frame())) + + -- WEAP_INTERFACE + local lWEAP_INTERFACE = GetDevice(12) + WriteToLog('lWEAP_INTERFACE:get_weapon_type_on_station '..dump(lWEAP_INTERFACE:get_weapon_type_on_station())) + WriteToLog('lWEAP_INTERFACE:get_selected_weapon_stations '..dump(lWEAP_INTERFACE:get_selected_weapon_stations())) + WriteToLog('lWEAP_INTERFACE:get_selected_gun_ammo '..dump(lWEAP_INTERFACE:get_selected_gun_ammo())) + WriteToLog('lWEAP_INTERFACE:get_selected_gun_ammo_count '..dump(lWEAP_INTERFACE:get_selected_gun_ammo_count())) + WriteToLog('lWEAP_INTERFACE:get_weapon_count_on_station '..dump(lWEAP_INTERFACE:get_weapon_count_on_station())) + + -- DISS + local lDISS = GetDevice(16) + WriteToLog('lDISS:get_w_vector '..dump(lDISS:get_w_vector())) + WriteToLog('lDISS:get_drift_angle '..dump(lDISS:get_drift_angle())) + + -- NAV_INTERFACE + local lNAV_INTERFACE = GetDevice(28) + WriteToLog('lNAV_INTERFACE:get_indicated_air_speed '..dump(lNAV_INTERFACE:get_indicated_air_speed())) + WriteToLog('lNAV_INTERFACE:get_vertical_velocity '..dump(lNAV_INTERFACE:get_vertical_velocity())) + + -- HSI + local lHSI = GetDevice(30) + WriteToLog('lHSI:get_course '..dump(lHSI:get_course())) + WriteToLog('lHSI:get_course_dev_warning_flag '..dump(lHSI:get_course_dev_warning_flag())) + WriteToLog('lHSI:get_heading '..dump(lHSI:get_heading())) + WriteToLog('lHSI:get_heading_warning_flag '..dump(lHSI:get_heading_warning_flag())) + WriteToLog('lHSI:get_glideslope_dev_warning_flag '..dump(lHSI:get_glideslope_dev_warning_flag())) + WriteToLog('lHSI:get_range '..dump(lHSI:get_range())) + WriteToLog('lHSI:get_commanded_course '..dump(lHSI:get_commanded_course())) + WriteToLog('lHSI:get_bearing '..dump(lHSI:get_bearing())) + WriteToLog('lHSI:get_commanded_heading '..dump(lHSI:get_commanded_heading())) + + -- ADI + local lADI = GetDevice(31) + WriteToLog('lADI:get_sideslip '..dump(lADI:get_sideslip())) + WriteToLog('lADI:get_attitude_warn_flag_val '..dump(lADI:get_attitude_warn_flag_val())) + WriteToLog('lADI:get_pitch_steering '..dump(lADI:get_pitch_steering())) + WriteToLog('lADI:get_track_deviation '..dump(lADI:get_track_deviation())) + WriteToLog('lADI:get_airspeed_deviation '..dump(lADI:get_airspeed_deviation())) + WriteToLog('lADI:get_height_deviation '..dump(lADI:get_height_deviation())) + WriteToLog('lADI:get_bank_steering '..dump(lADI:get_bank_steering())) + WriteToLog('lADI:get_pitch '..dump(lADI:get_pitch())) + WriteToLog('lADI:get_steering_warn_flag_val '..dump(lADI:get_steering_warn_flag_val())) + WriteToLog('lADI:get_bank '..dump(lADI:get_bank())) + + -- AUTOPILOT + local lAUTOPILOT = GetDevice(33) + WriteToLog('lAUTOPILOT:get_channel_status_Bank '..dump(lAUTOPILOT:get_channel_status_Bank())) + WriteToLog('lAUTOPILOT:get_directional_mode '..dump(lAUTOPILOT:get_directional_mode())) + WriteToLog('lAUTOPILOT:get_channel_status_Yaw '..dump(lAUTOPILOT:get_channel_status_Yaw())) + WriteToLog('lAUTOPILOT:get_channel_status_Pitch '..dump(lAUTOPILOT:get_channel_status_Pitch())) + WriteToLog('lAUTOPILOT:get_channel_status_Height '..dump(lAUTOPILOT:get_channel_status_Height())) + + -- RADAR_ALTIMETER + local lRADAR_ALTIMETER = GetDevice(38) + WriteToLog('lRADAR_ALTIMETER:get_altitude '..dump(lRADAR_ALTIMETER:get_altitude())) + WriteToLog('lRADAR_ALTIMETER:get_dangerous_height_flag '..dump(lRADAR_ALTIMETER:get_dangerous_height_flag())) + WriteToLog('lRADAR_ALTIMETER:get_distance_limit '..dump(lRADAR_ALTIMETER:get_distance_limit())) + WriteToLog('lRADAR_ALTIMETER:get_dangerous_height '..dump(lRADAR_ALTIMETER:get_dangerous_height())) + WriteToLog('lRADAR_ALTIMETER:get_warning_flag '..dump(lRADAR_ALTIMETER:get_warning_flag())) + WriteToLog('lRADAR_ALTIMETER:get_mode '..dump(lRADAR_ALTIMETER:get_mode())) + WriteToLog('lRADAR_ALTIMETER:get_aperture_size '..dump(lRADAR_ALTIMETER:get_aperture_size())) + WriteToLog('lRADAR_ALTIMETER:get_needle_value '..dump(lRADAR_ALTIMETER:get_needle_value())) + + -- MISC_SYSTEMS_INTERFACE + local lMISC_SYSTEMS_INTERFACE = GetDevice(41) + WriteToLog('lMISC_SYSTEMS_INTERFACE:get_rotor_blades_pitch '..dump(lMISC_SYSTEMS_INTERFACE:get_rotor_blades_pitch())) + WriteToLog('lMISC_SYSTEMS_INTERFACE:get_main_rotor_rpm '..dump(lMISC_SYSTEMS_INTERFACE:get_main_rotor_rpm())) + + -- ARK_22 + local lARK_22 = GetDevice(46) + WriteToLog('lARK_22:get_channel '..dump(lARK_22:get_channel())) + WriteToLog('lARK_22:get_mode '..dump(lARK_22:get_mode())) + WriteToLog('lARK_22:get_homer_selector_pos '..dump(lARK_22:get_homer_selector_pos())) + + -- R_800 + local lR_800 = GetDevice(48) + WriteToLog('lR_800:is_on '..dump(lR_800:is_on())) + WriteToLog('lR_800:get_frequency '..dump(lR_800:get_frequency())) + --WriteToLog('lR_800:set_modulation '..dump(lR_800:set_modulation())) -- test the parameters + --WriteToLog('lR_800:set_frequency '..dump(lR_800:(set_frequency))) -- test the parameters + + -- R_828 + local R_828 = GetDevice(49) + WriteToLog('R_828:is_on '..dump(R_828:is_on())) + WriteToLog('R_828:get_frequency '..dump(R_828:get_frequency())) + --WriteToLog('R_828:set_modulation '..dump(R_828:set_modulation())) -- test the parameters + --WriteToLog('R_828:set_frequency '..dump(R_828:(set_frequency))) -- test the parameters + --WriteToLog('R_828:set_channel '..dump(R_828:(set_channel))) -- test the parameters + + -- SPU_9 + local lSPU_9 = GetDevice(50) + WriteToLog('lSPU_9:get_is_on '..dump(lSPU_9:get_is_on())) + WriteToLog('lSPU_9:is_communicator_available '..dump(lSPU_9:is_communicator_available())) + WriteToLog('lSPU_9:get_selector_pos '..dump(lSPU_9:get_selector_pos())) + WriteToLog('lSPU_9:get_noise_level '..dump(lSPU_9:get_noise_level())) + WriteToLog('lSPU_9:get_signal_level '..dump(lSPU_9:get_signal_level())) + --WriteToLog('lSPU_9:set_communicator '..dump(lSPU_9:set_communicator())) -- test the parameters + --WriteToLog('lSPU_9:set_voip_mode '..dump(lSPU_9:set_voip_mode())) -- test the parameters + + -- STBY_ADI + local lSTBY_ADI = GetDevice(55) + WriteToLog('lSTBY_ADI:get_sideslip '..dump(lSTBY_ADI:get_sideslip())) + WriteToLog('lSTBY_ADI:get_bank '..dump(lSTBY_ADI:get_bank())) + WriteToLog('lSTBY_ADI:get_pitch '..dump(lSTBY_ADI:get_pitch())) + ]] +--[[ + local ltmp1 = 0 + for ltmp2 = 0, 62, 1 do + ltmp1 = GetDevice(ltmp2) + WriteToLog(ltmp2..': '..dump(ltmp1)) + WriteToLog(ltmp2..' (metatable): '..dump(getmetatable(ltmp1))) + end +]] +end + +----------------------------- +-- Custom functions -- +----------------------------- + +function genericRadio(key, value, hardware) + local lHardware = hardware or 1 + -- Werte werden per Encoder im Bereich von 0.0 bis 2.0 in 0.1 Schritten uebergeben + -- im jeweiligen Abschnitt muessen die Eingangsdaten auf den Zulaessigen Bereich eingeschraengt werden + local lRotaryFrequency_1, lRotaryFrequency_2, lVolume, lPreset, lLoad, lSquelch, lManualPreset, lPower, lDevice, lClickAction, lSetFrequency = nil + local lMainPanelDevice = GetDevice(0) + local lMaxRadios = 2 + + if gES_genericRadio == nil then + gES_genericRadio = 0 + end + if gES_genericRadioFrequency1 == nil then + gES_genericRadioFrequency1 = 0.0 + end + if gES_genericRadioFrequency2 == nil then + gES_genericRadioFrequency2 = 0.0 + end + if gES_genericRadioPresetChannel == nil then + gES_genericRadioPresetChannel = 0.0 + end + if gES_genericRadioPower == nil then + gES_genericRadioPower = {} + end + if gES_genericRadioPresetManual == nil then + gES_genericRadioPresetManual = {} + end + if gES_genericRadioSquelch == nil then + gES_genericRadioSquelch = {} + end + + if key == "3001" then + gES_genericRadio = tonumber(value) + end + if key == "3002" then + lRotaryFrequency_1 = tonumber(value) + end + if key == "3003" then + lRotaryFrequency_2 = tonumber(value) + end + if key == "3004" then + lVolume = tonumber(value) + end + if key == "3005" then + lPreset = tonumber(value) + end + if key == "3006" then + lLoad = tonumber(value) + end + if key == "3007" then + lSquelch = tonumber(value) + end + if key == "3008" then + lManualPreset = tonumber(value) + end + if key == "3009" then + lPower = tonumber(value) + end + + if gES_genericRadio > lMaxRadios then + WriteToLog("Radio Nr. "..gES_genericRadio.." not defined.") + return + end + + if gES_genericRadio == 1 then + -- R_800 FM/AM Radio###.### + local lDeviceID = 48 + local lR_800 = GetDevice(lDeviceID) + + -- check status of the radio + if gES_genericRadioPower[gES_genericRadio] == nil then + if lR_800:is_on() then + gES_genericRadioPower[gES_genericRadio] = 1.0 + else + gES_genericRadioPower[gES_genericRadio] = 0.0 + end + end + if gES_genericRadioPresetManual[gES_genericRadio] == nil then + gES_genericRadioPresetManual[gES_genericRadio] = ((math.round(lMainPanelDevice:get_argument_value(167), 1) == 0) and 1 or 0) + end + if gES_genericRadioSquelch[gES_genericRadio] == nil then + gES_genericRadioSquelch[gES_genericRadio] = ((math.round(lMainPanelDevice:get_argument_value(170), 1) == 0) and 1 or 0) + end + + local lR_800_FREQUENCY = math.round(lR_800:get_frequency()/1000000 , 3, "floor") + + SendDataHW("3000", string.format("%.3f", lR_800_FREQUENCY), lHardware) + SendDataHW("3001", string.format("-"), lHardware) + SendDataHW("3002", string.format("%.3f", lR_800_FREQUENCY), lHardware) + + if lRotaryFrequency_1 ~= nil and (lRotaryFrequency_1 >= 0.0 and lRotaryFrequency_1 <= 2.0) then + + local lFrequency = StrSplit(lR_800_FREQUENCY, "%.") + + if type(lFrequency) == "table" and lFrequency[1] ~= nil then + lFrequency[1] = tonumber(lFrequency[1]) + if lFrequency[2] == nil then + lFrequency[2] = 0 + else + lFrequency[2] = tonumber(lFrequency[2]) + local ltmp = string.format("%.0f", lFrequency[2] / 25) + lFrequency[2] = ltmp * 25 + end + if lRotaryFrequency_1 < gES_genericRadioFrequency1 or lRotaryFrequency_1 == 0.0 or lRotaryFrequency_1 == 2.0 then + lFrequency[1] = lFrequency[1] - 1 + if lFrequency[1] == 99 then + lFrequency[1] = 399 + end + gES_genericRadioFrequency1 = lRotaryFrequency_1 + else + lFrequency[1] = lFrequency[1] + 1 + if lFrequency[1] == 400 then + lFrequency[1] = 100 + end + gES_genericRadioFrequency1 = lRotaryFrequency_1 + end + + lFrequency[2] = string.format("%.3f", lFrequency[2] / 1000) + local ltempFrequency = string.format("%.3f", lFrequency[1] + lFrequency[2]) + ltempFrequency = tonumber(ltempFrequency) + lSetFrequency = {DeviceID = lDeviceID, + Frequency = ltempFrequency * 1000000} + + else + WriteToLog("1. generic Ka-50 R_800 Radio, don't split frequency: "..lFrequency) + end + end + + if lRotaryFrequency_2 ~= nil and (lRotaryFrequency_2 >= 0.0 and lRotaryFrequency_2 <= 2.0) then + + local lFrequency = StrSplit(lR_800_FREQUENCY, "%.") + + if type(lFrequency) == "table" and lFrequency[1] ~= nil then + lFrequency[1] = tonumber(lFrequency[1]) + if lFrequency[2] == nil then + lFrequency[2] = 0 + else + lFrequency[2] = tonumber(lFrequency[2]) + local ltmp = string.format("%.0f", lFrequency[2] / 25) + lFrequency[2] = ltmp * 25 + end + if lRotaryFrequency_2 < gES_genericRadioFrequency2 or lRotaryFrequency_2 == 0.0 or lRotaryFrequency_2 == 2.0 then + lFrequency[2] = lFrequency[2] - 25 + if lFrequency[2] == -25 then + lFrequency[2] = 975 + end + gES_genericRadioFrequency2 = lRotaryFrequency_2 + else + lFrequency[2] = lFrequency[2] + 25 + if lFrequency[2] == 1000 then + lFrequency[2] = 0 + end + gES_genericRadioFrequency2 = lRotaryFrequency_2 + end + + lFrequency[2] = string.format("%.3f", lFrequency[2] / 1000) + local ltempFrequency = string.format("%.3f", lFrequency[1] + lFrequency[2]) + ltempFrequency = tonumber(ltempFrequency) + lSetFrequency = {DeviceID = lDeviceID, + Frequency = ltempFrequency * 1000000} + + else + WriteToLog("2. generic Ka-50 R_800 Radio, don't split frequency: "..lFrequency) + end + end +--[[ + if lVolume ~= nil and (lVolume >= 0.0 and lVolume <= 2.0) then + lVolume = lVolume / 2 + lClickAction = {DeviceID = lDeviceID, + ButtonID = 3005, + Value = lVolume} + end + if lPreset ~= nil and (lPreset >= 0.0 and lPreset <= 2.0) then + -- Preset 0.0 to 0.20 in 0.01 steps + if lPreset < gES_genericRadioPresetChannel or lPreset == 0.0 or lPreset == 2.0 then + lClickAction = {DeviceID = lDeviceID, + ButtonID = 3001, + Value = 0.01} + gES_genericRadioPresetChannel = lPreset + else + lClickAction = {DeviceID = lDeviceID, + ButtonID = 3002, + Value = -0.01} + gES_genericRadioPresetChannel = lPreset + end + end + if lLoad ~= nil and (lLoad == 0.0 or lLoad <= 1.0) then + lClickAction = {DeviceID = lDeviceID, + ButtonID = 3006, + Value = lLoad} + end +]] + if lSquelch ~= nil and (lSquelch == 0.0 or lSquelch <= 1.0) then + if lSquelch == 1.0 and gES_genericRadioSquelch[gES_genericRadio] == 1.0 then + -- Squelch off + lSquelch = 0.0 + gES_genericRadioSquelch[gES_genericRadio] = 0 + elseif lSquelch == 1.0 and gES_genericRadioSquelch[gES_genericRadio] == 0 then + -- Squelch on + lSquelch = 1.0 + gES_genericRadioSquelch[gES_genericRadio] = 1.0 + end + lClickAction = {DeviceID = lDeviceID, + ButtonID = 3006, + Value = lSquelch} + end + -- ManualPreset is AM FM modus switch + if lManualPreset ~= nil and (lManualPreset == 0.0 or lManualPreset <= 1.0) then + if lManualPreset == 1.0 and gES_genericRadioPresetManual[gES_genericRadio] == 0.0 then + -- AM + lManualPreset = 1.0 + gES_genericRadioPresetManual[gES_genericRadio] = 1.0 + elseif lManualPreset == 1.0 and gES_genericRadioPresetManual[gES_genericRadio] == 1.0 then + -- FM + lManualPreset = 0.0 + gES_genericRadioPresetManual[gES_genericRadio] = 0.0 + end + lClickAction = {DeviceID = lDeviceID, + ButtonID = 3002, + Value = lManualPreset} + end + if lPower ~= nil and (lPower == 0.0 or lPower <= 1.0) then + if lPower == 1.0 and gES_genericRadioPower[gES_genericRadio] == 1.0 then + -- Power off + lPower = 0.0 + gES_genericRadioPower[gES_genericRadio] = 0 + elseif lPower == 1.0 and gES_genericRadioPower[gES_genericRadio] == 0 then + -- Power on + lPower = 1.0 + gES_genericRadioPower[gES_genericRadio] = 1.0 + end + lClickAction = {DeviceID = lDeviceID, + ButtonID = 3011, + Value = lPower} + end + + elseif gES_genericRadio == 2 then + -- R_828 VHF ###.### + --------------------------------------------------- + local lDeviceID = 49 + local lR_828_RADIO = GetDevice(lDeviceID) + + -- check status of the radio + if gES_genericRadioPower[gES_genericRadio] == nil then + if lR_828_RADIO:is_on() then + gES_genericRadioPower[gES_genericRadio] = 1.0 + else + gES_genericRadioPower[gES_genericRadio] = 0.0 + end + end + if gES_genericRadioPresetManual[gES_genericRadio] == nil then + gES_genericRadioPresetManual[gES_genericRadio] = ((math.round(lMainPanelDevice:get_argument_value(135), 1) == 0.1) and 1 or 0) + end + if gES_genericRadioSquelch[gES_genericRadio] == nil then + gES_genericRadioSquelch[gES_genericRadio] = ((math.round(lMainPanelDevice:get_argument_value(134), 1) == 1.0) and 0 or 1) + end + + local lR_828_RADIO_PRESET = {[0.0]="1",[0.1]="2",[0.2]="3",[0.3]="4",[0.4]="5",[0.5]="6",[0.6]="7",[0.7]="8",[0.8]="9",[0.9]="10"} + local lR_828_RADIO_FREQUENCY = math.round(lR_828_RADIO:get_frequency()/1000000 , 3, "floor") + + local lPresetChannel = math.round(lMainPanelDevice:get_argument_value(371), 1) + + SendDataHW("3000", string.format("%s0%.3f", lR_828_RADIO_PRESET[lPresetChannel], lR_828_RADIO_FREQUENCY), lHardware) + SendDataHW("3001", string.format("%s0", lR_828_RADIO_PRESET[lPresetChannel]), lHardware) + SendDataHW("3002", string.format("%.3f", lR_828_RADIO_FREQUENCY), lHardware) + +--[[ + if lRotaryFrequency_1 ~= nil and (lRotaryFrequency_1 >= 0.0 and lRotaryFrequency_1 <= 2.0) then + + local lFrequency = StrSplit(lR_828_RADIO_FREQUENCY, "%.") + + if type(lFrequency) == "table" and lFrequency[1] ~= nil then + lFrequency[1] = tonumber(lFrequency[1]) + if lFrequency[2] == nil then + lFrequency[2] = 0 + else + lFrequency[2] = tonumber(lFrequency[2]) + local ltmp = string.format("%.0f", lFrequency[2] / 25) + lFrequency[2] = ltmp * 25 + end + if lRotaryFrequency_1 < gES_genericRadioFrequency1 or lRotaryFrequency_1 == 0.0 or lRotaryFrequency_1 == 2.0 then + lFrequency[1] = lFrequency[1] - 1 + if lFrequency[1] == 29 then + lFrequency[1] = 159 + end + gES_genericRadioFrequency1 = lRotaryFrequency_1 + else + lFrequency[1] = lFrequency[1] + 1 + if lFrequency[1] == 160 then + lFrequency[1] = 30 + end + gES_genericRadioFrequency1 = lRotaryFrequency_1 + end + + lFrequency[2] = string.format("%.3f", lFrequency[2] / 1000) + local ltempFrequency = string.format("%.3f", lFrequency[1] + lFrequency[2]) + ltempFrequency = tonumber(ltempFrequency) + lSetFrequency = {DeviceID = lDeviceID, + Frequency = ltempFrequency * 1000000} + + else + WriteToLog("1. generic Ka-50 VHF Radio, don't split frequency: "..lFrequency) + end + end + + if lRotaryFrequency_2 ~= nil and (lRotaryFrequency_2 >= 0.0 and lRotaryFrequency_2 <= 2.0) then + + local lFrequency = StrSplit(lR_828_RADIO_FREQUENCY, "%.") + + if type(lFrequency) == "table" and lFrequency[1] ~= nil then + lFrequency[1] = tonumber(lFrequency[1]) + if lFrequency[2] == nil then + lFrequency[2] = 0 + else + lFrequency[2] = tonumber(lFrequency[2]) + local ltmp = string.format("%.0f", lFrequency[2] / 25) + lFrequency[2] = ltmp * 25 + end + if lRotaryFrequency_2 < gES_genericRadioFrequency2 or lRotaryFrequency_2 == 0.0 or lRotaryFrequency_2 == 2.0 then + lFrequency[2] = lFrequency[2] - 25 + if lFrequency[2] == -25 then + lFrequency[2] = 975 + end + gES_genericRadioFrequency2 = lRotaryFrequency_2 + else + lFrequency[2] = lFrequency[2] + 25 + if lFrequency[2] == 1000 then + lFrequency[2] = 0 + end + gES_genericRadioFrequency2 = lRotaryFrequency_2 + end + + lFrequency[2] = string.format("%.3f", lFrequency[2] / 1000) + local ltempFrequency = string.format("%.3f", lFrequency[1] + lFrequency[2]) + ltempFrequency = tonumber(ltempFrequency) + lSetFrequency = {DeviceID = lDeviceID, + Frequency = ltempFrequency * 1000000} + + else + WriteToLog("2. generic Ka-50 VHF Radio, don't split frequency: "..lFrequency) + end + end +]] + if lVolume ~= nil and (lVolume >= 0.0 and lVolume <= 2.0) then + lVolume = lVolume / 2 + lClickAction = {DeviceID = lDeviceID, + ButtonID = 3002, + Value = lVolume} + end + if lPreset ~= nil and (lPreset >= 0.0 and lPreset <= 2.0) then +--[[ + -- Preset 0.0 to 0.9 in 0.1 steps + lPreset = (lPreset / 2) - 0.1 + if lPreset < gES_genericRadioPresetChannel or lPreset == 0.0 or lPreset == 2.0 then + lClickAction = {DeviceID = lDeviceID, + ButtonID = 3001, + Value = 0.1} + gES_genericRadioPresetChannel = lPreset + else + lClickAction = {DeviceID = lDeviceID, + ButtonID = 3001, + Value = -0.1} + gES_genericRadioPresetChannel = lPreset + end +]] + -- Preset 0.0 to 0.9 in 0.1 steps + lPreset = lPreset / 2 + if lPreset == 1.0 then + lPreset = 0.9 + end + lClickAction = {DeviceID = lDeviceID, + ButtonID = 3001, + Value = lPreset} + end + -- Load Button change the Frequence + if lLoad ~= nil and (lLoad == 0.0 or lLoad <= 1.0) then + lClickAction = {DeviceID = lDeviceID, + ButtonID = 3003, + Value = lLoad} + end + if lSquelch ~= nil and (lSquelch == 0.0 or lSquelch <= 1.0) then + if lSquelch == 1.0 and gES_genericRadioSquelch[gES_genericRadio] == 1.0 then + -- Squelch off + lSquelch = 0.0 + gES_genericRadioSquelch[gES_genericRadio] = 0 + elseif lSquelch == 1.0 and gES_genericRadioSquelch[gES_genericRadio] == 0 then + -- Squelch on + lSquelch = 1.0 + gES_genericRadioSquelch[gES_genericRadio] = 1.0 + end + lClickAction = {DeviceID = lDeviceID, + ButtonID = 3004, + Value = lSquelch} + end +--[[ + if lManualPreset ~= nil and (lManualPreset == 0.0 or lManualPreset <= 1.0) then + if lManualPreset == 1.0 and gES_genericRadioPresetManual[gES_genericRadio] == 1.0 then + -- Manual on + lManualPreset = 0.2 + gES_genericRadioPresetManual[gES_genericRadio] = 0 + elseif lManualPreset == 1.0 and gES_genericRadioPresetManual[gES_genericRadio] == 0 then + -- Preset on + lManualPreset = 0.3 + gES_genericRadioPresetManual[gES_genericRadio] = 1.0 + end + lClickAction = {DeviceID = lDeviceID, + ButtonID = 3003, + Value = lManualPreset} + end +]] + if lPower ~= nil and (lPower == 0.0 or lPower <= 1.0) then + if lPower == 1.0 and gES_genericRadioPower[gES_genericRadio] == 1.0 then + -- Power off + lPower = 0.0 + gES_genericRadioPower[gES_genericRadio] = 0 + elseif lPower == 1.0 and gES_genericRadioPower[gES_genericRadio] == 0 then + -- Power on + lPower = 1.0 + gES_genericRadioPower[gES_genericRadio] = 1.0 + end + lClickAction = {DeviceID = lDeviceID, + ButtonID = 3005, + Value = lPower} + end + + --SendDataHW("3011", lMainPanelDevice:get_argument_value(375), lHardware) + gES_genericRadioPresetManual[gES_genericRadio] = lMainPanelDevice:get_argument_value(375) + + else + SendDataHW("3000", "-", lHardware) + SendDataHW("3001", "-", lHardware) + SendDataHW("3002", "-", lHardware) + SendDataHW("3010", 0, lHardware) + SendDataHW("3011", 0, lHardware) + SendDataHW("3012", 0, lHardware) + return + end + + SendDataHW("3010", gES_genericRadioPower[gES_genericRadio], lHardware) + SendDataHW("3011", gES_genericRadioPresetManual[gES_genericRadio], lHardware) + SendDataHW("3012", gES_genericRadioSquelch[gES_genericRadio], lHardware) + + if lClickAction ~= nil then + lDevice = GetDevice(lClickAction.DeviceID) + if type(lDevice) == "table" then + --WriteToLog("GetDevice("..lClickAction.DeviceID.."):performClickableAction("..lClickAction.ButtonID..", "..lClickAction.Value..") ") + lDevice:performClickableAction(lClickAction.ButtonID, lClickAction.Value) + end + elseif lSetFrequency ~= nil then + lDevice = GetDevice(lSetFrequency.DeviceID) + if type(lDevice) == "table" and lDevice:is_on() then + --WriteToLog("GetDevice("..lSetFrequency.DeviceID.."):set_frequency("..lSetFrequency.Frequency..") ") + lDevice:set_frequency(lSetFrequency.Frequency) + else + WriteToLog("GetDevice("..lSetFrequency.DeviceID..") is no table or Radio is not on") + end + end +end diff --git a/ExportsModules/Mi-8MT.lua b/ExportsModules/Mi-8MT.lua new file mode 100644 index 0000000..67d4f01 --- /dev/null +++ b/ExportsModules/Mi-8MT.lua @@ -0,0 +1,1318 @@ +-- Mi-8MTV2 Export +-- Version 0.9.9 BETA + +gES_FoundDCSModule = true + +gES_GlassCockpitConfigEveryFrameArguments = +{ + --[[ + every frames arguments + based of "mainpanel_init.lua" + Example (http://www.lua.org/manual/5.1/manual.html#pdf-string.format) + [DeviceID] = "Format" + [4] = "%.4f", <- floating-point number with 4 digits after point + [19] = "%0.1f", <- floating-point number with 1 digit after point + [129] = "%1d", <- decimal number + ]] + + -- CONTROLLERS + --------------------------------------------------------------- + ----[209] = "%.4f", -- rudder { -1, 1} + --[266] = "%.4f", -- rudder_add { 1, -1} + --[181] = "%.4f", -- stick_roll {1, -1} + --[180] = "%.4f", -- stick_pitch {1, -1} + --[191] = "%.4f", -- collective_position {0, 1} + --[192] = "%1d", -- correction_position {1, 0} + --[230] = "%1d", -- collective_position_operator {0, 1} + --[231] = "%1d", -- correction_position_operator {1, 0} + --[560] = "%1d", -- coll_ROUTE_DESCENT_sw {0, 1} + --[558] = "%1d", -- coll_ReadjustFreeTurbRPM_sw {0, 1} + ----[208] = "%1d", -- collective_stopper {0, 1} + --[187] = "%.4f", -- left_engine_throttle {0.0, 1.0} + --[189] = "%.4f", -- right_engine_throttle {0.0, 1.0} + --[881] = "%.4f", -- wheelBrakes {0.0, 1.0} + ----[579] = "", -- throttle_cover {0.0, 1.0} + ----[208] = "", -- rotor_brake_handle {0.0, 1.0} + -- Left main panel + --------------------------------------------------------------- + [16] = "%.2f", -- Variometer_L {-1.0, -0.71, -0.43, -0.23, -0.09, -0.05, 0, 0.05, 0.09, 0.23, 0.43, 0.71, 1.0} + [95] = "%.2f", -- Variometer_R {-1.0, -0.71, -0.43, -0.23, -0.09, -0.05, 0, 0.05, 0.09, 0.23, 0.43, 0.71, 1.0} + [24] = "%.3f", -- IAS_L {0.0, 0.001, 0.028, 0.165, 0.277, 0.393, 1.0} + [790] = "%.3f", -- IAS_R {0.0, 0.001, 0.028, 0.165, 0.277, 0.393, 1.0} + -- AGB-3k + --------------------------------------------------------------- + [13] = "%.4f", -- AGB_3K_Left_roll {-1.0, 1.0} + [12] = "%.4f", -- AGB_3K_Left_pitch {1.0, -1.0} + [14] = "%.4f", -- AGB_3K_Left_failure_flag {0.0, 1.0} + [15] = "%.4f", -- AGB_3K_Left_sideslip {1.0, -1.0} + [820] = "%.4f", -- AGB_3K_Left_index {0.5, -0.5} + ------ + [92] = "%.4f", -- AGB_3K_Right_roll {-1.0, 1.0} + [91] = "%.4f", -- AGB_3K_Right_pitch {1.0, -1.0} + [93] = "%.4f", -- AGB_3K_Right_failure_flag {0.0, 1.0} + [94] = "%.4f", -- AGB_3K_Right_sideslip {1.0, -1.0} + [821] = "%.4f", -- AGB_3K_Right_index {0.5, -0.5} + -- EUP-53 + --------------------------------------------------------------- + [22] = "%.4f", -- EUP_speed {-1.0, 1.0} + [23] = "%.4f", -- EUP_sideslip {-1.0, 1.0} + -- UGR-4K + --------------------------------------------------------------- + [25] = "%.4f", -- UGR_4K_heading_L {0.0, 1.0} + [27] = "%.4f", -- UGR_4K_commanded_course_L {0.0, 1.0} + [28] = "%.4f", -- UGR_4K_bearing_needle_L {0.0, 1.0} + ---- + [101] = "%.4f", -- UGR_4K_heading_R {0.0, 1.0} + [103] = "%.4f", -- UGR_4K_commanded_course_R {0.0, 1.0} + [104] = "%.4f", -- UGR_4K_bearing_needle_R {0.0, 1.0} + -- Barometric altimeter VD-10K + --------------------------------------------------------------- + [19] = "%.4f", -- VD_10K_L_100 {0.0, 1.0} + [20] = "%.4f", -- VD_10K_L_10 {0.0, 1.0} + [833] = "%.4f", -- VD_10K_L_100_Ind {0.0, 1.0} + [832] = "%.4f", -- VD_10K_L_10_Ind {0.0, 1.0} + [21] = "%.4f", -- VD_10K_L_PRESS {0.0, 1.0} + ----- + [98] = "%.4f", -- VD_10K_R_100 {0.0, 1.0} + [99] = "%.4f", -- VD_10K_R_10 {0.0, 1.0} + [835] = "%.4f", -- VD_10K_R_100_Ind {0.0, 1.0} + [834] = "%.4f", -- VD_10K_R_10_Ind {0.0, 1.0} + [100] = "%.4f", -- VD_10K_R_PRESS {0.0, 1.0} + -- Rotor RPM + --------------------------------------------------------------- + [42] = "%.4f", -- RotorRPM {0.0, 1.0} + [787] = "%.4f", -- RotorRPM_Oper {0.0, 1.0} + -- Rotor Pitch + --------------------------------------------------------------- + [36] = "%.2f", -- RotorPitch {0.0, 0.07, 0.14, 0.21, 0.29, 0.35, 0.43, 0.5, 0.57, 0.64, 0.71, 0.79, 0.86, 0.93, 1.0} + -- Radar altimeter A-036 + --------------------------------------------------------------- + [34] = "%.3f", -- A_036_RALT {0.0, 0.475, 0.625, 1.0} + [31] = "%.3f", -- A_036_DangerRALT_index {0.0, 0.475, 0.625, 1.0} + [30] = "%.1f", -- A_036_DangerRALT_lamp {0.0, 1.0} + [33] = "%.1f", -- A_036_warning_flag {0.0, 1.0} + -- Engines RPM + --------------------------------------------------------------- + [40] = "%.4f", -- LeftEngineRPM {0.0, 1.0} + [41] = "%.4f", -- RightEngineRPM {0.0, 1.0} + [788] = "%.4f", -- LeftEngineRPM_Oper {0.0, 1.0} + [789] = "%.4f", -- RightEngineRPM_Oper {0.0, 1.0} + -- Engines temperature + --------------------------------------------------------------- + [43] = "%.4f", -- LeftEngineTemperatureHund {0.0, 1.0} + [44] = "%.4f", -- LeftEngineTemperatureTenth {0.0, 1.0} + [45] = "%.4f", -- RightEngineTemperatureHund {0.0, 1.0} + [46] = "%.4f", -- RightEngineTemperatureTenth {0.0, 1.0} + -- Engines mode indicator + --------------------------------------------------------------- + [39] = "%.4f", -- EnginesMode {0.0, 1.0} + [37] = "%.4f", -- LeftEngineMode {0.0, 1.0} + [38] = "%.4f", -- RightEngineMode {0.0, 1.0} + -- Engines brakes + --------------------------------------------------------------- + [204] = "%.1f", -- left_engine_brake_handle {0.0, 1.0} + [206] = "%.1f", -- right_engine_brake_handle {0.0, 1.0} + [203] = "%.1f", -- left_engine_brake_handle_holder {0.0, 1.0} + [205] = "%.1f", -- right_engine_brake_handle_holder {0.0, 1.0} + -- DISS 15 + --------------------------------------------------------------- + [830] = "%.4f", -- diss15_hover_x {-1.0, 0, 1.0} + [828] = "%.4f", -- diss15_hover_y {-1.0, 1.0} + [829] = "%.4f", -- diss15_hover_z {-1.0, 1.0} + [831] = "%.4f", -- diss15_hover_lamp_off {0.0, 0.9} + ---- + [791] = "%.4f", -- diss15_drift_angle {-1.0, 1.0} + ---- + [795] = "%.4f", -- diss15_W_shutter {0.0, 1.0} + [796] = "%.1f", -- diss15_W_memory_lamp {1.0, 0.0} + [792] = "%.4f", -- diss15_W_hundreds {0.0, 1.0} + [793] = "%.4f", -- diss15_W_tens {0.0, 1.0} + [794] = "%.4f", -- diss15_W_ones {0.0, 1.0} + ---- + [817] = "%.4f", -- diss15_coord_on_lamp {1.0, 0.0} + [805] = "%.4f", -- diss15_coord_forward {1.0, 0.0} + [806] = "%.4f", -- diss15_coord_X_hundreds {0.0, 1.0} + [807] = "%.4f", -- diss15_coord_X_tens {0.0, 1.0} + [808] = "%.4f", -- diss15_coord_X_ones {0.0, 1.0} + [802] = "%.4f", -- diss15_coord_right {0.0, 1.0} + [799] = "%.4f", -- diss15_coord_Z_hundreds {0.0, 1.0} + [800] = "%.4f", -- diss15_coord_Z_tens {0.0, 1.0} + [801] = "%.4f", -- diss15_coord_Z_ones {0.0, 1.0} + [811] = "%.4f", -- diss15_coord_angle_hundreds {0.0, 1.0} + [812] = "%.4f", -- diss15_coord_angle_tens {0.0, 1.0} + [813] = "%.4f", -- diss15_coord_angle_ones {0.0, 1.0} + [814] = "%.4f", -- diss15_coord_angle_minutes {0.0, 1.0} + ---- + [822] = "%.4f", -- diss15_check_control_lamp {0.0, 0.9} + [823] = "%.4f", -- diss15_check_work_lamp {0.0, 0.9} + [824] = "%.4f", -- diss15_check_failM_lamp {0.0, 0.9} + [825] = "%.4f", -- diss15_check_failC_lamp {0.0, 0.9} + -- Oil + --------------------------------------------------------------- + [111] = "%.4f", -- oils_p_main_reductor {0.0, 1.0} + [114] = "%.2f", -- oils_t_main_reductor {-0.25, 0.75} + [113] = "%.2f", -- oils_temp_tail_reductor {-0.25, 0.75} + [112] = "%.2f", -- oils_temp_intermediate_reductor {-0.25, 0.75} + [115] = "%.4f", -- oils_p_left_engine {0.0, 1.0} + [116] = "%.2f", -- oils_t_left_engine {-0.25, 0.75} + [117] = "%.4f", -- oils_p_right_engine {0.0, 1.0} + [118] = "%.2f", -- oils_t_right_engine {-0.25, 0.75} + -- Autopilot + --------------------------------------------------------------- + [122] = "%.4f", -- autopilot_yaw_indicator {-1.0, 1.0} + [124] = "%.4f", -- autopilot_pitch_indicator {-1.0, 1.0} + [123] = "%.2f", -- autopilot_roll_indicator {-0.33, 0.33} + [125] = "%.4f", -- autopilot_altitude_indicator {-1.0, 1.0} + [119] = "%.4f", -- autopilot_yaw_scale {0.0, 1.0} + [120] = "%.4f", -- autopilot_roll_scale {0.0, 1.0} + [121] = "%.4f", -- autopilot_pitch_scale {0.0, 1.0} + -- Center upper panel + --------------------------------------------------------------- + [404] = "%.2f", -- hydro_pressure_main {0.05, 0.33, 0.52, 0.69, 1.0} + [405] = "%.2f", -- hydro_pressure_aux {0.05, 0.33, 0.52, 0.69, 1.0} + [402] = "%.2f", -- APU_temperature {0.0, 0.2, 0.42, 0.69, 0.94, 1.0} + [403] = "%.2f", -- APU_pressure {0.04, 0.95} + -- Mechanic clock + --------------------------------------------------------------- + [49] = "%.4f", -- CLOCK_currtime_hours {0.0, 1.0} + [50] = "%.4f", -- CLOCK_currtime_minutes {0.0, 1.0} + [51] = "%.4f", -- CLOCK_currtime_seconds {0.0, 1.0} + [56] = "%.4f", -- CLOCK_flight_time_meter_status {0.0, 1.0} + [52] = "%.4f", -- CLOCK_flight_hours {0.0, 1.0} + [53] = "%.4f", -- CLOCK_flight_minutes {0.0, 1.0} + [54] = "%.4f", -- CLOCK_seconds_meter_time_minutes {0.0, 1.0} + [55] = "%.4f", -- CLOCK_seconds_meter_time_seconds {0.0, 1.0} + -- Fuel tanks + --------------------------------------------------------------- + [62] = "%.3f", -- FuelScaleUpper {0.0, 0.131, 0.244, 0.414, 0.647, 0.705, 0.9, 1.0} + [62] = "%.3f", -- FuelScaleLower {0.0, 0.165, 0.283, 0.393, 0.618, 1.0} + -- Air system gauges + --------------------------------------------------------------- + [320] = "%.2f", -- air_system_pressure {0.0, 0.23, 0.48, 1.0} + [321] = "%.4f", -- air_system_brake_pressure {0.0, 1.0} + -- SPUU-52 + --------------------------------------------------------------- + [126] = "%.4f", -- SPUU_pointer {-1.0, 1.0} + [786] = "%.1f", -- SPUU52_lamp {0.0, 1.0} + -- PU-26 LAMP + --------------------------------------------------------------- + [827] = "%.1f", -- PU_26_GA_Lamp {0.0, 0.5} + -- ARC-UD + --------------------------------------------------------------- + [458] = "%.1f", -- ARC_UD_Narrow_Lamp {0.0, 0.9} + [459] = "%.1f", -- ARC_UD_Wide_Lamp {0.0, 0.9} + [460] = "%.1f", -- ARC_UD_Pulse_Lamp {0.0, 0.9} + -- ARC-9 + --------------------------------------------------------------- + [681] = "%.4f", -- ARC_9_Signal {0.0, 1.0} + ---- + [857] = "%.4f", -- PKV_Reflector {0.0, 1.0} + ---- + [778] = "%.4f", -- SAFE_WEAP {0.0, 1.0} + ---- + [577] = "%.4f", -- AMMO_CNT1_1 {0.0, 1.0} + [578] = "%.4f", -- AMMO_CNT1_2 {0.0, 1.0} + [580] = "%.4f", -- AMMO_CNT2_1 {0.0, 1.0} + [581] = "%.4f", -- AMMO_CNT2_2 {0.0, 1.0} + [583] = "%.4f", -- AMMO_CNT3_1 {0.0, 1.0} + [584] = "%.4f", -- AMMO_CNT3_2 {0.0, 1.0} + -- Radio R-828 + --------------------------------------------------------------- + [740] = "%.2f", -- R828_ASU {0.0, 0.95} + [736] = "%.3f", -- R828_channel {0.0, 0.101, 0.199, 0.302, 0.400, 0.502, 0.601, 0.697, 0.801, 0.898} + -- Damage + --------------------------------------------------------------- + --[215] = "%0.1f", -- Blister_LEFT {0.0, 0.8} + --[216] = "%0.1f", -- Blister_RIGHT {0.0, 0.8} + ---- + --[878] = "%.1f", -- WindShiels_Up {0.0, 1.0} + --[879] = "%.1f", -- WindShiels_Down {0.0, 1.0} + -- UV-26 + --------------------------------------------------------------- + --[892] = "%.1f", -- UV26_Left {0.0, 1.0} + --[891] = "%.1f", -- UV26_Right {0.0, 1.0} + -- Pilots + --------------------------------------------------------------- + --[245] = "%.1f", -- Pilot_Body {0.0, 1.0} + --[242] = "%.1f", -- Operator_Body {0.0, 1.0} + --[262] = "%.1f", -- Crew_Body {0.0, 1.0} + -- Damage + --------------------------------------------------------------- + --[876] = "%.1f", -- Upper_Windshield {0.0, 1.0} + --[877] = "%.1f", -- Down_Windshield {0.0, 1.0} + --[879] = "%.1f", -- Left_Windshield {0.0, 1.0} + --[878] = "%.1f", -- Right_Windshield {0.0, 1.0} + -- Jadro 1A + --------------------------------------------------------------- + [849] = "%.1f", -- Jadro_ASU_Lamp {0.0, 1.0} + [848] = "%.1f", -- Jadro_Ctl_Lamp {0.0, 1.0} + [850] = "%.1f", -- Jadro_Breakdown_Lamp {0.0, 1.0} + ---- + [904] = "%.4f", -- RAM_Temp {-1.0, 0.0, 1.0} + ---- + [907] = "%.4f", -- G_Meter {-1.0, 0.343, 1.0} + [908] = "%.4f", -- G_Meter_Max {0.343, 1.0} + [909] = "%.4f", -- G_Meter_Min {-1.0, 0.343} + ---- + [903] = "%1d", -- filter_handle {0,1} + -- electric system gauges + --------------------------------------------------------------- + [526] = "%.4f", -- DC_voltage {0.0, 30.0} + [532] = "%.2f", -- AC_voltage {0.0, 0.14, 0.31, 0.56, 1.0} + [527] = "%.4f", -- DC_battery_I_current {0.0, 1.0} + [528] = "%.4f", -- DC_battery_II_current {0.0, 1.0} + [529] = "%.4f", -- DC_VU_I_current {0.0, 1.0} + [530] = "%.4f", -- DC_VU_II_current {0.0, 1.0} + [531] = "%.4f", -- DC_VU_III_current {0.0, 1.0} + [533] = "%.2f", -- AC_generator_I_current {0.0, 0.1, 0.2, 0.36, 0.63, 0.75, 0.86, 1.0} + [534] = "%.2f", -- AC_generator_II_current {0.0, 0.1, 0.2, 0.36, 0.63, 0.75, 0.86, 1.0} + [371] = "%.2f", -- AntiIce_ampermeter {0.0, 0.1, 0.2, 0.36, 0.63, 0.75, 0.86, 1.0} + -- LAMPS + --------------------------------------------------------------- + [781] = "%.1f", -- lamp_AP_heading_on + [782] = "%.1f", -- lamp_AP_heading_off + [783] = "%.1f", -- lamp_AP_pitch_roll_on + [784] = "%.1f", -- lamp_AP_height_on + [785] = "%.1f", -- lamp_AP_height_off + [316] = "%.1f", -- lamp_ENGINE_RT_LEFT_ON + [317] = "%.1f", -- lamp_ENGINE_RT_RIGHT_ON + [318] = "%.1f", -- lamp_SARPP_ON + [326] = "%.1f", -- lamp_LOCK_OPEN + [327] = "%.1f", -- lamp_DOORS_OPEN + [340] = "%.1f", -- lamp_TURN_ON_RI_65 + [360] = "%.1f", -- lamp_FROST + [362] = "%.1f", -- lamp_LEFT_ENG_HEATING + [363] = "%.1f", -- lamp_RIGHT_ENG_HEATING + [361] = "%.1f", -- lamp_ANTI_ICE_ON + [364] = "%.1f", -- lamp_LEFT_PZU_FRONT + [365] = "%.1f", -- lamp_RIGHT_PZU_FRONT + [366] = "%.1f", -- lamp_LEFT_PZU_BACK + [367] = "%.1f", -- lamp_RIGHT_PZU_BACK + [373] = "%.1f", -- lamp_SECTION_1 + [375] = "%.1f", -- lamp_SECTION_2 + [374] = "%.1f", -- lamp_SECTION_3 + [376] = "%.1f", -- lamp_SECTION_4 + [368] = "%.1f", -- lamp_RIO_heating_ok + [377] = "%.1f", -- lamp_LEFT_ENG_FIRE + [378] = "%.1f", -- lamp_RIGHT_ENG_FIRE + [379] = "%.1f", -- lamp_KO50_FIRE + [380] = "%.1f", -- lamp_REDUC_AI9_FIRE + [381] = "%.1f", -- lamp_FIRE_LENG_1_QUEUE + [382] = "%.1f", -- lamp_FIRE_RENG_1_QUEUE + [383] = "%.1f", -- lamp_FIRE_KO50_1_QUEUE + [384] = "%.1f", -- lamp_FIRE_REDUCT_1_QUEUE + [385] = "%.1f", -- lamp_FIRE_LENG_2_QUEUE + [386] = "%.1f", -- lamp_FIRE_RENG_2_QUEUE + [387] = "%.1f", -- lamp_FIRE_KO50_2_QUEUE + [388] = "%.1f", -- lamp_FIRE_REDUCT_2_QUEUE + [398] = "%.1f", -- lamp_CHECK_SENSORS + [407] = "%.1f", -- lamp_HYDRO_main_on + [408] = "%.1f", -- lamp_HYDRO_aux_on + [414] = "%.1f", -- lamp_APD9_on + [416] = "%.1f", -- lamp_APD9_oil_pressure + [417] = "%.1f", -- lamp_APD9_rpm + [418] = "%.1f", -- lamp_APD9_rpm_high + [420] = "%.1f", -- lamp_APD_on + [424] = "%.1f", -- lamp_APD_starter_on + [434] = "%.1f", -- lamp_FUEL_left_closed + [435] = "%.1f", -- lamp_FUEL_right_closed + [436] = "%.1f", -- lamp_FUEL_ring_closed + [441] = "%.1f", -- lamp_FUEL_center_on + [442] = "%.1f", -- lamp_FUEL_left_on + [443] = "%.1f", -- lamp_FUEL_right_on + [461] = "%.1f", -- lamp_HEATER + [462] = "%.1f", -- lamp_IGNITION + [463] = "%.1f", -- lamp_KO50_ON + [341] = "%.1f", -- lamp_LEFT_PITOT_HEATER_OK + [490] = "%.1f", -- lamp_RIGHT_PITOT_HEATER_OK + [509] = "%.1f", -- lamp_LEFT_PZU_ON + [510] = "%.1f", -- lamp_RIGHT_PZU_ON + [504] = "%.1f", -- lamp_ELEC_turn_VU1 + [505] = "%.1f", -- lamp_ELEC_turn_VU2 + [506] = "%.1f", -- lamp_ELEC_turn_VU3 + [507] = "%.1f", -- lamp_ELEC_DC_ground + [508] = "%.1f", -- lamp_ELEC_test_equipment + [543] = "%.1f", -- lamp_ELEC_gen1_fail + [544] = "%.1f", -- lamp_ELEC_gen2_fail + [545] = "%.1f", -- lamp_ELEC_AC_ground + [546] = "%.1f", -- lamp_ELEC_PO_500 + [86] = "%.1f", -- lamp_CIRCUIT_FROM_BATTERY + [68] = "%.1f", -- lamp_CLOG_TF_LEFT + [69] = "%.1f", -- lamp_CLOG_TF_RIGHT + [70] = "%.1f", -- lamp_CHIP_LEFT_ENG + [71] = "%.1f", -- lamp_CHIP_RIGHT_ENG + [72] = "%.1f", -- lamp_VIBRATION_LEFT_HIGH + [73] = "%.1f", -- lamp_VIBRATION_RIGHT_HIGH + [74] = "%.1f", -- lamp_FIRE + [76] = "%.1f", -- lamp_LEFT_ENG_TURN_OFF + [77] = "%.1f", -- lamp_RIGHT_ENG_TURN_OFF + [78] = "%.1f", -- lamp_FT_LEFT_HIGH + [79] = "%.1f", -- lamp_FT_RIGHT_HIGH + [80] = "%.1f", -- lamp_OIL_PRESSURE_LEFT + [81] = "%.1f", -- lamp_OIL_PRESSURE_RIGHT + [82] = "%.1f", -- lamp_ER_LEFT + [83] = "%.1f", -- lamp_ER_RIGHT + [84] = "%.1f", -- lamp_EEC_LEFT_OFF + [85] = "%.1f", -- lamp_EEC_RIGHT_OFF + [873] = "%.1f", -- lamp_CHIP_MAIN_REDUCTOR + [874] = "%.1f", -- lamp_CHIP_INTER_REDUCTOR + [875] = "%.1f", -- lamp_CHIP_TAIL_REDUCTOR + [64] = "%.1f", -- lamp_300_Left + [65] = "%.1f", -- lamp_DISS_OFF + [555] = "%.1f", -- lamp_BD1 + [556] = "%.1f", -- lamp_BD2 + [557] = "%.1f", -- lamp_BD3 + [558] = "%.1f", -- lamp_BD4 + [559] = "%.1f", -- lamp_BD5 + [560] = "%.1f", -- lamp_BD6 + [711] = "%.1f", -- lamp_BD1Bomb + [712] = "%.1f", -- lamp_BD2Bomb + [713] = "%.1f", -- lamp_BD3Bomb + [714] = "%.1f", -- lamp_BD4Bomb + [715] = "%.1f", -- lamp_BD5Bomb + [716] = "%.1f", -- lamp_BD6Bomb + [562] = "%.1f", -- lamp_PUS1 + [563] = "%.1f", -- lamp_PUS3 + [564] = "%.1f", -- lamp_PUS4 + [565] = "%.1f", -- lamp_PUS6 + [561] = "%.1f", -- lamp_EmergExplode + [705] = "%.1f", -- lamp_EmergExplodeSec + [710] = "%.1f", -- lamp_BV_Net_On + [566] = "%.1f", -- lamp_RS_Net_On + [567] = "%.1f", -- lamp_GUV_Net_On + --[] = "%.1f", -- lamp_MV_Net_On + [568] = "%.1f", -- lamp_FKP_On + [778] = "%.1f", -- lamp_Caution_Weap + --[] = "%.1f", -- lamp_LeftSignal + --[] = "%.1f", -- lamp_RightSignal + -- Lights system + --------------------------------------------------------------- + [880] = "%.1f", -- RedLightLhGr1 {1.0, 0.0} + [896] = "%.1f", -- RedLightLhGr2 {1.0, 0.0} + [897] = "%.1f", -- RedLightRhGr1 {1.0, 0.0} + [898] = "%.1f", -- RedLightRhGr2 {1.0, 0.0} + [899] = "%.1f", -- RedLightChGr1 {1.0, 0.0} + [901] = "%.1f", -- RedLightChGr2 {1.0, 0.0} + [902] = "%.1f" -- RedLight5V5 {1.0, 0.0} +} +gES_GlassCockpitConfigArguments = +{ + --[[ + arguments for export in low tick interval + based on "clickabledata.lua" + ]] + -- ELEC_INTERFACE + --[536] = "%.1f", -- PTR-EEP-LVR-ADJV1 (AC Voltage 1 set rotary) {-1, 1} + --[537] = "%.1f", -- PTR-EEP-LVR-ADJV2 (AC Voltage 2 set rotary) {-1, 1} + [538] = "%1d", --PTR-EEP-TMB-GEN1 (Generator 1) + [539] = "%1d", --PTR-EEP-TMB-GEN2 (Generator 2) + [540] = "%1d", --PTR-EEP-TMB-AER (AC ground power) + [541] = "%1d", --PTR-EEP-TMB-PO (115V Inverter) + [542] = "%1d", --PTR-EEP-TMB-PT (36V Inverter) + [535] = "%.1f", --PTR-EEP-LVR-MODE (AC Mode), 11 degrees + [494] = "%.1f", --PTR-RSPE-LVR-FEEDMODE (DC Bus Selector), 8 degrees + + [495] = "%1d", --PTR-RSPE-TMB-AKK1 (Battery 1) + [496] = "%1d", --PTR-RSPE-TMB-AKK2 (Battery 2) + [497] = "%1d", --PTR-RSPE-TMB-RESGEN (Standby Generator) + --[498] = "%.1f", -- PTR-RSPE-LVR-V (DC Voltage set rotary) {-1, 1} + [499] = "%1d", --PTR-RSPE-TMB-RECT1 (Rectifier 1) + [500] = "%1d", --PTR-RSPE-TMB-RECT2 (Rectifier 2) + [501] = "%1d", --PTR-RSPE-TMB-RECT3 (Rectifier 3) + [502] = "%1d", --PTR-RSPE-TMB-AERF (DC ground power) + [503] = "%1d", --PTR-RSPE-TMB-TESTEQU (Equipment Test) + + [147] = "%1d", --PTR-APP-CVR-CIRC (Standby Rectifier Cover) + [148] = "%1d", --PTR-APP-TMB-CIRC (Standby Rectifier) + [149] = "%1d", --PTR-APP-TMB-TRNS (36V Transformer) + + [590] = "%1d", --PTR-LAZS-TMB-BV-ZSBR (BW ESBR) + [591] = "%1d", --PTR-LAZS-TMB-BV-EXP (Explode) + [592] = "%1d", --PTR-LAZS-TMB-BV-DIR (Control) + [593] = "%1d", --PTR-LAZS-TMB-BV-EQU (Equipment) + [594] = "%1d", --PTR-LAZS-TMB-RSGUV-FIRE (RS/GUV Fire) + [595] = "%1d", --PTR-LAZS-TMB-RSGUV-SIGN (RS/GUV Warning) + [596] = "%1d", --PTR-LAZS-TMB-RSGUV-WARM (ESBR Heating) + + [597] = "%1d", --PTR-LAZS-TMB-311 (GUV Out 800 Left) + [598] = "%1d", --PTR-LAZS-TMB-GUOUT-800L (GUV Out 800 Left) + [599] = "%1d", --PTR-LAZS-TMB-GUOUT-800R (GUV Out 800 Right) + [600] = "%1d", --PTR-LAZS-TMB-GUOUTL-622L (GUV In Left 622 Left) + [601] = "%1d", --PTR-LAZS-TMB-GUOUTL-622R (GUV In Left 622 Right) + [602] = "%1d", --PTR-LAZS-TMB-GUOUTR-622L (GUV In Right 622 Left) + [603] = "%1d", --PTR-LAZS-TMB-GUOUTR-622R (GUV In Rignt 622 Right) + + [604] = "%1d", --PTR-LAZS-TMB-ES-800L (Electric Launch 800 Left) + [605] = "%1d", --PTR-LAZS-TMB-ES-622R (Electric Launch 800 Right) + [606] = "%1d", --PTR-LAZS-TMB-PKT (PKT) + [607] = "%1d", --PTR-LAZS-TMB-JETBOMB (Emergency Jettison) + [608] = "%1d", --PTR-LAZS-TMB-JETPWR (Power Jettison) + [609] = "%1d", --PTR-LAZS-TMB-JETEXPL (Emergency Jettison) + [610] = "%1d", --PTR-LAZS-TMB-JETRCKT (Alarm rockets) + + [611] = "%1d", --PTR-RAZS-TMB-START-TRBON (CB APU start) + [612] = "%1d", --PTR-RAZS-TMB-START-TRBIGN (CB APU ignition) + [613] = "%1d", --PTR-RAZS-TMB-START-ENGON (CB Engine start) + [614] = "%1d", --PTR-RAZS-TMB-START-ENGIGN (CB Engine ignition) + [615] = "%1d", --PTR-RAZS-TMB-RPM (CB RPM CONTROL) + [619] = "%1d", --PTR-RAZS-TMB-TURN (CB TURN INDICATOR) + + [629] = "%1d", --PTR-RAZS-TMB-TSCOCK-ON (CB Bypass) + [630] = "%1d", --PTR-RAZS-TMB-TSCOCK-L (CB Left valve) + [631] = "%1d", --PTR-RAZS-TMB-TSCOCK-R (CB Right valve) + [632] = "%1d", --PTR-RAZS-TMB-TSCOUNT (CB Fuelmeter) + [633] = "%1d", --PTR-RAZS-TMB-TSPMP-C (CB Center tank) + [634] = "%1d", --PTR-RAZS-TMB-TSPMP-L (CB Left pump) + [635] = "%1d", --PTR-RAZS-TMB-TSPMP-R (CB Right pump) + [636] = "%1d", --PTR-RAZS-TMB-T819 (CB T-819) + [637] = "%1d", --PTR-RAZS-TMB-SPPU52 (CB SPUU-52) + + [647] = "%1d", --PTR-RAZS-TMB-HLGT-DIR-L (SPOT CONTROL LEFT) + [648] = "%1d", --PTR-RAZS-TMB-HLGT-ON-L (SPOT ON LEFT) + [649] = "%1d", --PTR-RAZS-TMB-HLGT-DIR-R (SPOT CONTROL RIGHT) + [650] = "%1d", --PTR-RAZS-TMB-HLGT-ON-R (SPOT ON RIGHT) + [651] = "%1d", --PTR-RAZS-TMB-ANO (ANO) + [652] = "%1d", --PTR-RAZS-TMB-WNGLGT (WING LIGHTS) + [653] = "%1d", --PTR-RAZS-TMB-LAMPTEST (CHECK LAMPS/FLASHER) + --[654] = "%1d", -- PTR-RAZS-TMB-DIRMAIN (LOCK MAIN) + --[655] = "%1d", -- PTR-RAZS-TMB-DIRDUB (LOCK SPARE) + + [620] = "%1d", --PTR-RAZS-TMB-APMAIN (CB Autopilot MAIN) + [621] = "%1d", --PTR-RAZS-TMB-APFRICT (CB Autopilot Frict) + [622] = "%1d", --PTR-RAZS-TMB-APELCT (CB Autopilot Clutch) + [623] = "%1d", --PTR-RAZS-TMB-GSMAIN (CB Hydro Main) + [624] = "%1d", --PTR-RAZS-TMB-GSDBL (CB Hydro Aux) + [625] = "%1d", --PTR-RAZS-TMB-RADSPU (CB SPU (Intercom)) + [626] = "%1d", --PTR-RAZS-TMB-RADALT (CB Radio Altimeter) + [627] = "%1d", --PTR-RAZS-TMB-RADCOMM (CB Command Radio Station (R-863)) + [628] = "%1d", --PTR-RAZS-TMB-RADRS (CB 6201) + + [638] = "%1d", --PTR-RAZS-TMB-PPSSIGN (CB Signalization) + [639] = "%1d", --PTR-RAZS-TMB-PPSQUE1-L (CB 1 Queue Left) + [640] = "%1d", --PTR-RAZS-TMB-PPSQUE1-R (CB 1 Queue Right) + [641] = "%1d", --PTR-RAZS-TMB-PPSQUE2-L (CB 2 Queue Left) + [642] = "%1d", --PTR-RAZS-TMB-PPSQUE2-R (CB 2 Queue Right) + [643] = "%1d", --PTR-RAZS-TMB-RADCMP-SV (CB Radio Compass MW(ARC-9)) + [644] = "%1d", --PTR-RAZS-TMB-RADCMP-UKV (CB Radio Compass VHF(ARC-UD)) + [645] = "%1d", --PTR-RAZS-TMB-RADDISS (CB Doppler Navigator) + [646] = "%1d", --PTR-RAZS-TMB-RADRNTG (CB Radio Meter) + + [656] = "%1d", --PTR-RAZS-TMB-POSDIR (CONTROL) + [657] = "%1d", --PTR-RAZS-TMB-POSPZUENG-L (LEFT ENGINE) + [658] = "%1d", --PTR-RAZS-TMB-POSPZUENG-R (RIGHT ENGINE) + [659] = "%1d", --PTR-RAZS-TMB-POSRIO3 (RIO-3) + [660] = "%1d", --PTR-RAZS-TMB-POSGLS (WINDOW) + [661] = "%1d", --PTR-RAZS-TMB-WIPER-L (LEFT ENGINE) + [662] = "%1d", --PTR-RAZS-TMB-WIPER-R (RIGHT ENGINE) + [663] = "%1d", --PTR-RAZS-TMB-L1800 (RIO-3) + [664] = "%1d", --PTR-RAZS-TMB-KO50 (WINDOW) + + [882] = "%1d", --PTR-GRAZS-1 (CB Group 1) + [883] = "%1d", --PTR-GRAZS-2 (CB Group 4) + [884] = "%1d", --PTR-GRAZS-3 (CB Group 7) + [885] = "%1d", --PTR-GRAZS-4 (CB Group 2) + [886] = "%1d", --PTR-GRAZS-5 (CB Group 5) + [887] = "%1d", --PTR-GRAZS-6 (CB Group 8) + [888] = "%1d", --PTR-GRAZS-7 (CB Group 3) + [889] = "%1d", --PTR-GRAZS-8 (CB Group 6) + [890] = "%1d", --PTR-GRAZS-9 (CB Group 9) + ------------------------------------------------------------- + -- FUELSYS INTERFACE + [438] = "%1d", --PTR-CPE-TMB-PUMP-RATE (Service tank pump) + [439] = "%1d", --PTR-CPE-TMB-PUMPTNK-L (Left fuel tank pump) + [440] = "%1d", --PTR-CPE-TMB-PUMPTNK-R (Right fuel tank pump) + [427] = "%1d", --PTR-CPE-TMB-PUMP-L (Left Engine Shutoff Valve) + [429] = "%1d", --PTR-CPE-TMB-PUMP-R (Right Engine Shutoff Valve) + [426] = "%1d", --PTR-CPE-CVR-PUMP-L (Left Engine Shutoff Valve) + [428] = "%1d", --PTR-CPE-CVR-PUMP-R (Right Engine Shutoff Valve) + [431] = "%1d", --PTR-CPE-TMB-PUMP-RING (Crossfeed) + [430] = "%1d", --PTR-CPE-CVR-PUMP-RING (Crossfeed Cover) + + [433] = "%1d", --PTR-CPE-TMB-PUMP-PASS (Bypass) + [432] = "%1d", --PTR-CPE-CVR-PUMP-PASS (Bypass) + ------------------------------------------------------------- + -- ENGINE INTERFACE + [412] = "%1d", --PTR-CPE-TMB-TURBOSTART-ST (APU start mode) + [413] = "%1d", --PTR-CPE-BTN-TURBOSTART-ON (APU start) + [415] = "%1d", --PTR-CPE-BTN-TURBOSTART-OFF (APU stop) + + [419] = "%1d", --PTR-CPE-BTN-ENGSTART-ON (Engine start ON) + [421] = "%1d", --PTR-CPE-BTN-ENGSTART-OFF (Engine start OFF) + [422] = "%1d", --PTR-CPE-TMB-ENGSTART-LFTRGT (Select engine) + [423] = "%1d", --PTR-CPE-TMB-ENGSTART-ROLL (Engine start mode) + --[425] = "%1d", -- PTR-CPE-BTN-ENGSTART-TEST (Engine ignition check) + + [204] = "%1d", --PTR-ENGSTOP-ARM-L (Left engine stop) + [206] = "%1d", --PTR-ENGSTOP-ARM-R (Right engine stop) + [208] = "%1d", --PTR-VINTBRAKE-ARM (Rotor brake) + + [310] = "%1d", --PTR-LSPE-BTN-CONTR-IV500 (Vibration Sensor Test) + [311] = "%1d", --PTR-LSPE-BTN-CONTR-GRND (Temperature Sensor Test Cold) + [312] = "%1d", --PTR-LSPE-BTN-CONTR-AIR (Temperature Sensor Test Hot) + [313] = "%1d", --PTR-LSPE-BTN-CONTR-RTL (Temperature Regulator Test Left) + [314] = "%1d", --PTR-LSPE-BTN-CONTR-RTR (Temperature Regulator Test Right) + + [167] = "%1d", --PTR-APP-TMB-ERD-L (EEC Left) + [173] = "%1d", --PTR-APP-TMB-ERD-R (EEC Right) + [168] = "%1d", --PTR-APP-TMB-CHR-L (ER Left) + [172] = "%1d", --PTR-APP-TMB-CHR-R (ER Right) + [169] = "%1d", --PTR-APP-TMB-ST-L (FT Check Left) + [171] = "%1d", --PTR-APP-TMB-ST-R (FT Check Right) + [170] = "%1d", --PTR-APP-TMB-TKLR (CT check) + ------------------------------------------------------------- + -- HYDRO SYS INTERFACE + [406] = "%1d", --PTR-CPE-TMB-HYDRO-MAIN (Main Hydro) + [410] = "%1d", --PTR-CPE-TMB-HYDRO-DBL (Aux Hydro) + [409] = "%1d", --PTR-CPE-CVR-HYDRO-DBL (Aux Hydro Cover) + [411] = "%1d", --PTR-CPE-BTN-DBLOFF (Aux Hydro Off) + ------------------------------------------------------------- + -- AUTOPILOT + [134] = "%1d", --PTR-APP-BTN-DIRON (Autopilot Heading ON/Lamp Intensity. Rotate mouse wheel to set lamp intensity), Button + [868] = "%.4f", --PTR-APP-BTN-DIRON (Autopilot Heading ON/Lamp Intensity. Rotate mouse wheel to set lamp intensity), Axis + [135] = "%1d", --PTR-APP-BTN-DIROFF (Autopilot Heading OFF/Lamp Intensity. Rotate mouse wheel to set lamp intensity), Button + [869] = "%.4f", --PTR-APP-BTN-DIROFF (Autopilot Heading OFF/Lamp Intensity. Rotate mouse wheel to set lamp intensity), Axis + + [138] = "%1d", --PTR-APP-BTN-KTON (Autopilot Pitch/Roll ON/Lamp Intensity. Rotate mouse wheel to set lamp intensity), Button + [870] = "%.4f", --PTR-APP-BTN-KTON (Autopilot Pitch/Roll ON/Lamp Intensity. Rotate mouse wheel to set lamp intensity), Axis + [144] = "%1d", --PTR-APP-BTN-ALTON (Autopilot Altitude ON/Lamp Intensity. Rotate mouse wheel to set lamp intensity), Button + [871] = "%.4f", --PTR-APP-BTN-ALTON (Autopilot Altitude ON/Lamp Intensity. Rotate mouse wheel to set lamp intensity), Axis + [145] = "%1d", --PTR-APP-BTN-ALTOFF (Autopilot Altitude OFF/Lamp Intensity. Rotate mouse wheel to set lamp intensity), Button + [872] = "%.4f", --PTR-APP-BTN-ALTOFF (Autopilot Altitude OFF/Lamp Intensity. Rotate mouse wheel to set lamp intensity), Axis + + [146] = "%1d", --PTR-APP-BTN-CONTR (Autopilot Altitude Channel Control) + + [136] = "%.4f", --PTR-APP-LVR-DIR (Autopilot Heading Adjustment) + [140] = "%.4f", --PTR-APP-LVR-K (Autopilot Roll Adjustment) + [142] = "%.4f", --PTR-APP-LVR-T (Autopilot Pitch Adjustment) + ------------------------------------------------------------- + -- RADAR ALTIMETER + [32] = "%1d", --PTR-ALTR-LVR-TEST (Radio altimeter test) + [29] = "%.4f", --PTR-ALTR-LVR-SET (Dangerous RALT set rotary) {0, 1} + [35] = "%1d", --PTR-ALTR-TMB-ONOFF (Radar Altimeter Power) + ------------------------------------------------------------- + -- BAR ALTIMETER + [18] = "%.4f", --PTR-ALTB-LVR-SET (Baro pressure QFE knob) + [97] = "%.4f", --PTR-ALTB-LVR-SET-R (Baro pressure QFE knob) + ------------------------------------------------------------- + -- VARIOMETER + [17] = "%.4f", --PTR-VARIO-LVR-SET-L (Variometer adjustment knob) + [96] = "%.4f", --PTR-VARIO-LVR-SET-R (Variometer adjustment knob) + ------------------------------------------------------------- + --HSI + [26] = "%.4f", --PTR-PNP-LVR-SET (HSI Course set knob) + [858] = "%1d", --PTR-ARKSV-ARKUKV (HSI ARC-9/ARC-UD Select) + + [102] = "%.4f", --PTR-PNP-LVR-SET-R (HSI Course set knob) + ------------------------------------------------------------- + -- FUELSYS INTERFACE + [61] = "%.1f", --PTR-FUEL-LVR-MODE (Fuel meter switch) + ------------------------------------------------------------- + -- WEAPON SYS + [866] = "%1d", --PTR-SAFE-WEAPON (Weapon Safe-Armed) + [707] = "%1d", --PTR-ADDPBV-TMB-EMRGEXP (Emergency Explode) + [706] = "%1d", --PTR-ADDPBV-CVR-EMRGEXP (Emergency Explode Cover) + + [709] = "%1d", --PTR-ADDPBV-TMB-EMRGJET (Emergency Release) + [708] = "%1d", --PTR-ADDPBV-CVR-EMRGJET (Emergency Release Cover) + + [717] = "%1d", --PTR-ADDPBV-TMB-MAINOFF (Main Bombs) + [718] = "%1d", --PTR-ADDPBV-BTN-LAMPTEST (Lamps Check) + + [719] = "%.1f", --PTR-ADDPBV-LVR-MODE (Pod Variants) + [720] = "%1d", --PTR-ADDPBV-TMB-WARM (ESBR Heat) + + [730] = "%.4f", --PTR-ADDESBR-LVR-MODE (ESBR Position) + [731] = "%1d", --PTR-ADDESBR-LVR-ONOFF (ESBR On/Off) + + [570] = "%1d", --PTR-LAZS-TMB-EMRGEXP (Emergency Explode) + [572] = "%1d", --PTR-LAZS-TMB-EMRGJET (Emergency Release) + [569] = "%1d", --PTR-LAZS-CVR-EMRGEXP (Emergency Explode Cover) + [571] = "%1d", --PTR-LAZS-CVR-EMRGJET (Emergency Release Cover) + + --[573] = "%1d", -- PTR-LAZS-TMB-MAINOFF (Main On/Off) + [575] = "%1d", --PTR-LAZS-TMB-RSGUV (RS/GUV Selector) + [576] = "%1d", --PTR-LAZS-BTN-LAMPTEST (Lamps Check) + [574] = "%1d", --PTR-LAZS-BTN-ENTER (PUS Arming) + + [342] = "%1d", --PTR-LPE-TMB-SHOOT1 (8/16/4) + [343] = "%1d", --PTR-LPE-TMB-SHOOT2 (1256/AUTO/34) + [344] = "%1d", --PTR-LPE-TMB-RS (UPK/PKT/RS) + [345] = "%1d", --PTR-LPE-TMB-GUV (CUTOFF) + [349] = "%1d", --PTR-LAZS-TMB-MAINOFF05 (800_or_624_622_800) + [348] = "%1d", --PTR-LAZS-CVR-EMRGEXP01 (800 or 624_622_800 Cover) + + [347] = "%.4f", --PTR-LPE-TMB-VAR (In800Out/800inOr624/622) + + [346] = "%.4f", --PTR-LPE-LVR-SHELL (Burst length) + + [350] = "%.4f", --PTR-LPE-TMB-PYRO-L (PYROCARTRIDGE Left) + [351] = "%.4f", --PTR-LPE-TMB-PYRO-R (PYROCARTRIDGE Right) + ------------------------------------------------------------- + -- SYS CONTROLLER + [523] = "%1d", --PTR-RSPE-TMB-WINK (FLASHER) + [525] = "%1d", --PTR-RSPE-TMB-TAB (Transparent Day/Night) + [150] = "%1d", --PTR-APP-TMB-TEST (CHECK LAMPS/FLASHER) + ------------------------------------------------------------- + -- SPUU-52 + [332] = "%1d", --PTR-LES-TMB-SPPU52 (SPUU-52 Power) + [127] = "%1d", --PTR-APP-BTN-OFF (SPUU-52 Control Engage) + [129] = "%1d", --PTR-APP-TMB-RT (SPUU-52 Control (Left button - P. Right button - t)) + [128] = "%.4f", --PTR-APP-LVR-ADJ (SPUU 52 Control Adjustment) + ------------------------------------------------------------- + -- FIRE EXTING INTERFACE + [389] = "%1d", --PTR-CPE-BTN-QUE1-1 (Main Discharge L ENG) + [390] = "%1d", --PTR-CPE-BTN-QUE1-2 (Main Discharge R ENG) + [391] = "%1d", --PTR-CPE-BTN-QUE1-3 (Main Discharge KO-50) + [392] = "%1d", --PTR-CPE-BTN-QUE1-4 (Main Discharge APU GEAR) + [393] = "%1d", --PTR-CPE-BTN-QUE2-1 (Alternate Discharge L ENG) + [394] = "%1d", --PTR-CPE-BTN-QUE2-2 (Alternate Discharge R ENG) + [395] = "%1d", --PTR-CPE-BTN-QUE2-3 (Alternate Discharge KO-50) + [396] = "%1d", --PTR-CPE-BTN-QUE2-4 (Alternate Discharge APU GEAR) + [397] = "%1d", --PTR-CPE-BTN-FIRE-OFF (Turn Off Fire Signal) + + [399] = "%1d", --PTR-CPE-TMB-CONTR-FIRE (Fire Detector Test) + [400] = "%1d", --PTR-CPE-TMB-CONTR-PYRO (Squib Test) + [401] = "%.1f", --PTR-CPE-LVR-CONTR-MODE (Check Fire circuits) + ------------------------------------------------------------- + -- ENGINE INTERFACE + [353] = "%1d", --PTR-LPE-TMB-MANAUT (AUTO-MANUAL) + [354] = "%1d", --PTR-LPE-BTN-OVR (GENERAL OFF) + [355] = "%1d", --PTR-LPE-TMB-PZU-L (LEFT ENGINE) + [356] = "%1d", --PTR-LPE-TMB-PZU-R (RIGHT ENGINE) + [357] = "%1d", --PTR-LPE-TMB-GLASS (WINDOW) + [358] = "%1d", --PTR-LPE-TMB-RIO (Ice Detector Heater) + [359] = "%1d", --PTR-LPE-BTN-RIOCONTR (Ice Detector Heater Test) + [372] = "%.1f", --PTR-LPE-LVR-FEEDMODE (Anti Ice Sections Current) + + [519] = "%1d", --PTR-RSPE-TMB-WRMPVD-L (Left Pitot Heater) + [520] = "%1d", --PTR-RSPE-TMB-WRMPVD-R (Right Pitot Heater) + [339] = "%1d", --PTR-LES-BTN-CONTRPVD (Left Pitot Heater Control) + [482] = "%1d", --PTR-LES-BTN-CONTRPVD01 (Right Pitot Heater Control) + ------------------------------------------------------------- + -- DISS 15 + [483] = "%1d", --PTR-RES-TMB-DISS (Doppler Navigator, Power) + [818] = "%1d", --PTR-DISS-BTN-OFF (Turn Off Coordinates Calculator) + [819] = "%1d", --PTR-DISS-BTN-ON (Turn On Coordinates Calculator) + [815] = "%1d", --PTR-DISS-BTN-MINUS (Decrease Map Angle) + [816] = "%1d", --PTR-DISS-BTN-PLUS (Increase Map Angle) + [809] = "%1d", --PTR-DISS-BTN-N (Decrease Path KM) + [810] = "%1d", --PTR-DISS-BTN-V (Increase Path KM) + [803] = "%1d", --PTR-DISS-BTN-TOLE (Decrease Deviation KM) + [804] = "%1d", --PTR-DISS-BTN-TORI (Increase Deviation KM) + [826] = "%.1f", --PTR-IND-DISS-SELECTOR (Mode Switch) + [797] = "%1d", --PTR-DISS-SELECTOR-KR (Test/Work) + [798] = "%1d", --PTR-DISS-SELECTOR-SM (Land/Sea) + ------------------------------------------------------------- + -- ADI + [487] = "%1d", --PTR-RES-TMB-AG (Right Attitude Indicator Power) + [335] = "%1d", --PTR-LES-TMB-AG (Left Attitude Indicator Power) + [11] = "%1d", --PTR-AGB-LVR-KNOB (Left Attitude Indicator Cage) + [10] = "%.4f", --PTR-AGB-LVR-SET (Left Attitude Indicator Zero pitch trim) + [90] = "%1d", --PTR-AGB-LVR-KNOB-R (Right Attitude Indicator Cage) + [89] = "%.4f", --PTR-AGB-LVR-SET-R (Right Attitude Indicator Zero pitch trim) + ------------------------------------------------------------- + -- + [336] = "%1d", --PTR-LES-TMB-VK53 (VK-53, Power) + ------------------------------------------------------------- + -- GMK1A + [485] = "%1d", --PTR-RES-TMB-GMK (GMC Power) + [470] = "%1d", --PTR-RPE-LVR-CRDNS (GMC Hemisphere Selection) + [472] = "%1d", --PTR-RPE-LVR-CRDMK (GMC Mode (MC, DG, AC(N/F))) + [476] = "%.1f", --PTR-RPE-LVR-CRDCONTR (GMC Control (Left - 0, Right - 300)) {-1.0,0.0,1.0} + [477] = "%.1f", --PTR-RPE-LVR-CRDZK (GMC Course Setting (Left - CCW, Right - CW)) {-1.0,0.0,1.0} + [474] = "%.4f", --PTR-RPE-LVR-CRDLAT (GMC Latitude Selection) + ------------------------------------------------------------- + -- ENGINE INTERFACE + [517] = "%1d", --PTR-RSPE-TMB-PZUENG-L (Dust Protection Left) + [518] = "%1d", --PTR-RSPE-TMB-PZUENG-R (Dust Protection Right) + ------------------------------------------------------------- + -- Nav Lights System + [513] = "%1d", --PTR-RSPE-TMB-ANO (ANO) + [514] = "%1d", --PTR-RSPE-TMB-LGTWING (Formation Lights) + [515] = "%1d", --PTR-RSPE-TMB-LGTCONT (Tip Lights) + [516] = "%1d", --PTR-RSPE-TMB-BEAC (Strobe Light) + [322] = "%1d", --PTR-LSPE-TMB-AIR-CODE (ANO code) + [836] = "%1d", --PTR-LEFT-TAXI-L-SW (Taxi Light) + [837] = "%1d", --PTR-LEFT-TAXI-L-POS-SW (Left Landing Light) + [838] = "%1d", --PTR-LEFT-TAXI-R-POS-SW (Right Landing Light) + ------------------------------------------------------------- + -- Lights System + [333] = "%1d", --PTR-LES-TMB-PLF (Left Ceiling Light) + [489] = "%1d", --PTR-RES-TMB-PLF (Right Ceiling Light) + [479] = "%1d", --PTR-RES-TMB-LGT (5.5V Lights) + [280] = "%.4f", --PTR-LSPE-LVR-REDGRP1 (Lh RedLights Brightness Rst gr.1) {0.0, 1.0} + [281] = "%.4f", --PTR-LSPE-LVR-REDGRP2 (Lh RedLights Brightness Rst gr.2) {0.0, 1.0} + [491] = "%.4f", --PTR-RSPE-LVR-REDGRP1 (Rh RedLights Brightness Rst gr.1) {0.0, 1.0} + [492] = "%.4f", --PTR-RSPE-LVR-REDGRP2 (Rh RedLights Brightness Rst gr.2) {0.0, 1.0} + [894] = "%.4f", --PTR-RSPE-LVR-REDGRP003 (Central RedLights Brightness Rst gr.1) {0.0, 1.0} + [895] = "%.4f", --PTR-RSPE-LVR-REDGRP004 (Central RedLights Brightness Rst gr.2) {0.0, 1.0} + ------------------------------------------------- + -- RADIO EQUIPMENT + -- SPU-7 + -- Left + [549] = "%.4f", --PTR-LAZS-LVR-ALL (Common Volume) + [548] = "%.4f", --PTR-LAZS-LVR-AUDIT (Listening Volume) + [553] = "%1d", --PTR-LAZS-TMB-RADSPU (Radio/ICS) + [551] = "%1d", --PTR-LAZS-TMB-CIRC (Network 1/2 (N/F)) + [552] = "%1d", --PTR-LAZS-BTN-CB (Circular Call (N/F)) + [550] = "%.1f", --PTR-LAZS-LVR-MODES (Radio Source (R-863/JADRO-1A/R-828/NF/ARC-9/ARC-UD)) + -- Right + [841] = "%.4f", --PTR-RAZS-LVR-ALL002 (Common Volume) + [840] = "%.4f", --PTR-RAZS-LVR-AUDIT002 (Listening Volume) + [845] = "%1d", --PTR-RAZS-TMB-RADSPU002 (Radio/ICS) + [843] = "%1d", --PTR-RAZS-TMB-CIRC002 (Network 1/2 (N/F)) + [846] = "%1d", --PTR-RAZS-BTN-CB002 (Circular Call (N/F)) + [842] = "%.1f", --PTR-RAZS-LVR-MODES002 (Radio Source (R-863/JADRO-1A/R-828/NF/ARC-9/ARC-UD)) + + --[194] = "%.4f", -- RADIO/ICS-1-PTR (Radio/ICS) + [480] = "%1d", --PTR-RES-TMB-LARING (Laryngophone) + ------------------------------------------------------------- + -- R-863 + [369] = "%1d", --PTR-LPE-TMB-COMAND (R-863, Select FM/AM) + [132] = "%1d", --PTR-APP-TMB-NU (R-863, Dial/Memory Unit) + [370] = "%1d", --PTR-LPE-LVR-CHANNEL (R-863, Radio channel selector) + + [155] = "%1d", --PTR-APP-TMB-PS (R-863, Squelch) + [156] = "%.4f", --PTR-APP-LVR-LEVEL (R-863, Volume) + + [163] = "%.4f", --PTR-APP-LVR-SEL1 (R-863, 10MHz rotary) {-0.1, 0.1} + [164] = "%.4f", --PTR-APP-LVR-SEL2 (R-863, 1MHz rotary) {-0.1, 0.1} + [165] = "%.4f", --PTR-APP-LVR-SEL3 (R-863, 100kHz rotary) {-0.1, 0.1} + [166] = "%.4f", --PTR-APP-LVR-SEL4 (R-863, 1kHz rotary) {-0.1, 0.1} + + [153] = "%1d", --PTR-APP-TMB-AP (R-863, Emergency Receiver On/Off (N/F)) + [154] = "%1d", --PTR-APP-TMB-RK (R-863, ARC (N/F)) + ------------------------------------------------------------- + -- R-828 + [735] = "%1d", --PTR-ADDSECPLT-LVR-CHNL (R-828 Radio channel selector) + + [737] = "%.4f", --PTR-ADDSECPLT-LVR-VOL (R-828 Radio volume) + [738] = "%1d", --PTR-ADDSECPLT-BTN-ASU (R-828 Radio Tuner button) + [739] = "%1d", --PTR-ADDSECPLT-TMB-PSH (R-828 Radio Squelch) + [756] = "%1d", --PTR-ADDSECPLT-TMB-P828 (R-828 Radio, Power) + [757] = "%1d", --PTR-ADDSECPLT-TMB-MODSEL (R-828 Radio, COMM/NAV) + ------------------------------------------------------------- + -- Jadro-1A + [484] = "%1d", --PTR-RES-TMB-RS (Jadro 1A, Power) + [745] = "%.4f", --PTR-ADDSECPLT-LVR-DIG12 (Jadro 1A, Frequency Selector, 1MHz) {-0.1, 0.1} + [746] = "%.4f", --PTR-ADDSECPLT-LVR-DIG3 (Jadro 1A, Frequency Selector, 100kHz) {-0.1, 0.1} + [747] = "%.4f", --PTR-ADDSECPLT-LVR-DIG4 (Jadro 1A, Frequency Selector, 10kHz) {-0.1, 0.1} + + [748] = "%.4f", --PTR-ADDSECPLT-LVR-DIG6 (Jadro 1A, Frequency Selector, Left mouse - 1kHz/ Right mouse - 100Hz) + [749] = "%.4f", --PTR-ADDSECPLT-LVR-DIG6 (Jadro 1A, Frequency Selector, Left mouse - 1kHz/ Right mouse - 100Hz) + + [744] = "%.1f", --PTR-ADDSECPLT-LVR-ONOFF (Jadro 1A, Mode OFF/OM/AM) + + [743] = "%.4f", --PTR-ADDSECPLT-LVR-VOLUM (Jadro 1A, Volume) + [741] = "%.4f", --PTR-ADDSECPLT-LVR-PSH (Jadro 1A, Squelch) + [742] = "%1d", --PTR-ADDSECPLT-TMB-CONTR (Jadro 1A, Control) + ------------------------------------------------------------- + -- RI-65 + [338] = "%1d", --PTR-LES-TMB-RK85 (RI-65) + [292] = "%1d", --PTR-LSPE-BTN-RI65-OFF (RI-65 OFF) + [293] = "%1d", --PTR-LSPE-BTN-RI65-RETRY (RI-65 Repeat) + [294] = "%1d", --PTR-LSPE-BTN-RI65-TEST (RI-65 Check) + [295] = "%1d", --PTR-LSPE-TMB-RI65-AMP (RI-65 Amplifier) + ------------------------------------------------------------- + -- ARC-UD + [456] = "%.1f", --PTR-RPE-LVR-ARKMODE (ARC-UD, Mode OFF/NARROW/WIDE/PULSE/RC) + [457] = "%.1f", --PTR-RPE-LVR-ARKMODE2 (ARC-UD, Channel) + + [453] = "%1d", --PTR-RPE-TMB-ARKSENS (ARC-UD, Sensitivity) + [454] = "%1d", --PTR-RPE-TMB-ARKUKV (ARC-UD, MW/DW) + + [672] = "%1d", --PTR-RPE-BTN-CONTR (ARC-UD, Control) + [673] = "%1d", --PTR-RPE-BTN-ANTL (ARC-UD, Ant. Left) + [674] = "%1d", --PTR-RPE-BTN-ANTR (ARC-UD, Ant. Right) + + [455] = "%.4f", --PTR-RPE-LVR-ARKVOL (ARC-UD, Volume) + ------------------------------------------------------------- + -- PKV Sight + [589] = "%.4f", --PTR-LAZS-LVR-AIMLGT (Sight Brightness) + + [855] = "%.4f", --PTR-PKV-ROTARY (Sight Limb) + --[0] = "%1d", -- PTR-PKV-DOUBLE (Sight Double) + + [856] = "%.4f", --PTR-PKV-DOUBLE (Sight Double) {1.0,-1.0} + + [903] = "%.1f", --PTR-PKV-GLASS-FILTER (PKV Filter) + -------------------------------------------------------------------------------- + -- CLOCK + [57] = "%1d", --PTR-WATCH-LVR-L (Mech clock left lever) + [58] = "%1d", --PTR-WATCH-LVR-L (Mech clock left lever) + + [59] = "%1d", --PTR-WATCH-LVR-R (Mech clock right lever) + [60] = "%1d", --PTR-WATCH-LVR-R (Mech clock right lever) + + [839] = "%.1f", --PTR-STAT-PRESS (Static Pressure System Mode (LEFT/COMMON/RIGHT)) + -------------------------------------------------------------------------------- + -- UV-26 CMD Control Panel + [910] = "%1d", --PTR-UV26-ONOFF (CMD Power) + [859] = "%1d", --PTR-UV26-BOARD (CMD Select Left/Both/Right board flares dispensers) + [913] = "%1d", --PTR-UV26-PROG (CMD Amount flares counter/Programming) + [914] = "%1d", --PTR-L45-BTN (CMD Num of sequences) + [862] = "%1d", --PTR-L68-BTN (CMD Dispense interval) + [863] = "%1d", --PTR-L8-BTN (CMD Num in sequence) + [866] = "%1d", --PTR-START-BTN (CMD Start dispense) + [911] = "%1d", --PTR-LSPE-BTN-UV26-START (Start/Stop dispense) + [864] = "%1d", --PTR-RESET-PROG-BTN (CMD Reset to default program) + [865] = "%1d", --PTR-STOP-BTN (CMD Stop dispense) + ------------------------------------------------ + -- CPTMECH + [215] = "%1d", --PTR-BLISTER-LOCK-L (Left blister open/close) + [216] = "%1d", --PTR-BLISTER-LOCK-R (Right blister open/close) + + [881] = "%1d", --PTR-WHEELBRK-ARM (Wheel Brakes) + + [910] = "%1d", --PTR-RSPE-TMB-WINK002 (Acceleration Reset) + ------------------------------------------------ + -- ARC-9 + [469] = "%1d", --PTR-RPE-TMB-NEARFAR (ARC-9, Main/Backup Dialer) + [448] = "%.4f", --PTR-RPE-LVR-FRQVOLUME (ARC-9, Volume) + [444] = "%1d", --PTR-RPE-TMB-FRQTLG (ARC-9, TLF/TLG) + [446] = "%.1f", --PTR-RPE-LVR-FRQMODE (ARC-9, Mode OFF/COMP/ANT/LOOP) + [447] = "$.1f", --PTR-RPE-TMB-FRQFRAME (ARC-9, Loop Left/Right) + + [449] = "%.4f", --PTR-RPE-LVR-FRQADJRES (ARC-9, Backup Frequency Tune) + [675] = "%.2f", --PTR-RPE-LVR-FRQRES-SEC (ARC-9, Backup 100kHz rotary) + [450] = "%.2f", --PTR-RPE-LVR-FRQRES (ARC-9, Backup 10kHz rotary) + [451] = "%.4f", --PTR-RPE-LVR-FRQADJMAIN (ARC-9, Main Frequency Tune) + [678] = "%.2f", --PTR-RPE-LVR-FRQMAIN-SEC (ARC-9, Main 100kHz rotary) + [452] = "%.2f" --PTR-RPE-LVR-FRQMAIN (ARC-9, Main 10kHz rotary) +} + +----------------------------- +-- HIGH IMPORTANCE EXPORTS -- +-- done every export event -- +----------------------------- + +function ProcessGlassCockpitDCSConfigHighImportance(mainPanelDevice) + if gES_GlassCockpitType == 1 then + -- HELIOS Version 1.3 + elseif gES_GlassCockpitType == 2 then + --[[ + every frame export to GlassCockpit + Example from A-10C + Get Radio Frequencies + get data from device + local lUHFRadio = GetDevice(54) + SendData("ExportID", "Format") + SendData(2000, string.format("%7.3f", lUHFRadio:get_frequency()/1000000)) <- special function for get frequency data + ]] + -- Altimeter + -- VD_10K_L_100_Ind; VD_10K_L_10_Ind; VD_10K_L_PRESS + SendData(2000, string.format("%0.4f;%0.4f;%0.4f", + mainPanelDevice:get_argument_value(98), + mainPanelDevice:get_argument_value(99), + mainPanelDevice:get_argument_value(21))) + -- Altimeter Radar + -- A_036_RALT;A_036_DangerRALT_index;A_036_DangerRALT_lamp;A_036_warning_flag + SendData(2001, string.format("%0.4f;%0.4f;%0.4f;%0.4f", + mainPanelDevice:get_argument_value(34), + mainPanelDevice:get_argument_value(31), + mainPanelDevice:get_argument_value(30), + mainPanelDevice:get_argument_value(33))) + -- AGB_3K + -- AGB_3K_Left_roll, AGB_3K_Left_pitch, steering_warning_flag, SlipBallPosition + SendData(2002, string.format("%0.4f;%0.4f;%0.4f;%0.4f", + mainPanelDevice:get_argument_value(13), + mainPanelDevice:get_argument_value(12), + mainPanelDevice:get_argument_value(14), + mainPanelDevice:get_argument_value(15))) + + -- Clock + -- currtimeHours; currtimeMinutes; currtimeSeconds; flightTimeMeterStatus; + -- flightHours;flightMinutes; secondsMeterTimeMinutes; secondsMeterTimeSeconds; + SendData(2003, string.format("%0.4f;%0.4f;%0.4f;%0.4f;%0.4f;%0.4f;%0.4f;%0.4f", + mainPanelDevice:get_argument_value(49), + mainPanelDevice:get_argument_value(50), + mainPanelDevice:get_argument_value(51), + mainPanelDevice:get_argument_value(56), + mainPanelDevice:get_argument_value(52), + mainPanelDevice:get_argument_value(53), + mainPanelDevice:get_argument_value(54), + mainPanelDevice:get_argument_value(55))) + -- DirectionalGyro + -- UGR_4K_heading_L;UGR_4K_commanded_course_L;UGR_4K_bearing_needle_L + SendData(2004, string.format("%0.4f;%0.4f;%0.4f", + mainPanelDevice:get_argument_value(25), + mainPanelDevice:get_argument_value(27), + mainPanelDevice:get_argument_value(28))) + -- DriftIndicator + -- diss15_drift_angle;diss15_W_shutter;diss15_W_memory_lamp;diss15_W_hundreds; diss15_W_tens;diss15_W_ones + SendData(2005, string.format("%0.4f;%0.4f;%0.4f;%0.4f;%0.4f;%0.4f", + mainPanelDevice:get_argument_value(791), + mainPanelDevice:get_argument_value(795), + mainPanelDevice:get_argument_value(796), + mainPanelDevice:get_argument_value(792), + mainPanelDevice:get_argument_value(793), + mainPanelDevice:get_argument_value(794))) + -- EGT + -- LeftEngineTemperatureHund; LeftEngineTemperatureTenth; RightEngineTemperatureHund;RightEngineTemperatureTenth + SendData(2006, string.format("%0.4f;%0.4f;%0.4f;%0.4f", + mainPanelDevice:get_argument_value(43), + mainPanelDevice:get_argument_value(44), + mainPanelDevice:get_argument_value(45), + mainPanelDevice:get_argument_value(46))) + -- Engine Power + -- EnginesMode;LeftEngineMode;RightEngineMode ???? + SendData(2007, string.format("%0.4f;%0.4f;%0.4f", + mainPanelDevice:get_argument_value(39), + mainPanelDevice:get_argument_value(37), + mainPanelDevice:get_argument_value(38))) + -- Hover + -- diss15_hover_x; diss15_hover_y;diss15_hover_z;diss15_hover_lamp_off; + SendData(2008, string.format("%0.4f;%0.4f;%0.4f;%0.4f;%0.4f", + mainPanelDevice:get_argument_value(830), + mainPanelDevice:get_argument_value(828), + mainPanelDevice:get_argument_value(829), + mainPanelDevice:get_argument_value(831), + mainPanelDevice:get_argument_value(16))) + -- Oil Engine Left + -- oils_p_left_engine;oils_t_left_engine + SendData(2009, string.format("%0.4f;%0.4f", + mainPanelDevice:get_argument_value(115), + mainPanelDevice:get_argument_value(116))) + -- Oil Engine Right + -- oils_p_right_engine;oils_t_right_engine + SendData(2010, string.format("%0.4f;%0.4f", + mainPanelDevice:get_argument_value(117), + mainPanelDevice:get_argument_value(118))) + -- Oil Transition + -- oils_p_main_reductor;oils_t_main_reductor;oils_temp_tail_reductor; + SendData(2011, string.format("%0.4f;%0.4f;%0.4f", + mainPanelDevice:get_argument_value(111), + mainPanelDevice:get_argument_value(114), + mainPanelDevice:get_argument_value(113))) + -- RPM + -- LeftEngineRPM;RightEngineRPM + SendData(2012, string.format("%0.4f;%0.4f", + mainPanelDevice:get_argument_value(40), + mainPanelDevice:get_argument_value(41))) + -- Turn Indicator + -- EUP_speed;EUP_sideslip + SendData(2013, string.format("%0.4f;%0.4f", + mainPanelDevice:get_argument_value(22), + mainPanelDevice:get_argument_value(23))) + + end +end + +function ProcessHARDWAREConfigHighImportance(mainPanelDevice) + --[[ + every frame export to hardware + Example from A-10C + Get Radio Frequencies + get data from device + local UHF_RADIO = GetDevice(54) + SendDataHW("ExportID", "Format") + SendDataHW("ExportID", "Format", HardwareConfigID) + SendDataHW("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000)) + SendDataHW("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000), 2) -- export to Hardware '2' Config + ]] + + -- Radar altimeter A-036 + --------------------------------------------------------------- + SendDataHW("30", mainPanelDevice:get_argument_value(30) > 0.3 and 1 or 0) -- A_036_DangerRALT_lamp {0.0, 1.0} + -- DISS15 + --------------------------------------------------------------- + SendDataHW("822", mainPanelDevice:get_argument_value(822) > 0.3 and 1 or 0) -- diss15_check_control_lamp {0.0, 0.9} + SendDataHW("823", mainPanelDevice:get_argument_value(823) > 0.3 and 1 or 0) -- diss15_check_work_lamp {0.0, 0.9} + SendDataHW("824", mainPanelDevice:get_argument_value(824) > 0.3 and 1 or 0) -- diss15_check_failM_lamp {0.0, 0.9} + SendDataHW("825", mainPanelDevice:get_argument_value(825) > 0.3 and 1 or 0) -- diss15_check_failC_lamp {0.0, 0.9} + -- SPUU-52 + --------------------------------------------------------------- + SendDataHW("786", mainPanelDevice:get_argument_value(786) > 0.3 and 1 or 0) -- SPUU52_lamp {0.0, 1.0} + -- PU-26 LAMP + --------------------------------------------------------------- + SendDataHW("827", mainPanelDevice:get_argument_value(827) > 0.3 and 1 or 0) -- PU_26_GA_Lamp {0.0, 0.5} + -- ARC-UD + --------------------------------------------------------------- + SendDataHW("458", mainPanelDevice:get_argument_value(458) > 0.3 and 1 or 0) -- ARC_UD_Narrow_Lamp {0.0, 0.9} + SendDataHW("459", mainPanelDevice:get_argument_value(459) > 0.3 and 1 or 0) -- ARC_UD_Wide_Lamp {0.0, 0.9} + SendDataHW("460", mainPanelDevice:get_argument_value(460) > 0.3 and 1 or 0) -- ARC_UD_Pulse_Lamp {0.0, 0.9} + -- Jadro 1A + --------------------------------------------------------------- + SendDataHW("849", mainPanelDevice:get_argument_value(849) > 0.3 and 1 or 0) -- Jadro_ASU_Lamp {0.0, 1.0} + SendDataHW("848", mainPanelDevice:get_argument_value(848) > 0.3 and 1 or 0) -- Jadro_Ctl_Lamp {0.0, 1.0} + SendDataHW("850", mainPanelDevice:get_argument_value(450) > 0.3 and 1 or 0) -- Jadro_Breakdown_Lamp {0.0, 1.0} + -- Autopilot LAMPS + --------------------------------------------------------------- + SendDataHW("781", mainPanelDevice:get_argument_value(781) > 0.3 and 1 or 0) -- lamp_AP_heading_on + SendDataHW("782", mainPanelDevice:get_argument_value(782) > 0.3 and 1 or 0) -- lamp_AP_heading_off + SendDataHW("783", mainPanelDevice:get_argument_value(783) > 0.3 and 1 or 0) -- lamp_AP_pitch_roll_on + SendDataHW("784", mainPanelDevice:get_argument_value(784) > 0.3 and 1 or 0) -- lamp_AP_height_on + SendDataHW("785", mainPanelDevice:get_argument_value(785) > 0.3 and 1 or 0) -- lamp_AP_height_off + -- LAMPS + --------------------------------------------------------------- + SendDataHW("316", mainPanelDevice:get_argument_value(316) > 0.3 and 1 or 0) -- lamp_ENGINE_RT_LEFT_ON + SendDataHW("317", mainPanelDevice:get_argument_value(317) > 0.3 and 1 or 0) -- lamp_ENGINE_RT_RIGHT_ON + SendDataHW("318", mainPanelDevice:get_argument_value(318) > 0.3 and 1 or 0) -- lamp_SARPP_ON + SendDataHW("326", mainPanelDevice:get_argument_value(326) > 0.3 and 1 or 0) -- lamp_LOCK_OPEN + SendDataHW("327", mainPanelDevice:get_argument_value(327) > 0.3 and 1 or 0) -- lamp_DOORS_OPEN + SendDataHW("340", mainPanelDevice:get_argument_value(340) > 0.3 and 1 or 0) -- lamp_TURN_ON_RI_65 + SendDataHW("360", mainPanelDevice:get_argument_value(360) > 0.3 and 1 or 0) -- lamp_FROST + SendDataHW("362", mainPanelDevice:get_argument_value(362) > 0.3 and 1 or 0) -- lamp_LEFT_ENG_HEATING + SendDataHW("363", mainPanelDevice:get_argument_value(363) > 0.3 and 1 or 0) -- lamp_RIGHT_ENG_HEATING + SendDataHW("361", mainPanelDevice:get_argument_value(361) > 0.3 and 1 or 0) -- lamp_ANTI_ICE_ON + SendDataHW("364", mainPanelDevice:get_argument_value(364) > 0.3 and 1 or 0) -- lamp_LEFT_PZU_FRONT + SendDataHW("365", mainPanelDevice:get_argument_value(365) > 0.3 and 1 or 0) -- lamp_RIGHT_PZU_FRONT + SendDataHW("366", mainPanelDevice:get_argument_value(366) > 0.3 and 1 or 0) -- lamp_LEFT_PZU_BACK + SendDataHW("367", mainPanelDevice:get_argument_value(367) > 0.3 and 1 or 0) -- lamp_RIGHT_PZU_BACK + SendDataHW("373", mainPanelDevice:get_argument_value(373) > 0.3 and 1 or 0) -- lamp_SECTION_1 + SendDataHW("375", mainPanelDevice:get_argument_value(375) > 0.3 and 1 or 0) -- lamp_SECTION_2 + SendDataHW("374", mainPanelDevice:get_argument_value(374) > 0.3 and 1 or 0) -- lamp_SECTION_3 + SendDataHW("376", mainPanelDevice:get_argument_value(376) > 0.3 and 1 or 0) -- lamp_SECTION_4 + SendDataHW("368", mainPanelDevice:get_argument_value(368) > 0.3 and 1 or 0) -- lamp_RIO_heating_ok + SendDataHW("377", mainPanelDevice:get_argument_value(377) > 0.3 and 1 or 0) -- lamp_LEFT_ENG_FIRE + SendDataHW("378", mainPanelDevice:get_argument_value(378) > 0.3 and 1 or 0) -- lamp_RIGHT_ENG_FIRE + SendDataHW("379", mainPanelDevice:get_argument_value(379) > 0.3 and 1 or 0) -- lamp_KO50_FIRE + SendDataHW("380", mainPanelDevice:get_argument_value(380) > 0.3 and 1 or 0) -- lamp_REDUC_AI9_FIRE + SendDataHW("381", mainPanelDevice:get_argument_value(381) > 0.3 and 1 or 0) -- lamp_FIRE_LENG_1_QUEUE + SendDataHW("382", mainPanelDevice:get_argument_value(382) > 0.3 and 1 or 0) -- lamp_FIRE_RENG_1_QUEUE + SendDataHW("383", mainPanelDevice:get_argument_value(383) > 0.3 and 1 or 0) -- lamp_FIRE_KO50_1_QUEUE + SendDataHW("384", mainPanelDevice:get_argument_value(384) > 0.3 and 1 or 0) -- lamp_FIRE_REDUCT_1_QUEUE + SendDataHW("385", mainPanelDevice:get_argument_value(385) > 0.3 and 1 or 0) -- lamp_FIRE_LENG_2_QUEUE + SendDataHW("386", mainPanelDevice:get_argument_value(386) > 0.3 and 1 or 0) -- lamp_FIRE_RENG_2_QUEUE + SendDataHW("387", mainPanelDevice:get_argument_value(387) > 0.3 and 1 or 0) -- lamp_FIRE_KO50_2_QUEUE + SendDataHW("388", mainPanelDevice:get_argument_value(388) > 0.3 and 1 or 0) -- lamp_FIRE_REDUCT_2_QUEUE + SendDataHW("398", mainPanelDevice:get_argument_value(398) > 0.3 and 1 or 0) -- lamp_CHECK_SENSORS + SendDataHW("407", mainPanelDevice:get_argument_value(407) > 0.3 and 1 or 0) -- lamp_HYDRO_main_on + SendDataHW("408", mainPanelDevice:get_argument_value(408) > 0.3 and 1 or 0) -- lamp_HYDRO_aux_on + SendDataHW("414", mainPanelDevice:get_argument_value(414) > 0.3 and 1 or 0) -- lamp_APD9_on + SendDataHW("416", mainPanelDevice:get_argument_value(416) > 0.3 and 1 or 0) -- lamp_APD9_oil_pressure + SendDataHW("417", mainPanelDevice:get_argument_value(417) > 0.3 and 1 or 0) -- lamp_APD9_rpm + SendDataHW("418", mainPanelDevice:get_argument_value(418) > 0.3 and 1 or 0) -- lamp_APD9_rpm_high + SendDataHW("420", mainPanelDevice:get_argument_value(420) > 0.3 and 1 or 0) -- lamp_APD_on + SendDataHW("424", mainPanelDevice:get_argument_value(424) > 0.3 and 1 or 0) -- lamp_APD_starter_on + SendDataHW("434", mainPanelDevice:get_argument_value(434) > 0.3 and 1 or 0) -- lamp_FUEL_left_closed + SendDataHW("435", mainPanelDevice:get_argument_value(435) > 0.3 and 1 or 0) -- lamp_FUEL_right_closed + SendDataHW("436", mainPanelDevice:get_argument_value(436) > 0.3 and 1 or 0) -- lamp_FUEL_ring_closed + SendDataHW("441", mainPanelDevice:get_argument_value(441) > 0.3 and 1 or 0) -- lamp_FUEL_center_on + SendDataHW("442", mainPanelDevice:get_argument_value(442) > 0.3 and 1 or 0) -- lamp_FUEL_left_on + SendDataHW("443", mainPanelDevice:get_argument_value(443) > 0.3 and 1 or 0) -- lamp_FUEL_right_on + SendDataHW("461", mainPanelDevice:get_argument_value(461) > 0.3 and 1 or 0) -- lamp_HEATER + SendDataHW("462", mainPanelDevice:get_argument_value(462) > 0.3 and 1 or 0) -- lamp_IGNITION + SendDataHW("463", mainPanelDevice:get_argument_value(463) > 0.3 and 1 or 0) -- lamp_KO50_ON + SendDataHW("341", mainPanelDevice:get_argument_value(341) > 0.3 and 1 or 0) -- lamp_LEFT_PITOT_HEATER_OK + SendDataHW("490", mainPanelDevice:get_argument_value(490) > 0.3 and 1 or 0) -- lamp_RIGHT_PITOT_HEATER_OK + SendDataHW("509", mainPanelDevice:get_argument_value(509) > 0.3 and 1 or 0) -- lamp_LEFT_PZU_ON + SendDataHW("510", mainPanelDevice:get_argument_value(510) > 0.3 and 1 or 0) -- lamp_RIGHT_PZU_ON + SendDataHW("504", mainPanelDevice:get_argument_value(504) > 0.3 and 1 or 0) -- lamp_ELEC_turn_VU1 + SendDataHW("505", mainPanelDevice:get_argument_value(505) > 0.3 and 1 or 0) -- lamp_ELEC_turn_VU2 + SendDataHW("506", mainPanelDevice:get_argument_value(506) > 0.3 and 1 or 0) -- lamp_ELEC_turn_VU3 + SendDataHW("507", mainPanelDevice:get_argument_value(507) > 0.3 and 1 or 0) -- lamp_ELEC_DC_ground + SendDataHW("508", mainPanelDevice:get_argument_value(508) > 0.3 and 1 or 0) -- lamp_ELEC_test_equipment + SendDataHW("543", mainPanelDevice:get_argument_value(543) > 0.3 and 1 or 0) -- lamp_ELEC_gen1_fail + SendDataHW("544", mainPanelDevice:get_argument_value(544) > 0.3 and 1 or 0) -- lamp_ELEC_gen2_fail + SendDataHW("545", mainPanelDevice:get_argument_value(545) > 0.3 and 1 or 0) -- lamp_ELEC_AC_ground + SendDataHW("546", mainPanelDevice:get_argument_value(546) > 0.3 and 1 or 0) -- lamp_ELEC_PO_500 + SendDataHW("86", mainPanelDevice:get_argument_value(86) > 0.3 and 1 or 0) -- lamp_CIRCUIT_FROM_BATTERY + SendDataHW("68", mainPanelDevice:get_argument_value(68) > 0.3 and 1 or 0) -- lamp_CLOG_TF_LEFT + SendDataHW("69", mainPanelDevice:get_argument_value(69) > 0.3 and 1 or 0) -- lamp_CLOG_TF_RIGHT + SendDataHW("70", mainPanelDevice:get_argument_value(70) > 0.3 and 1 or 0) -- lamp_CHIP_LEFT_ENG + SendDataHW("71", mainPanelDevice:get_argument_value(71) > 0.3 and 1 or 0) -- lamp_CHIP_RIGHT_ENG + SendDataHW("72", mainPanelDevice:get_argument_value(72) > 0.3 and 1 or 0) -- lamp_VIBRATION_LEFT_HIGH + SendDataHW("73", mainPanelDevice:get_argument_value(73) > 0.3 and 1 or 0) -- lamp_VIBRATION_RIGHT_HIGH + SendDataHW("74", mainPanelDevice:get_argument_value(74) > 0.3 and 1 or 0) -- lamp_FIRE + SendDataHW("76", mainPanelDevice:get_argument_value(76) > 0.3 and 1 or 0) -- lamp_LEFT_ENG_TURN_OFF + SendDataHW("77", mainPanelDevice:get_argument_value(77) > 0.3 and 1 or 0) -- lamp_RIGHT_ENG_TURN_OFF + SendDataHW("78", mainPanelDevice:get_argument_value(78) > 0.3 and 1 or 0) -- lamp_FT_LEFT_HIGH + SendDataHW("79", mainPanelDevice:get_argument_value(79) > 0.3 and 1 or 0) -- lamp_FT_RIGHT_HIGH + SendDataHW("80", mainPanelDevice:get_argument_value(80) > 0.3 and 1 or 0) -- lamp_OIL_PRESSURE_LEFT + SendDataHW("81", mainPanelDevice:get_argument_value(81) > 0.3 and 1 or 0) -- lamp_OIL_PRESSURE_RIGHT + SendDataHW("82", mainPanelDevice:get_argument_value(82) > 0.3 and 1 or 0) -- lamp_ER_LEFT + SendDataHW("83", mainPanelDevice:get_argument_value(83) > 0.3 and 1 or 0) -- lamp_ER_RIGHT + SendDataHW("84", mainPanelDevice:get_argument_value(84) > 0.3 and 1 or 0) -- lamp_EEC_LEFT_OFF + SendDataHW("85", mainPanelDevice:get_argument_value(85) > 0.3 and 1 or 0) -- lamp_EEC_RIGHT_OFF + SendDataHW("873", mainPanelDevice:get_argument_value(873) > 0.3 and 1 or 0) -- lamp_CHIP_MAIN_REDUCTOR + SendDataHW("874", mainPanelDevice:get_argument_value(874) > 0.3 and 1 or 0) -- lamp_CHIP_INTER_REDUCTOR + SendDataHW("875", mainPanelDevice:get_argument_value(875) > 0.3 and 1 or 0) -- lamp_CHIP_TAIL_REDUCTOR + SendDataHW("64", mainPanelDevice:get_argument_value(64) > 0.3 and 1 or 0) -- lamp_300_Left + SendDataHW("65", mainPanelDevice:get_argument_value(65) > 0.3 and 1 or 0) -- lamp_DISS_OFF + SendDataHW("555", mainPanelDevice:get_argument_value(555) > 0.3 and 1 or 0) -- lamp_BD1 + SendDataHW("556", mainPanelDevice:get_argument_value(556) > 0.3 and 1 or 0) -- lamp_BD2 + SendDataHW("557", mainPanelDevice:get_argument_value(557) > 0.3 and 1 or 0) -- lamp_BD3 + SendDataHW("558", mainPanelDevice:get_argument_value(558) > 0.3 and 1 or 0) -- lamp_BD4 + SendDataHW("559", mainPanelDevice:get_argument_value(559) > 0.3 and 1 or 0) -- lamp_BD5 + SendDataHW("560", mainPanelDevice:get_argument_value(560) > 0.3 and 1 or 0) -- lamp_BD6 + SendDataHW("711", mainPanelDevice:get_argument_value(711) > 0.3 and 1 or 0) -- lamp_BD1Bomb + SendDataHW("712", mainPanelDevice:get_argument_value(712) > 0.3 and 1 or 0) -- lamp_BD2Bomb + SendDataHW("713", mainPanelDevice:get_argument_value(713) > 0.3 and 1 or 0) -- lamp_BD3Bomb + SendDataHW("714", mainPanelDevice:get_argument_value(714) > 0.3 and 1 or 0) -- lamp_BD4Bomb + SendDataHW("715", mainPanelDevice:get_argument_value(715) > 0.3 and 1 or 0) -- lamp_BD5Bomb + SendDataHW("716", mainPanelDevice:get_argument_value(716) > 0.3 and 1 or 0) -- lamp_BD6Bomb + SendDataHW("562", mainPanelDevice:get_argument_value(562) > 0.3 and 1 or 0) -- lamp_PUS1 + SendDataHW("563", mainPanelDevice:get_argument_value(563) > 0.3 and 1 or 0) -- lamp_PUS3 + SendDataHW("564", mainPanelDevice:get_argument_value(564) > 0.3 and 1 or 0) -- lamp_PUS4 + SendDataHW("565", mainPanelDevice:get_argument_value(565) > 0.3 and 1 or 0) -- lamp_PUS6 + SendDataHW("561", mainPanelDevice:get_argument_value(561) > 0.3 and 1 or 0) -- lamp_EmergExplode + SendDataHW("705", mainPanelDevice:get_argument_value(705) > 0.3 and 1 or 0) -- lamp_EmergExplodeSec + SendDataHW("710", mainPanelDevice:get_argument_value(710) > 0.3 and 1 or 0) -- lamp_BV_Net_On + SendDataHW("566", mainPanelDevice:get_argument_value(566) > 0.3 and 1 or 0) -- lamp_RS_Net_On + SendDataHW("567", mainPanelDevice:get_argument_value(567) > 0.3 and 1 or 0) -- lamp_GUV_Net_On + --SendDataHW("", mainPanelDevice:get_argument_value() > 0.3 and 1 or 0) -- lamp_MV_Net_On + SendDataHW("568", mainPanelDevice:get_argument_value(568) > 0.3 and 1 or 0) -- lamp_FKP_On + SendDataHW("778", mainPanelDevice:get_argument_value(778) > 0.3 and 1 or 0) -- lamp_Caution_Weap + +end + +----------------------------------------------------- +-- LOW IMPORTANCE EXPORTS -- +-- done every gExportLowTickInterval export events -- +----------------------------------------------------- + +function ProcessGlassCockpitDCSConfigLowImportance(mainPanelDevice) + --[[ + export in low tick interval to GlassCockpit + Example from A-10C + Get Radio Frequencies + get data from device + local lUHFRadio = GetDevice(54) + SendData("ExportID", "Format") + SendData(2000, string.format("%7.3f", lUHFRadio:get_frequency()/1000000)) <- special function for get frequency data + ]] + --[[ + -- AGB_3K_LEFT + local lAGB_3K_LEFT = GetDevice(6) + WriteToLog('lAGB_3K_LEFT:get_sideslip '..dump(lAGB_3K_LEFT:get_sideslip())) + WriteToLog('lAGB_3K_LEFT:get_bank '..dump(lAGB_3K_LEFT:get_bank())) + WriteToLog('lAGB_3K_LEFT:get_pitch '..dump(lAGB_3K_LEFT:get_pitch())) + + -- AGB_3K_RIGHT + local lAGB_3K_RIGHT = GetDevice(7) + WriteToLog('lAGB_3K_RIGHT:get_sideslip '..dump(lAGB_3K_RIGHT:get_sideslip())) + WriteToLog('lAGB_3K_RIGHT:get_bank '..dump(lAGB_3K_RIGHT:get_bank())) + WriteToLog('lAGB_3K_RIGHT:get_pitch '..dump(lAGB_3K_RIGHT:get_pitch())) + + -- DISS_15 + local lDISS_15 = GetDevice(15) + WriteToLog('lDISS_15:get_w_vector '..dump(lDISS_15:get_w_vector())) + WriteToLog('lDISS_15:get_drift_angle '..dump(lDISS_15:get_drift_angle())) + + -- RADAR_ALTIMETER + local lRADAR_ALTIMETER = GetDevice(18) + WriteToLog('lRADAR_ALTIMETER:get_altitude '..dump(lRADAR_ALTIMETER:get_altitude())) + WriteToLog('lRADAR_ALTIMETER:get_dangerous_height_flag '..dump(lRADAR_ALTIMETER:get_dangerous_height_flag())) + WriteToLog('lRADAR_ALTIMETER:get_distance_limit '..dump(lRADAR_ALTIMETER:get_distance_limit())) + WriteToLog('lRADAR_ALTIMETER:get_dangerous_height '..dump(lRADAR_ALTIMETER:get_dangerous_height())) + WriteToLog('lRADAR_ALTIMETER:get_warning_flag '..dump(lRADAR_ALTIMETER:get_warning_flag())) + WriteToLog('lRADAR_ALTIMETER:get_mode '..dump(lRADAR_ALTIMETER:get_mode())) + WriteToLog('lRADAR_ALTIMETER:get_aperture_size '..dump(lRADAR_ALTIMETER:get_aperture_size())) + WriteToLog('lRADAR_ALTIMETER:get_needle_value '..dump(lRADAR_ALTIMETER:get_needle_value())) + + -- MISC_SYSTEMS_INTERFACE + local lMISC_SYSTEMS_INTERFACE = GetDevice(20) + WriteToLog('lMISC_SYSTEMS_INTERFACE:get_rotor_blades_pitch '..dump(lMISC_SYSTEMS_INTERFACE:get_rotor_blades_pitch())) + WriteToLog('lMISC_SYSTEMS_INTERFACE:get_main_rotor_rpm '..dump(lMISC_SYSTEMS_INTERFACE:get_main_rotor_rpm())) + + -- SPU_7 (Intercom) + local lSPU_7 = GetDevice(36) + WriteToLog('lSPU_7:is_communicator_available '..dump(lSPU_7:is_communicator_available())) + WriteToLog('lSPU_7:get_noise_level '..dump(lSPU_7:get_noise_level())) + WriteToLog('lSPU_7:get_signal_level '..dump(lSPU_7:get_signal_level())) + --WriteToLog('lSPU_7:set_communicator '..dump(lSPU_7:set_communicator())) -- test parameters + --WriteToLog('lSPU_7:set_voip_mode '..dump(lSPU_7:set_voip_mode())) -- test parameters + + -- JADRO_1A + local lJADRO_1A = GetDevice(37) + WriteToLog('lJADRO_1A:is_on '..dump(lJADRO_1A:is_on())) + WriteToLog('lJADRO_1A:get_frequency '..dump(lJADRO_1A:get_frequency())) + --WriteToLog('lJADRO_1A:set_frequency '..dump(lJADRO_1A:set_frequency())) -- test parameters + --WriteToLog('lJADRO_1A:set_modulation '..dump(lJADRO_1A:set_modulation())) -- test parameters + --WriteToLog('lJADRO_1A:set_channel '..dump(lJADRO_1A:set_channel())) -- test parameters + + -- R_863 + local lR_863 = GetDevice(38) + WriteToLog('lR_863:is_on '..dump(lR_863:is_on())) + WriteToLog('lR_863:get_frequency '..dump(lR_863:get_frequency())) + --WriteToLog('lR_863:set_frequency '..dump(lR_863:set_frequency())) -- test parameters + --WriteToLog('lR_863:set_modulation '..dump(lR_863:set_modulation())) -- test parameters + --WriteToLog('lR_863:set_channel '..dump(lR_863:set_channel())) -- test parameters + + -- R_828 + local lR_828 = GetDevice(39) + WriteToLog('lR_828:is_on '..dump(lR_828:is_on())) + WriteToLog('lR_828:get_frequency '..dump(lR_828:get_frequency())) + --WriteToLog('lR_828:set_frequency '..dump(lR_828:set_frequency())) -- test parameters + --WriteToLog('lR_828:set_modulation '..dump(lR_828:set_modulation())) -- test parameters + --WriteToLog('lR_828:set_channel '..dump(lR_828:set_channel())) -- test parameters + ]] +end + +function ProcessHARDWAREConfigLowImportance(mainPanelDevice) +--[[ + export in low tick interval to hardware + Example from A-10C + Landing Gear + mainPanelDevice, basis panel + SendDataHW("2004", mainPanelDevice:get_argument_value(659)) -- GEAR_N_SAFE + SendDataHW("2005", mainPanelDevice:get_argument_value(660)) -- GEAR_L_SAFE + SendDataHW("2006", mainPanelDevice:get_argument_value(661)) -- GEAR_R_SAFE + + Device test, Device 2 to 32 + is value "userdata", is only DLL intern functions + + local ltmp1 = 0 + for ltmp2 = 1, 50, 1 do + ltmp1 = GetDevice(ltmp2) + WriteToLog(ltmp2..': '..dump(ltmp1)) + WriteToLog(ltmp2..' (metatable): '..dump(getmetatable(ltmp1))) + end + ]] + + -- Radio comunication + -- JADRO 1A + local lJADRO_1A = GetDevice(37) + if lJADRO_1A:is_on() then + SendDataHW("2000", string.format("%7.4f", lJADRO_1A:get_frequency()/1000000)) + else + SendDataHW("2000", "-") + end + + -- R_863 (center) + local lR_863_c = GetDevice(38) + SendDataHW("2001", string.format("%7.3f", lR_863_c:get_frequency()/1000000)) + + -- R_863 (left) Channel + local lR_863_l = {[0.0]="1",[0.05]="2",[0.10]="3",[0.15]="4",[0.20]="5",[0.25]="6",[0.30]="7",[0.35]="8",[0.40]="9",[0.45]="10",[0.50]="11",[0.55]="12",[0.60]="13",[0.65]="14",[0.70]="15",[0.75]="16",[0.80]="17",[0.85]="18",[0.90]="19",[0.95]="20"} + SendDataHW("2002", lR_863_l[math.round(mainPanelDevice:get_argument_value(370), 2)]) + + -- R_863 (left) Frequency + -- is the same frequency as R_863 (center), but not the frequency from R_863 (left) + local lR_863_F = GetDevice(38) + SendDataHW("2003", string.format("%7.3f", lR_863_F:get_frequency()/1000000)) + + -- R_828 Channel + local lR_828 = {[0.0]="1",[0.101]="2",[0.199]="3",[0.302]="4",[0.400]="5",[0.502]="6",[0.601]="7",[0.697]="8",[0.801]="9",[0.898]="10"} + SendDataHW("2004", lR_828[math.round(mainPanelDevice:get_argument_value(736), 3)]) + + -- R_828 Frequency + local lR_828_F = GetDevice(39) + if lR_828_F:is_on() then + SendDataHW("2005", string.format("%7.3f", lR_828_F:get_frequency()/1000000)) + else + SendDataHW("2005", "-") + end + + -- UV-26 + local lUV26 = list_indication(5) + lUV26 = lUV26:gsub("-----------------------------------------", "") + lUV26 = lUV26:gsub("txt_digits", "") + lUV26 = lUV26:gsub("%c", "") + + SendDataHW("2006", string.format("%s", lUV26)) + + + --============================================================================================ + --[[ + WriteToLog('list_cockpit_params(): '..dump(list_cockpit_params())) + + local ltmp1 = 0 + for ltmp2 = 1, 10, 1 do + ltmp1 = list_indication(ltmp2) + WriteToLog(ltmp2..': '..dump(ltmp1)) + --WriteToLog(ltmp2..' (metatable): '..dump(getmetatable(ltmp1))) + end + ]] +end \ No newline at end of file diff --git a/ExportsModules/MiG-15Bis.lua b/ExportsModules/MiG-15Bis.lua new file mode 100644 index 0000000..11120f6 --- /dev/null +++ b/ExportsModules/MiG-15Bis.lua @@ -0,0 +1,454 @@ +-- MiG-15Bis +-- Version 0.9.9 BETA + +gES_FoundDCSModule = true + +gES_GlassCockpitConfigEveryFrameArguments = +{ +-- arguments for export every frame +-- based of "mainpanel_init.lua" + + [225] = "%.4f", -- Canopy + [223] = "%.4f", -- LeftCanopyLever + [222] = "%.4f", -- RightCanopyLever + [224] = "%.4f", -- AftCanopyLever + [14] = "%.4f", -- Variometer + [28] = "%.4f", -- Altimeter_km + [29] = "%.4f", -- Altimeter_m + [31] = "%.4f", -- Altimeter_Pressure + [15] = "%.4f", -- CLOCK_currtime_hours + [16] = "%.4f", -- CLOCK_currtime_minutes + [22] = "%.4f", -- CLOCK_flight_time_meter_status + [18] = "%.4f", -- CLOCK_flight_hours + [19] = "%.4f", -- CLOCK_flight_minutes + [20] = "%.4f", -- CLOCK_seconds_meter_time_minutes + [17] = "%.4f", -- CLOCK_seconds_meter_time_seconds + [4] = "%.4f", -- IAS + [5] = "%.4f", -- TAS + [27] = "%.4f", -- MACH + [6] = "%.4f", -- AGK_47B_roll + [7] = "%.4f", -- AGK_47B_pitch + [11] = "%.4f", -- AGK_47B_failure_flag + [8] = "%.4f", -- AGK_47B_sideslip + [9] = "%.4f", -- AGK_47B_turn + [10] = "%.4f", -- AGK_47B_horizon + [35] = "%.4f", -- PRV_46_RAlt + [32] = "%.4f", -- PDK-45 HeadingScale + [33] = "%.4f", -- PDK-45 Heading + -- Weapon System + [95] = "%.4f", -- N37D_Ready_Lamp + [93] = "%.4f", -- NR23_TOP_Ready_Lamp + [94] = "%.4f", -- NR23_BOTTOM_Ready_Lamp + [100] = "%.4f", -- Tactical_Rel_Lamp + [98] = "%.4f", -- LEFT_BOMB_Lamp + [99] = "%.4f", -- RIGHT_BOMB_Lamp + -- electric system + [83] = "%.4f", -- VoltAmperMeter + [244] = "%.4f", -- lamps_lightness + -- hydraulic system + [168] = "%.4f", -- HydraulicPressureMain + [139] = "%.4f", -- HydraulicPressureGain + [169] = "%.4f", -- HydraulicPressureAirFlaps + [165] = "%.4f", -- HydraulicPressureAirGears + [172] = "%.4f", -- HydraulicPressureMainAir + -- gear system + [121] = "%.4f", -- LeftBrakePressure + [122] = "%.4f", -- RightBrakePressure + -- fuel system + [47] = "%.4f", -- FuelQuantity + -- air system + [188] = "%.4f", -- CanopyAirValveIndication + [39] = "%.4f", -- CockpitAltitude + [40] = "%.4f", -- PressureDifference + -- oxygen system + [48] = "%.4f", -- OxygenPressure + [60] = "%.4f", -- FlowBlinker + [49] = "%.4f", -- FlowPressure + -- Engine + [42] = "%.4f", -- EngineTachometer + [41] = "%.4f", -- EngineTemperature + [45] = "%.4f", -- OilTemperature + [44] = "%.4f", -- OilPressure + [43] = "%.4f", -- EngineFuelPressure + [46] = "%.4f", -- FuelPressure + -- radio compass + [238] = "%.4f", -- ARC5_Band + [176] = "%.4f", -- ARC5_TuningMeter + [175] = "%.4f", -- ARC5_Tuning + [38] = "%.4f", -- ARC5_Bearing + [239] = "%.4f", -- ARC5_FreqScale + -- Radio RSI-6K + [235] = "%.4f", -- RadioAntennaPower + [128] = "%.4f", -- RadioReceiverKnob + [127] = "%.4f", -- RadioReceiverInd + [144] = "%.4f", -- RadioReceiverGauge + [245] = "%.4f", -- ASP_3N_Range + -- Lamps + -- electric system + [57] = "%.4f", -- lamp_GeneratorOff + [58] = "%.4f", -- lamp_Ignition + -- power plant + [119] = "%.4f", -- lamp_IsolatingValve + -- gear system + [75] = "%.4f", -- lamp_LeftGearExt + [74] = "%.4f", -- lamp_LeftGearRet + [79] = "%.4f", -- lamp_RightGearExt + [78] = "%.4f", -- lamp_RightGearRet + [77] = "%.4f", -- lamp_NoseGearExt + [76] = "%.4f", -- lamp_NoseGearRet + [53] = "%.4f", -- lamp_ExtendGears + -- fuel system + [56] = "%.4f", -- lamp_Remain300 + [50] = "%.4f", -- lamp_AftEmpty + [52] = "%.4f", -- lamp_DropTanks + [51] = "%.4f", -- lamp_BoostPressure + -- control system + [113] = "%.4f", -- lamp_TrimmerNeutral + [59] = "%.4f", -- lamp_FlapsExt + [124] = "%.4f", -- lamp_AirBrakeExt + -- fire extinguisher system + [135] = "%.4f", -- lamp_FireDetected + -- ARC-5 + [183] = "%.4f", -- lamp_ARC_5 + [218] = "%.4f", -- light_ARC_5_scale + -- MRP-48P + [54] = "%.4f", -- lamp_Marker + -- Light System + [226] = "%.4f", -- light_LeftUV + [215] = "%.4f", -- light_CenterUV + [227] = "%.4f", -- light_RightUV + [217] = "%.4f", -- light_Panels + [216] = "%.4f", -- light_AuxLeftPanel + -- Gun Camera + [55] = "%.4f" -- lamp_GunCamera +} +gES_GlassCockpitConfigArguments = +{ + --[[ + arguments for export in low tick interval + based on "clickabledata.lua" + ]] + + -- Cockpit mechanics + [221] = "%.4f", -- Emergency Canopy Jettison - Pull to jettison + [222] = "%.4f", -- Right Canopy Lever, OPEN/CLOSE + [224] = "%.4f", -- Aft Canopy Lever, OPEN/CLOSE + -- Control system + [114] = "%.4f", -- Elevator Trimmer Switch, PULL(CLIMB)/OFF/PUSH(DESCEND) + [142] = "%.4f", -- Aileron Trimmer Switch, LEFT/OFF/RIGHT + [207] = "%.4f", -- Wing Flaps Handle, RETRACT/NEUTRAL/20 degrees/55 degrees + [125] = "%.4f", -- Airbrake Switch, CLOSE/OPEN + [203] = "%.4f", -- Hydro Booster Lever, ON/OFF + [204] = "%.4f", -- Throttle Friction Lever + [198] = "%.4f", -- Airbrake Button, Hold to extend + -- Electric system + [84] = "%.4f", -- Ampere- & Voltmeter - Push to view Volts + [149] = "%.4f", -- Air Start Switch, ON/OFF + [81] = "%.4f", -- Pitot and Clock Heater Switch, ON/OFF + [200] = "%.4f", -- Engine Start Button - Push to start + [214] = "%.4f", -- Engine Start Button Cover + -- Circuit Breakers + [117] = "%.4f", -- Transfer Pump Switch, ON/OFF + [115] = "%.4f", -- Booster Pump Switch, ON/OFF + [120] = "%.4f", -- Ignition Switch, ON/OFF + [116] = "%.4f", -- Instruments and Lights Switch, ON/OFF + -- Right Panel + [152] = "%.4f", -- Accumulator Switch, ON/OFF + [153] = "%.4f", -- Generator Switch, ON/OFF + [151] = "%.4f", -- Nose Light Master Switch, ON/OFF + [154] = "%.4f", -- Trim Master Switch, ON/OFF + [155] = "%.4f", -- AGK-47B Artificial Horizon + DGMK-3 Switch, ON/OFF + [158] = "%.4f", -- Radio Switch, ON/OFF + [157] = "%.4f", -- Bombs Switch, ON/OFF + [156] = "%.4f", -- Emergency Drop Switch, ON/OFF + [159] = "%.4f", -- ARC Switch, ON/OFF + [160] = "%.4f", -- RV-2 Radio Altimeter Switch, ON/OFF + [161] = "%.4f", -- NR-23 Cannon Switch, ON/OFF + [162] = "%.4f", -- N-37D Cannon Switch, ON/OFF + [163] = "%.4f", -- ASP-3N Gunsight Switch, ON/OFF + [164] = "%.4f", -- S-13 Gun Camera Switch, ON/OFF + -- HydroSystem + [171] = "%.4f", -- Emergency Flaps Valve + [167] = "%.4f", -- Emergency Gears Valve + [170] = "%.4f", -- Emergency Flaps Valve Cover + [166] = "%.4f", -- Emergency Gears Valve Cover + [186] = "%.4f", -- Emergency System Filling Valve + [242] = "%.4f", -- Air Net Valve + [241] = "%.4f", -- Cockpit Filling Valve + -- Gear System + [71] = "%.4f", -- Landing Gear Handle, UP/DOWN + [72] = "%.4f", -- Gear Lamps Test Button - Push to test + [210] = "%.4f", -- Right Emergency Gear Release Handle + [209] = "%.4f", -- Left Emergency Gear Release Handle + [85] = "%.4f", -- Landing Gear Handle Lock, Lock/Unlock + -- Fuel System + [82] = "%.4f", -- Drop Tank Signal Switch, ON/OFF + [141] = "%.4f", -- Oxygen Supply Valve + [143] = "%.4f", -- Air Valve + [243] = "%.4f", -- Oxygen Emergency Valve + -- Conditioning and Heating System + [187] = "%.4f", -- Cockpit Air Valve + [86] = "%.4f", -- Ventilation Valve + -- Internal Lights System + [184] = "%.4f", -- Left UV Light Rheostat + [185] = "%.4f", -- Right UV Light Rheostat + [220] = "%.4f", -- Panels Light Rheostat + -- Nav Lights System + [111] = "%.4f", -- External Lights Switch, ON/OFF + [80] = "%.4f", -- Nose Light Switch, ON/OFF + -- Power Plant + [208] = "%.4f", -- Engine Stop, CLOSE/OPEN + [118] = "%.4f", -- Isolating Valve Switch, ON/OFF + -- Fire Extinguisher System + [136] = "%.4f", -- Engine Fire Extinguisher Button Cover + [137] = "%.4f", -- Engine Fire Extinguisher Button + [138] = "%.4f", -- Engine Fire Warning Light Test Button - Push to test + -- Signal Flares + [129] = "%.4f", -- Signal Flare Switch, ON/OFF + [130] = "%.4f", -- Signal Flare Yellow Button + [131] = "%.4f", -- Signal Flare Green Button + [132] = "%.4f", -- Signal Flare Red Button + [133] = "%.4f", -- Signal Flare White Button + ---------------------------------------------------- + -- Devices + -- AGK-47B + [12] = "%.4f", -- AGK-47B Artificial Horizon Cage - Pull to cage + [13] = "%.4f", -- AGK-47B Artificial Horizon Zero Pitch Trim Knob + --VD-15 + [30] = "%.4f", -- Barometric Pressure QFE Knob + --PRV-46 + [36] = "%.4f", -- PRV-46 Radar Altimeter Indicator Range Switch, 120m/1200m AGL + [37] = "%.4f", -- PRV-46 Radar Altimeter Indicator Power Switch, ON/OFF + --PDK-45 + [34] = "%.4f", -- Heading Knob + [61] = "%.4f", -- Fast Slave Button + -- CLOCK + [23] = "%.4f", -- AChS-1 Cockpit Chronograph Left Knob + [25] = "%.4f", -- AChS-1 Cockpit Chronograph Right Knob + -- Weapon System + [92] = "%.4f", -- N-37D Cannon Reload Button + [90] = "%.4f", -- NR-23 (Top) Cannon Reload Button + [91] = "%.4f", -- NR-23 (Bottom) Cannon Reload Button + [96] = "%.4f", -- Tactical Release Switch, ON/OFF + [97] = "%.4f", -- Emergency Release Button + [104] = "%.4f", -- Emergency Release Button Cover + --ASP-3N Gunsight + [101] = "%.4f", -- ASP-3N Gunsight Mode, GYRO/FIXED + [106] = "%.4f", -- ASP-3N Gunsight Fixed Reticle Mask Lever + [103] = "%.4f", -- ASP-3N Gunsight Fixed Reticle Mask Lever + [102] = "%.4f", -- ASP-3N Gunsight Brightness Knob + [201] = "%.4f", -- ASP-3N Gunsight Target Distance + [105] = "%.4f", -- ASP-3N Gunsight Color Filter, ON/OFF + -- ARC-5 radio compass + [180] = "%.4f", -- ARC-5 Audio Volume Control + [177] = "%.4f", -- ARC-5 Frequency Band Switch + [174] = "%.4f", -- ARC-5 Function Selector Switch, OFF/COMP/ANT./LOOP + [178] = "%.4f", -- ARC-5 LOOP L-R Switch + [175] = "%.4f", -- ARC-5 Tuning Crank + [181] = "%.4f", -- ARC-5 Scale Light Control + [173] = "%.4f", -- ARC-5 TLG-TLF Switch + [182] = "%.4f", -- ARC-5 Take Control Button + [123] = "%.4f", -- ARC-5 Near/Far NDB Switch + [146] = "%.4f", -- ARC-5 NDB 1 Switch + [147] = "%.4f", -- ARC-5 NDB 2 Switch + [148] = "%.4f", -- ARC-5 NDB 3 Switch + -- RSI-6K radio + [126] = "%.4f", -- RSI-6K Audio Volume Control + [232] = "%.4f", -- RSI-6K Wave Control + [230] = "%.4f", -- RSI-6K Antenna Control + [231] = "%.4f", -- RSI-6K Wave Lock + [233] = "%.4f", -- RSI-6K Antenna Lock + [128] = "%.4f", -- RSI-6K Receiver Tuning + [140] = "%.4f", -- RSI-6K Receive/ARC + [240] = "%.4f", -- RSI-6K Forced Mode, ON/OFF + [202] = "%.4f", -- Microphone Button +} + +----------------------------- +-- HIGH IMPORTANCE EXPORTS -- +-- done every export event -- +----------------------------- + +-- Pointed to by ProcessGlassCockpitDCSHighImportance +function ProcessGlassCockpitDCSConfigHighImportance(mainPanelDevice) + if gES_GlassCockpitType == 1 then + -- HELIOS Version 1.3 + elseif gES_GlassCockpitType == 2 then + -- HawgTouch version 1.6 + + -- ADI + -- AGK_47B_roll;AGK_47B_pitch;AGK_47B_failure_flag;AGK_47B_sideslip; + -- AGK_47B_turn;AGK_47B_horizon + SendData(2001, string.format("%.4f;%.4f;%.4f;%.4f;%.4f;%.1f", + mainPanelDevice:get_argument_value(6), + mainPanelDevice:get_argument_value(7), + mainPanelDevice:get_argument_value(11), + mainPanelDevice:get_argument_value(8), + mainPanelDevice:get_argument_value(9), + mainPanelDevice:get_argument_value(10))) + -- Altimeter + -- Altimeter_km;Altimeter_m;Altimeter_Pressure + SendData(2002, string.format("%0.4f;%0.4f;%0.4f", + mainPanelDevice:get_argument_value(28), + mainPanelDevice:get_argument_value(29), + mainPanelDevice:get_argument_value(31))) + -- Airspeed + -- IAS;TAS + SendData(2003, string.format("%0.4f;%0.4f", + mainPanelDevice:get_argument_value(4), + mainPanelDevice:get_argument_value(5))) + -- Brake + -- LeftBrakePressure;RightBrakePressure + SendData(2004, string.format("%0.4f;%0.4f", + mainPanelDevice:get_argument_value(121), + mainPanelDevice:get_argument_value(122))) + -- Cockpit + -- CockpitAltitude;PressureDifference; + SendData(2005, string.format("%0.4f;%0.4f", + mainPanelDevice:get_argument_value(39), + mainPanelDevice:get_argument_value(40))) + -- FuelFlow + -- OilTemperature;OilPressure;EngineFuelPressure; + SendData(2006, string.format("%0.4f;%0.4f;%0.4f", + mainPanelDevice:get_argument_value(45), + mainPanelDevice:get_argument_value(44), + mainPanelDevice:get_argument_value(43))) + -- Gear + -- lamp_LeftGearExt;lamp_LeftGearRet;lamp_RightGearExt;lamp_RightGearRet;lamp_NoseGearExt; + -- lamp_NoseGearRet;lamp_ExtendGears + SendData(2007, string.format("%.4f;%.4f;%.4f;%.4f;%.4f;%.4f;%.3f", + mainPanelDevice:get_argument_value(75), + mainPanelDevice:get_argument_value(74), + mainPanelDevice:get_argument_value(79), + mainPanelDevice:get_argument_value(78), + mainPanelDevice:get_argument_value(77), + mainPanelDevice:get_argument_value(76), + mainPanelDevice:get_argument_value(53))) + -- GyroCompass + -- HeadingScale;Heading + SendData(2008, string.format("%0.4f;%0.4f", + mainPanelDevice:get_argument_value(32), + mainPanelDevice:get_argument_value(33))) + -- VoltAmpMeter + -- VoltAmperMeter; lamps_lightness; + SendData(2009, string.format("%0.4f;%0.4f", + mainPanelDevice:get_argument_value(83), + mainPanelDevice:get_argument_value(244))) + -- Clock + -- CLOCK_currtime_hours;CLOCK_currtime_minutes;CLOCK_flight_time_meter_status; + -- CLOCK_flight_hours; CLOCK_flight_minutes;CLOCK_seconds_meter_time_minutes; + -- CLOCK_seconds_meter_time_seconds + SendData(2010, string.format("%.4f;%.4f;%.4f;%.4f;%.4f;%.4f;%.3f", + mainPanelDevice:get_argument_value(15), + mainPanelDevice:get_argument_value(16), + mainPanelDevice:get_argument_value(22), + mainPanelDevice:get_argument_value(18), + mainPanelDevice:get_argument_value(19), + mainPanelDevice:get_argument_value(20), + mainPanelDevice:get_argument_value(17))) + -- Compass + -- heading, pitch, bank + SendData(2011, string.format("%0.4f;%0.4f;%0.4f", + mainPanelDevice:get_argument_value(33), + mainPanelDevice:get_argument_value(7), + mainPanelDevice:get_argument_value(6))) + end +end + +function ProcessHARDWAREConfigHighImportance(mainPanelDevice) +-- SendDataHW("", mainPanelDevice:get_argument_value()) -- + -- Lamps + -- electric system + SendDataHW("57", mainPanelDevice:get_argument_value(57)) -- lamp_GeneratorOff + SendDataHW("58", mainPanelDevice:get_argument_value(58)) -- lamp_Ignition + -- power plant + SendDataHW("119", mainPanelDevice:get_argument_value(119)) -- lamp_IsolatingValve + -- gear system + SendDataHW("75", mainPanelDevice:get_argument_value(75)) -- lamp_LeftGearExt + SendDataHW("74", mainPanelDevice:get_argument_value(74)) -- lamp_LeftGearRet + SendDataHW("79", mainPanelDevice:get_argument_value(79)) -- lamp_RightGearExt + SendDataHW("78", mainPanelDevice:get_argument_value(78)) -- lamp_RightGearRet + SendDataHW("77", mainPanelDevice:get_argument_value(77)) -- lamp_NoseGearExt + SendDataHW("76", mainPanelDevice:get_argument_value(76)) -- lamp_NoseGearRet + SendDataHW("53", mainPanelDevice:get_argument_value(53)) -- lamp_ExtendGears + -- fuel system + SendDataHW("56", mainPanelDevice:get_argument_value(56)) -- lamp_Remain300 + SendDataHW("50", mainPanelDevice:get_argument_value(50)) -- lamp_AftEmpty + SendDataHW("52", mainPanelDevice:get_argument_value(52)) -- lamp_DropTanks + SendDataHW("51", mainPanelDevice:get_argument_value(51)) -- lamp_BoostPressure + -- control system + SendDataHW("113", mainPanelDevice:get_argument_value(113)) -- lamp_TrimmerNeutral + SendDataHW("59", mainPanelDevice:get_argument_value(59)) -- lamp_FlapsExt + SendDataHW("124", mainPanelDevice:get_argument_value(124)) -- lamp_AirBrakeExt + -- fire extinguisher system + SendDataHW("135", mainPanelDevice:get_argument_value(135)) -- lamp_FireDetected + -- ARC-5 + SendDataHW("183", mainPanelDevice:get_argument_value(183)) -- lamp_ARC_5 + SendDataHW("218", mainPanelDevice:get_argument_value(218)) -- light_ARC_5_scale + -- MRP-48P + SendDataHW("54", mainPanelDevice:get_argument_value(54)) -- lamp_Marker + -- Light System + SendDataHW("226", mainPanelDevice:get_argument_value(226)) -- light_LeftUV + SendDataHW("215", mainPanelDevice:get_argument_value(215)) -- light_CenterUV + SendDataHW("227", mainPanelDevice:get_argument_value(227)) -- light_RightUV + SendDataHW("217", mainPanelDevice:get_argument_value(217)) -- light_Panels + SendDataHW("216", mainPanelDevice:get_argument_value(216)) -- light_AuxLeftPanel + -- Gun Camera + SendDataHW("55", mainPanelDevice:get_argument_value(55)) -- lamp_GunCamera +end + +----------------------------------------------------- +-- LOW IMPORTANCE EXPORTS -- +-- done every gExportLowTickInterval export events -- +----------------------------------------------------- + +-- Pointed to by ProcessGlassCockpitDCSConfigLowImportance +function ProcessGlassCockpitDCSConfigLowImportance(mainPanelDevice) + if gES_GlassCockpitType == 1 then + -- HELIOS Version 1.3 + elseif gES_GlassCockpitType == 2 then + -- HawgTouch version 1.6 + end +end + +function ProcessHARDWAREConfigLowImportance(mainPanelDevice) + --[[ + every frame export to hardware + Example from A-10C + Get Radio Frequencies + get data from device + local UHF_RADIO = GetDevice(54) + SendDataHW("ExportID", "Format") + SendDataHW("ExportID", "Format", HardwareConfigID) + SendDataHW("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000)) + SendDataHW("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000), 2) -- export to Hardware '2' Config + ]] + + --===================================================================================== + --[[ + WriteToLog('list_cockpit_params(): '..dump(list_cockpit_params())) + WriteToLog('CMSP: '..dump(list_indication(7))) + + local ltmp1 = 0 + for ltmp2 = 0, 13, 1 do + ltmp1 = list_indication(ltmp2) + WriteToLog(ltmp2..': '..dump(ltmp1)) + --WriteToLog(ltmp2..' (metatable): '..dump(getmetatable(ltmp1))) + end + ]] +--[[ + local ltmp1 = 0 + for ltmp2 = 1, 73, 1 do + ltmp1 = GetDevice(ltmp2) + WriteToLog(ltmp2..': '..dump(ltmp1)) + WriteToLog(ltmp2..' (metatable): '..dump(getmetatable(ltmp1))) + end +]] +end + +----------------------------- +-- Custom functions -- +----------------------------- + +function genericRadio(key, value, hardware) +end diff --git a/ExportsModules/MiG-21Bis.lua b/ExportsModules/MiG-21Bis.lua new file mode 100644 index 0000000..505848f --- /dev/null +++ b/ExportsModules/MiG-21Bis.lua @@ -0,0 +1,831 @@ +-- MiG-21Bis Export +-- Version 0.9.9 BETA + +gES_FoundDCSModule = true + +gES_GlassCockpitConfigEveryFrameArguments = +{ + --[[ + every frames arguments + based of "mainpanel_init.lua" + Example (http://www.lua.org/manual/5.1/manual.html#pdf-string.format) + [DeviceID] = "Format" + [4] = "%.4f", <- floating-point number with 4 digits after point + [19] = "%0.1f", <- floating-point number with 1 digit after point + [129] = "%1d", <- decimal number + ]] + [239] = "%.1f", -- CANOPY_anti_ice +--ALCOHOL, COMPRESSED_AIR other similar stuff == == == == == == == == == == == == == == == == == == == == == == = + [411] = "%.1f", -- ALCOHOL + [413] = "%.1f", -- COMPRESSED_AIR_main + [414] = "%.1f", -- COMPRESSED_AIR_aux +-- OXYGENE SYSTEM (pilot only, engine O2 separated) == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == + [59] = "%.1f", -- OXYGENE_instrument_IK52 + [60] = "%.1f", -- OXYGENE_instrument_IK52_blinking_lungs + [58] = "%.1f", -- OXYGENE_instrument_M2000 +--GEAR LIGHTS == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == + [9] = "%.1f", -- GEAR_NOSE_UP_LIGHT + [12] = "%.1f", -- GEAR_NOSE_DOWN_LIGHT + [10] = "%.1f", -- GEAR_LEFT_UP_LIGHT + [13] = "%.1f", -- GEAR_LEFT_DOWN_LIGHT + [11] = "%.1f", -- GEAR_RIGHT_UP_LIGHT + [14] = "%.1f", -- GEAR_RIGHT_DOWN_LIGHT +-- AIRBRAKES == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == + [316] = "%.1f", -- AIRBRAKES_button + [7] = "%.1f", -- AIRBRAKES_3D +-- INSTRUMENTS == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == + [100] = "%.4f", -- IAS_indicator + [101] = "%.4f", -- TAS_indicator + [102] = "%.4f", -- M_indicator +-- Baro altimeter subgroup -------------------------------------------------------------------------------------------------------------------------- + [104] = "%.4f", -- H_indicator_needle_m + [112] = "%.4f", -- H_indicator_needle_km +--/N/ KSI subgroup (NPP) -------------------------------------------------------------------------------------------------------------------------- + [178] = "%.1f", -- KSI_switch + [258] = "%.1f", -- KSI_adjust_button + [111] = "%.1f", -- KSI_course_indicator + [68] = "%.1f", -- KSI_course_set_needle +-- RSBN subgroup ------------------------------------------------------------------------------------------------------------------------------------------------ + [176] = "%.1f", -- RSBN_switch + [548] = "%.1f", -- RSBN_azimut_korekcija_LIGHT + [549] = "%.1f", -- RSBN_dalnost_korekcija_LIGHT + [417] = "%.1f", -- RSBN_distance_meter + [355] = "%.1f", -- RSBN_distance_meter_Hundreds + [356] = "%.1f", -- RSBN_distance_meter_Tens + [357] = "%.1f", -- RSBN_distance_meter_Singles + [587] = "%.1f", -- RSBN_NPP_kurs_blinker + [588] = "%.1f", -- RSBN_NPP_glisada_blinker + [590] = "%.4f", -- RSBN_NPP_kurs_needle + [589] = "%.4f", -- RSBN_NPP_glisada_needle + [567] = "%.1f", -- RSBN_KPP_kren_blinker + [568] = "%.1f", -- RSBN_KPP_tangaz_blinker + [565] = "%.4f", -- RSBN_KPP_kurs_director + [566] = "%.4f", -- RSBN_KPP_glisada_director +--/N/ ARK subgroup --------------------------------------------------------------------------------------------------------------------------------- + [174] = "%.1f", -- ARK_switch + [254] = "%.1f", -- ARK_dal_bliz_selector + [36] = "%.4f", -- ARK_RSBN_needle +-- Radio-altimeter subgroup ------------------------------------------------------------------------------------------------------------------------------------------------------ + [175] = "%.1f", -- RADIO_ALTIMETER_MARKER_switch + [103] = "%.4f", -- RADIO_ALTIMETER_indicator + [500] = "%.1f", -- LOW_ALT_LIGHT +-- UUA and SUA subgroup ----------------------------------------------------------------------------------------------------------------------------------------------------------- + [105] = "%.4f", -- UUA_indicator + [537] = "%.1f", -- AOA_WARNING_LIGHT +-- DA-200 subgroup --------------------------------------------------------------------------------------------------------------------------------------------------------- + [107] = "%.6f", -- DA200_TurnNeedle + [106] = "%.4f", -- DA200_VerticalVelocity + [31] = "%.1f", -- DA200_Slipball + [177] = "%.1f", -- KPP_switch + [259] = "%.1f", -- KPP_ARRETIR + [535] = "%.1f", -- KPP_ARRETIR_light + [108] = "%.4f", -- KPP_Bank + [109] = "%.4f", -- KPP_Pitch +-- ACCELEROMETER == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == + [110] = "%.4f", -- ACCELEROMETER + [228] = "%.4f", -- RESET_G_needle + [113] = "%.4f", -- MAX_G_needle + [114] = "%.4f", -- MIN_G_needle +--TRIMMER == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == = + [172] = "%.1f", -- TRIMMER_switch + [519] = "%.1f", -- TRIMMER_light +--PITOT TUBES == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == + [229] = "%.1f", -- PITOT_TUBES_SELECTOR + [279] = "%.1f", -- PITOT_TUBES_HEATING_main + [280] = "%.1f", -- PITOT_TUBES_HEATING_aux + [406] = "%.1f", -- PITOT_TUBES_STATUS +-- FREEZING EFFECTS == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == = + [410] = "%.1f", -- FREEZING_level_absolute + [543] = "%.1f", -- FREEZING_EFFECTS_canopy +--/N/ DC bus == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == + [124] = "%.4f", -- DC_BUS_V_needle + [165] = "%.1f", -- DC_BUS_battery + [155] = "%.1f", -- DC_BUS_battery_heat + [510] = "%.1f", -- DC_GENERATOR_LIGHT + [16666] = "%.1f", -- DC_GENERATOR + [563] = "%.1f", -- DC_BUS + [55] = "%.1f", -- DC_BUS_ISA_K +--/N/ AC bus == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == + [564] = "%.1f", -- AC_BUS + [15366] = "%.1f", -- AC_BUS_PO7501 + [15466] = "%.1f", -- AC_BUS_PO7502 + [16466] = "%.1f", -- AC_BUS_Emerg_Inverter + [16966] = "%.1f", -- AC_GENERATOR + [511] = "%.1f", -- AC_GENERATOR_LIGHT +--/N/ FUEL PUMPS & FUEL SYSTEM == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == = + [159] = "%.1f", -- FUEL_PUMP_3 + [160] = "%.1f", -- FUEL_PUMP_1 + [161] = "%.1f", -- FUEL_PUMP_RASHOD + [402] = "%.4f", -- FUEL_PRESSURE { 0, 45 } ???? + [52] = "%.1f", -- FUEL_METER +--FUEL LIGHTS (in connection with previous) == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == = + [501] = "%.1f", -- FUEL_LIGHT_FUELPODC + [502] = "%.1f", -- FUEL_LIGHT_1GR + [503] = "%.1f", -- FUEL_LIGHT_450 + [504] = "%.1f", -- FUEL_LIGHT_3GR + [505] = "%.1f", -- FUEL_LIGHT_FUELPODW + [506] = "%.1f", -- FUEL_LIGHT_RASHOD +--ENGINE START DEVICE == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == = + [403] = "%.1f", -- ENGINE_START_DEVICE_STATUS { -1, 0, 1, 2 } + [509] = "%.1f", -- START_DEVICE_ZAZIG_LIGHT + [415] = "%.1f", -- ENGINE_OXYGENE_STATUS + [61] = "%.4f", -- ENGINE_OXYGENE_manometer +-- ENGINE and THROTTLE == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == + [624] = "%.1f", -- SPS_state + [625] = "%.4f", -- KONUS_efficiency + [626] = "%.4f", -- SOPLO_efficiency + [50] = "%.4f", -- ENGINE_RPM + [670] = "%.4f", -- ENGINE_RPM2 + [51] = "%.4f", -- ENGINE_TEMP + [404] = "%.4f", -- ENGINE_STRESS + [507] = "%.1f", -- FORSAZ_1_LIGHT + [508] = "%.1f", -- FORSAZ_2_LIGHT + [512] = "%.1f", -- NOZZLE_LIGHT + [517] = "%.1f", -- KONUS_LIGHT + [513] = "%.1f", -- OIL_LIGHT + [627] = "%.4f", -- OIL_PRESSURE + [534] = "%.1f", -- FIRE_LIGHT + [405] = "%.1f", -- ENGINE_SURGE_DOORS_POZITION { -1, 0, 1 } +-- GIDRO == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == + [418] = "%.4f", -- PRIMARY_GIDRO_Pressure + [419] = "%.4f", -- SECONDARY_GIDRO_Pressure + [126] = "%.4f", -- PRIMARY_GIDRO_Pressure_needle + [125] = "%.4f", -- SECONDARY_GIDRO_Pressure_needle + [171] = "%.1f", -- GIDRO_NR27_switch + [319] = "%.1f", -- GIDRO_ailerones_busters_switch + [515] = "%.1f", -- HYDRAULIC_LIGHT + [514] = "%.1f", -- BUSTER_LIGHT +--HELMET == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == = + [306] = "%.1f", -- HELMET_heat_man_auto_switch + [310] = "%.1f", -- HELMET_quick_heat_button + [595] = "%.1f", -- HELMET_visor_switch +--AIR CONDITIONING == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == = + [412] = "%.4f", -- AIR_CONDITION_cockpit_temperature +-- WARNING LIGHTS == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == + [541] = "%.1f", -- CANOPY_WARNING_LIGHT + [542] = "%.1f", -- SORC_LIGHT + [407] = "%.1f", -- WARNING_LIGHTS_CHECK_STATE + [516] = "%.1f", -- MARKER_LIGHT + [518] = "%.1f", -- STABILISATOR_LIGHT + [520] = "%.1f", -- CHECK_GEAR_LIGHT + [521] = "%.1f", -- FLAPS_LIGHT + [522] = "%.1f", -- AIRBRAKE_LIGHT + [523] = "%.1f", -- CENTRAL_PYLON_LIGHT + [524] = "%.1f", -- RATO_L_LIGHT + [525] = "%.1f", -- RATO_R_LIGHT + [526] = "%.1f", -- PYLON_1_ON_LIGHT + [527] = "%.1f", -- PYLON_2_ON_LIGHT + [528] = "%.1f", -- PYLON_3_ON_LIGHT + [529] = "%.1f", -- PYLON_4_ON_LIGHT + [530] = "%.1f", -- PYLON_1_OFF_LIGHT + [531] = "%.1f", -- PYLON_2_OFF_LIGHT + [532] = "%.1f", -- PYLON_3_OFF_LIGHT + [533] = "%.1f", -- PYLON_4_OFF_LIGHT +-- GIRO DEVICES == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == + [536] = "%.1f", -- GIRO_ARRETIR + [408] = "%.1f", -- GIRO_AGD_KSI_SAU_RLS_STATE + [409] = "%.1f", -- GIRO_DA200_KSI_SAU_RLS_STATE + [162] = "%.1f", -- GIRO_AGD_KSI_SAU_RLS_switch + [163] = "%.1f", -- GIRO_DA200_KSI_SAU_RLS_switch +-- ASP == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == = + [539] = "%.1f", -- ASP_TGT_ACQUIRED_LIGHT + [538] = "%.1f", -- ASP_LAUNCH + [540] = "%.1f", -- ASP_DISENGAGE + [67] = "%.1f", -- GUN_camera_3D + [551] = "%.1f", -- ASP_DISTANCE + [552] = "%.4f", -- ASP_DISTANCE_MISSILE + [553] = "%.1f", -- RADAR_ERROR + [554] = "%.1f", -- RADAR_LOW_ALT + [555] = "%.1f", -- RADAR_FIX_BEAM + [556] = "%.1f", -- ASP_SCALE_BASE + [557] = "%.1f", -- ASP_SCALE_ANGLE + [558] = "%.1f", -- RADAR_LAUNCH + [559] = "%.1f", -- RADAR_MISSILE_HEAD_RDY + [560] = "%.1f", -- RADAR_JAMMED + [561] = "%.1f", -- RADAR_BROKEN + [562] = "%.1f", -- RADAR_DISENGAGE + [571] = "%.1f", -- RADAR_19A_1 + [572] = "%.1f", -- RADAR_19A_2 + [573] = "%.1f", -- RADAR_19A_3 + [574] = "%.1f", -- RADAR_19A_4 + [575] = "%.1f", -- RADAR_19A_5 + [576] = "%.1f", -- RADAR_19A_6 + [577] = "%.1f", -- RADAR_19A_7 + [578] = "%.1f", -- RADAR_19A_8 + [579] = "%.1f", -- SEAT_HEIGHT + [580] = "%.1f", -- IAB_BOX + [581] = "%.1f", -- IAB_LIGHT_1 + [582] = "%.1f", -- IAB_LIGHT_2 + [583] = "%.1f", -- IAB_LIGHT_3 + [584] = "%.1f", -- MISSILE_55_1 + [585] = "%.1f", -- MISSILE_55_2 + [586] = "%.1f", -- MISSILE_62 + [63] = "%.1f", -- TACTICAL_DROP_ARMED + [591] = "%.1f", -- SPS_BOX + [592] = "%.1f", -- SPS_HIGH + [593] = "%.1f", -- SPS_ILLUMINATION + [594] = "%.1f", -- SPS_LAUNCH + [598] = "%.1f", -- GUV_BOX + [701] = "%.1f", -- GUV_LAUNCH +-- SARPP == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == = + [193] = "%.1f", -- SARPP_switch +-- SAU == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == + [546] = "%.1f", -- SAU_stabilization_LIGHT + [547] = "%.1f", -- SAU_privedenie_LIGHT + [544] = "%.1f", -- SAU_landing_COMMAND_LIGHT + [545] = "%.1f", -- SAU_landing_AUTO_LIGHT +-- ARU == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == = + [64] = "%.1f", -- ARU_3G_instrument +-- KONUS == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == = + [66] = "%.1f", -- KONUS_UPES_3_instrument +-- DRAG CHUTE == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == + [550] = "%.1f", -- GUN_GOTOVN_LIGHT +-- SPO == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == = + [601] = "%.1f", -- SPO_L_F + [602] = "%.1f", -- SPO_R_F + [603] = "%.1f", -- SPO_R_B + [604] = "%.1f", -- SPO_L_B + [605] = "%.1f", -- SPO_MUTED +-- SOD == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == + [606] = "%.1f", -- SOD_ANSWER + [607] = "%.1f", -- SRZO_ON + [608] = "%.1f", -- SRZO_CODE + [609] = "%.1f", -- SRZO_CIPH + [611] = "%.1f", -- SRZO_ERROR + [613] = "%.1f", -- ASP_BACKLIGHT_ON + [614] = "%.1f", -- ASP_BACKLIGHT_INTENSITY + [618] = "%.1f", -- NEEDLES_PHOSPHOR_LIGHT + [152] = "%.1f", -- RED_PANELLIGHT + [619] = "%.1f", -- RED_FLOODLIGHT + [620] = "%.1f", -- WHITE_PANELLIGHT + [621] = "%.1f", -- RED_INSTRUMENT + [622] = "%.1f", -- ASP_GLASS_LIGHT_INTENSITY + [652] = "%.4f", -- H_indicator_needle_max + [655] = "%.4f", -- COCKPIT_PRESSURE_ALTIMETER + [656] = "%.4f", -- COCKPIT_PRESSURE +} +gES_GlassCockpitConfigArguments = +{ + --[[ + arguments for export in low tick interval + based on "clickabledata.lua" + ]] + -- cockpit mechanics + --[718] = "%.1f", -- Canopy Switch, OPEN/OFF/CLOSE {-1.0, 1.0} + --[818] = "%.1f", -- Emergency Jettison Handle, IN/OUT {0.0, 1.0} + +-- DC & AC buses & giro devices + [165] = "%.1f", -- Battery On/Off + [155] = "%.1f", -- Battery Heat On/Off + [166] = "%.1f", -- DC Generator On/Off + [169] = "%.1f", -- AC Generator On/Off + [153] = "%.1f", -- PO-750 Inverter #1 On/Off + [154] = "%.1f", -- PO-750 Inverter #2 On/Off + [164] = "%.1f", -- Emergency Inverter +-- GIRO + [162] = "%.1f", -- Giro, NPP, SAU, RLS Signal, KPP Power On/Off + [163] = "%.1f", -- DA-200 Signal, Giro, NPP, RLS, SAU Power On/Off +-- FUEL_PUMPS & FUEL_SYSTEM (merged) + [159] = "%.1f", -- Fuel Tanks 3rd Group, Fuel Pump + [160] = "%.1f", -- Fuel Tanks 1st Group, Fuel Pump + [161] = "%.1f", -- Drain Fuel Tank, Fuel Pump + [274] = "%.1f", -- Fuel Quantity Set +-- ENGINE START DEVICE + [302] = "%.1f", -- APU On/Off + [288] = "%.1f", -- Engine Cold / Normal Start + [289] = "%.1f", -- Start Engine + [301] = "%.1f", -- Engine Emergency Air Start + [616] = "%.1f", -- Engine Stop/Lock +-- ACCELEROMETER + [228] = "%.1f", -- Accelerometer Reset +-- PITOT TUBES and related things that use dc bus for heating + [229] = "%.1f", -- Pitot tube Selector Main/Emergency + [279] = "%.1f", -- Pitot tube/Periscope/Clock Heat + [280] = "%.1f", -- Secondary Pitot Tube Heat +-- DA-200 + [261] = "%.1f", -- Variometer Set +-- ENGINE + [308] = "%.1f", -- Anti surge doors - Auto/Manual + [300] = "%.1f", -- Afterburner/Maximum Off/On + [320] = "%.1f", -- Emergency Afterburner Off/On +-- FIRE EXTINGUISHER + [303] = "%.1f", -- Fire Extinguisher Off/On + [324] = "%.1f", -- Fire Extinguisher Cover + [325] = "%.1f", -- Fire Extinguisher +-- LIGHTS + [612] = "%.1f", -- Cockpit Texts Back-light default_axis + [156] = "%.1f", -- Instruments Back-light default_axis + [157] = "%.1f", -- Main Red Lights default_axis + [222] = "%.1f", -- Main White Lights default_axis + [194] = "%.1f", -- Navigation Lights Off/Min/Med/Max + [323] = "%.1f", -- Landing Lights Off/Taxi/Land +-- LIGHTS WARNING + [195] = "%.1f", -- CheckWarningLights11 + [196] = "%.1f", -- CheckWarningLights21 + [273] = "%.1f", -- CheckWarningLights31 + [282] = "%.1f", -- CheckWarningLights41 + [283] = "%.1f", -- CheckWarningLights51 + [322] = "%.1f", -- CheckWarningLights61 + [657] = "%.1f", -- SORC +-- Radio + [173] = "%.1f", -- Radio System On/Off + [208] = "%.1f", -- Radio / Compass + [209] = "%.1f", -- Squelch On/Off + [210] = "%.1f", -- Radio Volume + [211] = "%.1f", -- Radio Channel + [315] = "%.1f", -- Radio PTT +-- ARK + [174] = "%.1f", -- ARK On/Off + [198] = "%.1f", -- ARK Sound + [212] = "%.1f", -- ARK Change + [189] = "%.1f", -- ARK Zone + [197] = "%.1f", -- ARK Mode - Antenna / Compass + [254] = "%.1f", -- Marker Far/Near +-- RSBN + [176] = "%.1f", -- RSBN On/Off + [240] = "%.1f", -- RSBN Mode Land/Navigation/Descend + [340] = "%.1f", -- RSBN / ARK + [294] = "%.1f", -- RSBN Identify + [347] = "%.1f", -- RSBN self-test +--RSBN Panel + [345] = "%.1f", -- RSBN Sound + [351] = "%.1f", -- RSBN Navigation + [352] = "%.1f", -- PRMG Landing + [366] = "%.1f", -- RSBN Reset + [367] = "%.1f", -- RSBN Bearing + [368] = "%.1f", -- RSBN Distance +-- SAU + [179] = "%.1f", -- SAU On/Off + [180] = "%.1f", -- SAU Pitch On/Off + [343] = "%.1f", -- SAU - Stabilize + [376] = "%.1f", -- SAU cancel current mode + [377] = "%.1f", -- SAU - Recovery + [344] = "%.1f", -- SAU Preset - Limit Altitude + [341] = "%.1f", -- SAU - Landing - Command + [342] = "%.1f", -- SAU - Landing - Auto + [348] = "%.1f", -- SAU Reset/Off +-- SPO + [202] = "%.1f", -- SPO-10 RWR On/Off + [226] = "%.1f", -- SPO-10 Test + [227] = "%.1f", -- SPO-10 Night / Day + [225] = "%.1f", -- SPO-10 Volume +-- SRZO IFF + [188] = "%.1f", -- SRZO IFF Coder/Decoder On/Off + [192] = "%.1f", -- SRZO Codes + [346] = "%.1f", -- IFF System 'Type 81' On/Off + [190] = "%.1f", -- Emergency Transmitter Cover + [191] = "%.1f", -- Emergency Transmitter On/Off + [427] = "%.1f", -- SRZO Self Destruct Cover + [428] = "%.1f", -- SRZO Self Destruct +-- SOD + [200] = "%.1f", -- SOD IFF On/Off + [199] = "%.1f", -- SOD Identify + [201] = "%.1f", -- SOD Wave Selector 3/1/2 + [204] = "%.1f", -- SOD Modes +-- RADAR + [205] = "%.1f", -- Radar Off/Prep/On + [206] = "%.1f", -- Low Altitude Off/Comp/On + [207] = "%.1f", -- Locked Beam On/Off + [266] = "%.1f", -- Radar Screen Magnetic Reset + [330] = "%.1f", -- Radar Interferes - Continues + [331] = "%.1f", -- Radar Interferes - Temporary + [332] = "%.1f", -- Radar Interferes - Passive + [333] = "%.1f", -- Radar Interferes - Weather + [334] = "%.1f", -- Radar Interferes - IFF + [335] = "%.1f", -- Radar Interferes - Low Speed + [336] = "%.1f", -- Radar Interferes - Self-test + [337] = "%.1f", -- Radar Interferes - Reset + [378] = "%.1f", -- Lock Target + [623] = "%.1f", -- Radar Polar Filter +-- SPRD + [167] = "%.1f", -- SPRD (RATO) System On/Off + [168] = "%.1f", -- SPRD (RATO) Drop System On/Off + [252] = "%.1f", -- SPRD (RATO) Start Cover + [253] = "%.1f", -- SPRD (RATO) Start + [317] = "%.1f", -- SPRD (RATO)t Drop Cover + [318] = "%.1f", -- SPRD (RATO) Drop +-- CONTROL SYSTEM ------------- subsystems -------------------------------------------- +-- SPS + [293] = "%.1f", -- SPS System Off/On +-- ARU + [295] = "%.1f", -- ARU System - Manual/Auto + [296] = "%.1f", -- ARU System - Low Speed/Neutral/High Speed +-- Airbrake + [316] = "%.1f", -- Airbrake - Out/In +-- Gear brakes + [299] = "%.1f", -- ABS Off/On + [238] = "%.1f", -- Nosegear Brake Off/On + [237] = "%.1f", -- Emergency Brake +-- Gears + [326] = "%.1f", -- Gear Handle Fixator + [327] = "%.1f", -- Gear Up/Neutral/Down + [223] = "%.1f", -- Main Gears Emergency Release Handle + [281] = "%.1f", -- Nose Gear Emergency Release Handle +-- Flaps + [311] = "%.1f", -- Flaps Neutral + [312] = "%.1f", -- Flaps Take-Off + [313] = "%.1f", -- Flaps Landing + [314] = "%.1f", -- Flaps Reset buttons +-- Drag chute + [298] = "%.1f", -- Release Drag Chute + [304] = "%.1f", -- Drop Drag Chute Cover + [305] = "%.1f", -- Drop Drag Chute +--TRIMMER + [172] = "%.1f", -- Trimmer On/Off + [379] = "%.1f", -- Trimmer Pitch Up/Down +-- KONUS + [170] = "%.1f", -- Nosecone On/Off + [309] = "%.1f", -- Nosecone Control - Manual/Auto + [236] = "%.1f", -- Nosecone manual position controller +-- SOPLO + [291] = "%.1f", -- Engine Nozzle 2 Position Emergency Control +--MAIN_HYDRO and BUSTER_HYDRO == == == == == == == == == == == == == == == == == == == TEMPORARY MERGED == == == == == == == == == == == == == == == == == == == == == == + [171] = "%.1f", -- Emergency Hydraulic Pump On/Off + [319] = "%.1f", -- Aileron Booster - Off/On +--KPP + [177] = "%.1f", -- KPP Main/Emergency + [259] = "%.1f", -- KPP Cage + [260] = "%.1f", -- KPP Set +--IAS / TAS / KSI (NPP) + [178] = "%.1f", -- NPP On/Off + [258] = "%.1f", -- NPP Adjust + [263] = "%.1f", -- NPP Course set +-- ALTIMETER and radioALTIMETER + [175] = "%.1f", -- Radio Altimeter/Marker On/Off + [284] = "%.1f", -- Dangerous Altitude Warning Set + [262] = "%.1f", -- Altimeter pressure knob +-- OXYGENE_SYSTEM + [285] = "%.1f", -- Helmet Air Condition Off/On + [286] = "%.1f", -- Emergency Oxygen Off/On + [287] = "%.1f", -- Mixture/Oxygen +-- CANOPY + [328] = "%.1f", -- Hermetize Canopy + [329] = "%.1f", -- Secure Canopy + [375] = "%.1f", -- Canopy Open + [385] = "%.1f", -- Canopy Close + [239] = "%.1f", -- Canopy Anti Ice + [224] = "%.1f", -- Canopy Emergency Release Handle + [649] = "%.1f", -- Canopy Ventilation System +-- ASP Gunsight + [186] = "%.1f", -- ASP Optical sight On/Off + [241] = "%.1f", -- ASP Main Mode - Manual/Auto + [242] = "%.1f", -- ASP Mode - Bombardment/Shooting + [243] = "%.1f", -- ASP Mode - Missiles-Rockets/Gun + [244] = "%.1f", -- ASP Mode - Giro/Missile + [249] = "%.1f", -- Pipper On/Off + [250] = "%.1f", -- Fix net On/Off + [245] = "%.1f", -- Target Size + [246] = "%.1f", -- Intercept Angle + [247] = "%.1f", -- Scale Backlights control + [248] = "%.1f", -- Pipper light control + [251] = "%.1f", -- Fix Net light control + [384] = "%.1f", -- TDC Range / Pipper Span control +-- WEAPON_CONTROL + [181] = "%.1f", -- Missiles - Rockets Heat On/Off + [182] = "%.1f", -- Missiles - Rockets Launch On/Off + [183] = "%.1f", -- Pylon 1-2 Power On/Off + [184] = "%.1f", -- Pylon 3-4 Power On/Off + [185] = "%.1f", -- GS-23 Gun On/Off + [187] = "%.1f", -- Guncam On/Off + [277] = "%.1f", -- Tactical Drop Cover + [278] = "%.1f", -- Tactical Drop + [275] = "%.1f", -- Emergency Missile/Rocket Launcher Cover + [276] = "%.1f", -- Emergency Missile/Rocket Launcher + [256] = "%.1f", -- Drop Wing Fuel Tanks Cover + [257] = "%.1f", -- Drop Wing Fuel Tanks + [386] = "%.1f", -- Drop Center Fuel Tank + [269] = "%.1f", -- Drop Payload - Outer Pylons Cover + [270] = "%.1f", -- Drop Payload - Outer Pylons + [271] = "%.1f", -- Drop Payload - Inner Pylons Cover + [272] = "%.1f", -- Drop Payload - Inner Pylons + [230] = "%.1f", -- Weapon Mode - Air/Ground + [231] = "%.1f", -- Weapon Mode - IR Missile/Neutral/SAR Missile + [232] = "%.1f", -- Activate Gun Loading Pyro - 1 + [233] = "%.1f", -- Activate Gun Loading Pyro - 2 + [234] = "%.1f", -- Activate Gun Loading Pyro - 3 + [235] = "%.1f", -- Weapon Selector + [297] = "%.1f", -- Missile Seeker Sound + [381] = "%.1f", -- Fire Gun + [382] = "%.1f", -- Release Weapon + [383] = "%.1f", -- Release Weapon Cover +-- HELMET_VISOR + [306] = "%.1f", -- Helmet Heat - Manual/Auto + [310] = "%.1f", -- Helmet Quick Heat + [369] = "%.1f", -- Helmet visor - off/on +-- AIR CONDITIONING + [292] = "%.1f", -- Cockpit Air Condition Off/Cold/Auto/Warm +-- SARPP + [193] = "%.1f", -- SARPP-12 Flight Data Recorder On/Off +-- Flight Control + +-- Dummy buttons/switches + [632] = "%.1f", -- Radar emission - Cover + [633] = "%.1f", -- Radar emission - Combat/Training + [634] = "%.1f", -- G-Suit Max/Min valve + [635] = "%.1f", -- Electric Bus Nr.1 - Cover + [636] = "%.1f", -- Electric Bus Nr.1 + [637] = "%.1f", -- Electric Bus Nr.2 + [638] = "%.1f", -- 1.7 Mach Test Button - Cover + [639] = "%.1f", -- 1.7 Mach Test Button + [640] = "%.1f", -- BU-45 Buster System Separation + [642] = "%.1f", -- SOD Control PBU-1 + [641] = "%.1f", -- SOD Control PBU-2 + [643] = "%.1f", -- Eject + [644] = "%.1f", -- Ejection Seat Emergency Oxygen + [645] = "%.1f", -- UK-2M Mic Amplifier M/L + [646] = "%.1f", -- UK-2M Mic Amplifier GS/KM + [647] = "%.1f", -- Suit Ventilation + [648] = "%.1f", -- Harness Separation + [650] = "%.1f", -- Harness Loose/Tight + [651] = "%.1f", -- Throttle Fixation +-- IAB PBK-3 + [387] = "%.1f", -- Emergency Jettison + [388] = "%.1f", -- Emergency Jettison Armed / Not Armed + [389] = "%.1f", -- Tactical Jettison + [390] = "%.1f", -- Special AB / Missile-Rocket-Bombs-Cannon + [391] = "%.1f", -- Brake Chute + [392] = "%.1f", -- Detonation Air / Ground +-- SPS 141-100 + [393] = "%.1f", -- "On / Off" + [394] = "%.1f", -- Transmit / Receive + [395] = "%.1f", -- Program I / II + [396] = "%.1f", -- Continuous / Impuls + [397] = "%.1f", -- Test + [398] = "%.1f", -- Dispenser Auto / Manual + [399] = "%.1f", -- Off / Parallel / Full + [400] = "%.1f", -- Manual Activation button - Cover + [401] = "%.1f", -- Manual Activation button +-- GUV Control Box -/N/ GUV is useless, it's mostly anti-infantry weapon + [420] = "%.1f", -- On / Off + [421] = "%.1f", -- MAIN GUN / UPK Guns + [422] = "%.1f", -- LOAD 1 + [425] = "%.1f", -- LOAD 2 + [424] = "%.1f", -- LOAD 3 +} + +----------------------------- +-- HIGH IMPORTANCE EXPORTS -- +-- done every export event -- +----------------------------- + +function ProcessGlassCockpitDCSConfigHighImportance(mainPanelDevice) + if gES_GlassCockpitType == 1 then + -- HELIOS Version 1.3 + elseif gES_GlassCockpitType == 2 then + -- HawgTouch version 1.6 + --[[ + every frame export + Example from A-10C + Landing Gear + mainPanelDevice, basis panel + SendDataHW("2004", mainPanelDevice:get_argument_value(659)) -- GEAR_N_SAFE + SendDataHW("2005", mainPanelDevice:get_argument_value(660)) -- GEAR_L_SAFE + SendDataHW("2006", mainPanelDevice:get_argument_value(661)) -- GEAR_R_SAFE + ]] + + + -- Distance + -- distance_meter_Hundreds;distance_meter_Tens;distance_meter_Singles + -- 355; 356; 357; + SendData(2000, string.format("%0.4f;%0.4f;%0.4f", + mainPanelDevice:get_argument_value(355), + mainPanelDevice:get_argument_value(356), + mainPanelDevice:get_argument_value(357))) + -- HSI + -- heading; requiredHeading; bearingNeedle; warningFlagG; warningFlagK; glide; side; + -- 111; 68; 590; 588; 587; glide; side; + SendData(2001, string.format("%0.4f;%0.4f;%0.4f;%0.1f;%0.1f", + mainPanelDevice:get_argument_value(111), + mainPanelDevice:get_argument_value(68), + mainPanelDevice:get_argument_value(590), + mainPanelDevice:get_argument_value(588), + mainPanelDevice:get_argument_value(587))) + -- mainPanelDevice:get_argument_value(???), + -- mainPanelDevice:get_argument_value(???))) + -- Altimeter + -- altituteMeter; altituteKM; baroPressure + -- 104; 112; 655; + SendData(2002, string.format("%0.4f;%0.4f;%0.4f", + mainPanelDevice:get_argument_value(104), + mainPanelDevice:get_argument_value(112), + mainPanelDevice:get_argument_value(655))) + -- ADI + -- bank; pitch; steeringWarningFlag attitudeWarningFlag; desiredBank; desirePitch; + -- airSpeedDeviation; trackDeviation;heightDeviation;sideslip; + SendData(2003, string.format("%0.4f;%0.4f", + mainPanelDevice:get_argument_value(108), + mainPanelDevice:get_argument_value(109))) + -- HydraulicPressure + -- PRIMARY_GIDRO_Pressure_needle, SECONDARY_GIDRO_Pressure_needle + -- 126; 125; + SendData(2004, string.format("%0.4f;%0.4f", + mainPanelDevice:get_argument_value(126), + mainPanelDevice:get_argument_value(125))) + -- Mach + -- 101; 102; + SendData(2005, string.format("%0.4f;%0.4f", + mainPanelDevice:get_argument_value(101), + mainPanelDevice:get_argument_value(102))) + -- Nosecone + -- KONUS_efficiency, KONUS_UPES_3_instrument + -- 625; 66; + SendData(2006, string.format("%0.4f;%0.4f", + mainPanelDevice:get_argument_value(625), + mainPanelDevice:get_argument_value(66))) + -- RPM + -- ENGINE_RPM; ENGINE_RPM2 + -- 50; 670; + SendData(2007, string.format("%0.4f;%0.4f", + mainPanelDevice:get_argument_value(50), + mainPanelDevice:get_argument_value(670))) + + -- VVI + -- DA200_VerticalVelocity; DA200_TurnNeedle; DA200_Slipball + -- 106; 107; 31; + SendData(2008, string.format("%0.4f;%0.4f;%0.4f", + mainPanelDevice:get_argument_value(106), + mainPanelDevice:get_argument_value(107), + mainPanelDevice:get_argument_value(31))) + -- Wheelbrakes + -- LEFT_Wheelbrake;RIGHT_Wheelbrake; + -- ???; ??? + -- SendData(2009, string.format("%0.4f;%0.4f", + -- mainPanelDevice:get_argument_value(???), + -- mainPanelDevice:get_argument_value(???))) + + -- Gear + -- GEAR_NOSE_UP_LIGHT; GEAR_NOSE_DOWN_LIGHT; GEAR_LEFT_UP_LIGHT; GEAR_LEFT_DOWN_LIGHT; + -- GEAR_RIGHT_UP_LIGHT; GEAR_RIGHT_DOWN_LIGHT; AIRBRAKE_LIGHT; FLAPS_LIGHT; CHECK_GEAR_LIGHT; + -- 9; 12; 10; 13; 11; 14; 522; 521; 520; + + SendData(2010, string.format("%0.4f;%0.4f;%0.4f;%0.4f;%0.4f;%0.4f;%0.4f;%0.4f;%0.4f", + mainPanelDevice:get_argument_value(9), + mainPanelDevice:get_argument_value(12), + mainPanelDevice:get_argument_value(10), + mainPanelDevice:get_argument_value(13), + mainPanelDevice:get_argument_value(11), + mainPanelDevice:get_argument_value(14), + mainPanelDevice:get_argument_value(522), + mainPanelDevice:get_argument_value(521), + mainPanelDevice:get_argument_value(520))) + -- ACC + -- ACCELEROMETER; MAX_G_needle; MIN_G_needle + -- 110; 113; 114; + SendData(2012, string.format("%0.4f;%0.4f;%0.4f", + mainPanelDevice:get_argument_value(110), + mainPanelDevice:get_argument_value(113), + mainPanelDevice:get_argument_value(114))) + -- SPO + -- SPO_L_F; SPO_R_F; SPO_R_B; SPO_L_B; SPO_MUTED + -- 601; 602; 603; 604; 605; + SendData(2013, string.format("%0.4f;%0.4f;%0.4f;%0.1f;%0.1f", + mainPanelDevice:get_argument_value(601), + mainPanelDevice:get_argument_value(602), + mainPanelDevice:get_argument_value(603), + mainPanelDevice:get_argument_value(604), + mainPanelDevice:get_argument_value(605))) + -- Clock + -- currtimeHours; currtimeMinutes; currtimeSeconds; flightTimeMeterStatus; + -- flightHours;flightMinutes; secondsMeterTimeMinutes; secondsMeterTimeSeconds; + -- 115; 116; 117; 118; 119; 120; 121; 122; + SendData(2014, string.format("%0.4f;%0.4f;%0.4f;%0.4f;%0.4f;%0.4f;%0.4f;%0.4f", + mainPanelDevice:get_argument_value(115), + mainPanelDevice:get_argument_value(116), + mainPanelDevice:get_argument_value(117), + mainPanelDevice:get_argument_value(118), + mainPanelDevice:get_argument_value(119), + mainPanelDevice:get_argument_value(120), + mainPanelDevice:get_argument_value(121), + mainPanelDevice:get_argument_value(122))) + end +end + +function ProcessHARDWAREConfigHighImportance(mainPanelDevice) + --[[ + every frame export to hardware + Example from A-10C + Get Radio Frequencies + get data from device + local UHF_RADIO = GetDevice(54) + SendDataHW("ExportID", "Format") + SendDataHW("ExportID", "Format", HardwareConfigID) + SendDataHW("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000)) + SendDataHW("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000), 2) -- export to Hardware '2' Config + ]] +--GEAR LIGHTS == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == + SendDataHW("9", mainPanelDevice:get_argument_value(9)) -- GEAR_NOSE_UP_LIGHT + SendDataHW("12", mainPanelDevice:get_argument_value(12)) -- GEAR_NOSE_DOWN_LIGHT + SendDataHW("10", mainPanelDevice:get_argument_value(10)) -- GEAR_LEFT_UP_LIGHT + SendDataHW("13", mainPanelDevice:get_argument_value(13)) -- GEAR_LEFT_DOWN_LIGHT + SendDataHW("11", mainPanelDevice:get_argument_value(11)) -- GEAR_RIGHT_UP_LIGHT + SendDataHW("14", mainPanelDevice:get_argument_value(14)) -- GEAR_RIGHT_DOWN_LIGHT + SendDataHW("522", mainPanelDevice:get_argument_value(522)) -- AIRBRAKE_LIGHT + SendDataHW("521", mainPanelDevice:get_argument_value(521)) -- FLAPS_LIGHT + SendDataHW("520", mainPanelDevice:get_argument_value(520)) -- CHECK_GEAR_LIGHT +-- Radio-altimeter subgroup ------------------------------------------------------------------------------------------------------------------------------------------------------ + SendDataHW("500", mainPanelDevice:get_argument_value(500)) -- LOW_ALT_LIGHT +-- UUA and SUA subgroup ----------------------------------------------------------------------------------------------------------------------------------------------------------- + SendDataHW("537", mainPanelDevice:get_argument_value(537)) -- AOA_WARNING_LIGHT +--/N/ DC bus == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == + SendDataHW("510", mainPanelDevice:get_argument_value(510)) -- DC_GENERATOR_LIGHT +--TRIMER == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == = + SendDataHW("519", mainPanelDevice:get_argument_value(519)) -- TRIMMER_light +--/N/ AC bus == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == + SendDataHW("511", mainPanelDevice:get_argument_value(511)) -- AC_GENERATOR_LIGHT +--FUEL LIGHTS (in connection with previous) == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == = + SendDataHW("501", mainPanelDevice:get_argument_value(501)) -- FUEL_LIGHT_FUELPODC + SendDataHW("502", mainPanelDevice:get_argument_value(502)) -- FUEL_LIGHT_1GR + SendDataHW("503", mainPanelDevice:get_argument_value(503)) -- FUEL_LIGHT_450 + SendDataHW("504", mainPanelDevice:get_argument_value(504)) -- FUEL_LIGHT_3GR + SendDataHW("505", mainPanelDevice:get_argument_value(505)) -- FUEL_LIGHT_FUELPODW + SendDataHW("506", mainPanelDevice:get_argument_value(506)) -- FUEL_LIGHT_RASHOD +-- GIDRO == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == + SendDataHW("515", mainPanelDevice:get_argument_value(515)) -- HYDRAULIC_LIGHT + SendDataHW("514", mainPanelDevice:get_argument_value(514)) -- BUSTER_LIGHT +-- DRAG CHUTE == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == + SendDataHW("550", mainPanelDevice:get_argument_value(550)) -- GUN_GOTOVN_LIGHT +-- SPO == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == = + SendDataHW("601", mainPanelDevice:get_argument_value(601)) -- SPO_L_F + SendDataHW("602", mainPanelDevice:get_argument_value(602)) -- SPO_R_F + SendDataHW("603", mainPanelDevice:get_argument_value(603)) -- SPO_R_B + SendDataHW("604", mainPanelDevice:get_argument_value(604)) -- SPO_L_B + SendDataHW("605", mainPanelDevice:get_argument_value(605)) -- SPO_MUTED +-- SAU == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == + SendDataHW("546", mainPanelDevice:get_argument_value(546)) -- SAU_stabilization_LIGHT + SendDataHW("547", mainPanelDevice:get_argument_value(547)) -- SAU_privedenie_LIGHT + SendDataHW("544", mainPanelDevice:get_argument_value(544)) -- SAU_landing_COMMAND_LIGHT + SendDataHW("545", mainPanelDevice:get_argument_value(545)) -- SAU_landing_AUTO_LIGHT +-- WARNING LIGHTS == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == + SendDataHW("541", mainPanelDevice:get_argument_value(541)) -- CANOPY_WARNING_LIGHT + SendDataHW("542", mainPanelDevice:get_argument_value(542)) -- SORC_LIGHT + SendDataHW("407", mainPanelDevice:get_argument_value(407)) -- WARNING_LIGHTS_CHECK_STATE + SendDataHW("516", mainPanelDevice:get_argument_value(516)) -- MARKER_LIGHT + SendDataHW("518", mainPanelDevice:get_argument_value(518)) -- STABILISATOR_LIGHT + SendDataHW("520", mainPanelDevice:get_argument_value(520)) -- CHECK_GEAR_LIGHT + SendDataHW("521", mainPanelDevice:get_argument_value(521)) -- FLAPS_LIGHT + SendDataHW("522", mainPanelDevice:get_argument_value(522)) -- AIRBRAKE_LIGHT + SendDataHW("523", mainPanelDevice:get_argument_value(523)) -- CENTRAL_PYLON_LIGHT + SendDataHW("524", mainPanelDevice:get_argument_value(524)) -- RATO_L_LIGHT + SendDataHW("525", mainPanelDevice:get_argument_value(525)) -- RATO_R_LIGHT + SendDataHW("526", mainPanelDevice:get_argument_value(526)) -- PYLON_1_ON_LIGHT + SendDataHW("527", mainPanelDevice:get_argument_value(527)) -- PYLON_2_ON_LIGHT + SendDataHW("528", mainPanelDevice:get_argument_value(528)) -- PYLON_3_ON_LIGHT + SendDataHW("529", mainPanelDevice:get_argument_value(529)) -- PYLON_4_ON_LIGHT + SendDataHW("530", mainPanelDevice:get_argument_value(530)) -- PYLON_1_OFF_LIGHT + SendDataHW("531", mainPanelDevice:get_argument_value(531)) -- PYLON_2_OFF_LIGHT + SendDataHW("532", mainPanelDevice:get_argument_value(532)) -- PYLON_3_OFF_LIGHT + SendDataHW("533", mainPanelDevice:get_argument_value(533)) -- PYLON_4_OFF_LIGHT +-- ENGINE and THROTTLE == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == + SendDataHW("507", mainPanelDevice:get_argument_value(507)) -- FORSAZ_1_LIGHT + SendDataHW("508", mainPanelDevice:get_argument_value(508)) -- FORSAZ_2_LIGHT + SendDataHW("512", mainPanelDevice:get_argument_value(512)) -- NOZZLE_LIGHT + SendDataHW("517", mainPanelDevice:get_argument_value(517)) -- KONUS_LIGHT + SendDataHW("513", mainPanelDevice:get_argument_value(513)) -- OIL_LIGHT + SendDataHW("534", mainPanelDevice:get_argument_value(534)) -- FIRE_LIGHT +--ENGINE START DEVICE == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == = + SendDataHW("509", mainPanelDevice:get_argument_value(509)) -- START_DEVICE_ZAZIG_LIGHT + +end + +----------------------------------------------------- +-- LOW IMPORTANCE EXPORTS -- +-- done every gExportLowTickInterval export events -- +----------------------------------------------------- + +function ProcessGlassCockpitDCSConfigLowImportance(mainPanelDevice) + --[[ + export in low tick interval to HELIOS + Example from A-10C + Landing Gear + mainPanelDevice, basis panel + SendDataHW("2004", mainPanelDevice:get_argument_value(659)) -- GEAR_N_SAFE + SendDataHW("2005", mainPanelDevice:get_argument_value(660)) -- GEAR_L_SAFE + SendDataHW("2006", mainPanelDevice:get_argument_value(661)) -- GEAR_R_SAFE + ]] + if gES_GlassCockpitType == 1 then + -- HELIOS Version 1.3 + elseif gES_GlassCockpitType == 2 then + -- HawgTouch version 1.6 + end +end + +function ProcessHARDWAREConfigLowImportance(mainPanelDevice) +--[[ + export in low tick interval to hardware + Example from A-10C + Get Radio Frequencies + get data from device + local lUHFRadio = GetDevice(54) + SendData("ExportID", "Format") + SendData(2000, string.format("%7.3f", lUHFRadio:get_frequency()/1000000)) <- special function for get frequency data + + Device test, Device 2 to 32 + is value "userdata", is only DLL intern functions + local ltmp1 = 0 + for ltmp2 = 1, 32, 1 do + ltmp1 = GetDevice(ltmp2) + WriteToLog(ltmp2..': '..dump(ltmp1)) + WriteToLog(ltmp2..' (metatable): '..dump(getmetatable(ltmp1))) + end + ]] +end \ No newline at end of file diff --git a/ExportsModules/MiG-29A.lua b/ExportsModules/MiG-29A.lua new file mode 100644 index 0000000..2941857 --- /dev/null +++ b/ExportsModules/MiG-29A.lua @@ -0,0 +1,841 @@ +-- MiG-29A Export +-- Version 0.9.9 BETA + +gES_FoundFCModule = true + +-- auxiliary function +dofile(gES_ExportModulePath.."FC_AuxiliaryFuntions.lua") + +----------------------------------------- +-- FLAMING CLIFFS AIRCRAFT / MiG-29A -- +-- FC aircraft don't support GetDevice -- +----------------------------------------- + +function ProcessGlassCockpitFCHighImportanceConfig() + + local myData = LoGetSelfData() + + if (myData) then + local lLatitude = myData.LatLongAlt.Lat -- LATITUDE + local lLongitude = myData.LatLongAlt.Long -- LONGITUDE + local lBasicAtmospherePressure = LoGetBasicAtmospherePressure() -- BAROMETRIC PRESSURE + local lAltBar = LoGetAltitudeAboveSeaLevel() -- ALTITUDE SEA LEVEL (Meter) + local lAltRad = LoGetAltitudeAboveGroundLevel() -- ALTITUDE GROUND LEVEL (Meter) + --local lTrueAirSpeed = LoGetTrueAirSpeed() -- TRUE AIRSPEED (Meter/Second) + local lPitch, lBank, lYaw = LoGetADIPitchBankYaw() -- PITCH, BANK, YAW (Radian) + + local lHeading = myData.Heading -- HEADING (Radian) + local lVVI = LoGetVerticalVelocity() -- VERTICAL SPEED (Meter/Second) + local lIAS = LoGetIndicatedAirSpeed() -- INDICATED AIRSPEED (Meter/Second) + local lMachNumber = LoGetMachNumber() -- MACH + local lAoA = LoGetAngleOfAttack() -- ANGLE OF ATTACK AoA (Radian) + + local lGlide = LoGetGlideDeviation() -- VOR1 HORIZONTAL DEFLECTION (-1 +1) + local lSide = LoGetSideDeviation() -- VOR1 VERTICAL DEFLECTION (-1 +1) + --local lSlipBallPosition = LoGetSlipBallPosition() -- SLIP BALL (-1 +1) + --local lAccelerationUnits = LoGetAccelerationUnits().y -- G-LOAD + + --local lNavInfoPitch = LoGetNavigationInfo().Requirements.pitch -- AP REQUIRED PITCH (Radian) + --local lNavInfoRoll = LoGetNavigationInfo().Requirements.roll -- AP REQUIRED BANK (Radian) + --local lNavInfoSpeed = LoGetNavigationInfo().Requirements.speed -- AP SPEED (Meter/Second) + --local lNavInfoAltitude = LoGetNavigationInfo().Requirements.altitude -- AP ALTITUDE (Meter) + --local lNavInfoVerticalSpeed = LoGetNavigationInfo().Requirements.vertical_speed -- AP VERTICAL SPEED (Meter/Second) + + --local lControlPanel_HSI = LoGetControlPanel_HSI() -- HSI Data + local lHSI_RMI = LoGetControlPanel_HSI().RMI_raw -- VOR1 OBS (Radian) + local lHSI_ADF = LoGetControlPanel_HSI().ADF_raw -- ADF OBS (Radian) + --local lHSI_Heading = LoGetControlPanel_HSI().Heading_raw -- Heading (Radian) + + local lEngineRPMleft = LoGetEngineInfo().RPM.left -- ENG1 RPM % + local lEngineRPMright = LoGetEngineInfo().RPM.right -- ENG2 RPM % + local lEngineTempLeft = LoGetEngineInfo().Temperature.left -- ENG1 EGT ºC + local lEngineTempRight = LoGetEngineInfo().Temperature.right -- ENG2 EGT ºC + --local lEngineFuelInternal = LoGetEngineInfo().fuel_internal -- TANK1 (INT) (KG) + --local lEngineFuelExternal = LoGetEngineInfo().fuel_external -- TANK2 (EXT) (KG) + + --local lMechInfo = LoGetMechInfo() -- mechanical components, e.g. Flaps, Wheelbrakes,... + --local lPayloadInfo = LoGetPayloadInfo() -- Paylod, e.g. bombs, guns, rockets, fuel tanks,... + + local lDistanceToWay = 999 + local lRoute = LoGetRoute() + + if (myData and lRoute) then -- if neither are nil + local myLoc = LoGeoCoordinatesToLoCoordinates(lLongitude, lLatitude) + --lDistanceToWay = math.sqrt((myLoc.x - lRoute.goto_point.world_point.x)^2 + (myLoc.y - lRoute.goto_point.world_point.y)^2) + lDistanceToWay = math.sqrt((myLoc.x - lRoute.goto_point.world_point.x)^2 + (myLoc.z - lRoute.goto_point.world_point.z)^2) + end + + if gES_GlassCockpitType == 1 then + -- HELIOS Version 1.3 + -- customizing for HELOS + lPitch = math.deg(lPitch) -- PITCH, (Radian to Grad) + lBank = math.deg(lBank) -- BANK (Radian to Grad) + lYaw = math.deg(lYaw) -- YAW (Radian to Grad) + lHSI_RMI = math.deg(lHSI_RMI) -- VOR1 OBS (Radian to Grad) + lHSI_ADF = math.deg(lHSI_ADF) -- ADF OBS (Radian to Grad) + lAoA = math.deg(lAoA) -- ANGLE OF ATTACK AoA (Radian to Grad) + lHeading = math.deg(lHeading) -- Heading (Radian to Grad) + lHSI_ADF = (360 - lHSI_ADF) + (360 - lHeading) + lHSI_RMI = 360 - lHSI_RMI + lIAS = lIAS * 3.6 -- change from m/s to km/h + + SendData("1", string.format("%.2f", lPitch) ) + SendData("2", string.format("%.2f", lBank) ) + SendData("3", string.format("%.2f", lYaw) ) + SendData("4", string.format("%.2f", lAltBar) ) + SendData("5", string.format("%.2f", lAltRad) ) + SendData("6", string.format("%.2f", lHSI_ADF) ) + SendData("7", string.format("%.2f", lHSI_RMI) ) + SendData("8", string.format("%.2f", lHeading) ) + SendData("9", string.format("%.2f", lEngineRPMleft) ) + SendData("10", string.format("%.2f", lEngineRPMright) ) + SendData("11", string.format("%.2f", lEngineTempLeft) ) + SendData("12", string.format("%.2f", lEngineTempRight) ) + SendData("13", string.format("%.2f", lVVI) ) + SendData("14", string.format("%.2f", lIAS) ) + SendData("15", string.format("%.2f", lDistanceToWay) ) + SendData("16", string.format("%.2f", lAoA) ) + SendData("17", string.format("%.2f", lGlide) ) + SendData("18", string.format("%.2f", lSide) ) + + elseif gES_GlassCockpitType == 2 then + -- HawgTouch version 1.6 + + local lRadToDCSsignd = math.pi + local lRadToDCSunsignd = math.pi * 2 + local lDefaultNull = 0.0 + local lDefaultOne = 1.0 + + -- IAS Indicator (IAS, Thousend) {"%.4f;%.4f"} + FC_Russian_AirSpeed_1000hkm(1) + + -- AOA Indicator and Accelerometer (AOA, GLoad) + FC_Russian_AOA_MiG29(3) + + -- ADI + FC_Russian_ADI_Old(4) + + -- HSI + FC_Russian_HSI(lDistanceToWay, 5) + + -- Vertical Velocity Indicator (VVI) (VVI, TurnIndicator, SlipBallPosition) + FC_Russian_VVI_Old(6) + + -- Radar Altimeter (AltRad, MinAltitude, WarningFlag, MinAltitudeLamp) {"%.4f;%.4f;%.1f;%.1f"} (below 100m is warning light on) + FC_Russian_RadarAltimeter_1000m(100, 7) + + -- Barometric Altimeter (AltBar, BasicAtmospherePressure) + FC_Russian_BarometricAltimeter_30000(8) + + -- Tachometer (RPM) (EngineRPMleft, EngineRPMright) {"%.4f;%.4f"} + FC_Russian_EngineRPM(9) + + -- Left Jet Engine Turbine Temperature Indicator (EngineTemp) {"%.4f"} + FC_Russian_EGT_1000gc(lEngineTempLeft + 80, 10) -- differenc fromtechnical temperature to showing temperature + + -- Right Jet Engine Turbine Temperature Indicator (EngineTemp) {"%.4f"} + FC_Russian_EGT_1000gc(lEngineTempRight + 80, 11) + + -- Clock from Ka-50 {CurrentHours, CurrentMinutes, CurrentSeconds, 0, FlightTimeHours, FlightTimeMinutes, 0, 0) {"%.4f;%.4f;%.4f;%.1f;%.4f;%.4f;%.4f;%.4f"} + FC_Russian_Clock_ACS1(12) + + -- Mach {max, Mach} + local lMachTmp = 0 + --[[ + y_min = 0.0 -- minimaler Ausgabewert + y_max = 1.0 -- maximaler Ausgabewert + x_min = 0.0 -- minimaler Eingangswert + x_max = 3.0 -- maximaler Eingangswert + x = 1.65 -- aktueller Eingangswert + + d_y = 1.0 -- Delta Ausgabewerte (y_max - y_min) + d_x = 3.0 -- Delta Eingangswerte (x_max - x_min) + m = 0.33333333333333333333333333333333 -- Steigung der linearen Funktion (d_y / d_x) + n = 0.00000000000000000000000000000001 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max) + + y = 0.55 -- Ergebnis (m * x + n) + ]] + lMachTmp = 0.33333333333333333333333333333333 * lMachNumber + 0.00000000000000000000000000000001 + + SendData("13", string.format("%0.4f;%0.4f", lMachTmp, 0.0)) + end + else + WriteToLog("Unknown FC Error, no LoGetSelfData.") + end + +end + +function ProcessHARDWAREConfigHighImportance(mainPanelDevice) +end + +function ProcessGlassCockpitFCLowImportanceConfig() + + if gES_GlassCockpitType == 1 then + -- HELIOS Version 1.3 + + elseif gES_GlassCockpitType == 2 then + -- HawgTouch version 1.6 + + FC_RadarWarning_SPO15(14) + + -- Fuel Quantity Indicator + local lEngineInfo = LoGetEngineInfo() + if lEngineInfo ~= nil then + --WriteToLog('lEngineInfo: '..dump(lEngineInfo)) + --[[ + [fuel_external] = number: "0" + [Temperature] = { + [left] = number: "626.99444580078" + [right] = number: "626.99444580078" + } + [RPM] = { + [left] = number: "87.453765869141" + [right] = number: "87.453758239746" + } + [FuelConsumption] = { + [left] = number: "0.1500396137767" + [right] = number: "0.1500396137767" + } + [fuel_internal] = number: "3773.2749023438" + [EngineStart] = { + [left] = number: "0" + [right] = number: "0" + } + [HydraulicPressure] = { + [left] = number: "210" + [right] = number: "210" + } + lPayloadInfo.Stations[8].CLSID == E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF -- ext 800l Fuel Tank + ]] + + local lTotalFuel = lEngineInfo.fuel_internal + lEngineInfo.fuel_external + --local lTotalFuel = string.format("%3d", math.round((lEngineInfo.fuel_internal / 10), 0, "ceil") * 10) + --local lTotalFuel = string.format("%4d", lEngineInfo.fuel_internal) -- total fuel in kg + --local lTotalFuel = string.format("%4d", lEngineInfo.fuel_external) -- external fuel in kg + local lTotalFuel_7_5 = 0 + local lTotalFuel_5_0 = 0 + + if lTotalFuel < 7500 then + if lTotalFuel > 5000 then + --[[ + y_min = 0.0 -- minimaler Ausgabewert + y_max = 1.0 -- maximaler Ausgabewert + x_min = 5000 -- minimaler Eingangswert + x_max = 7500 -- maximaler Eingangswert + x = 6000 -- aktueller Eingangswert + + d_y = 1 -- Delta Ausgabewerte (y_max - y_min) + d_x = 2500 -- Delta Eingangswerte (x_max - x_min) + m = 0.0004 -- Steigung der linearen Funktion (d_y / d_x) + n = -2.0 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max) + + y = 0.4 -- Ergebnis (m * x + n) + ]] + lTotalFuel_7_5 = 0.0004 * lTotalFuel + -2.0 + else + lTotalFuel_7_5 = 0.0 + end + else + lTotalFuel_7_5 = 1.0 + end + if lTotalFuel < 5000 then + --[[ + y_min = 0.04 -- minimaler Ausgabewert + y_max = 1.0 -- maximaler Ausgabewert + x_min = 0 -- minimaler Eingangswert + x_max = 5000 -- maximaler Eingangswert + x = 3000 -- aktueller Eingangswert + + d_y = 0.96 -- Delta Ausgabewerte (y_max - y_min) + d_x = 5000 -- Delta Eingangswerte (x_max - x_min) + m = 0.000192 -- Steigung der linearen Funktion (d_y / d_x) + n = 0.04 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max) + + y = 0.616 -- Ergebnis (m * x + n) + ]] + lTotalFuel_5_0 = 0.000192 * lTotalFuel + 0.04 + else + lTotalFuel_5_0 = 1.0 + end + + -- TotalFuel_5_0 + -- TotalFuel_7_5 + -- Light1 + -- Light2 + -- Light3 + -- Light4 + -- BingoLight + SendData("15", string.format("%0.4f;%0.4f;%d;%d;%d;%d;%d", + lTotalFuel_5_0, + lTotalFuel_7_5, + 0, + (lEngineInfo.fuel_internal < 3200.0 and 1 or 0), -- Tank warning 1 + (lEngineInfo.fuel_internal < 2800.0 and 1 or 0), -- Tank warning 2 + (lEngineInfo.fuel_internal < 1400.0 and 1 or 0), -- Tank warning 3 + (lEngineInfo.fuel_internal < 800.0 and 1 or 0))) -- Tank warning 4 + + -- Hydraulic Pressure Left + FC_OneNeedleGauge(lEngineInfo.HydraulicPressure.left, 240, 17) + + -- Hydraulic Pressure Right + FC_OneNeedleGauge(lEngineInfo.HydraulicPressure.right, 240, 18) + end + + -- EKRAN Message + FC_EKRAN(16) + + -- Mechanical Configuration Indicator (GearWarningLight, NoseGear, LeftGear, RightGear, Airbreaks, Flaps1, Flaps2) {"%.1f;%d;%d;%d;%d;%d;%d"} + local lMechInfo = LoGetMechInfo() -- mechanical components, e.g. Flaps, Wheelbrakes,... + if lMechInfo ~= nil then + --WriteToLog('lMechInfo: '..dump(lMechInfo)) + local lWarningLight = 0.0 + local lTrueAirSpeed = LoGetTrueAirSpeed() + if lTrueAirSpeed ~= nil then + --WriteToLog('lTrueAirSpeed: '..dump(lTrueAirSpeed)) + lWarningLight = ((lMechInfo.flaps.value > 0.93 and lTrueAirSpeed > 340) and 1.0 or 0.0) -- Speed Warning for Flaps, same light as gear warning light, but blinking light + lWarningLight = (((lMechInfo.gear.status == 1 and lMechInfo.gear.value < 1) or (lMechInfo.gear.status == 0 and lMechInfo.gear.value > 0)) and 1.0 or lWarningLight ) -- gear warning light + end + -- WarningLight {0.0 = Off, 0.1 = blinking light, 0.2 = on} + -- WarningLight {0.0 = Off, no blinking light, 1.0 = on} + + -- left gear {0, 1} + -- right gear {0, 1} + -- nose gear {0, 1} + -- WarningLight + -- Flap 1 + -- Flap 2 + -- Nose Flap + -- Speedbreakes on {0, 1} + SendData("2", string.format("%.1f;%d;%d;%d;%d;%d;%d", + (lMechInfo.gear.value > 0.95 and 1 or 0), -- left gear + (lMechInfo.gear.value == 1 and 1 or 0), -- right gear + (lMechInfo.gear.value > 0.85 and 1 or 0), -- nose gear + lWarningLight, +-- (lMechInfo.flaps.value > 0.47 and 1 or 0), -- flap 1 +-- (lMechInfo.flaps.value > 0.93 and 1 or 0), -- flap 2 + (lMechInfo.flaps.status == 1 and 1 or 0), -- flap 1 + (lMechInfo.flaps.status == 2 and 1 or 0), -- flap 2 + (lMechInfo.noseflap.value > 0.1 and 1 or 0), -- noseflap + (lMechInfo.speedbrakes.status == 1 and 1 or 0))) -- speedbreakes on > 0.1 (0 - 1) + + -- Wheelbrakes Hydraulic Pressure Left + FC_OneNeedleGauge(lMechInfo.wheelbrakes.value, 240, 19) + + -- Wheelbrakes Hydraulic Pressure Right + FC_OneNeedleGauge(lMechInfo.wheelbrakes.value, 240, 20) + end + + -- Airintake + FC_Russian_AirIntake(21) + end + + --(x < 0 and 'negative' or 'non-negative') + --[[ + local lPayloadInfo = LoGetPayloadInfo() + WriteToLog('lPayloadInfo: '..dump(lPayloadInfo)) + + local lSnares = LoGetSnares() -- Flare and Chaff + WriteToLog('lSnares: '..dump(lSnares)) + + local lSightingSystemInfo = LoGetSightingSystemInfo() + WriteToLog('lSightingSystemInfo: '..dump(lSightingSystemInfo)) + + local lTWSInfo = LoGetTWSInfo() -- SPO Informationen, z.B. Radarwarner F15C + WriteToLog('lTWSInfo: '..dump(lTWSInfo)) + + local lTargetInformation = LoGetTargetInformation() -- detalierte Radar Infos z.B. F15C + WriteToLog('lTargetInformation: '..dump(lTargetInformation)) + + local lLockedTargetInformation = LoGetLockedTargetInformation() + WriteToLog('lLockedTargetInformation: '..dump(lLockedTargetInformation)) + + local lF15_TWS_Contacs = LoGetF15_TWS_Contacts() -- the same information but only for F-15 in TWS mode + WriteToLog('lF15_TWS_Contacs: '..dump(lF15_TWS_Contacs)) + + local lMechInfo = LoGetMechInfo() -- mechanical components, e.g. Flaps, Wheelbrakes,... + WriteToLog('lMechInfo: '..dump(lMechInfo)) + + local lMCPState = LoGetMCPState() -- Warnlichter + WriteToLog('lMCPState: '..dump(lMCPState)) + + local lControlPanel_HSI = LoGetControlPanel_HSI() + WriteToLog('lControlPanel_HSI: '..dump(lControlPanel_HSI)) + + local lRadioBeaconsStatus = LoGetRadioBeaconsStatus() + WriteToLog('lRadioBeaconsStatus: '..dump(lRadioBeaconsStatus)) + + local lEngineInfo = LoGetEngineInfo() + WriteToLog('lEngineInfo: '..dump(lEngineInfo)) + ]] + -- Weapon Control System + --local lNameByType = LoGetNameByType () -- args 4 (number : level1,level2,level3,level4), result string + -- values from LoGetTargetInformation().type + --WriteToLog('lNameByType: '..dump(lNameByType)) +end + +function ProcessHARDWAREConfigLowImportance(mainPanelDevice) +-- where necessary, specify HardwareID, example WeaponStatusPanel(2) + WeaponStatusPanel() + MechanicalDevicesIndicator() + StatusLamp() + FuelQuantityIndicator() + SightingSystem() + SPO15RWR() + FlareChaff() +end + +----------------------------- +-- Custom functions -- +----------------------------- + +function SightingSystem(hardware) + local lHardware = hardware or 1 + local lSightingSystemInfo = LoGetSightingSystemInfo() + if lSightingSystemInfo == nil then + return + end + --WriteToLog('lSightingSystemInfo: '..dump(lSightingSystemInfo)9 + --[[ + [PRF] = { + [selection] = string: "ILV" + [current] = string: "MED" + } + [laser_on] = boolean: "false" + [scale] = { + [azimuth] = number: "0.52359873056412" + [distance] = number: "10000" + } + [radar_on] = boolean: "false" + [optical_system_on] = boolean: "false" + [LaunchAuthorized] = boolean: "false" + [ECM_on] = boolean: "false" + [Manufacturer] = string: "RUS" + [TDC] = { + [y] = number: "0" + [x] = number: "0" + } + [ScanZone] = { + [coverage_H] = { + [min] = number: "0" + [max] = number: "20000" + } + [size] = { + [azimuth] = number: "1.0471974611282" + [elevation] = number: "0.17453290522099" + } + [position] = { + [exceeding_manual] = number: "0" + [distance_manual] = number: "0" + [azimuth] = number: "0" + [elevation] = number: "0" + } + } + ]] + SendDataHW("600", lSightingSystemInfo.ECM_on == true and 1 or 0, lHardware ) + SendDataHW("601", lSightingSystemInfo.laser_on == true and 1 or 0, lHardware ) + SendDataHW("602", lSightingSystemInfo.optical_system_on == true and 1 or 0, lHardware ) + SendDataHW("603", lSightingSystemInfo.LaunchAuthorized == true and 1 or 0, lHardware ) + SendDataHW("604", lSightingSystemInfo.radar_on == true and 1 or 0, lHardware ) +end + +function FlareChaff(hardware) + local lHardware = hardware or 1 + local lSnares = LoGetSnares() -- Flare and Chaff + --WriteToLog('lSnares: '..dump(lSnares)) + + --[chaff] = number: "30" + --[flare] = number: "30" + + SendDataHW("800", lSnares.chaff + lSnares.flare, lHardware ) +end + +function StatusLamp(hardware) + local lHardware = hardware or 1 + local lMCPState = LoGetMCPState() -- Warnlichter + if lMCPState == nil then + return + end + --WriteToLog('lMCPState: '..dump(lMCPState)) + --[[ + [RightTailPlaneFailure] = boolean: "false" + [EOSFailure] = boolean: "false" + [ECMFailure] = boolean: "false" + [RightAileronFailure] = boolean: "false" + [MasterWarning] = boolean: "false" + [RightEngineFailure] = boolean: "false" + [CannonFailure] = boolean: "false" + [MLWSFailure] = boolean: "false" + [ACSFailure] = boolean: "false" + [RadarFailure] = boolean: "false" + [HelmetFailure] = boolean: "false" + [HUDFailure] = boolean: "false" + [LeftMainPumpFailure] = boolean: "false" + [RightWingPumpFailure] = boolean: "false" + [LeftWingPumpFailure] = boolean: "false" + [MFDFailure] = boolean: "false" + [RWSFailure] = boolean: "false" + [GearFailure] = boolean: "false" + [HydraulicsFailure] = boolean: "false" + [AutopilotFailure] = boolean: "true" + [FuelTankDamage] = boolean: "false" + [LeftAileronFailure] = boolean: "false" + [CanopyOpen] = boolean: "false" + [RightMainPumpFailure] = boolean: "false" + [StallSignalization] = boolean: "false" + [LeftEngineFailure] = boolean: "false" + [AutopilotOn] = boolean: "false" + [LeftTailPlaneFailure] = boolean: "false" + ]] + + SendDataHW("700", lMCPState.LeftTailPlaneFailure == true and 1 or 0, lHardware ) + SendDataHW("701", lMCPState.RightTailPlaneFailure == true and 1 or 0, lHardware ) + SendDataHW("702", lMCPState.MasterWarning == true and 1 or 0, lHardware ) + SendDataHW("703", lMCPState.LeftEngineFailure == true and 1 or 0, lHardware ) + SendDataHW("704", lMCPState.RightEngineFailure == true and 1 or 0, lHardware ) + SendDataHW("705", lMCPState.LeftAileronFailure == true and 1 or 0, lHardware ) + SendDataHW("706", lMCPState.RightAileronFailure == true and 1 or 0, lHardware ) + SendDataHW("707", lMCPState.LeftMainPumpFailure == true and 1 or 0, lHardware ) + SendDataHW("708", lMCPState.RightMainPumpFailure == true and 1 or 0, lHardware ) + SendDataHW("709", lMCPState.LeftWingPumpFailure == true and 1 or 0, lHardware ) + SendDataHW("710", lMCPState.RightWingPumpFailure == true and 1 or 0, lHardware ) + SendDataHW("711", lMCPState.EOSFailure == true and 1 or 0, lHardware ) + SendDataHW("712", lMCPState.ECMFailure == true and 1 or 0, lHardware ) + SendDataHW("713", lMCPState.CannonFailure == true and 1 or 0, lHardware ) + SendDataHW("714", lMCPState.MLWSFailure == true and 1 or 0, lHardware ) + SendDataHW("715", lMCPState.ACSFailure == true and 1 or 0, lHardware ) + SendDataHW("716", lMCPState.RadarFailure == true and 1 or 0, lHardware ) + SendDataHW("717", lMCPState.HelmetFailure == true and 1 or 0, lHardware ) + SendDataHW("718", lMCPState.HUDFailure == true and 1 or 0, lHardware ) + SendDataHW("719", lMCPState.MFDFailure == true and 1 or 0, lHardware ) + SendDataHW("720", lMCPState.RWSFailure == true and 1 or 0, lHardware ) + SendDataHW("721", lMCPState.GearFailure == true and 1 or 0, lHardware ) + SendDataHW("722", lMCPState.HydraulicsFailure == true and 1 or 0, lHardware ) + SendDataHW("723", lMCPState.AutopilotFailure == true and 1 or 0, lHardware ) + SendDataHW("724", lMCPState.FuelTankDamage == true and 1 or 0, lHardware ) + SendDataHW("725", lMCPState.CanopyOpen == true and 1 or 0, lHardware ) + SendDataHW("726", lMCPState.StallSignalization == true and 1 or 0, lHardware ) + SendDataHW("727", lMCPState.AutopilotOn == true and 1 or 0, lHardware ) + + local lEngineInfo = LoGetEngineInfo() + if lEngineInfo ~= nil then + --WriteToLog('lEngineInfo: '..dump(lEngineInfo)) + + SendDataHW("728", lEngineInfo.EngineStart.left, lHardware ) -- lamp start left engine 1 (0|1) + SendDataHW("729", lEngineInfo.EngineStart.right, lHardware ) -- lamp start right engine 1 (0|1) + + SendDataHW("730", (lEngineInfo.RPM.left > 100.0 and 1 or 0), lHardware ) -- lamp after burner left engine + SendDataHW("731", (lEngineInfo.RPM.right > 100.0 and 1 or 0), lHardware ) -- lam after burner right engine + end + + local lAccelerationUnits = LoGetAccelerationUnits() + if lAccelerationUnits ~= nil then + --WriteToLog('lAccelerationUnits: '..dump(lAccelerationUnits)) + SendDataHW("732", (lAccelerationUnits.y > 8.0 and 1 or 0), lHardware ) -- lamp Over-G warning + end +end + +function WeaponStatusPanel(hardware) + local lHardware = hardware or 1 +-- The weapon status panel, quantity and readiness of the currently selected weapon and the remaining gun ammunition are indicated. + gES_PayloadInfo = LoGetPayloadInfo() + if gES_PayloadInfo == nil then + return + end + --WriteToLog('gES_PayloadInfo: '..dump(gES_PayloadInfo)) + --[[ exsample + [Stations] = { + [1] = { + [CLSID] = string: "{FBC29BFE-3D24-4C64-B81D-941239D12249}" + [container] = boolean: "false" + [count] = number: "1" + [weapon] = { + [level3] = number: "7" + [level1] = number: "4" + [level4] = number: "18" + [level2] = number: "4" + } + } + [2] = { + [CLSID] = string: "{FBC29BFE-3D24-4C64-B81D-941239D12249}" + [container] = boolean: "false" + [count] = number: "1" + [weapon] = { + [level3] = number: "7" + [level1] = number: "4" + [level4] = number: "18" + [level2] = number: "4" + } + } + [3] = { + [CLSID] = string: "{B4C01D60-A8A3-4237-BD72-CA7655BC0FE9}" + [container] = boolean: "false" + [count] = number: "1" + [weapon] = { + [level3] = number: "7" + [level1] = number: "4" + [level4] = number: "19" + [level2] = number: "4" + } + } + [4] = { + [CLSID] = string: "{B4C01D60-A8A3-4237-BD72-CA7655BC0FE9}" + [container] = boolean: "false" + [count] = number: "1" + [weapon] = { + [level3] = number: "7" + [level1] = number: "4" + [level4] = number: "19" + [level2] = number: "4" + } + } + [5] = { + [CLSID] = string: "{B4C01D60-A8A3-4237-BD72-CA7655BC0FE9}" + [container] = boolean: "false" + [count] = number: "1" + [weapon] = { + [level3] = number: "7" + [level1] = number: "4" + [level4] = number: "19" + [level2] = number: "4" + } + } + [6] = { + [CLSID] = string: "{B4C01D60-A8A3-4237-BD72-CA7655BC0FE9}" + [container] = boolean: "false" + [count] = number: "1" + [weapon] = { + [level3] = number: "7" + [level1] = number: "4" + [level4] = number: "19" + [level2] = number: "4" + } + } + [7] = { + [CLSID] = string: "{2BEC576B-CDF5-4B7F-961F-B0FA4312B841}" + [container] = boolean: "false" + [count] = number: "1" + [weapon] = { + [level3] = number: "43" + [level1] = number: "1" + [level4] = number: "17" + [level2] = number: "3" + } + } + } + [CurrentStation] = number: "3" + [Cannon] = { + [shells] = number: "150" + } + ]] + --[[ + Weapon Panel + | + ------------------------------- + | | | | | | | + 1 2 3 C 4 5 6 + ]] + -- Payload Info + -- weapon stations (panel) 1 (left) - 10 (right), no lamp for center station + SendDataHW("100", gES_PayloadInfo.Cannon.shells ) -- count cannon shells + SendDataHW("101", (gES_PayloadInfo.Stations[1].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 1) + SendDataHW("111", (gES_PayloadInfo.Stations[2].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 6) + SendDataHW("102", (gES_PayloadInfo.Stations[3].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 2) + SendDataHW("103", (gES_PayloadInfo.Stations[4].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 5) + SendDataHW("104", (gES_PayloadInfo.Stations[5].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 3) + SendDataHW("105", (gES_PayloadInfo.Stations[6].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 4) + --SendDataHW("106", (gES_PayloadInfo.Stations[7].count > 0 and 1 or 0) ) -- weapon presend > 0 center station, not visible + --SendDataHW("CurrentStation", gES_PayloadInfo.CurrentStation ) + + -- defination + gES_TmpStationToPanel = {} + gES_TmpStationToPanel[1] = {Panel = 1, StationID = 101, CurrentID = 201, HardwareID = lHardware } -- left + gES_TmpStationToPanel[2] = {Panel = 6, StationID = 106, CurrentID = 206, HardwareID = lHardware } -- right + gES_TmpStationToPanel[3] = {Panel = 2, StationID = 102, CurrentID = 202, HardwareID = lHardware } + gES_TmpStationToPanel[4] = {Panel = 5, StationID = 103, CurrentID = 203, HardwareID = lHardware } + gES_TmpStationToPanel[5] = {Panel = 3, StationID = 104, CurrentID = 204, HardwareID = lHardware } + gES_TmpStationToPanel[6] = {Panel = 4, StationID = 105, CurrentID = 205, HardwareID = lHardware } + + if gES_PayloadInfo.CurrentStation ~= 0 then -- gegebenenfalls prüfen ob sich CurrentStation geändert hat + SendDataHW(gES_TmpStationToPanel[gES_PayloadInfo.CurrentStation].CurrentID, 1, lHardware) -- eigentliche Auswahl + table.foreach(gES_PayloadInfo.Stations, WeaponStatusPanel_selectCurrentPayloadStation) -- zugehörige Stationen + end +end + +function FuelQuantityIndicator(hardware) + local lHardware = hardware or 1 +-- Fuel quantity shows the fuel remaining in all tanks + local lEngineInfo = LoGetEngineInfo() + if lEngineInfo == nil then + return + end + --WriteToLog('lEngineInfo: '..dump(lEngineInfo)) + --[[ + [fuel_external] = number: "0" + [Temperature] = { + [left] = number: "626.99444580078" + [right] = number: "626.99444580078" + } + [RPM] = { + [left] = number: "87.453765869141" + [right] = number: "87.453758239746" + } + [FuelConsumption] = { + [left] = number: "0.1500396137767" + [right] = number: "0.1500396137767" + } + [fuel_internal] = number: "3773.2749023438" + [EngineStart] = { + [left] = number: "0" + [right] = number: "0" + } + [HydraulicPressure] = { + [left] = number: "210" + [right] = number: "210" + } + lPayloadInfo.Stations[7].CLSID == 2BEC576B-CDF5-4B7F-961F-B0FA4312B841 -- ext 1500l Fuel Tank + ]] + + SendDataHW("300", string.format("%d", math.round(((lEngineInfo.fuel_internal + lEngineInfo.fuel_external) / 10), 0, "ceil") * 10), lHardware ) -- total fuel in kg + --SendDataHW("301", string.format("%d", lEngineInfo.fuel_internal)) -- internal fuel in kg + --SendDataHW("302", string.format("%d", lEngineInfo.fuel_external)) -- external fuel in kg + + --[[ + local lPayloadInfo = LoGetPayloadInfo() + if lPayloadInfo ~= nil then + --WriteToLog('lPayloadInfo: '..dump(lPayloadInfo)) + if lPayloadInfo.Stations[7].CLSID == "{2BEC576B-CDF5-4B7F-961F-B0FA4312B841}" then -- center tanks presend and full + SendDataHW("303", ((lEngineInfo.fuel_external < 1200.0 ) and 1 or 0), lHardware ) + else + SendDataHW("303", 1, lHardware ) + end + if lPayloadInfo.Stations[3].CLSID == "{C0FF4842-FBAC-11d5-9190-00A0249B6F00}" or + lPayloadInfo.Stations[4].CLSID == "{C0FF4842-FBAC-11d5-9190-00A0249B6F00}" then -- external tank presend and full (panel 2 and 5) + SendDataHW("304", ((lEngineInfo.fuel_internal < 2830.0 ) and 1 or 0), lHardware ) + else + SendDataHW("304", 1, lHardware ) + end + else + SendDataHW("303", 1, lHardware ) + SendDataHW("304", 1, lHardware ) + end]] + + SendDataHW("304", (lEngineInfo.fuel_internal < 3200.0 and 1 or 0), lHardware ) -- Tank warning 1 + SendDataHW("305", (lEngineInfo.fuel_internal < 2800.0 and 1 or 0), lHardware ) -- Tank warning 2 + SendDataHW("306", (lEngineInfo.fuel_internal < 1390.0 and 1 or 0), lHardware ) -- Tank warning 3 + SendDataHW("307", (lEngineInfo.fuel_internal < 760.0 and 1 or 0), lHardware ) -- Tank warning 4 + --SendDataHW("308", (lEngineInfo.fuel_internal < 600.0 and 1 or 0), lHardware ) -- Bingo Fuel + +end + +function MechanicalDevicesIndicator(hardware) + local lHardware = hardware or 1 +-- The mechanical devices indicator shows the position of the landing gear, flaps, leading edge flaps and airbrake + local lMechInfo = LoGetMechInfo() -- mechanical components, e.g. Flaps, Wheelbrakes,... + if lMechInfo == nil then + return + end + --[[ + [hook] = { + [status] = number: "0" + [value] = number: "0" + } + [parachute] = { + [status] = number: "0" + [value] = number: "0" + } + [controlsurfaces] = { + [eleron] = { + [left] = number: "0" + [right] = number: "-0.21084336936474" + } + [elevator] = { + [left] = number: "-0" + [right] = number: "-0" + } + [rudder] = { + [left] = number: "0" + [right] = number: "0" + } + } + [airintake] = { + [status] = number: "0" + [value] = number: "0" + } + [canopy] = { + [status] = number: "0" + [value] = number: "0" + } + [refuelingboom] = { + [status] = number: "0" + [value] = number: "0" + } + [wing] = { + [status] = number: "0" + [value] = number: "0" + } + [noseflap] = { + [status] = number: "0" + [value] = number: "0" + } + [gear] = { + [value] = number: "0" + [nose] = { + [rod] = number: "0" + } + [main] = { + [left] = { + [rod] = number: "0" + } + [right] = { + [rod] = number: "0" + } + } + [status] = number: "0" + } + [speedbrakes] = { + [status] = number: "0" + [value] = number: "0" + } + [wheelbrakes] = { + [status] = number: "0" + [value] = number: "0" + } + [flaps] = { + [status] = number: "0" + [value] = number: "0" + }]] + --SendDataHW("500", lMechInfo.gear.status ) + --SendDataHW("501", lMechInfo.gear.value ) + --SendDataHW("502", lMechInfo.gear.nose.rod ) -- zeigt an wie weit das Fahrwerk einsackt wenn das Flugzeug auf dem Boden ist + --SendDataHW("503", lMechInfo.gear.main.left.rod ) -- zeigt an wie weit das Fahrwerk einsackt wenn das Flugzeug auf dem Boden ist + --SendDataHW("504", lMechInfo.gear.main.right.rod ) -- zeigt an wie weit das Fahrwerk einsackt wenn das Flugzeug auf dem Boden ist + --SendDataHW("500", ((lMechInfo.gear.status == 1 and lMechInfo.gear.value < 1) and 1 or 0 ) ) -- gear warning light, go up + --SendDataHW("500", ((lMechInfo.gear.status == 0 and lMechInfo.gear.value > 0) and 1 or 0 ) ) -- gear warning light, go down + SendDataHW("500", (((lMechInfo.gear.status == 1 and lMechInfo.gear.value < 1) or (lMechInfo.gear.status == 0 and lMechInfo.gear.value > 0)) and 1 or 0 ), lHardware ) -- gear warning light + SendDataHW("501", (lMechInfo.gear.value > 0.85 and 1 or 0), lHardware ) -- nose gear + SendDataHW("502", (lMechInfo.gear.value > 0.95 and 1 or 0), lHardware ) -- left gear + SendDataHW("503", (lMechInfo.gear.value == 1 and 1 or 0), lHardware ) -- right gear + + --SendDataHW("510", lMechInfo.speedbrakes.status ) -- speedbreakes on 1 (0|1) + SendDataHW("510", (lMechInfo.speedbrakes.value > 0.1 and 1 or 0), lHardware ) -- speedbreakes on > 0.1 (0 - 1) + + --SendDataHW("520", lMechInfo.wheelbrakes.status ) -- not in use + --SendDataHW("521", lMechInfo.wheelbrakes.value ) -- not in use + + local lGetTrueAirSpeed = LoGetTrueAirSpeed() + --SendDataHW("530", lMechInfo.flaps.status ) -- flap switch off 0, 1. position 1, 2. position 2 (0|1|2) + --SendDataHW("531", lMechInfo.flaps.value ) -- flap 1. position > 0.25, 2. position > 0.93 (0 - 1) + SendDataHW("531", (lMechInfo.flaps.value > 0.25 and 1 or 0), lHardware ) -- flap 1. position + SendDataHW("532", (lMechInfo.flaps.value > 0.93 and 1 or 0), lHardware ) -- flap 2. position + SendDataHW("533", ((lMechInfo.flaps.value > 0.93 and lGetTrueAirSpeed > 340) and 1 or 0), lHardware ) -- Speed Warning for Flaps, same light as gear warning light, but blinking light + SendDataHW("534", (lMechInfo.gear.status > 1.0 and 1 or 0), lHardware ) -- Intake FOD shields + + --SendDataHW("540", lMechInfo.parachute.status ) + SendDataHW("541", (lMechInfo.parachute.value < 0.5 and 1 or 0), lHardware ) + + --SendDataHW("550", lMechInfo.noseflap.status ) + SendDataHW("551", (lMechInfo.noseflap.value > 20.0 and 1 or 0), lHardware ) + + SendDataHW("560", lMechInfo.airintake.status, lHardware ) + --SendDataHW("561", lMechInfo.airintake.value ) +end \ No newline at end of file diff --git a/ExportsModules/MiG-29S.lua b/ExportsModules/MiG-29S.lua new file mode 100644 index 0000000..8761e3f --- /dev/null +++ b/ExportsModules/MiG-29S.lua @@ -0,0 +1,840 @@ +-- MiG-29S Export +-- Version 0.9.9 BETA + +gES_FoundFCModule = true + +-- auxiliary function +dofile(gES_ExportModulePath.."FC_AuxiliaryFuntions.lua") + +----------------------------------------- +-- FLAMING CLIFFS AIRCRAFT / MiG-29S -- +-- FC aircraft don't support GetDevice -- +----------------------------------------- + +function ProcessGlassCockpitFCHighImportanceConfig() + + local myData = LoGetSelfData() + + if (myData) then + local lLatitude = myData.LatLongAlt.Lat -- LATITUDE + local lLongitude = myData.LatLongAlt.Long -- LONGITUDE + local lBasicAtmospherePressure = LoGetBasicAtmospherePressure() -- BAROMETRIC PRESSURE + local lAltBar = LoGetAltitudeAboveSeaLevel() -- ALTITUDE SEA LEVEL (Meter) + local lAltRad = LoGetAltitudeAboveGroundLevel() -- ALTITUDE GROUND LEVEL (Meter) + --local lTrueAirSpeed = LoGetTrueAirSpeed() -- TRUE AIRSPEED (Meter/Second) + local lPitch, lBank, lYaw = LoGetADIPitchBankYaw() -- PITCH, BANK, YAW (Radian) + + local lHeading = myData.Heading -- HEADING (Radian) + local lVVI = LoGetVerticalVelocity() -- VERTICAL SPEED (Meter/Second) + local lIAS = LoGetIndicatedAirSpeed() -- INDICATED AIRSPEED (Meter/Second) + local lMachNumber = LoGetMachNumber() -- MACH + local lAoA = LoGetAngleOfAttack() -- ANGLE OF ATTACK AoA (Radian) + + local lGlide = LoGetGlideDeviation() -- VOR1 HORIZONTAL DEFLECTION (-1 +1) + local lSide = LoGetSideDeviation() -- VOR1 VERTICAL DEFLECTION (-1 +1) + --local lSlipBallPosition = LoGetSlipBallPosition() -- SLIP BALL (-1 +1) + --local lAccelerationUnits = LoGetAccelerationUnits().y -- G-LOAD + + --local lNavInfoPitch = LoGetNavigationInfo().Requirements.pitch -- AP REQUIRED PITCH (Radian) + --local lNavInfoRoll = LoGetNavigationInfo().Requirements.roll -- AP REQUIRED BANK (Radian) + --local lNavInfoSpeed = LoGetNavigationInfo().Requirements.speed -- AP SPEED (Meter/Second) + --local lNavInfoAltitude = LoGetNavigationInfo().Requirements.altitude -- AP ALTITUDE (Meter) + --local lNavInfoVerticalSpeed = LoGetNavigationInfo().Requirements.vertical_speed -- AP VERTICAL SPEED (Meter/Second) + + --local lControlPanel_HSI = LoGetControlPanel_HSI() -- HSI Data + local lHSI_RMI = LoGetControlPanel_HSI().RMI_raw -- VOR1 OBS (Radian) + local lHSI_ADF = LoGetControlPanel_HSI().ADF_raw -- ADF OBS (Radian) + --local lHSI_Heading = LoGetControlPanel_HSI().Heading_raw -- Heading (Radian) + + local lEngineRPMleft = LoGetEngineInfo().RPM.left -- ENG1 RPM % + local lEngineRPMright = LoGetEngineInfo().RPM.right -- ENG2 RPM % + local lEngineTempLeft = LoGetEngineInfo().Temperature.left -- ENG1 EGT ºC + local lEngineTempRight = LoGetEngineInfo().Temperature.right -- ENG2 EGT ºC + --local lEngineFuelInternal = LoGetEngineInfo().fuel_internal -- TANK1 (INT) (KG) + --local lEngineFuelExternal = LoGetEngineInfo().fuel_external -- TANK2 (EXT) (KG) + + --local lMechInfo = LoGetMechInfo() -- mechanical components, e.g. Flaps, Wheelbrakes,... + --local lPayloadInfo = LoGetPayloadInfo() -- Paylod, e.g. bombs, guns, rockets, fuel tanks,... + + local lDistanceToWay = 999 + local lRoute = LoGetRoute() + + if (myData and lRoute) then -- if neither are nil + local myLoc = LoGeoCoordinatesToLoCoordinates(lLongitude, lLatitude) + --lDistanceToWay = math.sqrt((myLoc.x - lRoute.goto_point.world_point.x)^2 + (myLoc.y - lRoute.goto_point.world_point.y)^2) + lDistanceToWay = math.sqrt((myLoc.x - lRoute.goto_point.world_point.x)^2 + (myLoc.z - lRoute.goto_point.world_point.z)^2) + end + + if gES_GlassCockpitType == 1 then + -- HELIOS Version 1.3 + -- customizing for HELOS + lPitch = math.deg(lPitch) -- PITCH, (Radian to Grad) + lBank = math.deg(lBank) -- BANK (Radian to Grad) + lYaw = math.deg(lYaw) -- YAW (Radian to Grad) + lHSI_RMI = math.deg(lHSI_RMI) -- VOR1 OBS (Radian to Grad) + lHSI_ADF = math.deg(lHSI_ADF) -- ADF OBS (Radian to Grad) + lAoA = math.deg(lAoA) -- ANGLE OF ATTACK AoA (Radian to Grad) + lHeading = math.deg(lHeading) -- Heading (Radian to Grad) + lHSI_ADF = (360 - lHSI_ADF) + (360 - lHeading) + lHSI_RMI = 360 - lHSI_RMI + lIAS = lIAS * 3.6 -- change from m/s to km/h + + SendData("1", string.format("%.2f", lPitch) ) + SendData("2", string.format("%.2f", lBank) ) + SendData("3", string.format("%.2f", lYaw) ) + SendData("4", string.format("%.2f", lAltBar) ) + SendData("5", string.format("%.2f", lAltRad) ) + SendData("6", string.format("%.2f", lHSI_ADF) ) + SendData("7", string.format("%.2f", lHSI_RMI) ) + SendData("8", string.format("%.2f", lHeading) ) + SendData("9", string.format("%.2f", lEngineRPMleft) ) + SendData("10", string.format("%.2f", lEngineRPMright) ) + SendData("11", string.format("%.2f", lEngineTempLeft) ) + SendData("12", string.format("%.2f", lEngineTempRight) ) + SendData("13", string.format("%.2f", lVVI) ) + SendData("14", string.format("%.2f", lIAS) ) + SendData("15", string.format("%.2f", lDistanceToWay) ) + SendData("16", string.format("%.2f", lAoA) ) + SendData("17", string.format("%.2f", lGlide) ) + SendData("18", string.format("%.2f", lSide) ) + + elseif gES_GlassCockpitType == 2 then + -- HawgTouch version 1.6 + + local lRadToDCSsignd = math.pi + local lRadToDCSunsignd = math.pi * 2 + local lDefaultNull = 0.0 + local lDefaultOne = 1.0 + + -- IAS Indicator (IAS, Thousend) {"%.4f;%.4f"} + FC_Russian_AirSpeed_1000hkm(1) + + -- AOA Indicator and Accelerometer (AOA, GLoad) + FC_Russian_AOA_MiG29(3) + + -- ADI + FC_Russian_ADI_Old(4) + + -- HSI + FC_Russian_HSI(lDistanceToWay, 5) + + -- Vertical Velocity Indicator (VVI) (VVI, TurnIndicator, SlipBallPosition) + FC_Russian_VVI_Old(6) + + -- Radar Altimeter (AltRad, MinAltitude, WarningFlag, MinAltitudeLamp) {"%.4f;%.4f;%.1f;%.1f"} (below 100m is warning light on) + FC_Russian_RadarAltimeter_1000m(100, 7) + + -- Barometric Altimeter (AltBar, BasicAtmospherePressure) + FC_Russian_BarometricAltimeter_30000(8) + + -- Tachometer (RPM) (EngineRPMleft, EngineRPMright) {"%.4f;%.4f"} + FC_Russian_EngineRPM(9) + + -- Left Jet Engine Turbine Temperature Indicator (EngineTemp) {"%.4f"} + FC_Russian_EGT_1000gc(lEngineTempLeft + 80, 10) -- differenc fromtechnical temperature to showing temperature + + -- Right Jet Engine Turbine Temperature Indicator (EngineTemp) {"%.4f"} + FC_Russian_EGT_1000gc(lEngineTempRight + 80, 11) + + -- Clock from Ka-50 {CurrentHours, CurrentMinutes, CurrentSeconds, 0, FlightTimeHours, FlightTimeMinutes, 0, 0) {"%.4f;%.4f;%.4f;%.1f;%.4f;%.4f;%.4f;%.4f"} + FC_Russian_Clock_ACS1(12) + + -- Mach {max, Mach} + local lMachTmp = 0 + --[[ + y_min = 0.0 -- minimaler Ausgabewert + y_max = 1.0 -- maximaler Ausgabewert + x_min = 0.0 -- minimaler Eingangswert + x_max = 3.0 -- maximaler Eingangswert + x = 1.65 -- aktueller Eingangswert + + d_y = 1.0 -- Delta Ausgabewerte (y_max - y_min) + d_x = 3.0 -- Delta Eingangswerte (x_max - x_min) + m = 0.33333333333333333333333333333333 -- Steigung der linearen Funktion (d_y / d_x) + n = 0.00000000000000000000000000000001 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max) + + y = 0.55 -- Ergebnis (m * x + n) + ]] + lMachTmp = 0.33333333333333333333333333333333 * lMachNumber + 0.00000000000000000000000000000001 + + SendData("13", string.format("%0.4f;%0.4f", lMachTmp, 0.0)) + end + else + WriteToLog("Unknown FC Error, no LoGetSelfData.") + end + +end + +function ProcessHARDWAREConfigHighImportance(mainPanelDevice) +end + +function ProcessGlassCockpitFCLowImportanceConfig() + + if gES_GlassCockpitType == 1 then + -- HELIOS Version 1.3 + + elseif gES_GlassCockpitType == 2 then + -- HawgTouch version 1.6 + + FC_RadarWarning_SPO15(14) + + -- Fuel Quantity Indicator + local lEngineInfo = LoGetEngineInfo() + if lEngineInfo ~= nil then + --WriteToLog('lEngineInfo: '..dump(lEngineInfo)) + --[[ + [fuel_external] = number: "0" + [Temperature] = { + [left] = number: "626.99444580078" + [right] = number: "626.99444580078" + } + [RPM] = { + [left] = number: "87.453765869141" + [right] = number: "87.453758239746" + } + [FuelConsumption] = { + [left] = number: "0.1500396137767" + [right] = number: "0.1500396137767" + } + [fuel_internal] = number: "3773.2749023438" + [EngineStart] = { + [left] = number: "0" + [right] = number: "0" + } + [HydraulicPressure] = { + [left] = number: "210" + [right] = number: "210" + } + lPayloadInfo.Stations[8].CLSID == E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF -- ext 800l Fuel Tank + ]] + + local lTotalFuel = lEngineInfo.fuel_internal + lEngineInfo.fuel_external + --local lTotalFuel = string.format("%3d", math.round((lEngineInfo.fuel_internal / 10), 0, "ceil") * 10) + --local lTotalFuel = string.format("%4d", lEngineInfo.fuel_internal) -- total fuel in kg + --local lTotalFuel = string.format("%4d", lEngineInfo.fuel_external) -- external fuel in kg + local lTotalFuel_7_5 = 0 + local lTotalFuel_5_0 = 0 + + if lTotalFuel < 7500 then + if lTotalFuel > 5000 then + --[[ + y_min = 0.0 -- minimaler Ausgabewert + y_max = 1.0 -- maximaler Ausgabewert + x_min = 5000 -- minimaler Eingangswert + x_max = 7500 -- maximaler Eingangswert + x = 6000 -- aktueller Eingangswert + + d_y = 1 -- Delta Ausgabewerte (y_max - y_min) + d_x = 2500 -- Delta Eingangswerte (x_max - x_min) + m = 0.0004 -- Steigung der linearen Funktion (d_y / d_x) + n = -2.0 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max) + + y = 0.4 -- Ergebnis (m * x + n) + ]] + lTotalFuel_7_5 = 0.0004 * lTotalFuel + -2.0 + else + lTotalFuel_7_5 = 0.0 + end + else + lTotalFuel_7_5 = 1.0 + end + if lTotalFuel < 5000 then + --[[ + y_min = 0.04 -- minimaler Ausgabewert + y_max = 1.0 -- maximaler Ausgabewert + x_min = 0 -- minimaler Eingangswert + x_max = 5000 -- maximaler Eingangswert + x = 3000 -- aktueller Eingangswert + + d_y = 0.96 -- Delta Ausgabewerte (y_max - y_min) + d_x = 5000 -- Delta Eingangswerte (x_max - x_min) + m = 0.000192 -- Steigung der linearen Funktion (d_y / d_x) + n = 0.04 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max) + + y = 0.616 -- Ergebnis (m * x + n) + ]] + lTotalFuel_5_0 = 0.000192 * lTotalFuel + 0.04 + else + lTotalFuel_5_0 = 1.0 + end + + -- TotalFuel_5_0 + -- TotalFuel_7_5 + -- Light1 + -- Light2 + -- Light3 + -- Light4 + -- BingoLight + SendData("15", string.format("%0.4f;%0.4f;%d;%d;%d;%d;%d", + lTotalFuel_5_0, + lTotalFuel_7_5, + 0, + (lEngineInfo.fuel_internal < 3200.0 and 1 or 0), -- Tank warning 1 + (lEngineInfo.fuel_internal < 2800.0 and 1 or 0), -- Tank warning 2 + (lEngineInfo.fuel_internal < 1400.0 and 1 or 0), -- Tank warning 3 + (lEngineInfo.fuel_internal < 800.0 and 1 or 0))) -- Tank warning 4 + + -- Hydraulic Pressure Left + FC_OneNeedleGauge(lEngineInfo.HydraulicPressure.left, 240, 17) + + -- Hydraulic Pressure Right + FC_OneNeedleGauge(lEngineInfo.HydraulicPressure.right, 240, 18) + end + + -- EKRAN Message + FC_EKRAN(16) + + -- Mechanical Configuration Indicator (GearWarningLight, NoseGear, LeftGear, RightGear, Airbreaks, Flaps1, Flaps2) {"%.1f;%d;%d;%d;%d;%d;%d"} + local lMechInfo = LoGetMechInfo() -- mechanical components, e.g. Flaps, Wheelbrakes,... + if lMechInfo ~= nil then + --WriteToLog('lMechInfo: '..dump(lMechInfo)) + local lWarningLight = 0.0 + local lTrueAirSpeed = LoGetTrueAirSpeed() + if lTrueAirSpeed ~= nil then + --WriteToLog('lTrueAirSpeed: '..dump(lTrueAirSpeed)) + lWarningLight = ((lMechInfo.flaps.value > 0.93 and lTrueAirSpeed > 340) and 1.0 or 0.0) -- Speed Warning for Flaps, same light as gear warning light, but blinking light + lWarningLight = (((lMechInfo.gear.status == 1 and lMechInfo.gear.value < 1) or (lMechInfo.gear.status == 0 and lMechInfo.gear.value > 0)) and 1.0 or lWarningLight ) -- gear warning light + end + -- WarningLight {0.0 = Off, 0.1 = blinking light, 0.2 = on} + -- WarningLight {0.0 = Off, no blinking light, 1.0 = on} + + -- left gear {0, 1} + -- right gear {0, 1} + -- nose gear {0, 1} + -- WarningLight + -- Flap 1 + -- Flap 2 + -- Nose Flap + -- Speedbreakes on {0, 1} + SendData("2", string.format("%.1f;%d;%d;%d;%d;%d;%d", + (lMechInfo.gear.value > 0.95 and 1 or 0), -- left gear + (lMechInfo.gear.value == 1 and 1 or 0), -- right gear + (lMechInfo.gear.value > 0.85 and 1 or 0), -- nose gear + lWarningLight, +-- (lMechInfo.flaps.value > 0.47 and 1 or 0), -- flap 1 +-- (lMechInfo.flaps.value > 0.93 and 1 or 0), -- flap 2 + (lMechInfo.flaps.status == 1 and 1 or 0), -- flap 1 + (lMechInfo.flaps.status == 2 and 1 or 0), -- flap 2 + (lMechInfo.noseflap.value > 0.1 and 1 or 0), -- noseflap + (lMechInfo.speedbrakes.status == 1 and 1 or 0))) -- speedbreakes on > 0.1 (0 - 1) + + -- Wheelbrakes Hydraulic Pressure Left + FC_OneNeedleGauge(lMechInfo.wheelbrakes.value, 240, 19) + + -- Wheelbrakes Hydraulic Pressure Right + FC_OneNeedleGauge(lMechInfo.wheelbrakes.value, 240, 20) + end + + -- Airintake + FC_Russian_AirIntake(21) + end + + --(x < 0 and 'negative' or 'non-negative') + --[[ + local lPayloadInfo = LoGetPayloadInfo() + WriteToLog('lPayloadInfo: '..dump(lPayloadInfo)) + + local lSnares = LoGetSnares() -- Flare and Chaff + WriteToLog('lSnares: '..dump(lSnares)) + + local lSightingSystemInfo = LoGetSightingSystemInfo() + WriteToLog('lSightingSystemInfo: '..dump(lSightingSystemInfo)) + + local lTWSInfo = LoGetTWSInfo() -- SPO Informationen, z.B. Radarwarner F15C + WriteToLog('lTWSInfo: '..dump(lTWSInfo)) + + local lTargetInformation = LoGetTargetInformation() -- detalierte Radar Infos z.B. F15C + WriteToLog('lTargetInformation: '..dump(lTargetInformation)) + + local lLockedTargetInformation = LoGetLockedTargetInformation() + WriteToLog('lLockedTargetInformation: '..dump(lLockedTargetInformation)) + + local lF15_TWS_Contacs = LoGetF15_TWS_Contacts() -- the same information but only for F-15 in TWS mode + WriteToLog('lF15_TWS_Contacs: '..dump(lF15_TWS_Contacs)) + + local lMechInfo = LoGetMechInfo() -- mechanical components, e.g. Flaps, Wheelbrakes,... + WriteToLog('lMechInfo: '..dump(lMechInfo)) + + local lMCPState = LoGetMCPState() -- Warnlichter + WriteToLog('lMCPState: '..dump(lMCPState)) + + local lControlPanel_HSI = LoGetControlPanel_HSI() + WriteToLog('lControlPanel_HSI: '..dump(lControlPanel_HSI)) + + local lRadioBeaconsStatus = LoGetRadioBeaconsStatus() + WriteToLog('lRadioBeaconsStatus: '..dump(lRadioBeaconsStatus)) + + local lEngineInfo = LoGetEngineInfo() + WriteToLog('lEngineInfo: '..dump(lEngineInfo)) + ]] + -- Weapon Control System + --local lNameByType = LoGetNameByType () -- args 4 (number : level1,level2,level3,level4), result string + -- values from LoGetTargetInformation().type + --WriteToLog('lNameByType: '..dump(lNameByType)) +end + +function ProcessHARDWAREConfigLowImportance(mainPanelDevice) +-- where necessary, specify HardwareID, example WeaponStatusPanel(2) + WeaponStatusPanel() + MechanicalDevicesIndicator() + StatusLamp() + FuelQuantityIndicator() + SightingSystem() + SPO15RWR() + FlareChaff() +end + +----------------------------- +-- Custom functions -- +----------------------------- + +function SightingSystem(hardware) + local lHardware = hardware or 1 + local lSightingSystemInfo = LoGetSightingSystemInfo() + if lSightingSystemInfo == nil then + return + end + --WriteToLog('lSightingSystemInfo: '..dump(lSightingSystemInfo)9 + --[[ + [PRF] = { + [selection] = string: "ILV" + [current] = string: "MED" + } + [laser_on] = boolean: "false" + [scale] = { + [azimuth] = number: "0.52359873056412" + [distance] = number: "10000" + } + [radar_on] = boolean: "false" + [optical_system_on] = boolean: "false" + [LaunchAuthorized] = boolean: "false" + [ECM_on] = boolean: "false" + [Manufacturer] = string: "RUS" + [TDC] = { + [y] = number: "0" + [x] = number: "0" + } + [ScanZone] = { + [coverage_H] = { + [min] = number: "0" + [max] = number: "20000" + } + [size] = { + [azimuth] = number: "1.0471974611282" + [elevation] = number: "0.17453290522099" + } + [position] = { + [exceeding_manual] = number: "0" + [distance_manual] = number: "0" + [azimuth] = number: "0" + [elevation] = number: "0" + } + } + ]] + SendDataHW("600", lSightingSystemInfo.ECM_on == true and 1 or 0, lHardware ) + SendDataHW("601", lSightingSystemInfo.laser_on == true and 1 or 0, lHardware ) + SendDataHW("602", lSightingSystemInfo.optical_system_on == true and 1 or 0, lHardware ) + SendDataHW("603", lSightingSystemInfo.LaunchAuthorized == true and 1 or 0, lHardware ) + SendDataHW("604", lSightingSystemInfo.radar_on == true and 1 or 0, lHardware ) +end + +function FlareChaff(hardware) + local lHardware = hardware or 1 + local lSnares = LoGetSnares() -- Flare and Chaff + --WriteToLog('lSnares: '..dump(lSnares)) + + --[chaff] = number: "30" + --[flare] = number: "30" + + SendDataHW("800", lSnares.chaff + lSnares.flare, lHardware ) +end + +function StatusLamp(hardware) + local lHardware = hardware or 1 + local lMCPState = LoGetMCPState() -- Warnlichter + if lMCPState == nil then + return + end + --WriteToLog('lMCPState: '..dump(lMCPState)) + --[[ + [RightTailPlaneFailure] = boolean: "false" + [EOSFailure] = boolean: "false" + [ECMFailure] = boolean: "false" + [RightAileronFailure] = boolean: "false" + [MasterWarning] = boolean: "false" + [RightEngineFailure] = boolean: "false" + [CannonFailure] = boolean: "false" + [MLWSFailure] = boolean: "false" + [ACSFailure] = boolean: "false" + [RadarFailure] = boolean: "false" + [HelmetFailure] = boolean: "false" + [HUDFailure] = boolean: "false" + [LeftMainPumpFailure] = boolean: "false" + [RightWingPumpFailure] = boolean: "false" + [LeftWingPumpFailure] = boolean: "false" + [MFDFailure] = boolean: "false" + [RWSFailure] = boolean: "false" + [GearFailure] = boolean: "false" + [HydraulicsFailure] = boolean: "false" + [AutopilotFailure] = boolean: "true" + [FuelTankDamage] = boolean: "false" + [LeftAileronFailure] = boolean: "false" + [CanopyOpen] = boolean: "false" + [RightMainPumpFailure] = boolean: "false" + [StallSignalization] = boolean: "false" + [LeftEngineFailure] = boolean: "false" + [AutopilotOn] = boolean: "false" + [LeftTailPlaneFailure] = boolean: "false" + ]] + + SendDataHW("700", lMCPState.LeftTailPlaneFailure == true and 1 or 0, lHardware ) + SendDataHW("701", lMCPState.RightTailPlaneFailure == true and 1 or 0, lHardware ) + SendDataHW("702", lMCPState.MasterWarning == true and 1 or 0, lHardware ) + SendDataHW("703", lMCPState.LeftEngineFailure == true and 1 or 0, lHardware ) + SendDataHW("704", lMCPState.RightEngineFailure == true and 1 or 0, lHardware ) + SendDataHW("705", lMCPState.LeftAileronFailure == true and 1 or 0, lHardware ) + SendDataHW("706", lMCPState.RightAileronFailure == true and 1 or 0, lHardware ) + SendDataHW("707", lMCPState.LeftMainPumpFailure == true and 1 or 0, lHardware ) + SendDataHW("708", lMCPState.RightMainPumpFailure == true and 1 or 0, lHardware ) + SendDataHW("709", lMCPState.LeftWingPumpFailure == true and 1 or 0, lHardware ) + SendDataHW("710", lMCPState.RightWingPumpFailure == true and 1 or 0, lHardware ) + SendDataHW("711", lMCPState.EOSFailure == true and 1 or 0, lHardware ) + SendDataHW("712", lMCPState.ECMFailure == true and 1 or 0, lHardware ) + SendDataHW("713", lMCPState.CannonFailure == true and 1 or 0, lHardware ) + SendDataHW("714", lMCPState.MLWSFailure == true and 1 or 0, lHardware ) + SendDataHW("715", lMCPState.ACSFailure == true and 1 or 0, lHardware ) + SendDataHW("716", lMCPState.RadarFailure == true and 1 or 0, lHardware ) + SendDataHW("717", lMCPState.HelmetFailure == true and 1 or 0, lHardware ) + SendDataHW("718", lMCPState.HUDFailure == true and 1 or 0, lHardware ) + SendDataHW("719", lMCPState.MFDFailure == true and 1 or 0, lHardware ) + SendDataHW("720", lMCPState.RWSFailure == true and 1 or 0, lHardware ) + SendDataHW("721", lMCPState.GearFailure == true and 1 or 0, lHardware ) + SendDataHW("722", lMCPState.HydraulicsFailure == true and 1 or 0, lHardware ) + SendDataHW("723", lMCPState.AutopilotFailure == true and 1 or 0, lHardware ) + SendDataHW("724", lMCPState.FuelTankDamage == true and 1 or 0, lHardware ) + SendDataHW("725", lMCPState.CanopyOpen == true and 1 or 0, lHardware ) + SendDataHW("726", lMCPState.StallSignalization == true and 1 or 0, lHardware ) + SendDataHW("727", lMCPState.AutopilotOn == true and 1 or 0, lHardware ) + + local lEngineInfo = LoGetEngineInfo() + if lEngineInfo ~= nil then + --WriteToLog('lEngineInfo: '..dump(lEngineInfo)) + + SendDataHW("728", lEngineInfo.EngineStart.left, lHardware ) -- lamp start left engine 1 (0|1) + SendDataHW("729", lEngineInfo.EngineStart.right, lHardware ) -- lamp start right engine 1 (0|1) + + SendDataHW("730", (lEngineInfo.RPM.left > 100.0 and 1 or 0), lHardware ) -- lamp after burner left engine + SendDataHW("731", (lEngineInfo.RPM.right > 100.0 and 1 or 0), lHardware ) -- lam after burner right engine + end + + local lAccelerationUnits = LoGetAccelerationUnits() + if lAccelerationUnits ~= nil then + --WriteToLog('lAccelerationUnits: '..dump(lAccelerationUnits)) + SendDataHW("732", (lAccelerationUnits.y > 8.0 and 1 or 0), lHardware ) -- lamp Over-G warning + end +end + +function WeaponStatusPanel(hardware) + local lHardware = hardware or 1 +-- The weapon status panel, quantity and readiness of the currently selected weapon and the remaining gun ammunition are indicated. + gES_PayloadInfo = LoGetPayloadInfo() + if gES_PayloadInfo == nil then + return + end + --WriteToLog('gES_PayloadInfo: '..dump(gES_PayloadInfo)) + --[[ exsample + [Stations] = { + [1] = { + [CLSID] = string: "{FBC29BFE-3D24-4C64-B81D-941239D12249}" + [container] = boolean: "false" + [count] = number: "1" + [weapon] = { + [level3] = number: "7" + [level1] = number: "4" + [level4] = number: "18" + [level2] = number: "4" + } + } + [2] = { + [CLSID] = string: "{FBC29BFE-3D24-4C64-B81D-941239D12249}" + [container] = boolean: "false" + [count] = number: "1" + [weapon] = { + [level3] = number: "7" + [level1] = number: "4" + [level4] = number: "18" + [level2] = number: "4" + } + } + [3] = { + [CLSID] = string: "{B4C01D60-A8A3-4237-BD72-CA7655BC0FE9}" + [container] = boolean: "false" + [count] = number: "1" + [weapon] = { + [level3] = number: "7" + [level1] = number: "4" + [level4] = number: "19" + [level2] = number: "4" + } + } + [4] = { + [CLSID] = string: "{B4C01D60-A8A3-4237-BD72-CA7655BC0FE9}" + [container] = boolean: "false" + [count] = number: "1" + [weapon] = { + [level3] = number: "7" + [level1] = number: "4" + [level4] = number: "19" + [level2] = number: "4" + } + } + [5] = { + [CLSID] = string: "{B4C01D60-A8A3-4237-BD72-CA7655BC0FE9}" + [container] = boolean: "false" + [count] = number: "1" + [weapon] = { + [level3] = number: "7" + [level1] = number: "4" + [level4] = number: "19" + [level2] = number: "4" + } + } + [6] = { + [CLSID] = string: "{B4C01D60-A8A3-4237-BD72-CA7655BC0FE9}" + [container] = boolean: "false" + [count] = number: "1" + [weapon] = { + [level3] = number: "7" + [level1] = number: "4" + [level4] = number: "19" + [level2] = number: "4" + } + } + [7] = { + [CLSID] = string: "{2BEC576B-CDF5-4B7F-961F-B0FA4312B841}" + [container] = boolean: "false" + [count] = number: "1" + [weapon] = { + [level3] = number: "43" + [level1] = number: "1" + [level4] = number: "17" + [level2] = number: "3" + } + } + } + [CurrentStation] = number: "3" + [Cannon] = { + [shells] = number: "150" + } + ]] + --[[ + Weapon Panel + | + ------------------------------- + | | | | | | | + 1 2 3 C 4 5 6 + ]] + -- Payload Info + -- weapon stations (panel) 1 (left) - 10 (right), no lamp for center station + SendDataHW("100", gES_PayloadInfo.Cannon.shells ) -- count cannon shells + SendDataHW("101", (gES_PayloadInfo.Stations[1].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 1) + SendDataHW("111", (gES_PayloadInfo.Stations[2].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 6) + SendDataHW("102", (gES_PayloadInfo.Stations[3].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 2) + SendDataHW("103", (gES_PayloadInfo.Stations[4].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 5) + SendDataHW("104", (gES_PayloadInfo.Stations[5].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 3) + SendDataHW("105", (gES_PayloadInfo.Stations[6].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 4) + --SendDataHW("106", (gES_PayloadInfo.Stations[7].count > 0 and 1 or 0) ) -- weapon presend > 0 center station, not visible + --SendDataHW("CurrentStation", gES_PayloadInfo.CurrentStation ) + + -- defination + gES_TmpStationToPanel = {} + gES_TmpStationToPanel[1] = {Panel = 1, StationID = 101, CurrentID = 201, HardwareID = lHardware } -- left + gES_TmpStationToPanel[2] = {Panel = 6, StationID = 106, CurrentID = 206, HardwareID = lHardware } -- right + gES_TmpStationToPanel[3] = {Panel = 2, StationID = 102, CurrentID = 202, HardwareID = lHardware } + gES_TmpStationToPanel[4] = {Panel = 5, StationID = 103, CurrentID = 203, HardwareID = lHardware } + gES_TmpStationToPanel[5] = {Panel = 3, StationID = 104, CurrentID = 204, HardwareID = lHardware } + gES_TmpStationToPanel[6] = {Panel = 4, StationID = 105, CurrentID = 205, HardwareID = lHardware } + + if gES_PayloadInfo.CurrentStation ~= 0 then -- gegebenenfalls prüfen ob sich CurrentStation geändert hat + SendDataHW(gES_TmpStationToPanel[gES_PayloadInfo.CurrentStation].CurrentID, 1, lHardware) -- eigentliche Auswahl + table.foreach(gES_PayloadInfo.Stations, WeaponStatusPanel_selectCurrentPayloadStation) -- zugehörige Stationen + end +end + +function FuelQuantityIndicator(hardware) + local lHardware = hardware or 1 +-- Fuel quantity shows the fuel remaining in all tanks + local lEngineInfo = LoGetEngineInfo() + if lEngineInfo == nil then + return + end + --WriteToLog('lEngineInfo: '..dump(lEngineInfo)) + --[[ + [fuel_external] = number: "0" + [Temperature] = { + [left] = number: "626.99444580078" + [right] = number: "626.99444580078" + } + [RPM] = { + [left] = number: "87.453765869141" + [right] = number: "87.453758239746" + } + [FuelConsumption] = { + [left] = number: "0.1500396137767" + [right] = number: "0.1500396137767" + } + [fuel_internal] = number: "3773.2749023438" + [EngineStart] = { + [left] = number: "0" + [right] = number: "0" + } + [HydraulicPressure] = { + [left] = number: "210" + [right] = number: "210" + } + lPayloadInfo.Stations[7].CLSID == 2BEC576B-CDF5-4B7F-961F-B0FA4312B841 -- ext 1500l Fuel Tank + ]] + + SendDataHW("300", string.format("%d", math.round(((lEngineInfo.fuel_internal + lEngineInfo.fuel_external) / 10), 0, "ceil") * 10), lHardware ) -- total fuel in kg + --SendDataHW("301", string.format("%d", lEngineInfo.fuel_internal)) -- internal fuel in kg + --SendDataHW("302", string.format("%d", lEngineInfo.fuel_external)) -- external fuel in kg + + --[[ + local lPayloadInfo = LoGetPayloadInfo() + if lPayloadInfo ~= nil then + --WriteToLog('lPayloadInfo: '..dump(lPayloadInfo)) + if lPayloadInfo.Stations[7].CLSID == "{2BEC576B-CDF5-4B7F-961F-B0FA4312B841}" then -- center tanks presend and full + SendDataHW("303", ((lEngineInfo.fuel_external < 1200.0 ) and 1 or 0), lHardware ) + else + SendDataHW("303", 1, lHardware ) + end + if lPayloadInfo.Stations[3].CLSID == "{C0FF4842-FBAC-11d5-9190-00A0249B6F00}" or + lPayloadInfo.Stations[4].CLSID == "{C0FF4842-FBAC-11d5-9190-00A0249B6F00}" then -- external tank presend and full (panel 2 and 5) + SendDataHW("304", ((lEngineInfo.fuel_internal < 2830.0 ) and 1 or 0), lHardware ) + else + SendDataHW("304", 1, lHardware ) + end + else + SendDataHW("303", 1, lHardware ) + SendDataHW("304", 1, lHardware ) + end]] + + SendDataHW("304", (lEngineInfo.fuel_internal < 3200.0 and 1 or 0), lHardware ) -- Tank warning 1 + SendDataHW("305", (lEngineInfo.fuel_internal < 2800.0 and 1 or 0), lHardware ) -- Tank warning 2 + SendDataHW("306", (lEngineInfo.fuel_internal < 1390.0 and 1 or 0), lHardware ) -- Tank warning 3 + SendDataHW("307", (lEngineInfo.fuel_internal < 760.0 and 1 or 0), lHardware ) -- Tank warning 4 + --SendDataHW("308", (lEngineInfo.fuel_internal < 600.0 and 1 or 0), lHardware ) -- Bingo Fuel + +end + +function MechanicalDevicesIndicator(hardware) + local lHardware = hardware or 1 +-- The mechanical devices indicator shows the position of the landing gear, flaps, leading edge flaps and airbrake + local lMechInfo = LoGetMechInfo() -- mechanical components, e.g. Flaps, Wheelbrakes,... + if lMechInfo == nil then + return + end + --[[ + [hook] = { + [status] = number: "0" + [value] = number: "0" + } + [parachute] = { + [status] = number: "0" + [value] = number: "0" + } + [controlsurfaces] = { + [eleron] = { + [left] = number: "0" + [right] = number: "-0.21084336936474" + } + [elevator] = { + [left] = number: "-0" + [right] = number: "-0" + } + [rudder] = { + [left] = number: "0" + [right] = number: "0" + } + } + [airintake] = { + [status] = number: "0" + [value] = number: "0" + } + [canopy] = { + [status] = number: "0" + [value] = number: "0" + } + [refuelingboom] = { + [status] = number: "0" + [value] = number: "0" + } + [wing] = { + [status] = number: "0" + [value] = number: "0" + } + [noseflap] = { + [status] = number: "0" + [value] = number: "0" + } + [gear] = { + [value] = number: "0" + [nose] = { + [rod] = number: "0" + } + [main] = { + [left] = { + [rod] = number: "0" + } + [right] = { + [rod] = number: "0" + } + } + [status] = number: "0" + } + [speedbrakes] = { + [status] = number: "0" + [value] = number: "0" + } + [wheelbrakes] = { + [status] = number: "0" + [value] = number: "0" + } + [flaps] = { + [status] = number: "0" + [value] = number: "0" + }]] + --SendDataHW("500", lMechInfo.gear.status ) + --SendDataHW("501", lMechInfo.gear.value ) + --SendDataHW("502", lMechInfo.gear.nose.rod ) -- zeigt an wie weit das Fahrwerk einsackt wenn das Flugzeug auf dem Boden ist + --SendDataHW("503", lMechInfo.gear.main.left.rod ) -- zeigt an wie weit das Fahrwerk einsackt wenn das Flugzeug auf dem Boden ist + --SendDataHW("504", lMechInfo.gear.main.right.rod ) -- zeigt an wie weit das Fahrwerk einsackt wenn das Flugzeug auf dem Boden ist + --SendDataHW("500", ((lMechInfo.gear.status == 1 and lMechInfo.gear.value < 1) and 1 or 0 ) ) -- gear warning light, go up + --SendDataHW("500", ((lMechInfo.gear.status == 0 and lMechInfo.gear.value > 0) and 1 or 0 ) ) -- gear warning light, go down + SendDataHW("500", (((lMechInfo.gear.status == 1 and lMechInfo.gear.value < 1) or (lMechInfo.gear.status == 0 and lMechInfo.gear.value > 0)) and 1 or 0 ), lHardware ) -- gear warning light + SendDataHW("501", (lMechInfo.gear.value > 0.85 and 1 or 0), lHardware ) -- nose gear + SendDataHW("502", (lMechInfo.gear.value > 0.95 and 1 or 0), lHardware ) -- left gear + SendDataHW("503", (lMechInfo.gear.value == 1 and 1 or 0), lHardware ) -- right gear + + --SendDataHW("510", lMechInfo.speedbrakes.status ) -- speedbreakes on 1 (0|1) + SendDataHW("510", (lMechInfo.speedbrakes.value > 0.1 and 1 or 0), lHardware ) -- speedbreakes on > 0.1 (0 - 1) + + --SendDataHW("520", lMechInfo.wheelbrakes.status ) -- not in use + --SendDataHW("521", lMechInfo.wheelbrakes.value ) -- not in use + + local lGetTrueAirSpeed = LoGetTrueAirSpeed() + --SendDataHW("530", lMechInfo.flaps.status ) -- flap switch off 0, 1. position 1, 2. position 2 (0|1|2) + --SendDataHW("531", lMechInfo.flaps.value ) -- flap 1. position > 0.25, 2. position > 0.93 (0 - 1) + SendDataHW("531", (lMechInfo.flaps.value > 0.25 and 1 or 0), lHardware ) -- flap 1. position + SendDataHW("532", (lMechInfo.flaps.value > 0.93 and 1 or 0), lHardware ) -- flap 2. position + SendDataHW("533", ((lMechInfo.flaps.value > 0.93 and lGetTrueAirSpeed > 340) and 1 or 0), lHardware ) -- Speed Warning for Flaps, same light as gear warning light, but blinking light + + --SendDataHW("540", lMechInfo.parachute.status ) + SendDataHW("541", (lMechInfo.parachute.value < 0.5 and 1 or 0), lHardware ) + + --SendDataHW("550", lMechInfo.noseflap.status ) + SendDataHW("551", (lMechInfo.noseflap.value > 20.0 and 1 or 0), lHardware ) + + SendDataHW("560", lMechInfo.airintake.status, lHardware ) + --SendDataHW("561", lMechInfo.airintake.value ) +end \ No newline at end of file diff --git a/ExportsModules/P-51D.lua b/ExportsModules/P-51D.lua new file mode 100644 index 0000000..1482831 --- /dev/null +++ b/ExportsModules/P-51D.lua @@ -0,0 +1,559 @@ +-- P-51D Export +-- Version 0.9.9 BETA + +gES_FoundDCSModule = true + +gES_GlassCockpitConfigEveryFrameArguments = +{ + --[[ + every frames arguments + based of "mainpanel_init.lua" + Example (http://www.lua.org/manual/5.1/manual.html#pdf-string.format) + [DeviceID] = "Format" + [4] = "%.4f", <- floating-point number with 4 digits after point + [19] = "%0.1f", <- floating-point number with 1 digit after point + [129] = "%1d", <- decimal number + ]] + -- Flight Instruments + [11] = "%.4f", -- AirspeedNeedle + [29] = "%.4f", -- Variometer + -- Altimeter + [97] = "%.4f", -- Altimeter_Pressure + [96] = "%.41f", -- Altimeter_10000_footPtr + [24] = "%.4f", -- Altimeter_1000_footPtr + [25] = "%.4f", -- Altimeter_100_footPtr + -- Artificial horizon + [15] = "%.4f", -- AHorizon_Pitch + [14] = "%.4f", -- AHorizon_Bank + [16] = "%.1f", -- AHorizon_PitchShift + [20] = "%.1f", -- AHorizon_Caged + -- directional gyro + [12] = "%.4f", -- GyroHeading + -- turn indicator + [27] = "%.4f", -- TurnNeedle + [28] = "%.4f", -- Slipball + -- oxygen pressure indicator + [34] = "%.4f", -- Oxygen_Pressure + [33] = "%.4f", -- Oxygen_Flow_Blinker + -- fuel system + [155] = "%.4f", -- Fuel_Tank_Left + [156] = "%.4f", -- Fuel_Tank_Right + [160] = "%.4f", -- Fuel_Tank_Fuselage + [32] = "%.4f", -- Fuel_Pressure + -- A-11 clock + [4] = "%.4f", -- CLOCK_currtime_hours + [5] = "%.4f", -- CLOCK_currtime_minutes + [6] = "%.4f", -- CLOCK_currtime_seconds + -- AN5730 remote compass + [1] = "%.4f", -- CompassHeading + [2] = "%.4f", -- CommandedCourse + [3] = "%.4f", -- CommandedCourseKnob + -- TailRadarWarning + [161] = "%.1f", -- Lamp TailRadarWarning + -- SCR-522A Control panel + [122] = "%.1f", -- A_channel_light + [123] = "%.1f", -- B_channel_light + [124] = "%.1f", -- C_channel_light + [125] = "%.1f", -- D_channel_light + [126] = "%.1f", -- Transmit_light + -- hydraulic pressure + [78] = "%.4f", -- Hydraulic_Pressure + -- Landing gears handle + [150] = "%.4f", -- Landing_Gear_Handle + [151] = "%.4f", -- Landing_Gear_Handle_Indoor + [80] = "%.1f", -- LandingGearGreenLight + [82] = "%.1f", -- LandingGearRedLight + -- gauges + [10] = "%.4f", -- Manifold_Pressure + [23] = "%.4f", -- Engine_RPM + [9] = "%.4f", -- Vacuum_Suction + [21] = "%.4f", -- Carb_Temperature + [22] = "%.4f", -- Coolant_Temperature + [30] = "%.4f", -- Oil_Temperature + [31] = "%.4f", -- Oil_Pressure + [164] = "%.1f", -- Left_Fluor_Light + [165] = "%.1f", -- Right_Fluor_Light + [59] = "%.1f", -- Hight_Blower_Lamp + -- Trimmer + [170] = "%.4f", -- Aileron_Trimmer + [172] = "%.4f", -- Rudder_Trimmer + [171] = "%.4f", -- Elevator_Trimmer + [174] = "%.4f", -- Control_Lock_Bracket + [175] = "%.4f", -- Accelerometer_main + [177] = "%.4f", -- Accelerometer_min + [178] = "%.4f", -- Accelerometer_max + [101] = "%.4f", -- Ammeter + -- light + [185] = "%.1f", -- Left_cockpit_light + [186] = "%.1f", -- Right_cockpit_light + [190] = "%.4f", -- warEmergencyPowerLimWire + ------------- + [181] = "%.4f", -- Panel_Shake_Z + [180] = "%.4f", -- Panel_Shake_Y + [189] = "%.4f", -- Panel_Rot_X + [162] = "%.1f", -- Canopy_Trucks + [163] = "%.1f", -- Canopy_Visibility + -- Stick + [50] = "%.4f", -- StickPitch + [51] = "%.4f", -- StickBank + -- RudderPedals + [54] = "%.4f", -- RudderPedals + [55] = "%.4f", -- Left_Wheel_Brake + [56] = "%.4f", -- Right_Wheel_Brake + -- K-14 gunsight + [36] = "%.4f", -- sightRange + [188] = "%.4f", -- K_14_Shake_Z + [187] = "%.4f", -- K_14_Shake_Y + ------------- + [45] = "%.4f", -- ThrottleTwistGrip + ------------- + [77] = "%.4f" -- Rocket_Counter +} + +gES_GlassCockpitConfigArguments = +{ + --[[ + arguments for export in low tick interval + based on "clickabledata.lua" + ]] + -- Right Swich Panel + [102] = "%d", -- Generator Connect/Disconnect + [103] = "%d", -- Battery Connect/Disconnect + [104] = "%d", -- Gun Heating ON/OFF + [105] = "%d", -- Pitot Heating ON/OFF + [106] = "%d", -- Wing Position Lights Bright/Off/Dim + [107] = "%d", -- Tail Position Lights Bright/Off/Dim + [108] = "%d", -- Red Recognition Light Key/Off/Steady + [109] = "%d", -- Green Recognition Light Key/Off/Steady + [110] = "%d", -- Amber Recognition Light Key/Off/Steady + [111] = "%d", -- Recognition Lights Key + [112] = "%d", -- Circuit Protectors Reset + [100] = "%d", -- Right Fluorescent Light + [90] = "%d", -- Left Fluorescent Light + -- Flight Instrument panel + [3] = "%.4f", -- Course Set + [179] = "%.4f", -- Heading Set/Cage + [13] = "%d", -- Heading Set/Cage Button + [17] = "%.4f", -- Pitch Adjustment + [19] = "%.4f", -- Cage + [18] = "%d", -- Cage Button + [8] = "%d", -- Winding/Adjustment Clock ?? + [7] = "%d", -- Winding/Adjustment Clock ?? + [26] = "%.4f", -- Set Pressure + -- SCR-522A Control panel + [117] = "%d", -- Radio ON/OFF + [118] = "%d", -- A Channel Activate + [119] = "%d", -- B Channel Activate + [120] = "%d", -- C Channel Activate + [121] = "%d", -- D Channel Activate + [127] = "%.4f", -- Radio Lights Dimmer + [116] = "%.4f", -- Radio Audio Volume + [44] = "%d", -- Microphone On + [129] = "%d", -- Switch Locking Lever + [128] = "%.4f", -- Radio Mode Transmit/Receive/Remote + ------------- + [71] = "%.4f", -- Cockpit Lights + [66] = "%0.1f", -- Ignition Off/Right/Left/Both + [67] = "%d", -- Gun control Gun And Camera On/Gun And Camera OFF/Camera On + [72] = "%d", -- Silence Landing Gear Warning Horn Cut Off + -- Bomb Arm/Chemical + [69] = "%d", -- Left Bomb Arm/Chemical + [70] = "%d", -- Right Bomb Arm/Chemical + -- Release Mode + [68] = "%0.1f", -- Release Mode, Bombs and Rockets Safe/Bombs Train Release/Bombs Both Release/Rockets Arm + [73] = "%0.1f", -- Rockets Release Mode Off/Single/Auto + [74] = "%d", -- Rockets Delay Switch Delay/Int + [75] = "%0.1f", -- Rockets Counter Control + -- Engine Control Panel + [58] = "%d", -- Supercharger Switch Cover + [57] = "%0.1f", -- Supercharger AUTO/LOW/HIGH + [60] = "%d", -- High Blower Lamp Test + [61] = "%d", -- Fuel Booster On/Off + [62] = "%d", -- Oil Dilute Activate + [63] = "%d", -- Starter Activate + [64] = "%d", -- Starter Switch Cover + [65] = "%d", -- Primer Activate + -- Oxygen Regulator + [131] = "%d", -- Auto-Mix On-Off + [130] = "%0.4f", -- Oxygen Emergency By-pass + -- Fuel system + [85] = "%0.1f", -- Fuel Selector Valve, Select Right Combat Tank/Select Left Main Tank/Select Fuselage Tank/Select Right Main Tank/Select Left Combat Tank + [86] = "%d", -- Fuel Shut-Off Valve ON/OFF + -- AN/APS-13 + [114] = "%d", -- ail Warning Radar Power ON/OFF + [115] = "%d", -- Tail Warning Radar Test + [113] = "%.4f", -- Tail Warning Radar Light Control + ------------- + [79] = "%.4f", -- Hydraulic Release Knob + [94] = "%.4f", -- Flaps Control Handle + [84] = "%d", -- Parking Brake Handle + [81] = "%d", -- Safe Landing Gear Light Test + [83] = "%d", -- Unsafe Landing Gear Light Test + -- Detrola receiver + [137] = "%0.4f", -- Detrola Frequency Selector + [138] = "%0.4f", -- Detrola Volume + -- canopy + [147] = "%.4f", -- Canopy Hand Crank + [149] = "%d", -- Canopy Emergency Release Handle + -- AN/ARA-8 + [152] = "%0.1f", -- Homing Adapter Mode TRANSMIT/COMM./HOMING + [153] = "%d", -- Homing Adapter Power On/Off + [154] = "%d", -- Homing Adapter's Circuit Breaker + -- SCR-695 + [139] = "%0.1f", -- IFF Code Selector Code 1/2/3/4/5/6 + [140] = "%d", -- IFF Power On/Off + [141] = "%d", -- IFF TIME/OFF/ON + [142] = "%d", -- IFF Detonator Circuit On/Off + [143] = "%d", -- IFF Distress Signal On/Off + [145] = "%d", -- IFF Detonator Left + [146] = "%d", -- IFF Detonator Right + -- Trimmers + [91] = "%.4f", -- Aileron Trim + [92] = "%.4f", -- Elevator Trim + [93] = "%.4f", -- Rudder Trim + ------------- + [157] = "%.4f", -- Defroster + [158] = "%.4f", -- Cold Air + [159] = "%.4f", -- Hot Air + ------------- + [89] = "%d", -- Landing Light On/Off + [168] = "%d", -- Coolant Control Cover + [87] = "%0.1f", -- Close Coolant Control/Automatic Coolant Control/Open Coolant Control + [169] = "%d", -- Oil Control Cover + [88] = "%0.1f", -- Close Oil Control/Automatic Oil Control/Open Oil Control + [134] = "%0.1f", -- Carburetor Cold Air Control + [135] = "%0.1f", -- Carburetor Warm Air Control + [47] = "%0.1f", -- Mixture Control Select IDLE CUT OFF/RUN/EMERGENCY FULL RICH + [43] = "%.4f", -- Throttle + [46] = "%.4f", -- Propeller RPM + [173] = "%.4f", -- Surface Control Lock Plunger. Left Button - Lock Stick in the Forward Position', Right Button - Lock Stick in the Neutral Position + [48] = "%.4f", -- Lock Throttle + [49] = "%.4f", -- Lock Propeller & Mixture + [176] = "%.4f", -- G-meter reset + [183] = "%.4f", -- Mirror + --Gunsight Selector + [41] = "%d", -- Sight On/Off + [39] = "%d", -- Fixed Reticle Mask Lever + [40] = "%0.1f", -- Sight Mode, Fixed Sight/Fixed-Gyro Sight/Gyro Sight + [42] = "%.4f", -- Gun Sight Brightness + [35] = "%.4f", -- Wing Span Selector + ------------- + [132] = "%.4f", -- Left Payload Salvo + [133] = "%.4f" -- Right Payload Salvo +} + +----------------------------- +-- HIGH IMPORTANCE EXPORTS -- +-- done every export event -- +----------------------------- + +function ProcessGlassCockpitDCSConfigHighImportance(mainPanelDevice) + --[[ + every frame export to GlassCockpit + Example from A-10C + Get Radio Frequencies + get data from device + local lUHFRadio = GetDevice(54) + SendData("ExportID", "Format") + SendData(2000, string.format("%7.3f", lUHFRadio:get_frequency()/1000000)) <- special function for get frequency data + ]] + if gES_GlassCockpitType == 1 then + -- HELIOS Version 1.3 +-- WriteToLog('in ProcessGlassCockpitDCSConfigHighImportance - HELIOS: '..t) + local MainPanel = GetDevice(0) + local AirspeedNeedle = MainPanel:get_argument_value(11)*1000 + local Altimeter_10000_footPtr = MainPanel:get_argument_value(96)*100000 + local Variometer = MainPanel:get_argument_value(29) + local TurnNeedle = MainPanel:get_argument_value(27) + local Slipball = MainPanel:get_argument_value(28) + local CompassHeading = MainPanel:get_argument_value(1) + local CommandedCourse = MainPanel:get_argument_value(2) + local Manifold_Pressure = MainPanel:get_argument_value(10) + local Engine_RPM = MainPanel:get_argument_value(23) + local AHorizon_Pitch = MainPanel:get_argument_value(15) + local AHorizon_Bank = MainPanel:get_argument_value(14) + local AHorizon_PitchShift = MainPanel:get_argument_value(16) * 10.0 * math.pi/180.0 + local AHorizon_Caged = MainPanel:get_argument_value(20) + local GyroHeading = MainPanel:get_argument_value(12) + local vaccum_suction = MainPanel:get_argument_value(9) + local carburator_temp = MainPanel:get_argument_value(21) + local coolant_temp = MainPanel:get_argument_value(22) + local Acelerometer = MainPanel:get_argument_value(175) + local OilTemperature = MainPanel:get_argument_value(30) + local OilPressure = MainPanel:get_argument_value(31) + local FuelPressure = MainPanel:get_argument_value(32) + local Clock_hours = MainPanel:get_argument_value(4) + local Clock_minutes = MainPanel:get_argument_value(5) + local Clock_seconds = MainPanel:get_argument_value(6) + local LandingGearGreenLight = MainPanel:get_argument_value(80) + local LandingGearRedLight = MainPanel:get_argument_value(82) + local Hight_Blower_Lamp = MainPanel:get_argument_value(59) + local Acelerometer_Min = MainPanel:get_argument_value(177) + local Acelerometer_Max = MainPanel:get_argument_value(178) + local Ammeter = MainPanel:get_argument_value(101) + local hydraulic_Pressure = MainPanel:get_argument_value(78) + local Oxygen_Flow_Blinker = MainPanel:get_argument_value(33) + local Oxygen_Pressure = MainPanel:get_argument_value(34) + local Fuel_Tank_Left = MainPanel:get_argument_value(155) + local Fuel_Tank_Right = MainPanel:get_argument_value(156) + local Fuel_Tank_Fuselage = MainPanel:get_argument_value(160) + local Tail_radar_warning = MainPanel:get_argument_value(161) + local Channel_A = MainPanel:get_argument_value(122) + local Channel_B = MainPanel:get_argument_value(123) + local Channel_C = MainPanel:get_argument_value(124) + local Channel_D = MainPanel:get_argument_value(125) + local transmit_light = MainPanel:get_argument_value(126) + local RocketCounter = MainPanel:get_argument_value(77) + + --- preparing landing gear and High Blower lights, all together, in only one value + local gear_lights = 0 + if LandingGearGreenLight > 0 then gear_lights = gear_lights +100 end + if LandingGearRedLight > 0 then gear_lights = gear_lights +10 end + if Hight_Blower_Lamp > 0 then gear_lights = gear_lights +1 end + ------------------------------------------------------------ + + --- preparing radio lights, all together, in only one value + local radio_active = 0 + if Channel_A > 0 then radio_active = 1 end + if Channel_B >0 then radio_active= 2 end + if Channel_C >0 then radio_active= 3 end + if Channel_D >0 then radio_active= 4 end + if transmit_light >0 then radio_active = radio_active + 10 end + ------------------------------------------------------------ + + + ---- sending P51 and tf51 data across fc2 interface + ----Please comment out the appropriate entries in the table 'gES_GlassCockpitConfigEveryFrameArguments'. + + SendData("1", string.format("%.5f", math.floor((AHorizon_Pitch+1)*1000) + ((AHorizon_Bank+1)/100) ) ) -- pitch + SendData("2", string.format("%.3f", math.floor(Oxygen_Flow_Blinker*100) + (Oxygen_Pressure/100) ) ) -- bank + SendData("3", string.format("%.4f", math.floor(OilTemperature*100) + (vaccum_suction/100) ) ) -- yaw + SendData("4", string.format("%.3f", math.floor(Altimeter_10000_footPtr) + (AHorizon_Caged/100) ) ) -- barometric altitude + SendData("5", string.format("%.5f", math.floor(Clock_hours*1000000) + (Tail_radar_warning/100) ) ) -- radar altitude + SendData("6", string.format("%.5f", math.floor(CompassHeading*1000) + (CommandedCourse/100) ) ) -- adf + SendData("7", string.format("%.4f", math.floor(Clock_seconds*100) + (hydraulic_Pressure/100) ) ) -- rmi + SendData("8", string.format("%.2f", math.floor(GyroHeading*1000) + (radio_active/100) ) ) -- heading + SendData("9", string.format("%.4f", math.floor(Engine_RPM*100) + (Manifold_Pressure/100) ) ) -- left rpm + SendData("10", string.format("%.4f", math.floor(Fuel_Tank_Left*100) + (Fuel_Tank_Right/100) ) ) -- right rpm + SendData("11", string.format("%.4f", math.floor(carburator_temp*100) + (coolant_temp/100) ) ) -- left temp + SendData("12", string.format("%.4f", math.floor(gear_lights) + (Acelerometer_Min/100 ) ) ) -- right temp + SendData("13", string.format("%.2f", Variometer) ) -- vvi + SendData("14", string.format("%.5f", math.floor(AirspeedNeedle)+ (RocketCounter/100) ) ) -- ias + SendData("15", string.format("%.4f", math.floor(OilPressure*100) + (FuelPressure/100) ) ) -- distance to way + SendData("16", string.format("%.3f", math.floor(Acelerometer*1000) + (Acelerometer_Max/100 ) ) ) -- aoa + SendData("17", string.format("%.4f", math.floor((TurnNeedle+1)*100) + ((Slipball+1)/100) ) ) -- glide + SendData("18", string.format("%.4f", math.floor(Fuel_Tank_Fuselage*100) + (Ammeter/100) ) ) -- side + + elseif gES_GlassCockpitType == 2 then + -- HawgTouch version 1.6 +-- WriteToLog('in ProcessGlassCockpitDCSConfigHighImportance - HawgTouch: '..t) + -- ADI AN5736 + -- Artificial horizon + --[15] = "%.4f", -- AHorizon_Pitch {1.0, -1.0} + --[14] = "%.4f", -- AHorizon_Bank {1.0, -1.0} + --[16] = "%.1f", -- AHorizon_PitchShift + --[20] = "%.1f", -- AHorizon_Caged + SendData(2000, string.format("%0.4f;%0.4f", + mainPanelDevice:get_argument_value(15), + mainPanelDevice:get_argument_value(14))) + -- turn indicator AN5820 + --[27] = "%.4f", -- TurnNeedle {-1.0, 1.0} + --[28] = "%.4f", -- Slipball {-1.0, 1.0} + SendData(2001, string.format("%0.4f;%0.4f", + mainPanelDevice:get_argument_value(27), + mainPanelDevice:get_argument_value(28))) + -- directional gyro AN5735 + --[12] = "%.1f", -- GyroHeading {0.0, 1.0} + -- Vacuum_Suction AN5771-5 + --[9] = "%.4f", -- Vacuum_Suction {0.0, 1.0} + -- F-2 Airspeed Indicator + -- [11] = "%.2f", -- AirspeedNeedle {0, 50, 100, 150, 200, 250, 300, 350, 400, 450, 500, 550, 600, 650, 700} {0.0, 0.05, 0.10, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7} + -- Altimeter AN5760-2 + --[96] = "%.1f", -- Altimeter_10000_footPtr {0.0, 1.0} + --[24] = "%.1f", -- Altimeter_1000_footPtr {0.0, 1.0} + --[25] = "%.1f", -- Altimeter_100_footPtr {0.0, 1.0} + --[97] = "%.1f", -- Altimeter_Pressure {28.1, 31.0} {0.0, 1.0} + SendData(2002, string.format("%0.4f;%0.4f;%0.4f;%0.4f", + mainPanelDevice:get_argument_value(96), + mainPanelDevice:get_argument_value(24), + mainPanelDevice:get_argument_value(25), + mainPanelDevice:get_argument_value(97))) + -- Rate of Climb Indicator AN5825 + --[29] = "%.1f", -- Variometer {0.0, 1.0} + -- D-10 Manifold Pressure Indicator + --[10] = "%.4f", -- Manifold_Pressure {10.0, 75.0} {0.0, 1.0} + -- Tachometer + --[23] = "%.4f", -- Engine_RPM {0.0, 4500.0} {0.0, 1.0} + -- AN5790-6 Carburetor Air Temperature Indicator + --[21] = "%.4f", -- Carb_Temperature {-80, 150} {-0, 1} + -- Coolant Temperature Indicator + --[22] = "%.4f", -- Carb_Temperature {-80, 150} {-0, 1} + -- Engine Gauge + --[30] = "%.4f", -- Oil_Temperature {0.0, 100.0} {0.0, 1.0} + --[31] = "%.4f", -- Oil_Pressure {0.0, 200.0} {0.0, 1.0} + --[32] = "%.1f", -- Fuel_Pressure {0.0, 25.0} -- PSI {0.0, 1.0} + SendData(2003, string.format("%0.4f;%0.4f;%0.4f", + mainPanelDevice:get_argument_value(30), + mainPanelDevice:get_argument_value(31), + mainPanelDevice:get_argument_value(32))) + -- Remote Indicator Compass + -- AN5730 remote compass + --[1] = "%.4f", -- CompassHeading {0.0, 1.0} + --[2] = "%.4f", -- CommandedCourse {0.0, 1.0} + SendData(2004, string.format("%0.4f;%0.4f", + mainPanelDevice:get_argument_value(1), + mainPanelDevice:get_argument_value(2))) + -- A-11 clock + --[4] = "%.4f", -- CLOCK_currtime_hours {0.0, 1.0} + --[5] = "%.4f", -- CLOCK_currtime_minutes {0.0, 1.0} + --[6] = "%.4f", -- CLOCK_currtime_seconds {0.0, 1.0} + SendData(2005, string.format("%0.4f;%0.4f;%0.4f", + mainPanelDevice:get_argument_value(4), + mainPanelDevice:get_argument_value(5), + mainPanelDevice:get_argument_value(6))) + -- Oxygen Flow Indicator + --[33] = "%.1f", -- Oxygen_Flow_Blinker {0.0, 1.0} + -- Oxygen Pressure Gauge + --[34] = "%.1f", -- Oxygen_Pressure {0.0, 500.0} {0.0, 1.0} + -- Hydraulic Pressure Gauge + --[78] = "%.4f", -- Hydraulic_Pressure {0.0, 2000.0} -- PSI {0.0, 1.0} + -- Fuel Gauges + -- Left Wing Main Tank + --[155] = "%.2f", -- Fuel_Tank_Left {0.0, 5.0, 15.0, 30.0, 45.0, 60.0, 75.0, 92.0} -- US GAL {0.0, 0.2, 0.36, 0.52, 0.65, 0.77, 0.92, 1.0} + -- Fuselage Tank + --[160] = "%.2f", -- Fuel_Tank_Fuselage {0.0, 10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 85.0} -- US GAL {0.0, 0.12, 0.28, 0.40, 0.51, 0.62, 0.72, 0.83, 0.96, 1.0} + -- Right Wing Main Tank + --[156] = "%.2f", -- Fuel_Tank_Right {0.0, 5.0, 15.0, 30.0, 45.0, 60.0, 75.0, 92.0} -- US GAL {0.0, 0.2, 0.36, 0.52, 0.65, 0.77, 0.92, 1.0} + -- AN-5745 accelerometer indicator + --[175] = "%.4f", -- Accelerometer_main {-5.0, 12.0} {0.0, 1.0} + --[177] = "%.4f", -- Accelerometer_min {-5.0, 12.0} {0.0, 1.0} + --[178] = "%.4f", -- Accelerometer_max {-5.0, 12.0} {0.0, 1.0} + SendData(2006, string.format("%0.4f;%0.4f;%0.4f", + mainPanelDevice:get_argument_value(175), + mainPanelDevice:get_argument_value(177), + mainPanelDevice:get_argument_value(178))) + -- Landing Gear Warning Lights + --[80] = "%.1f", -- LandingGearGreenLight + --[82] = "%.1f", -- LandingGearRedLight + SendData(2007, string.format("%.1f;%.1f", + mainPanelDevice:get_argument_value(80), + mainPanelDevice:get_argument_value(82))) + -- AMMETER + --[101] = "%.4f", -- Ammeter {0.0, 150.0} {0.0, 1.0} + end +end + +function ProcessHARDWAREConfigHighImportance(mainPanelDevice) + --[[ + every frame export to hardware + Example from A-10C + Get Radio Frequencies + get data from device + local UHF_RADIO = GetDevice(54) + SendDataHW("ExportID", "Format") + SendDataHW("ExportID", "Format", HardwareConfigID) + SendDataHW("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000)) + SendDataHW("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000), 2) -- export to Hardware '2' Config + ]] + -- no dimming lights + -- TailRadarWarning + SendDataHW("161", mainPanelDevice:get_argument_value(161) > 0.3 and 1 or 0) -- Lamp TailRadarWarning + -- SCR-522A Control panel + SendDataHW("122", mainPanelDevice:get_argument_value(122) > 0.3 and 1 or 0) -- A_channel_light + SendDataHW("123", mainPanelDevice:get_argument_value(123) > 0.3 and 1 or 0) -- B_channel_light + SendDataHW("124", mainPanelDevice:get_argument_value(124) > 0.3 and 1 or 0) -- C_channel_light + SendDataHW("125", mainPanelDevice:get_argument_value(125) > 0.3 and 1 or 0) -- D_channel_light + SendDataHW("126", mainPanelDevice:get_argument_value(126) > 0.3 and 1 or 0) -- Transmit_light + -- Landing gears + SendDataHW("80", mainPanelDevice:get_argument_value(80) > 0.3 and 1 or 0) -- LandingGearGreenLight + SendDataHW("82", mainPanelDevice:get_argument_value(82) > 0.3 and 1 or 0) -- LandingGearRedLight + -- Engine + SendDataHW("59", mainPanelDevice:get_argument_value(59) > 0.3 and 1 or 0) -- Hight_Blower_Lamp + -- Cockpit Lights + SendDataHW("164", mainPanelDevice:get_argument_value(164) > 0.3 and 1 or 0) -- Left_Fluor_Light + SendDataHW("165", mainPanelDevice:get_argument_value(165) > 0.3 and 1 or 0) -- Right_Fluor_Light + SendDataHW("185", mainPanelDevice:get_argument_value(185) > 0.3 and 1 or 0) -- Left_cockpit_light + SendDataHW("186", mainPanelDevice:get_argument_value(186) > 0.3 and 1 or 0) -- Right_cockpit_light + + --[[ + -- dimming lights + -- TailRadarWarning + SendDataHW("161", string.format("%.1f", mainPanelDevice:get_argument_value(161))) -- Lamp TailRadarWarning + -- SCR-522A Control panel + SendDataHW("122", string.format("%.1f", mainPanelDevice:get_argument_value(122))) -- A_channel_light + SendDataHW("123", string.format("%.1f", mainPanelDevice:get_argument_value(123))) -- B_channel_light + SendDataHW("124", string.format("%.1f", mainPanelDevice:get_argument_value(124))) -- C_channel_light + SendDataHW("125", string.format("%.1f", mainPanelDevice:get_argument_value(125))) -- D_channel_light + SendDataHW("126", string.format("%.1f", mainPanelDevice:get_argument_value(126))) -- Transmit_light + -- Landing gears + SendDataHW("80", string.format("%.1f", mainPanelDevice:get_argument_value(80))) -- LandingGearGreenLight + SendDataHW("82", string.format("%.1f", mainPanelDevice:get_argument_value(82))) -- LandingGearRedLight + -- Engine + SendDataHW("59", string.format("%.1f", mainPanelDevice:get_argument_value(59))) -- Hight_Blower_Lamp + -- Cockpit Lights + SendDataHW("164", string.format("%.1f", mainPanelDevice:get_argument_value(164))) -- Left_Fluor_Light + SendDataHW("165", string.format("%.1f", mainPanelDevice:get_argument_value(165))) -- Right_Fluor_Light + SendDataHW("185", string.format("%.1f", mainPanelDevice:get_argument_value(185))) -- Left_cockpit_light + SendDataHW("186", string.format("%.1f", mainPanelDevice:get_argument_value(186))) -- Right_cockpit_light + ]] +end + +----------------------------------------------------- +-- LOW IMPORTANCE EXPORTS -- +-- done every gExportLowTickInterval export events -- +----------------------------------------------------- + +function ProcessGlassCockpitDCSConfigLowImportance(mainPanelDevice) + --[[ + export in low tick interval to GlassCockpit + Example from A-10C + Get Radio Frequencies + get data from device + local lUHFRadio = GetDevice(54) + SendData("ExportID", "Format") + SendData(2000, string.format("%7.3f", lUHFRadio:get_frequency()/1000000)) <- special function for get frequency data + ]] + + --[[ + local lDETROLA = GetDevice(24) + WriteToLog('lDETROLA: '..dump(lDETROLA:is_on())) + WriteToLog('lDETROLA: '..dump(lDETROLA:get_frequency())) + --SendData(2000, string.format("%7.3f", lDETROLA:get_frequency()/1000000)) + + local lINTERCOM = GetDevice(31) + WriteToLog('lINTERCOM: '..dump(lINTERCOM:is_communicator_available())) + WriteToLog('lINTERCOM: '..dump(lINTERCOM:get_noise_level())) + WriteToLog('lINTERCOM: '..dump(lINTERCOM:get_signal_level())) + ]] +--[[ + local ltmp1 = 0 + for ltmp2 = 1, 35, 1 do + ltmp1 = GetDevice(ltmp2) + WriteToLog(ltmp2..': '..dump(ltmp1)) + WriteToLog(ltmp2..' (metatable): '..dump(getmetatable(ltmp1))) + end +]] +end + +function ProcessHARDWAREConfigLowImportance(mainPanelDevice) +--[[ + export in low tick interval to hardware + Example from A-10C + Landing Gear + mainPanelDevice, basis panel + SendDataHW("2004", mainPanelDevice:get_argument_value(659)) -- GEAR_N_SAFE + SendDataHW("2005", mainPanelDevice:get_argument_value(660)) -- GEAR_L_SAFE + SendDataHW("2006", mainPanelDevice:get_argument_value(661)) -- GEAR_R_SAFE + ]] + + --[[ + WriteToLog('list_cockpit_params(): '..dump(list_cockpit_params())) + + local ltmp1 = 0 + for ltmp2 = 1, 10, 1 do + ltmp1 = list_indication(ltmp2) + WriteToLog(ltmp2..': '..dump(ltmp1)) + --WriteToLog(ltmp2..' (metatable): '..dump(getmetatable(ltmp1))) + end + ]] +end \ No newline at end of file diff --git a/ExportsModules/Su-25.lua b/ExportsModules/Su-25.lua new file mode 100644 index 0000000..ad134fa --- /dev/null +++ b/ExportsModules/Su-25.lua @@ -0,0 +1,948 @@ +-- Su-25A Export +-- Version 0.9.9 BETA + +gES_FoundFCModule = true + +-- auxiliary function +dofile(gES_ExportModulePath.."FC_AuxiliaryFuntions.lua") + +----------------------------------------- +-- FLAMING CLIFFS AIRCRAFT / Su-25A -- +-- FC aircraft don't support GetDevice -- +----------------------------------------- + +function ProcessGlassCockpitFCHighImportanceConfig() + + local myData = LoGetSelfData() + + if (myData) then + local lLatitude = myData.LatLongAlt.Lat -- LATITUDE + local lLongitude = myData.LatLongAlt.Long -- LONGITUDE + local lBasicAtmospherePressure = LoGetBasicAtmospherePressure() -- BAROMETRIC PRESSURE + local lAltBar = LoGetAltitudeAboveSeaLevel() -- ALTITUDE SEA LEVEL (Meter) + local lAltRad = LoGetAltitudeAboveGroundLevel() -- ALTITUDE GROUND LEVEL (Meter) + --local lTrueAirSpeed = LoGetTrueAirSpeed() -- TRUE AIRSPEED (Meter/Second) + local lPitch, lBank, lYaw = LoGetADIPitchBankYaw() -- PITCH, BANK, YAW (Radian) + + local lHeading = myData.Heading -- HEADING (Radian) + local lVVI = LoGetVerticalVelocity() -- VERTICAL SPEED (Meter/Second) + local lIAS = LoGetIndicatedAirSpeed() -- INDICATED AIRSPEED (Meter/Second) + local lMachNumber = LoGetMachNumber() -- MACH + local lAoA = LoGetAngleOfAttack() -- ANGLE OF ATTACK AoA (Radian) + + local lGlide = LoGetGlideDeviation() -- VOR1 HORIZONTAL DEFLECTION (-1 +1) + local lSide = LoGetSideDeviation() -- VOR1 VERTICAL DEFLECTION (-1 +1) + --local lSlipBallPosition = LoGetSlipBallPosition() -- SLIP BALL (-1 +1) + --local lAccelerationUnits = LoGetAccelerationUnits().y -- G-LOAD + + --local lNavInfoPitch = LoGetNavigationInfo().Requirements.pitch -- AP REQUIRED PITCH (Radian) + --local lNavInfoRoll = LoGetNavigationInfo().Requirements.roll -- AP REQUIRED BANK (Radian) + --local lNavInfoSpeed = LoGetNavigationInfo().Requirements.speed -- AP SPEED (Meter/Second) + --local lNavInfoAltitude = LoGetNavigationInfo().Requirements.altitude -- AP ALTITUDE (Meter) + --local lNavInfoVerticalSpeed = LoGetNavigationInfo().Requirements.vertical_speed -- AP VERTICAL SPEED (Meter/Second) + + --local lControlPanel_HSI = LoGetControlPanel_HSI() -- HSI Data + local lHSI_RMI = LoGetControlPanel_HSI().RMI_raw -- VOR1 OBS (Radian) + local lHSI_ADF = LoGetControlPanel_HSI().ADF_raw -- ADF OBS (Radian) + --local lHSI_Heading = LoGetControlPanel_HSI().Heading_raw -- Heading (Radian) + + local lEngineRPMleft = LoGetEngineInfo().RPM.left -- ENG1 RPM % + local lEngineRPMright = LoGetEngineInfo().RPM.right -- ENG2 RPM % + local lEngineTempLeft = LoGetEngineInfo().Temperature.left -- ENG1 EGT ºC + local lEngineTempRight = LoGetEngineInfo().Temperature.right -- ENG2 EGT ºC + --local lEngineFuelInternal = LoGetEngineInfo().fuel_internal -- TANK1 (INT) (KG) + --local lEngineFuelExternal = LoGetEngineInfo().fuel_external -- TANK2 (EXT) (KG) + + --local lMechInfo = LoGetMechInfo() -- mechanical components, e.g. Flaps, Wheelbrakes,... + --local lPayloadInfo = LoGetPayloadInfo() -- Paylod, e.g. bombs, guns, rockets, fuel tanks,... + + local lDistanceToWay = 999 + local lRoute = LoGetRoute() + + if (myData and lRoute) then -- if neither are nil + local myLoc = LoGeoCoordinatesToLoCoordinates(lLongitude, lLatitude) + --lDistanceToWay = math.sqrt((myLoc.x - lRoute.goto_point.world_point.x)^2 + (myLoc.y - lRoute.goto_point.world_point.y)^2) + lDistanceToWay = math.sqrt((myLoc.x - lRoute.goto_point.world_point.x)^2 + (myLoc.z - lRoute.goto_point.world_point.z)^2) + end + + if gES_GlassCockpitType == 1 then + -- HELIOS Version 1.3 + -- customizing for HELOS + lPitch = math.deg(lPitch) -- PITCH, (Radian to Grad) + lBank = math.deg(lBank) -- BANK (Radian to Grad) + lYaw = math.deg(lYaw) -- YAW (Radian to Grad) + lHSI_RMI = math.deg(lHSI_RMI) -- VOR1 OBS (Radian to Grad) + lHSI_ADF = math.deg(lHSI_ADF) -- ADF OBS (Radian to Grad) + lAoA = math.deg(lAoA) -- ANGLE OF ATTACK AoA (Radian to Grad) + lHeading = math.deg(lHeading) -- Heading (Radian to Grad) + lHSI_ADF = (360 - lHSI_ADF) + (360 - lHeading) + lHSI_RMI = 360 - lHSI_RMI + lIAS = lIAS * 3.6 -- change from m/s to km/h + + SendData("1", string.format("%.2f", lPitch) ) + SendData("2", string.format("%.2f", lBank) ) + SendData("3", string.format("%.2f", lYaw) ) + SendData("4", string.format("%.2f", lAltBar) ) + SendData("5", string.format("%.2f", lAltRad) ) + SendData("6", string.format("%.2f", lHSI_ADF) ) + SendData("7", string.format("%.2f", lHSI_RMI) ) + SendData("8", string.format("%.2f", lHeading) ) + SendData("9", string.format("%.2f", lEngineRPMleft) ) + SendData("10", string.format("%.2f", lEngineRPMright) ) + SendData("11", string.format("%.2f", lEngineTempLeft) ) + SendData("12", string.format("%.2f", lEngineTempRight) ) + SendData("13", string.format("%.2f", lVVI) ) + SendData("14", string.format("%.2f", lIAS) ) + SendData("15", string.format("%.2f", lDistanceToWay) ) + SendData("16", string.format("%.2f", lAoA) ) + SendData("17", string.format("%.2f", lGlide) ) + SendData("18", string.format("%.2f", lSide) ) + + elseif gES_GlassCockpitType == 2 then + -- HawgTouch version 1.6 + + local lRadToDCSsignd = math.pi + local lRadToDCSunsignd = math.pi * 2 + local lDefaultNull = 0.0 + local lDefaultOne = 1.0 + + -- IAS-TAS Indicator (IAS, TAS) {"%.4f;%.4f"} + FC_Russian_AirSpeed_1100hkm(1) + + -- AOA Indicator and Accelerometer (AOA, GLoad) + FC_Russian_AOA_Su25(3) + + -- ADI + FC_Russian_ADI_Old(4) + + -- HSI + FC_Russian_HSI_old(5) + + -- Vertical Velocity Indicator (VVI) (VVI, TurnIndicator, SlipBallPosition) + FC_Russian_VVI_Old(6) + + -- Radar Altimeter (AltRad, MinAltitude, WarningFlag, MinAltitudeLamp) {"%.4f;%.4f;%.1f;%.1f"} (below 100m is warning light on) + FC_Russian_RadarAltimeter_1500m(100, 7) + + -- Barometric Altimeter (AltBar, BasicAtmospherePressure) + FC_Russian_BarometricAltimeter_late(8) + + -- Tachometer (RPM) (EngineRPMleft, EngineRPMright) {"%.4f;%.4f"} + FC_Russian_EngineRPM(9) + + -- Left Jet Engine Turbine Temperature Indicator (EngineTemp) {"%.4f"} + FC_Russian_EGT_1000gc(lEngineTempLeft, 10) + + -- Right Jet Engine Turbine Temperature Indicator (EngineTemp) {"%.4f"} + FC_Russian_EGT_1000gc(lEngineTempRight, 11) + + -- Clock from Ka-50 {CurrentHours, CurrentMinutes, CurrentSeconds, 0, FlightTimeHours, FlightTimeMinutes, 0, 0) {"%.4f;%.4f;%.4f;%.1f;%.4f;%.4f;%.4f;%.4f"} + FC_Russian_Clock_late(12) + + -- HSI Distance + FC_Russian_HSI_Distance_old(lDistanceToWay, 21) + + -- Mach {max, Mach} + local lMachTmp = 0 + if lMachNumber > 0.475 then + --[[ + y_min = 0.0 -- minimaler Ausgabewert + y_max = 1.0 -- maximaler Ausgabewert + x_min = 0.475 -- minimaler Eingangswert + x_max = 1.0 -- maximaler Eingangswert + x = 0.65 -- aktueller Eingangswert + + d_y = 1 -- Delta Ausgabewerte (y_max - y_min) + d_x = 0.525 -- Delta Eingangswerte (x_max - x_min) + m = 1.9047619047619047619047619047619 -- Steigung der linearen Funktion (d_y / d_x) + n = -0.9047619047619047619047619047619 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max) + + y = 0,333333333333333333333333333334 -- Ergebnis (m * x + n) + ]] + lMachTmp = 1.9047619047619047619047619047619 * lMachNumber + -0.9047619047619047619047619047619 + else + lMachTmp = 0 + end + + SendData("22", string.format("%0.4f;%0.4f", 0.665, lMachTmp)) + end + else + WriteToLog("Unknown FC Error, no LoGetSelfData.") + end + +end + +function ProcessHARDWAREConfigHighImportance() +end + +function ProcessGlassCockpitFCLowImportanceConfig() + + if gES_GlassCockpitType == 1 then + -- HELIOS Version 1.3 + + elseif gES_GlassCockpitType == 2 then + -- HawgTouch version 1.6 + + FC_WeaponPanel_SU25(13) + + FC_RadarWarning_SPO15(14) + + -- Fuel Quantity Indicator + local lEngineInfo = LoGetEngineInfo() + if lEngineInfo ~= nil then + --WriteToLog('lEngineInfo: '..dump(lEngineInfo)) + --[[ + [fuel_external] = number: "0" + [Temperature] = { + [left] = number: "626.99444580078" + [right] = number: "626.99444580078" + } + [RPM] = { + [left] = number: "87.453765869141" + [right] = number: "87.453758239746" + } + [FuelConsumption] = { + [left] = number: "0.1500396137767" + [right] = number: "0.1500396137767" + } + [fuel_internal] = number: "3773.2749023438" + [EngineStart] = { + [left] = number: "0" + [right] = number: "0" + } + [HydraulicPressure] = { + [left] = number: "210" + [right] = number: "210" + } + lPayloadInfo.Stations[8].CLSID == E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF -- ext 800l Fuel Tank + ]] + + local lTotalFuel = lEngineInfo.fuel_internal + local lFuel_leftbar = 1.0 + local lFuel_rightbar = 1.0 + local lExtTank1 = 1.0 -- external tanks + local lExtTank2 = 1.0 -- inner tanks + + if lTotalFuel < 5000 then + if lTotalFuel > 1500 then + --[[ + y_min = 0.0 -- minimaler Ausgabewert + y_max = 1.0 -- maximaler Ausgabewert + x_min = 1500 -- minimaler Eingangswert + x_max = 5000 -- maximaler Eingangswert + x = 3500 -- aktueller Eingangswert + + d_y = 1 -- Delta Ausgabewerte (y_max - y_min) + d_x = 3500 -- Delta Eingangswerte (x_max - x_min) + m = 2.8571428571428571428571428571429e-4 -- Steigung der linearen Funktion (d_y / d_x) + n = -0.42857142857142857142857142857143 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max) + + y = 0,57142857142857142857142857142857 -- Ergebnis (m * x + n) + ]] + lFuel_leftbar = 2.8571428571428571428571428571429e-4 * lTotalFuel + -0.42857142857142857142857142857143 + else + lFuel_leftbar = 0.0 + end + else + lFuel_leftbar = 1.0 + end + if lTotalFuel < 1200 then + lFuel_rightbar = lTotalFuel / 1200 + else + lFuel_rightbar = 1.0 + end + + local lPayloadInfo = LoGetPayloadInfo() + if lPayloadInfo ~= nil then + --WriteToLog('lPayloadInfo: '..dump(lPayloadInfo)) + if lPayloadInfo.Stations[10].CLSID == "{E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF}" or + lPayloadInfo.Stations[9].CLSID == "{E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF}" then -- external tanks presend and full (panel 6 and 5) + lExtTank1 = ((lEngineInfo.fuel_external < 1240.0 ) and 1.0 or 0.0) + end + if lPayloadInfo.Stations[5].CLSID == "{E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF}" or + lPayloadInfo.Stations[6].CLSID == "{E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF}" then-- inner tanks presend and full (panel 3 and 8) + lExtTank2 = ((lEngineInfo.fuel_external < 1.0 ) and 1.0 or 0.0) + end + end + -- Fuel_leftbar + -- Fuel_rightbar + -- Light1 + -- Light2 + -- Light3 + -- Light4 + -- Light5 + -- BingoLight + SendData("15", string.format("%0.4f;%0.4f;%d;%d;%d;%d;%d", + lFuel_leftbar, + lFuel_rightbar, + lExtTank1, -- external tanks + lExtTank2, -- inner tanks + (lEngineInfo.fuel_internal < 2790.0 and 1 or 0), -- Interne Flügeltanks + (lEngineInfo.fuel_internal < 1840.0 and 1 or 0), -- Interne Rumpftanks + (lEngineInfo.fuel_internal < 600.0 and 1 or 0))) -- Bingo Fuel + + -- Hydraulic Pressure Left + FC_OneNeedleGauge(lEngineInfo.HydraulicPressure.left, 240, 17) + + -- Hydraulic Pressure Right + FC_OneNeedleGauge(lEngineInfo.HydraulicPressure.right, 240, 18) + end + + -- EKRAN Message + FC_EKRAN(16) + + -- Mechanical Configuration Indicator (GearWarningLight, NoseGear, LeftGear, RightGear, Airbreaks, Flaps1, Flaps2) {"%.1f;%d;%d;%d;%d;%d;%d"} + FC_Russian_MDI_SU25(2) + + local lMechInfo = LoGetMechInfo() -- mechanical components, e.g. Flaps, Wheelbrakes,... + if lMechInfo ~= nil then + -- Wheelbrakes Hydraulic Pressure Left + FC_OneNeedleGauge(lMechInfo.wheelbrakes.value, 240, 19) + + -- Wheelbrakes Hydraulic Pressure Right + FC_OneNeedleGauge(lMechInfo.wheelbrakes.value, 240, 20) + end + end + + --(x < 0 and 'negative' or 'non-negative') + --[[ + local lPayloadInfo = LoGetPayloadInfo() + WriteToLog('lPayloadInfo: '..dump(lPayloadInfo)) + + local lSnares = LoGetSnares() -- Flare and Chaff + WriteToLog('lSnares: '..dump(lSnares)) + + local lSightingSystemInfo = LoGetSightingSystemInfo() + WriteToLog('lSightingSystemInfo: '..dump(lSightingSystemInfo)) + + local lTWSInfo = LoGetTWSInfo() -- SPO Informationen, z.B. Radarwarner F15C + WriteToLog('lTWSInfo: '..dump(lTWSInfo)) + + local lTargetInformation = LoGetTargetInformation() -- detalierte Radar Infos z.B. F15C + WriteToLog('lTargetInformation: '..dump(lTargetInformation)) + + local lLockedTargetInformation = LoGetLockedTargetInformation() + WriteToLog('lLockedTargetInformation: '..dump(lLockedTargetInformation)) + + local lF15_TWS_Contacs = LoGetF15_TWS_Contacts() -- the same information but only for F-15 in TWS mode + WriteToLog('lF15_TWS_Contacs: '..dump(lF15_TWS_Contacs)) + + local lMechInfo = LoGetMechInfo() -- mechanical components, e.g. Flaps, Wheelbrakes,... + WriteToLog('lMechInfo: '..dump(lMechInfo)) + + local lMCPState = LoGetMCPState() -- Warnlichter + WriteToLog('lMCPState: '..dump(lMCPState)) + + local lControlPanel_HSI = LoGetControlPanel_HSI() + WriteToLog('lControlPanel_HSI: '..dump(lControlPanel_HSI)) + + local lRadioBeaconsStatus = LoGetRadioBeaconsStatus() + WriteToLog('lRadioBeaconsStatus: '..dump(lRadioBeaconsStatus)) + + local lEngineInfo = LoGetEngineInfo() + WriteToLog('lEngineInfo: '..dump(lEngineInfo)) + ]] + -- Weapon Control System + --local lNameByType = LoGetNameByType () -- args 4 (number : level1,level2,level3,level4), result string + -- values from LoGetTargetInformation().type + --WriteToLog('lNameByType: '..dump(lNameByType)) +end + +function ProcessHARDWAREConfigLowImportance() +-- where necessary, specify HardwareID, example WeaponStatusPanel(2) + WeaponStatusPanel() + MechanicalDevicesIndicator() + StatusLamp() + FuelQuantityIndicator() + SightingSystem() + SPO15RWR() +end + +----------------------------- +-- Custom functions -- +----------------------------- + +function SightingSystem(hardware) + local lHardware = hardware or 1 + local lSightingSystemInfo = LoGetSightingSystemInfo() + if lSightingSystemInfo == nil then + return + end + --WriteToLog('lSightingSystemInfo: '..dump(lSightingSystemInfo)9 + --[[ + [PRF] = { + [selection] = string: "ILV" + [current] = string: "MED" + } + [laser_on] = boolean: "false" + [scale] = { + [azimuth] = number: "0.52359873056412" + [distance] = number: "10000" + } + [radar_on] = boolean: "false" + [optical_system_on] = boolean: "false" + [LaunchAuthorized] = boolean: "false" + [ECM_on] = boolean: "false" + [Manufacturer] = string: "RUS" + [TDC] = { + [y] = number: "0" + [x] = number: "0" + } + [ScanZone] = { + [coverage_H] = { + [min] = number: "0" + [max] = number: "20000" + } + [size] = { + [azimuth] = number: "1.0471974611282" + [elevation] = number: "0.17453290522099" + } + [position] = { + [exceeding_manual] = number: "0" + [distance_manual] = number: "0" + [azimuth] = number: "0" + [elevation] = number: "0" + } + } + ]] + SendDataHW("600", lSightingSystemInfo.ECM_on == true and 1 or 0, lHardware ) + SendDataHW("601", lSightingSystemInfo.laser_on == true and 1 or 0, lHardware ) + --SendDataHW("602", lSightingSystemInfo.optical_system_on == true and 1 or 0, lHardware ) + SendDataHW("603", lSightingSystemInfo.LaunchAuthorized == true and 1 or 0, lHardware ) + --SendDataHW("604", lSightingSystemInfo.radar_on == true and 1 or 0, lHardware ) +end + +function FlareChaff(hardware) + local lHardware = hardware or 1 + local lSnares = LoGetSnares() -- Flare and Chaff + if lSnares == nil then + return + end + --WriteToLog('lSnares: '..dump(lSnares)) + + --[chaff] = number: "128" + --[flare] = number: "128" +end + +function StatusLamp(hardware) + local lHardware = hardware or 1 + local lMCPState = LoGetMCPState() -- Warning Lights + if lMCPState == nil then + return + end + --WriteToLog('lMCPState: '..dump(lMCPState)) + --[[ + [RightTailPlaneFailure] = boolean: "false" + [EOSFailure] = boolean: "false" + [ECMFailure] = boolean: "false" + [RightAileronFailure] = boolean: "false" + [MasterWarning] = boolean: "false" + [RightEngineFailure] = boolean: "false" + [CannonFailure] = boolean: "false" + [MLWSFailure] = boolean: "false" + [ACSFailure] = boolean: "false" + [RadarFailure] = boolean: "false" + [HelmetFailure] = boolean: "false" + [HUDFailure] = boolean: "false" + [LeftMainPumpFailure] = boolean: "false" + [RightWingPumpFailure] = boolean: "false" + [LeftWingPumpFailure] = boolean: "false" + [MFDFailure] = boolean: "false" + [RWSFailure] = boolean: "false" + [GearFailure] = boolean: "false" + [HydraulicsFailure] = boolean: "false" + [AutopilotFailure] = boolean: "true" + [FuelTankDamage] = boolean: "false" + [LeftAileronFailure] = boolean: "false" + [CanopyOpen] = boolean: "false" + [RightMainPumpFailure] = boolean: "false" + [StallSignalization] = boolean: "false" + [LeftEngineFailure] = boolean: "false" + [AutopilotOn] = boolean: "false" + [LeftTailPlaneFailure] = boolean: "false" + ]] + + SendDataHW("700", lMCPState.LeftTailPlaneFailure == true and 1 or 0, lHardware ) + SendDataHW("701", lMCPState.RightTailPlaneFailure == true and 1 or 0, lHardware ) + SendDataHW("702", lMCPState.MasterWarning == true and 1 or 0, lHardware ) + SendDataHW("703", lMCPState.LeftEngineFailure == true and 1 or 0, lHardware ) + SendDataHW("704", lMCPState.RightEngineFailure == true and 1 or 0, lHardware ) + SendDataHW("705", lMCPState.LeftAileronFailure == true and 1 or 0, lHardware ) + SendDataHW("706", lMCPState.RightAileronFailure == true and 1 or 0, lHardware ) + SendDataHW("707", lMCPState.LeftMainPumpFailure == true and 1 or 0, lHardware ) + SendDataHW("708", lMCPState.RightMainPumpFailure == true and 1 or 0, lHardware ) + SendDataHW("709", lMCPState.LeftWingPumpFailure == true and 1 or 0, lHardware ) + SendDataHW("710", lMCPState.RightWingPumpFailure == true and 1 or 0, lHardware ) + SendDataHW("711", lMCPState.EOSFailure == true and 1 or 0, lHardware ) + SendDataHW("712", lMCPState.ECMFailure == true and 1 or 0, lHardware ) + SendDataHW("713", lMCPState.CannonFailure == true and 1 or 0, lHardware ) + SendDataHW("714", lMCPState.MLWSFailure == true and 1 or 0, lHardware ) + SendDataHW("715", lMCPState.ACSFailure == true and 1 or 0, lHardware ) + SendDataHW("716", lMCPState.RadarFailure == true and 1 or 0, lHardware ) + SendDataHW("717", lMCPState.HelmetFailure == true and 1 or 0, lHardware ) + SendDataHW("718", lMCPState.HUDFailure == true and 1 or 0, lHardware ) + SendDataHW("719", lMCPState.MFDFailure == true and 1 or 0, lHardware ) + SendDataHW("720", lMCPState.RWSFailure == true and 1 or 0, lHardware ) + SendDataHW("721", lMCPState.GearFailure == true and 1 or 0, lHardware ) + SendDataHW("722", lMCPState.HydraulicsFailure == true and 1 or 0, lHardware ) + SendDataHW("723", lMCPState.AutopilotFailure == true and 1 or 0, lHardware ) + SendDataHW("724", lMCPState.FuelTankDamage == true and 1 or 0, lHardware ) + SendDataHW("725", lMCPState.CanopyOpen == true and 1 or 0, lHardware ) + SendDataHW("726", lMCPState.StallSignalization == true and 1 or 0, lHardware ) + SendDataHW("727", lMCPState.AutopilotOn == true and 1 or 0, lHardware ) + + local lEngineInfo = LoGetEngineInfo() + if lEngineInfo ~= nil then + --WriteToLog('lEngineInfo: '..dump(lEngineInfo)) + SendDataHW("728", lEngineInfo.EngineStart.left, lHardware ) -- lamp start left engine 1 (0|1) + SendDataHW("729", lEngineInfo.EngineStart.right, lHardware ) -- lamp start right engine 1 (0|1) + end + + local lAoA = LoGetAngleOfAttack() + if lAoA ~= nil then + lAoA = lAoA * 57.3 + SendDataHW("730", (lAoA > 20.0 and 1 or 0), lHardware ) -- lamp start AOA warning (0|1) + end +end + +function WeaponStatusPanel(hardware) +-- The weapon status panel, quantity and readiness of the currently selected weapon and the remaining gun ammunition are indicated. + local lHardware = hardware or 1 + gES_PayloadInfo = LoGetPayloadInfo() + if gES_PayloadInfo == nil then + return + end + --WriteToLog('gES_PayloadInfo: '..dump(gES_PayloadInfo)) + --[[ exsample + [Stations] = { + [1] = { + [CLSID] = string: "{682A481F-0CB5-4693-A382-D00DD4A156D7}" + [container] = boolean: "false" + [count] = number: "1" + [weapon] = { + [level3] = number: "7" + [level1] = number: "4" + [level4] = number: "10" + [level2] = number: "4" + } + } + [2] = { + [CLSID] = string: "{682A481F-0CB5-4693-A382-D00DD4A156D7}" + [container] = boolean: "false" + [count] = number: "1" + [weapon] = { + [level3] = number: "7" + [level1] = number: "4" + [level4] = number: "10" + [level2] = number: "4" + } + } + [3] = { + [wstype] = { + [level3] = number: "32" + [level1] = number: "4" + [level4] = number: "6" + [level2] = number: "7" + } + [count] = number: "20" + [CLSID] = string: "{F72F47E5-C83A-4B85-96ED-D3E46671EE9A}" + [adapter] = { + [level3] = number: "0" + [level1] = number: "0" + [level4] = number: "0" + [level2] = number: "0" + } + [container] = boolean: "true" + [weapon] = { + [level3] = number: "33" + [level1] = number: "4" + [level4] = number: "32" + [level2] = number: "7" + } + } + [4] = { + [wstype] = { + [level3] = number: "32" + [level1] = number: "4" + [level4] = number: "6" + [level2] = number: "7" + } + [count] = number: "20" + [CLSID] = string: "{F72F47E5-C83A-4B85-96ED-D3E46671EE9A}" + [adapter] = { + [level3] = number: "0" + [level1] = number: "0" + [level4] = number: "0" + [level2] = number: "0" + } + [container] = boolean: "true" + [weapon] = { + [level3] = number: "33" + [level1] = number: "4" + [level4] = number: "32" + [level2] = number: "7" + } + } + [5] = { + [wstype] = { + [level3] = number: "32" + [level1] = number: "4" + [level4] = number: "99" + [level2] = number: "4" + } + [count] = number: "1" + [CLSID] = string: "{79D73885-0801-45a9-917F-C90FE1CE3DFC}" + [adapter] = { + [level3] = number: "0" + [level1] = number: "0" + [level4] = number: "0" + [level2] = number: "0" + } + [container] = boolean: "true" + [weapon] = { + [level3] = number: "8" + [level1] = number: "4" + [level4] = number: "45" + [level2] = number: "4" + } + } + [6] = { + [wstype] = { + [level3] = number: "32" + [level1] = number: "4" + [level4] = number: "99" + [level2] = number: "4" + } + [count] = number: "1" + [CLSID] = string: "{79D73885-0801-45a9-917F-C90FE1CE3DFC}" + [adapter] = { + [level3] = number: "0" + [level1] = number: "0" + [level4] = number: "0" + [level2] = number: "0" + } + [container] = boolean: "true" + [weapon] = { + [level3] = number: "8" + [level1] = number: "4" + [level4] = number: "45" + [level2] = number: "4" + } + } + [7] = { + [wstype] = { + [level3] = number: "32" + [level1] = number: "4" + [level4] = number: "47" + [level2] = number: "4" + } + [count] = number: "8" + [CLSID] = string: "{F789E86A-EE2E-4E6B-B81E-D5E5F903B6ED}" + [adapter] = { + [level3] = number: "0" + [level1] = number: "0" + [level4] = number: "0" + [level2] = number: "0" + } + [container] = boolean: "true" + [weapon] = { + [level3] = number: "8" + [level1] = number: "4" + [level4] = number: "58" + [level2] = number: "4" + } + } + [8] = { + [wstype] = { + [level3] = number: "32" + [level1] = number: "4" + [level4] = number: "47" + [level2] = number: "4" + } + [count] = number: "8" + [CLSID] = string: "{F789E86A-EE2E-4E6B-B81E-D5E5F903B6ED}" + [adapter] = { + [level3] = number: "0" + [level1] = number: "0" + [level4] = number: "0" + [level2] = number: "0" + } + [container] = boolean: "true" + [weapon] = { + [level3] = number: "8" + [level1] = number: "4" + [level4] = number: "58" + [level2] = number: "4" + } + } + [9] = { + [CLSID] = string: "{D5435F26-F120-4FA3-9867-34ACE562EF1B}" + [container] = boolean: "false" + [count] = number: "1" + [weapon] = { + [level3] = number: "38" + [level1] = number: "4" + [level4] = number: "20" + [level2] = number: "5" + } + } + [10] = { + [CLSID] = string: "{D5435F26-F120-4FA3-9867-34ACE562EF1B}" + [container] = boolean: "false" + [count] = number: "1" + [weapon] = { + [level3] = number: "38" + [level1] = number: "4" + [level4] = number: "20" + [level2] = number: "5" + } + } + [11] = { + [CLSID] = string: "" + [container] = boolean: "false" + [count] = number: "0" + [weapon] = { + [level3] = number: "0" + [level1] = number: "0" + [level4] = number: "0" + [level2] = number: "0" + } + } + } + [CurrentStation] = number: "0" + [Cannon] = { + [shells] = number: "250" + } + ]] + --[[ + Weapon Panel + | + --------------------------------------------------- + | | | | | | | | | | | + 1 2 3 4 5 C 6 7 8 9 10 + ]] + -- Payload Info + -- weapon stations (panel) 1 (left) - 10 (right), no lamp for center station + SendDataHW("100", gES_PayloadInfo.Cannon.shells, lHardware ) -- count cannon shells + SendDataHW("101", (gES_PayloadInfo.Stations[1].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 1) + SendDataHW("110", (gES_PayloadInfo.Stations[2].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 10) + SendDataHW("102", (gES_PayloadInfo.Stations[3].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 2) + SendDataHW("109", (gES_PayloadInfo.Stations[4].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 9) + SendDataHW("103", (gES_PayloadInfo.Stations[5].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 3) + SendDataHW("108", (gES_PayloadInfo.Stations[6].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 8) + SendDataHW("104", (gES_PayloadInfo.Stations[7].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 4) + SendDataHW("107", (gES_PayloadInfo.Stations[8].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 7) + SendDataHW("105", (gES_PayloadInfo.Stations[9].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 5) + SendDataHW("106", (gES_PayloadInfo.Stations[10].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 6) + --SendDataHW("110", (gES_PayloadInfo.Stations[11].count > 0 and 1 or 0) ) -- weapon presend > 0 center station, not visible + --SendDataHW("CurrentStation", gES_PayloadInfo.CurrentStation, lHardware ) + -- air-to-air missils panel 1 and 11, air combat modus, CurrentStation = 1, panel 1 and 11 on + -- CurrentStation 5, panel 3 + -- CurrentStation 3, panel 2 + -- CurrentStation 7, panel 4 + -- CurrentStation 4, panel 9 + -- CurrentStation 9, panel 5 + -- CurrentStation 10, panel 6 + -- CurrentStation 8, panel 7 + -- CurrentStation 6, panel 8 + -- wenn die Waffenstationen gleichmässig belegt sind, hat bei Auswahl CurrentStation immer den Wert der linken Station + -- bei ungleichmäßiger Belegung, hat CurrentStation immer den Wert der jeweiligen Station + -- Waffenbezeichnung als UUID, gES_PayloadInfo.Stations[X].CLSID + + -- defination + if gES_CurrentStationTmp == nil then + gES_CurrentStationTmp = -1 + end + + if gES_PayloadInfo.CurrentStation > 0 and + gES_CurrentStationTmp ~= gES_PayloadInfo.CurrentStation then + gES_CurrentStationTmp = gES_PayloadInfo.CurrentStation + + gES_TmpStationToPanel = {} + gES_TmpStationToPanel[1] = {Panel = 1, StationID = 101, CurrentID = 201, HardwareID = lHardware } -- left + gES_TmpStationToPanel[2] = {Panel = 10, StationID = 110, CurrentID = 210, HardwareID = lHardware } -- right + gES_TmpStationToPanel[3] = {Panel = 2, StationID = 102, CurrentID = 202, HardwareID = lHardware } + gES_TmpStationToPanel[4] = {Panel = 9, StationID = 109, CurrentID = 209, HardwareID = lHardware } + gES_TmpStationToPanel[5] = {Panel = 3, StationID = 103, CurrentID = 203, HardwareID = lHardware } + gES_TmpStationToPanel[6] = {Panel = 8, StationID = 108, CurrentID = 208, HardwareID = lHardware } + gES_TmpStationToPanel[7] = {Panel = 4, StationID = 104, CurrentID = 204, HardwareID = lHardware } + gES_TmpStationToPanel[8] = {Panel = 7, StationID = 107, CurrentID = 207, HardwareID = lHardware } + gES_TmpStationToPanel[9] = {Panel = 5, StationID = 105, CurrentID = 205, HardwareID = lHardware } + gES_TmpStationToPanel[10] = {Panel = 6, StationID = 106, CurrentID = 206, HardwareID = lHardware } + + WeaponStatusPanel_Reset(201, 210, lHardware) + + if gES_TmpStationToPanel[gES_PayloadInfo.CurrentStation] ~= nil then + SendDataHW(gES_TmpStationToPanel[gES_PayloadInfo.CurrentStation].CurrentID, 1, lHardware ) -- eigentliche Auswahl + + table.foreach(gES_PayloadInfo.Stations, WeaponStatusPanel_selectCurrentPayloadStation) -- zugehörige Stationen + end + end +end + +function FuelQuantityIndicator(hardware) +-- Fuel quantity shows the fuel remaining in all tanks + local lHardware = hardware or 1 + local lEngineInfo = LoGetEngineInfo() + if lEngineInfo == nil then + return + end + --WriteToLog('lEngineInfo: '..dump(lEngineInfo)) + --[[ + [fuel_external] = number: "0" + [Temperature] = { + [left] = number: "626.99444580078" + [right] = number: "626.99444580078" + } + [RPM] = { + [left] = number: "87.453765869141" + [right] = number: "87.453758239746" + } + [FuelConsumption] = { + [left] = number: "0.1500396137767" + [right] = number: "0.1500396137767" + } + [fuel_internal] = number: "3773.2749023438" + [EngineStart] = { + [left] = number: "0" + [right] = number: "0" + } + [HydraulicPressure] = { + [left] = number: "210" + [right] = number: "210" + } + lPayloadInfo.Stations[8].CLSID == E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF -- ext 800l Fuel Tank + ]] + + SendDataHW("300", string.format("%d", math.round((lEngineInfo.fuel_internal / 10), 0, "ceil") * 10), lHardware ) -- total fuel in kg + --SendDataHW("301", string.format("%d", lEngineInfo.fuel_internal)) -- total fuel in kg + --SendDataHW("302", string.format("%d", lEngineInfo.fuel_external)) -- external fuel in kg + + local lPayloadInfo = LoGetPayloadInfo() + if lPayloadInfo ~= nil then + --WriteToLog('lPayloadInfo: '..dump(lPayloadInfo)) + if lPayloadInfo.Stations[10].CLSID == "{E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF}" or + lPayloadInfo.Stations[9].CLSID == "{E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF}" then -- external tanks presend and full (panel 6 and 5) + SendDataHW("303", ((lEngineInfo.fuel_external < 1240.0 ) and 1 or 0), lHardware ) + else + SendDataHW("303", 1, lHardware ) + end + if lPayloadInfo.Stations[5].CLSID == "{E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF}" or + lPayloadInfo.Stations[6].CLSID == "{E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF}" then-- inner tank presend and full (panel 3 and 8) + SendDataHW("304", ((lEngineInfo.fuel_external < 1.0 ) and 1 or 0), lHardware ) + else + SendDataHW("304", 1, lHardware ) + end + else + SendDataHW("303", 1, lHardware ) + SendDataHW("304", 1, lHardware ) + end + SendDataHW("305", (lEngineInfo.fuel_internal < 2790.0 and 1 or 0), lHardware ) -- Interne Flügeltanks + SendDataHW("306", (lEngineInfo.fuel_internal < 1840.0 and 1 or 0), lHardware ) -- Interne Rumpftanks + --SendDataHW("307", (lEngineInfo.fuel_internal < 1.0 and 1 or 0), lHardware ) -- Zentraler Rumpftanks + SendDataHW("308", (lEngineInfo.fuel_internal < 600.0 and 1 or 0), lHardware ) -- Bingo Fuel + +end + +function MechanicalDevicesIndicator(hardware) +-- The mechanical devices indicator shows the position of the landing gear, flaps, leading edge flaps and airbrake + local lHardware = hardware or 1 + local lMechInfo = LoGetMechInfo() -- mechanical components, e.g. Flaps, Wheelbrakes,... + if lMechInfo == nil then + return + end + --[[ + [hook] = { + [status] = number: "0" + [value] = number: "0" + } + [parachute] = { + [status] = number: "0" + [value] = number: "0" + } + [controlsurfaces] = { + [eleron] = { + [left] = number: "0" + [right] = number: "-0.21084336936474" + } + [elevator] = { + [left] = number: "-0" + [right] = number: "-0" + } + [rudder] = { + [left] = number: "0" + [right] = number: "0" + } + } + [airintake] = { + [status] = number: "0" + [value] = number: "0" + } + [canopy] = { + [status] = number: "0" + [value] = number: "0" + } + [refuelingboom] = { + [status] = number: "0" + [value] = number: "0" + } + [wing] = { + [status] = number: "0" + [value] = number: "0" + } + [noseflap] = { + [status] = number: "0" + [value] = number: "0" + } + [gear] = { + [value] = number: "0" + [nose] = { + [rod] = number: "0" + } + [main] = { + [left] = { + [rod] = number: "0" + } + [right] = { + [rod] = number: "0" + } + } + [status] = number: "0" + } + [speedbrakes] = { + [status] = number: "0" + [value] = number: "0" + } + [wheelbrakes] = { + [status] = number: "0" + [value] = number: "0" + } + [flaps] = { + [status] = number: "0" + [value] = number: "0" + }]] + --SendDataHW("500", lMechInfo.gear.status ) + --SendDataHW("501", lMechInfo.gear.value ) + --SendDataHW("502", lMechInfo.gear.nose.rod ) -- zeigt an wie weit das Fahrwerk einsackt wenn das Flugzeug auf dem Boden ist + --SendDataHW("503", lMechInfo.gear.main.left.rod ) -- zeigt an wie weit das Fahrwerk einsackt wenn das Flugzeug auf dem Boden ist + --SendDataHW("504", lMechInfo.gear.main.right.rod ) -- zeigt an wie weit das Fahrwerk einsackt wenn das Flugzeug auf dem Boden ist + --SendDataHW("500", ((lMechInfo.gear.status == 1 and lMechInfo.gear.value < 1) and 1 or 0 ) ) -- gear warning light, go up + --SendDataHW("500", ((lMechInfo.gear.status == 0 and lMechInfo.gear.value > 0) and 1 or 0 ) ) -- gear warning light, go down + SendDataHW("500", (((lMechInfo.gear.status == 1 and lMechInfo.gear.value < 1) or (lMechInfo.gear.status == 0 and lMechInfo.gear.value > 0)) and 1 or 0 ), lHardware ) -- gear warning light + SendDataHW("501", (lMechInfo.gear.value > 0.85 and 1 or 0), lHardware ) -- nose gear + SendDataHW("502", (lMechInfo.gear.value > 0.95 and 1 or 0), lHardware ) -- left gear + SendDataHW("503", (lMechInfo.gear.value == 1 and 1 or 0), lHardware ) -- right gear + + --SendDataHW("510", lMechInfo.speedbrakes.status ) -- speedbreakes on 1 (0|1) + SendDataHW("510", (lMechInfo.speedbrakes.value > 0.1 and 1 or 0), lHardware ) -- speedbreakes on > 0.1 (0 - 1) + + --SendDataHW("520", lMechInfo.wheelbrakes.status, lHardware ) -- not in use + --SendDataHW("521", lMechInfo.wheelbrakes.value, lHardware ) -- not in use + + local lTrueAirSpeed = LoGetTrueAirSpeed() + --SendDataHW("530", lMechInfo.flaps.status ) -- flap switch off 0, 1. position 1, 2. position 2 (0|1|2) + --SendDataHW("531", lMechInfo.flaps.value ) -- flap 1. position > 0.25, 2. position > 0.93 (0 - 1) + SendDataHW("531", (lMechInfo.flaps.value > 0.25 and 1 or 0), lHardware ) -- flap 1. position + SendDataHW("532", (lMechInfo.flaps.value > 0.93 and 1 or 0), lHardware ) -- flap 2. position + SendDataHW("533", ((lMechInfo.flaps.value > 0.93 and lTrueAirSpeed > 340) and 1 or 0), lHardware ) -- Speed Warning for Flaps, same light as gear warning light, but blinking light +end diff --git a/ExportsModules/Su-25T.lua b/ExportsModules/Su-25T.lua new file mode 100644 index 0000000..796a684 --- /dev/null +++ b/ExportsModules/Su-25T.lua @@ -0,0 +1,899 @@ +-- Su-25T Export +-- Version 0.9.9 BETA + +gES_FoundFCModule = true + +-- auxiliary function +dofile(gES_ExportModulePath.."FC_AuxiliaryFuntions.lua") + +----------------------------------------- +-- FLAMING CLIFFS AIRCRAFT / Su-25T -- +-- FC aircraft don't support GetDevice -- +----------------------------------------- + +function ProcessGlassCockpitFCHighImportanceConfig() + + local myData = LoGetSelfData() + + if (myData) then + local lLatitude = myData.LatLongAlt.Lat -- LATITUDE + local lLongitude = myData.LatLongAlt.Long -- LONGITUDE + local lBasicAtmospherePressure = LoGetBasicAtmospherePressure() -- BAROMETRIC PRESSURE + local lAltBar = LoGetAltitudeAboveSeaLevel() -- ALTITUDE SEA LEVEL (Meter) + local lAltRad = LoGetAltitudeAboveGroundLevel() -- ALTITUDE GROUND LEVEL (Meter) + --local lTrueAirSpeed = LoGetTrueAirSpeed() -- TRUE AIRSPEED (Meter/Second) + local lPitch, lBank, lYaw = LoGetADIPitchBankYaw() -- PITCH, BANK, YAW (Radian) + + local lHeading = myData.Heading -- HEADING (Radian) + local lVVI = LoGetVerticalVelocity() -- VERTICAL SPEED (Meter/Second) + local lIAS = LoGetIndicatedAirSpeed() -- INDICATED AIRSPEED (Meter/Second) + --local lMachNumber = LoGetMachNumber -- MACH + local lAoA = LoGetAngleOfAttack() -- ANGLE OF ATTACK AoA (Radian) + + local lGlide = LoGetGlideDeviation() -- VOR1 HORIZONTAL DEFLECTION (-1 +1) + local lSide = LoGetSideDeviation() -- VOR1 VERTICAL DEFLECTION (-1 +1) + --local lSlipBallPosition = LoGetSlipBallPosition() -- SLIP BALL (-1 +1) + --local lAccelerationUnits = LoGetAccelerationUnits().y -- G-LOAD + + --local lNavInfoPitch = LoGetNavigationInfo().Requirements.pitch -- AP REQUIRED PITCH (Radian) + --local lNavInfoRoll = LoGetNavigationInfo().Requirements.roll -- AP REQUIRED BANK (Radian) + --local lNavInfoSpeed = LoGetNavigationInfo().Requirements.speed -- AP SPEED (Meter/Second) + --local lNavInfoAltitude = LoGetNavigationInfo().Requirements.altitude -- AP ALTITUDE (Meter) + --local lNavInfoVerticalSpeed = LoGetNavigationInfo().Requirements.vertical_speed -- AP VERTICAL SPEED (Meter/Second) + + --local lControlPanel_HSI = LoGetControlPanel_HSI() -- HSI Data + local lHSI_RMI = LoGetControlPanel_HSI().RMI_raw -- VOR1 OBS (Radian) + local lHSI_ADF = LoGetControlPanel_HSI().ADF_raw -- ADF OBS (Radian) + --local lHSI_Heading = LoGetControlPanel_HSI().Heading_raw -- Heading (Radian) + + local lEngineRPMleft = LoGetEngineInfo().RPM.left -- ENG1 RPM % + local lEngineRPMright = LoGetEngineInfo().RPM.right -- ENG2 RPM % + local lEngineTempLeft = LoGetEngineInfo().Temperature.left -- ENG1 EGT ºC + local lEngineTempRight = LoGetEngineInfo().Temperature.right -- ENG2 EGT ºC + --local lEngineFuelInternal = LoGetEngineInfo().fuel_internal -- TANK1 (INT) (KG) + --local lEngineFuelExternal = LoGetEngineInfo().fuel_external -- TANK2 (EXT) (KG) + + --local lMechInfo = LoGetMechInfo() -- mechanical components, e.g. Flaps, Wheelbrakes,... + --local lPayloadInfo = LoGetPayloadInfo() -- Paylod, e.g. bombs, guns, rockets, fuel tanks,... + + local lDistanceToWay = 999 + local lRoute = LoGetRoute() + + if (myData and lRoute) then -- if neither are nil + local myLoc = LoGeoCoordinatesToLoCoordinates(lLongitude, lLatitude) + --lDistanceToWay = math.sqrt((myLoc.x - lRoute.goto_point.world_point.x)^2 + (myLoc.y - lRoute.goto_point.world_point.y)^2) + lDistanceToWay = math.sqrt((myLoc.x - lRoute.goto_point.world_point.x)^2 + (myLoc.z - lRoute.goto_point.world_point.z)^2) + end + + if gES_GlassCockpitType == 1 then + -- HELIOS Version 1.3 + -- customizing for HELOS + lPitch = math.deg(lPitch) -- PITCH, (Radian to Grad) + lBank = math.deg(lBank) -- BANK (Radian to Grad) + lYaw = math.deg(lYaw) -- YAW (Radian to Grad) + lHSI_RMI = math.deg(lHSI_RMI) -- VOR1 OBS (Radian to Grad) + lHSI_ADF = math.deg(lHSI_ADF) -- ADF OBS (Radian to Grad) + lAoA = math.deg(lAoA) -- ANGLE OF ATTACK AoA (Radian to Grad) + lHeading = math.deg(lHeading) -- Heading (Radian to Grad) + lHSI_ADF = (360 - lHSI_ADF) + (360 - lHeading) + lHSI_RMI = 360 - lHSI_RMI + lIAS = lIAS * 3.6 -- change from m/s to km/h + + SendData("1", string.format("%.2f", lPitch) ) + SendData("2", string.format("%.2f", lBank) ) + SendData("3", string.format("%.2f", lYaw) ) + SendData("4", string.format("%.2f", lAltBar) ) + SendData("5", string.format("%.2f", lAltRad) ) + SendData("6", string.format("%.2f", lHSI_ADF) ) + SendData("7", string.format("%.2f", lHSI_RMI) ) + SendData("8", string.format("%.2f", lHeading) ) + SendData("9", string.format("%.2f", lEngineRPMleft) ) + SendData("10", string.format("%.2f", lEngineRPMright) ) + SendData("11", string.format("%.2f", lEngineTempLeft) ) + SendData("12", string.format("%.2f", lEngineTempRight) ) + SendData("13", string.format("%.2f", lVVI) ) + SendData("14", string.format("%.2f", lIAS) ) + SendData("15", string.format("%.2f", lDistanceToWay) ) + SendData("16", string.format("%.2f", lAoA) ) + SendData("17", string.format("%.2f", lGlide) ) + SendData("18", string.format("%.2f", lSide) ) + + elseif gES_GlassCockpitType == 2 then + -- HawgTouch version 1.6 + + local lRadToDCSsignd = math.pi + local lRadToDCSunsignd = math.pi * 2 + local lDefaultNull = 0.0 + local lDefaultOne = 1.0 + + -- IAS-TAS Indicator (IAS, TAS) {"%.4f;%.4f"} + FC_Russian_AirSpeed_1100hkm(1) + + -- AOA Indicator and Accelerometer (AOA, GLoad) + FC_Russian_AOA_Su25(3) + + -- ADI + FC_Russian_ADI_Old(4) + + -- HSI + FC_Russian_HSI(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 ProcessHARDWAREConfigHighImportance() +end + +function ProcessGlassCockpitFCLowImportanceConfig() + + if gES_GlassCockpitType == 1 then + -- HELIOS Version 1.3 + + elseif gES_GlassCockpitType == 2 then + -- HawgTouch version 1.6 + + FC_WeaponPanel_SU25(13) + + FC_RadarWarning_SPO15(14) + + -- Fuel Quantity Indicator + local lEngineInfo = LoGetEngineInfo() + if lEngineInfo ~= nil then + --WriteToLog('lEngineInfo: '..dump(lEngineInfo)) + --[[ + [fuel_external] = number: "0" + [Temperature] = { + [left] = number: "626.99444580078" + [right] = number: "626.99444580078" + } + [RPM] = { + [left] = number: "87.453765869141" + [right] = number: "87.453758239746" + } + [FuelConsumption] = { + [left] = number: "0.1500396137767" + [right] = number: "0.1500396137767" + } + [fuel_internal] = number: "3773.2749023438" + [EngineStart] = { + [left] = number: "0" + [right] = number: "0" + } + [HydraulicPressure] = { + [left] = number: "210" + [right] = number: "210" + } + lPayloadInfo.Stations[8].CLSID == E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF -- ext 800l Fuel Tank + ]] + + local lTotalFuel = lEngineInfo.fuel_internal + --local 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 ProcessHARDWAREConfigLowImportance() +-- where necessary, specify HardwareID, example WeaponStatusPanel(2) + WeaponStatusPanel() + MechanicalDevicesIndicator() + StatusLamp() + FuelQuantityIndicator() + SightingSystem() + SPO15RWR() +end + +----------------------------- +-- Custom functions -- +----------------------------- + +function SightingSystem(hardware) + local lHardware = hardware or 1 + local lSightingSystemInfo = LoGetSightingSystemInfo() + if lSightingSystemInfo == nil then + return + end + --WriteToLog('lSightingSystemInfo: '..dump(lSightingSystemInfo)9 + --[[ + [PRF] = { + [selection] = string: "ILV" + [current] = string: "MED" + } + [laser_on] = boolean: "false" + [scale] = { + [azimuth] = number: "0.52359873056412" + [distance] = number: "10000" + } + [radar_on] = boolean: "false" + [optical_system_on] = boolean: "false" + [LaunchAuthorized] = boolean: "false" + [ECM_on] = boolean: "false" + [Manufacturer] = string: "RUS" + [TDC] = { + [y] = number: "0" + [x] = number: "0" + } + [ScanZone] = { + [coverage_H] = { + [min] = number: "0" + [max] = number: "20000" + } + [size] = { + [azimuth] = number: "1.0471974611282" + [elevation] = number: "0.17453290522099" + } + [position] = { + [exceeding_manual] = number: "0" + [distance_manual] = number: "0" + [azimuth] = number: "0" + [elevation] = number: "0" + } + } + ]] + SendDataHW("600", lSightingSystemInfo.ECM_on == true and 1 or 0, lHardware ) + SendDataHW("601", lSightingSystemInfo.laser_on == true and 1 or 0, lHardware ) + SendDataHW("602", lSightingSystemInfo.optical_system_on == true and 1 or 0, lHardware ) + SendDataHW("603", lSightingSystemInfo.LaunchAuthorized == true and 1 or 0, lHardware ) + --SendDataHW("604", lSightingSystemInfo.radar_on == true and 1 or 0, lHardware ) +end + +function FlareChaff(hardware) + local lHardware = hardware or 1 + local lSnares = LoGetSnares() -- Flare and Chaff + if lSnares == nil then + return + end + --WriteToLog('lSnares: '..dump(lSnares)) + + --[chaff] = number: "128" + --[flare] = number: "128" +end + +function StatusLamp(hardware) + local lHardware = hardware or 1 + local lMCPState = LoGetMCPState() -- Warning Lights + if lMCPState == nil then + return + end + --WriteToLog('lMCPState: '..dump(lMCPState)) + --[[ + [RightTailPlaneFailure] = boolean: "false" + [EOSFailure] = boolean: "false" + [ECMFailure] = boolean: "false" + [RightAileronFailure] = boolean: "false" + [MasterWarning] = boolean: "false" + [RightEngineFailure] = boolean: "false" + [CannonFailure] = boolean: "false" + [MLWSFailure] = boolean: "false" + [ACSFailure] = boolean: "false" + [RadarFailure] = boolean: "false" + [HelmetFailure] = boolean: "false" + [HUDFailure] = boolean: "false" + [LeftMainPumpFailure] = boolean: "false" + [RightWingPumpFailure] = boolean: "false" + [LeftWingPumpFailure] = boolean: "false" + [MFDFailure] = boolean: "false" + [RWSFailure] = boolean: "false" + [GearFailure] = boolean: "false" + [HydraulicsFailure] = boolean: "false" + [AutopilotFailure] = boolean: "true" + [FuelTankDamage] = boolean: "false" + [LeftAileronFailure] = boolean: "false" + [CanopyOpen] = boolean: "false" + [RightMainPumpFailure] = boolean: "false" + [StallSignalization] = boolean: "false" + [LeftEngineFailure] = boolean: "false" + [AutopilotOn] = boolean: "false" + [LeftTailPlaneFailure] = boolean: "false" + ]] + + SendDataHW("700", lMCPState.LeftTailPlaneFailure == true and 1 or 0, lHardware ) + SendDataHW("701", lMCPState.RightTailPlaneFailure == true and 1 or 0, lHardware ) + SendDataHW("702", lMCPState.MasterWarning == true and 1 or 0, lHardware ) + SendDataHW("703", lMCPState.LeftEngineFailure == true and 1 or 0, lHardware ) + SendDataHW("704", lMCPState.RightEngineFailure == true and 1 or 0, lHardware ) + SendDataHW("705", lMCPState.LeftAileronFailure == true and 1 or 0, lHardware ) + SendDataHW("706", lMCPState.RightAileronFailure == true and 1 or 0, lHardware ) + SendDataHW("707", lMCPState.LeftMainPumpFailure == true and 1 or 0, lHardware ) + SendDataHW("708", lMCPState.RightMainPumpFailure == true and 1 or 0, lHardware ) + SendDataHW("709", lMCPState.LeftWingPumpFailure == true and 1 or 0, lHardware ) + SendDataHW("710", lMCPState.RightWingPumpFailure == true and 1 or 0, lHardware ) + SendDataHW("711", lMCPState.EOSFailure == true and 1 or 0, lHardware ) + SendDataHW("712", lMCPState.ECMFailure == true and 1 or 0, lHardware ) + SendDataHW("713", lMCPState.CannonFailure == true and 1 or 0, lHardware ) + SendDataHW("714", lMCPState.MLWSFailure == true and 1 or 0, lHardware ) + SendDataHW("715", lMCPState.ACSFailure == true and 1 or 0, lHardware ) + SendDataHW("716", lMCPState.RadarFailure == true and 1 or 0, lHardware ) + SendDataHW("717", lMCPState.HelmetFailure == true and 1 or 0, lHardware ) + SendDataHW("718", lMCPState.HUDFailure == true and 1 or 0, lHardware ) + SendDataHW("719", lMCPState.MFDFailure == true and 1 or 0, lHardware ) + SendDataHW("720", lMCPState.RWSFailure == true and 1 or 0, lHardware ) + SendDataHW("721", lMCPState.GearFailure == true and 1 or 0, lHardware ) + SendDataHW("722", lMCPState.HydraulicsFailure == true and 1 or 0, lHardware ) + SendDataHW("723", lMCPState.AutopilotFailure == true and 1 or 0, lHardware ) + SendDataHW("724", lMCPState.FuelTankDamage == true and 1 or 0, lHardware ) + SendDataHW("725", lMCPState.CanopyOpen == true and 1 or 0, lHardware ) + SendDataHW("726", lMCPState.StallSignalization == true and 1 or 0, lHardware ) + SendDataHW("727", lMCPState.AutopilotOn == true and 1 or 0, lHardware ) + + local lEngineInfo = LoGetEngineInfo() + if lEngineInfo ~= nil then + --WriteToLog('lEngineInfo: '..dump(lEngineInfo)) + SendDataHW("728", lEngineInfo.EngineStart.left, lHardware ) -- lamp start left engine 1 (0|1) + SendDataHW("729", lEngineInfo.EngineStart.right, lHardware ) -- lamp start right engine 1 (0|1) + end + + local lAoA = LoGetAngleOfAttack() + if lAoA ~= nil then + lAoA = lAoA * 57.3 + SendDataHW("730", (lAoA > 20.0 and 1 or 0), lHardware ) -- lamp start AOA warning (0|1) + end +end + +function WeaponStatusPanel(hardware) +-- The weapon status panel, quantity and readiness of the currently selected weapon and the remaining gun ammunition are indicated. + local lHardware = hardware or 1 + gES_PayloadInfo = LoGetPayloadInfo() + if gES_PayloadInfo == nil then + return + end + --WriteToLog('gES_PayloadInfo: '..dump(gES_PayloadInfo)) + --[[ exsample + [Stations] = { + [1] = { + [CLSID] = string: "{682A481F-0CB5-4693-A382-D00DD4A156D7}" + [container] = boolean: "false" + [count] = number: "1" + [weapon] = { + [level3] = number: "7" + [level1] = number: "4" + [level4] = number: "10" + [level2] = number: "4" + } + } + [2] = { + [CLSID] = string: "{682A481F-0CB5-4693-A382-D00DD4A156D7}" + [container] = boolean: "false" + [count] = number: "1" + [weapon] = { + [level3] = number: "7" + [level1] = number: "4" + [level4] = number: "10" + [level2] = number: "4" + } + } + [3] = { + [wstype] = { + [level3] = number: "32" + [level1] = number: "4" + [level4] = number: "6" + [level2] = number: "7" + } + [count] = number: "20" + [CLSID] = string: "{F72F47E5-C83A-4B85-96ED-D3E46671EE9A}" + [adapter] = { + [level3] = number: "0" + [level1] = number: "0" + [level4] = number: "0" + [level2] = number: "0" + } + [container] = boolean: "true" + [weapon] = { + [level3] = number: "33" + [level1] = number: "4" + [level4] = number: "32" + [level2] = number: "7" + } + } + [4] = { + [wstype] = { + [level3] = number: "32" + [level1] = number: "4" + [level4] = number: "6" + [level2] = number: "7" + } + [count] = number: "20" + [CLSID] = string: "{F72F47E5-C83A-4B85-96ED-D3E46671EE9A}" + [adapter] = { + [level3] = number: "0" + [level1] = number: "0" + [level4] = number: "0" + [level2] = number: "0" + } + [container] = boolean: "true" + [weapon] = { + [level3] = number: "33" + [level1] = number: "4" + [level4] = number: "32" + [level2] = number: "7" + } + } + [5] = { + [wstype] = { + [level3] = number: "32" + [level1] = number: "4" + [level4] = number: "99" + [level2] = number: "4" + } + [count] = number: "1" + [CLSID] = string: "{79D73885-0801-45a9-917F-C90FE1CE3DFC}" + [adapter] = { + [level3] = number: "0" + [level1] = number: "0" + [level4] = number: "0" + [level2] = number: "0" + } + [container] = boolean: "true" + [weapon] = { + [level3] = number: "8" + [level1] = number: "4" + [level4] = number: "45" + [level2] = number: "4" + } + } + [6] = { + [wstype] = { + [level3] = number: "32" + [level1] = number: "4" + [level4] = number: "99" + [level2] = number: "4" + } + [count] = number: "1" + [CLSID] = string: "{79D73885-0801-45a9-917F-C90FE1CE3DFC}" + [adapter] = { + [level3] = number: "0" + [level1] = number: "0" + [level4] = number: "0" + [level2] = number: "0" + } + [container] = boolean: "true" + [weapon] = { + [level3] = number: "8" + [level1] = number: "4" + [level4] = number: "45" + [level2] = number: "4" + } + } + [7] = { + [wstype] = { + [level3] = number: "32" + [level1] = number: "4" + [level4] = number: "47" + [level2] = number: "4" + } + [count] = number: "8" + [CLSID] = string: "{F789E86A-EE2E-4E6B-B81E-D5E5F903B6ED}" + [adapter] = { + [level3] = number: "0" + [level1] = number: "0" + [level4] = number: "0" + [level2] = number: "0" + } + [container] = boolean: "true" + [weapon] = { + [level3] = number: "8" + [level1] = number: "4" + [level4] = number: "58" + [level2] = number: "4" + } + } + [8] = { + [wstype] = { + [level3] = number: "32" + [level1] = number: "4" + [level4] = number: "47" + [level2] = number: "4" + } + [count] = number: "8" + [CLSID] = string: "{F789E86A-EE2E-4E6B-B81E-D5E5F903B6ED}" + [adapter] = { + [level3] = number: "0" + [level1] = number: "0" + [level4] = number: "0" + [level2] = number: "0" + } + [container] = boolean: "true" + [weapon] = { + [level3] = number: "8" + [level1] = number: "4" + [level4] = number: "58" + [level2] = number: "4" + } + } + [9] = { + [CLSID] = string: "{D5435F26-F120-4FA3-9867-34ACE562EF1B}" + [container] = boolean: "false" + [count] = number: "1" + [weapon] = { + [level3] = number: "38" + [level1] = number: "4" + [level4] = number: "20" + [level2] = number: "5" + } + } + [10] = { + [CLSID] = string: "{D5435F26-F120-4FA3-9867-34ACE562EF1B}" + [container] = boolean: "false" + [count] = number: "1" + [weapon] = { + [level3] = number: "38" + [level1] = number: "4" + [level4] = number: "20" + [level2] = number: "5" + } + } + [11] = { + [CLSID] = string: "" + [container] = boolean: "false" + [count] = number: "0" + [weapon] = { + [level3] = number: "0" + [level1] = number: "0" + [level4] = number: "0" + [level2] = number: "0" + } + } + } + [CurrentStation] = number: "0" + [Cannon] = { + [shells] = number: "250" + } + ]] + --[[ + Weapon Panel + | + --------------------------------------------------- + | | | | | | | | | | | + 1 2 3 4 5 C 6 7 8 9 10 + ]] + -- Payload Info + -- weapon stations (panel) 1 (left) - 10 (right), no lamp for center station + SendDataHW("100", gES_PayloadInfo.Cannon.shells, lHardware ) -- count cannon shells + SendDataHW("101", (gES_PayloadInfo.Stations[1].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 1) + SendDataHW("110", (gES_PayloadInfo.Stations[2].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 10) + SendDataHW("102", (gES_PayloadInfo.Stations[3].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 2) + SendDataHW("109", (gES_PayloadInfo.Stations[4].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 9) + SendDataHW("103", (gES_PayloadInfo.Stations[5].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 3) + SendDataHW("108", (gES_PayloadInfo.Stations[6].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 8) + SendDataHW("104", (gES_PayloadInfo.Stations[7].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 4) + SendDataHW("107", (gES_PayloadInfo.Stations[8].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 7) + SendDataHW("105", (gES_PayloadInfo.Stations[9].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 5) + SendDataHW("106", (gES_PayloadInfo.Stations[10].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 6) + --SendDataHW("110", (gES_PayloadInfo.Stations[11].count > 0 and 1 or 0) ) -- weapon presend > 0 center station, not visible + --SendDataHW("CurrentStation", gES_PayloadInfo.CurrentStation, lHardware ) + -- air-to-air missils panel 1 and 11, air combat modus, CurrentStation = 1, panel 1 and 11 on + -- CurrentStation 5, panel 3 + -- CurrentStation 3, panel 2 + -- CurrentStation 7, panel 4 + -- CurrentStation 4, panel 9 + -- CurrentStation 9, panel 5 + -- CurrentStation 10, panel 6 + -- CurrentStation 8, panel 7 + -- CurrentStation 6, panel 8 + -- wenn die Waffenstationen gleichmässig belegt sind, hat bei Auswahl CurrentStation immer den Wert der linken Station + -- bei ungleichmäßiger Belegung, hat CurrentStation immer den Wert der jeweiligen Station + -- Waffenbezeichnung als UUID, gES_PayloadInfo.Stations[X].CLSID + + -- defination + if gES_CurrentStationTmp == nil then + gES_CurrentStationTmp = -1 + end + + if gES_PayloadInfo.CurrentStation > 0 and + gES_CurrentStationTmp ~= gES_PayloadInfo.CurrentStation then + gES_CurrentStationTmp = gES_PayloadInfo.CurrentStation + + gES_TmpStationToPanel = {} + gES_TmpStationToPanel[1] = {Panel = 1, StationID = 101, CurrentID = 201, HardwareID = lHardware } -- left + gES_TmpStationToPanel[2] = {Panel = 10, StationID = 110, CurrentID = 210, HardwareID = lHardware } -- right + gES_TmpStationToPanel[3] = {Panel = 2, StationID = 102, CurrentID = 202, HardwareID = lHardware } + gES_TmpStationToPanel[4] = {Panel = 9, StationID = 109, CurrentID = 209, HardwareID = lHardware } + gES_TmpStationToPanel[5] = {Panel = 3, StationID = 103, CurrentID = 203, HardwareID = lHardware } + gES_TmpStationToPanel[6] = {Panel = 8, StationID = 108, CurrentID = 208, HardwareID = lHardware } + gES_TmpStationToPanel[7] = {Panel = 4, StationID = 104, CurrentID = 204, HardwareID = lHardware } + gES_TmpStationToPanel[8] = {Panel = 7, StationID = 107, CurrentID = 207, HardwareID = lHardware } + gES_TmpStationToPanel[9] = {Panel = 5, StationID = 105, CurrentID = 205, HardwareID = lHardware } + gES_TmpStationToPanel[10] = {Panel = 6, StationID = 106, CurrentID = 206, HardwareID = lHardware } + + WeaponStatusPanel_Reset(201, 210, lHardware) + + if gES_TmpStationToPanel[gES_PayloadInfo.CurrentStation] ~= nil then + SendDataHW(gES_TmpStationToPanel[gES_PayloadInfo.CurrentStation].CurrentID, 1, lHardware ) -- eigentliche Auswahl + + table.foreach(gES_PayloadInfo.Stations, WeaponStatusPanel_selectCurrentPayloadStation) -- zugehörige Stationen + end + end +end + +function FuelQuantityIndicator(hardware) +-- Fuel quantity shows the fuel remaining in all tanks + local lHardware = hardware or 1 + local lEngineInfo = LoGetEngineInfo() + if lEngineInfo == nil then + return + end + --WriteToLog('lEngineInfo: '..dump(lEngineInfo)) + --[[ + [fuel_external] = number: "0" + [Temperature] = { + [left] = number: "626.99444580078" + [right] = number: "626.99444580078" + } + [RPM] = { + [left] = number: "87.453765869141" + [right] = number: "87.453758239746" + } + [FuelConsumption] = { + [left] = number: "0.1500396137767" + [right] = number: "0.1500396137767" + } + [fuel_internal] = number: "3773.2749023438" + [EngineStart] = { + [left] = number: "0" + [right] = number: "0" + } + [HydraulicPressure] = { + [left] = number: "210" + [right] = number: "210" + } + lPayloadInfo.Stations[8].CLSID == E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF -- ext 800l Fuel Tank + ]] + + SendDataHW("300", string.format("%d", math.round((lEngineInfo.fuel_internal / 10), 0, "ceil") * 10), lHardware ) -- total fuel in kg + --SendDataHW("301", string.format("%d", lEngineInfo.fuel_internal)) -- total fuel in kg + --SendDataHW("302", string.format("%d", lEngineInfo.fuel_external)) -- external fuel in kg + + local lPayloadInfo = LoGetPayloadInfo() + if lPayloadInfo ~= nil then + --WriteToLog('lPayloadInfo: '..dump(lPayloadInfo)) + if lPayloadInfo.Stations[10].CLSID == "{E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF}" or + lPayloadInfo.Stations[9].CLSID == "{E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF}" then -- external tanks presend and full (panel 6 and 5) + SendDataHW("303", ((lEngineInfo.fuel_external < 1240.0 ) and 1 or 0), lHardware ) + else + SendDataHW("303", 1, lHardware ) + end + if lPayloadInfo.Stations[5].CLSID == "{E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF}" or + lPayloadInfo.Stations[6].CLSID == "{E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF}" then-- inner tank presend and full (panel 3 and 8) + SendDataHW("304", ((lEngineInfo.fuel_external < 1.0 ) and 1 or 0), lHardware ) + else + SendDataHW("304", 1, lHardware ) + end + else + SendDataHW("303", 1, lHardware ) + SendDataHW("304", 1, lHardware ) + end + SendDataHW("305", (lEngineInfo.fuel_internal < 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 diff --git a/ExportsModules/Su-27.lua b/ExportsModules/Su-27.lua new file mode 100644 index 0000000..42439ec --- /dev/null +++ b/ExportsModules/Su-27.lua @@ -0,0 +1,884 @@ +-- Su-27 Export +-- Version 0.9.9 BETA + +gES_FoundFCModule = true + +-- auxiliary function +dofile(gES_ExportModulePath.."FC_AuxiliaryFuntions.lua") + +----------------------------------------- +-- FLAMING CLIFFS AIRCRAFT / Su-27 -- +-- FC aircraft don't support GetDevice -- +----------------------------------------- + +function ProcessGlassCockpitFCHighImportanceConfig() + + local myData = LoGetSelfData() + + if (myData) then + local lLatitude = myData.LatLongAlt.Lat -- LATITUDE + local lLongitude = myData.LatLongAlt.Long -- LONGITUDE + local lBasicAtmospherePressure = LoGetBasicAtmospherePressure() -- BAROMETRIC PRESSURE + local lAltBar = LoGetAltitudeAboveSeaLevel() -- ALTITUDE SEA LEVEL (Meter) + local lAltRad = LoGetAltitudeAboveGroundLevel() -- ALTITUDE GROUND LEVEL (Meter) + --local lTrueAirSpeed = LoGetTrueAirSpeed() -- TRUE AIRSPEED (Meter/Second) + local lPitch, lBank, lYaw = LoGetADIPitchBankYaw() -- PITCH, BANK, YAW (Radian) + + local lHeading = myData.Heading -- HEADING (Radian) + local lVVI = LoGetVerticalVelocity() -- VERTICAL SPEED (Meter/Second) + local lIAS = LoGetIndicatedAirSpeed() -- INDICATED AIRSPEED (Meter/Second) + --local lMachNumber = LoGetMachNumber() -- MACH + local lAoA = LoGetAngleOfAttack() -- ANGLE OF ATTACK AoA (Radian) + + local lGlide = LoGetGlideDeviation() -- VOR1 HORIZONTAL DEFLECTION (-1 +1) + local lSide = LoGetSideDeviation() -- VOR1 VERTICAL DEFLECTION (-1 +1) + --local lSlipBallPosition = LoGetSlipBallPosition() -- SLIP BALL (-1 +1) + --local lAccelerationUnits = LoGetAccelerationUnits().y -- G-LOAD + + --local lNavInfoPitch = LoGetNavigationInfo().Requirements.pitch -- AP REQUIRED PITCH (Radian) + --local lNavInfoRoll = LoGetNavigationInfo().Requirements.roll -- AP REQUIRED BANK (Radian) + --local lNavInfoSpeed = LoGetNavigationInfo().Requirements.speed -- AP SPEED (Meter/Second) + --local lNavInfoAltitude = LoGetNavigationInfo().Requirements.altitude -- AP ALTITUDE (Meter) + --local lNavInfoVerticalSpeed = LoGetNavigationInfo().Requirements.vertical_speed -- AP VERTICAL SPEED (Meter/Second) + + --local lControlPanel_HSI = LoGetControlPanel_HSI() -- HSI Data + local lHSI_RMI = LoGetControlPanel_HSI().RMI_raw -- VOR1 OBS (Radian) + local lHSI_ADF = LoGetControlPanel_HSI().ADF_raw -- ADF OBS (Radian) + --local lHSI_Heading = LoGetControlPanel_HSI().Heading_raw -- Heading (Radian) + + local lEngineRPMleft = LoGetEngineInfo().RPM.left -- ENG1 RPM % + local lEngineRPMright = LoGetEngineInfo().RPM.right -- ENG2 RPM % + local lEngineTempLeft = LoGetEngineInfo().Temperature.left -- ENG1 EGT ºC + local lEngineTempRight = LoGetEngineInfo().Temperature.right -- ENG2 EGT ºC + --local lEngineFuelInternal = LoGetEngineInfo().fuel_internal -- TANK1 (INT) (KG) + --local lEngineFuelExternal = LoGetEngineInfo().fuel_external -- TANK2 (EXT) (KG) + + --local lMechInfo = LoGetMechInfo() -- mechanical components, e.g. Flaps, Wheelbrakes,... + --local lPayloadInfo = LoGetPayloadInfo() -- Paylod, e.g. bombs, guns, rockets, fuel tanks,... + + local lDistanceToWay = 999 + local lRoute = LoGetRoute() + + if (myData and lRoute) then -- if neither are nil + local myLoc = LoGeoCoordinatesToLoCoordinates(lLongitude, lLatitude) + --lDistanceToWay = math.sqrt((myLoc.x - lRoute.goto_point.world_point.x)^2 + (myLoc.y - lRoute.goto_point.world_point.y)^2) + lDistanceToWay = math.sqrt((myLoc.x - lRoute.goto_point.world_point.x)^2 + (myLoc.z - lRoute.goto_point.world_point.z)^2) + end + + if gES_GlassCockpitType == 1 then + -- HELIOS Version 1.3 + -- customizing for HELOS + lPitch = math.deg(lPitch) -- PITCH, (Radian to Grad) + lBank = math.deg(lBank) -- BANK (Radian to Grad) + lYaw = math.deg(lYaw) -- YAW (Radian to Grad) + lHSI_RMI = math.deg(lHSI_RMI) -- VOR1 OBS (Radian to Grad) + lHSI_ADF = math.deg(lHSI_ADF) -- ADF OBS (Radian to Grad) + lAoA = math.deg(lAoA) -- ANGLE OF ATTACK AoA (Radian to Grad) + lHeading = math.deg(lHeading) -- Heading (Radian to Grad) + lHSI_ADF = (360 - lHSI_ADF) + (360 - lHeading) + lHSI_RMI = 360 - lHSI_RMI + lIAS = lIAS * 3.6 -- change from m/s to km/h + + SendData("1", string.format("%.2f", lPitch) ) + SendData("2", string.format("%.2f", lBank) ) + SendData("3", string.format("%.2f", lYaw) ) + SendData("4", string.format("%.2f", lAltBar) ) + SendData("5", string.format("%.2f", lAltRad) ) + SendData("6", string.format("%.2f", lHSI_ADF) ) + SendData("7", string.format("%.2f", lHSI_RMI) ) + SendData("8", string.format("%.2f", lHeading) ) + SendData("9", string.format("%.2f", lEngineRPMleft) ) + SendData("10", string.format("%.2f", lEngineRPMright) ) + SendData("11", string.format("%.2f", lEngineTempLeft) ) + SendData("12", string.format("%.2f", lEngineTempRight) ) + SendData("13", string.format("%.2f", lVVI) ) + SendData("14", string.format("%.2f", lIAS) ) + SendData("15", string.format("%.2f", lDistanceToWay) ) + SendData("16", string.format("%.2f", lAoA) ) + SendData("17", string.format("%.2f", lGlide) ) + SendData("18", string.format("%.2f", lSide) ) + + elseif gES_GlassCockpitType == 2 then + -- HawgTouch version 1.6 + + local lRadToDCSsignd = math.pi + local lRadToDCSunsignd = math.pi * 2 + local lDefaultNull = 0.0 + local lDefaultOne = 1.0 + + -- IAS-MACH Indicator (IAS, MACH) {"%.4f;%.4f"} + FC_Russian_AirSpeed_1600hkm(1) + + -- AOA Indicator and Accelerometer (AOA, GLoad) + FC_Russian_AOA_Su2733(3) + + -- ADI + FC_Russian_ADI_Old(4) + + -- HSI + FC_Russian_HSI(lDistanceToWay, 5) + + -- Vertical Velocity Indicator (VVI) (VVI, TurnIndicator, SlipBallPosition) + FC_Russian_VVI_Old(6) + + -- Radar Altimeter (AltRad, MinAltitude, WarningFlag, MinAltitudeLamp) {"%.4f;%.4f;%.1f;%.1f"} (below 100m is warning light on) + FC_Russian_RadarAltimeter_1500m(100, 7) + + -- Barometric Altimeter (AltBar, BasicAtmospherePressure) + FC_Russian_BarometricAltimeter_20000(8) + + -- Tachometer (RPM) (EngineRPMleft, EngineRPMright) {"%.4f;%.4f"} + FC_Russian_EngineRPM(9) + + -- Left Jet Engine Turbine Temperature Indicator (EngineTemp) {"%.4f"} + FC_TwoNeedlesGauge(lEngineTempLeft, 1200, 100, 10) + + -- Right Jet Engine Turbine Temperature Indicator (EngineTemp) {"%.4f"} + FC_TwoNeedlesGauge(lEngineTempRight, 1200, 100, 11) + + -- Clock from Ka-50 {CurrentHours, CurrentMinutes, CurrentSeconds, 0, FlightTimeHours, FlightTimeMinutes, 0, 0) {"%.4f;%.4f;%.4f;%.1f;%.4f;%.4f;%.4f;%.4f"} + FC_Russian_Clock_late(12) + end + else + WriteToLog("Unknown FC Error, no LoGetSelfData.") + end + +end + +function ProcessHARDWAREConfigHighImportance(mainPanelDevice) +end + +function ProcessGlassCockpitFCLowImportanceConfig() + + if gES_GlassCockpitType == 1 then + -- HELIOS Version 1.3 + + elseif gES_GlassCockpitType == 2 then + -- HawgTouch version 1.6 + + FC_WeaponPanel_SU2733(13) + + FC_RadarWarning_SPO15(14) + + -- Fuel Quantity Indicator + local lEngineInfo = LoGetEngineInfo() + if lEngineInfo ~= nil then + --WriteToLog('lEngineInfo: '..dump(lEngineInfo)) + --[[ + [fuel_external] = number: "0" + [Temperature] = { + [left] = number: "626.99444580078" + [right] = number: "626.99444580078" + } + [RPM] = { + [left] = number: "87.453765869141" + [right] = number: "87.453758239746" + } + [FuelConsumption] = { + [left] = number: "0.1500396137767" + [right] = number: "0.1500396137767" + } + [fuel_internal] = number: "3773.2749023438" + [EngineStart] = { + [left] = number: "0" + [right] = number: "0" + } + [HydraulicPressure] = { + [left] = number: "210" + [right] = number: "210" + } + lPayloadInfo.Stations[8].CLSID == E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF -- ext 800l Fuel Tank + ]] + + local lTotalFuel = lEngineInfo.fuel_internal + --local lTotalFuel = string.format("%3d", math.round((lEngineInfo.fuel_internal / 10), 0, "ceil") * 10) + --local lTotalFuel = string.format("%4d", lEngineInfo.fuel_internal) -- total fuel in kg + --local lTotalFuel = string.format("%4d", lEngineInfo.fuel_external) -- external fuel in kg + local lTotalFuel_9_3 = 0 + local lTotalFuel_5_0 = 0 + + if lTotalFuel < 9000 then + if lTotalFuel > 3000 then + --[[ + y_min = 0.0 -- minimaler Ausgabewert + y_max = 1.0 -- maximaler Ausgabewert + x_min = 3000 -- minimaler Eingangswert + x_max = 9000 -- maximaler Eingangswert + x = 8000 -- aktueller Eingangswert + + d_y = 1 -- Delta Ausgabewerte (y_max - y_min) + d_x = 6000 -- Delta Eingangswerte (x_max - x_min) + m = 1.66666666666666666666666666667e-4 -- Steigung der linearen Funktion (d_y / d_x) + n = -0,5 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max) + + y = 0.83333 -- Ergebnis (m * x + n) + ]] + lTotalFuel_9_3 = 1.6666666666666666666666666666667e-4 * lTotalFuel + -0.5 + else + lTotalFuel_9_3 = 0.0 + end + else + lTotalFuel_9_3 = 1.0 + end + if lTotalFuel < 5000 then + lTotalFuel_5_0 = lTotalFuel / 5000 + else + lTotalFuel_5_0 = 1.0 + end + + -- TotalFuel_5_0 + -- TotalFuel_9_3 + -- Light1 + -- Light2 + -- Light3 + -- Light4 + -- BingoLight + SendData("15", string.format("%0.4f;%0.4f;%d;%d;%d;%d;%d", + lTotalFuel_5_0, + lTotalFuel_9_3, + (lEngineInfo.fuel_internal < 5000.0 and 1 or 0), -- Tank warning 1 + (lEngineInfo.fuel_internal < 4000.0 and 1 or 0), -- Tank warning 2 + (lEngineInfo.fuel_internal < 1500.0 and 1 or 0), -- Tank warning 3 + (lEngineInfo.fuel_internal < 1000.0 and 1 or 0), -- Tank warning 4 + (lEngineInfo.fuel_internal < 600.0 and 1 or 0))) -- Bingo Fuel + + -- Hydraulic Pressure Left + FC_OneNeedleGauge(lEngineInfo.HydraulicPressure.left, 240, 17) + + -- Hydraulic Pressure Right + FC_OneNeedleGauge(lEngineInfo.HydraulicPressure.right, 240, 18) + end + + -- EKRAN Message + FC_EKRAN(16) + + -- Mechanical Configuration Indicator (GearWarningLight, NoseGear, LeftGear, RightGear, Airbreaks, Flaps1, Flaps2) {"%.1f;%d;%d;%d;%d;%d;%d"} + local lMechInfo = LoGetMechInfo() -- mechanical components, e.g. Flaps, Wheelbrakes,... + if lMechInfo ~= nil then + local lWarningLight = 0.0 + local lTrueAirSpeed = LoGetTrueAirSpeed() + if lTrueAirSpeed ~= nil then + lWarningLight = ((lMechInfo.flaps.value > 0.93 and lTrueAirSpeed > 340) and 1.0 or 0.0) -- Speed Warning for Flaps, same light as gear warning light, but blinking light + lWarningLight = (((lMechInfo.gear.status == 1 and lMechInfo.gear.value < 1) or (lMechInfo.gear.status == 0 and lMechInfo.gear.value > 0)) and 1.0 or lWarningLight ) -- gear warning light + end + -- WarningLight {0.0 = Off, 0.1 = blinking light, 0.2 = on} + -- WarningLight {0.0 = Off, no blinking light, 1.0 = on} + + -- left gear {0, 1} + -- right gear {0, 1} + -- nose gear {0, 1} + -- WarningLight + -- Flap + -- Intake FOD shields + -- Speedbreakes on {0, 1} + SendData("2", string.format("%.1f;%d;%d;%d;%d;%d;%d", + (lMechInfo.gear.value > 0.95 and 1 or 0), -- left gear + (lMechInfo.gear.value == 1 and 1 or 0), -- right gear + (lMechInfo.gear.value > 0.85 and 1 or 0), -- nose gear + lWarningLight, + (lMechInfo.flaps.value > 0.93 and 1 or 0), -- flap + (lMechInfo.gear.value > 0.5 and 1 or 0), -- Intake FOD shields + (lMechInfo.speedbrakes.value > 0.1 and 1 or 0))) -- speedbreakes on > 0.1 (0 - 1) + + -- Wheelbrakes Hydraulic Pressure Left + FC_OneNeedleGauge(lMechInfo.wheelbrakes.value, 240, 19) + + -- Wheelbrakes Hydraulic Pressure Right + FC_OneNeedleGauge(lMechInfo.wheelbrakes.value, 240, 20) + + --WriteToLog('lMechInfo.noseflap.value: '..dump(lMechInfo.noseflap.value)) -- Vorfluegel, Balkenanzeige neben dem Radarhoehenmesser (0=oben bis 30=unten) + end + + -- Airintake + FC_Russian_AirIntake(21) + end + + --(x < 0 and 'negative' or 'non-negative') + --[[ + local lPayloadInfo = LoGetPayloadInfo() + WriteToLog('lPayloadInfo: '..dump(lPayloadInfo)) + + local lSnares = LoGetSnares() -- Flare and Chaff + WriteToLog('lSnares: '..dump(lSnares)) + + local lSightingSystemInfo = LoGetSightingSystemInfo() + WriteToLog('lSightingSystemInfo: '..dump(lSightingSystemInfo)) + + local lTWSInfo = LoGetTWSInfo() -- SPO Informationen, z.B. Radarwarner F15C + WriteToLog('lTWSInfo: '..dump(lTWSInfo)) + + local lTargetInformation = LoGetTargetInformation() -- detalierte Radar Infos z.B. F15C + WriteToLog('lTargetInformation: '..dump(lTargetInformation)) + + local lLockedTargetInformation = LoGetLockedTargetInformation() + WriteToLog('lLockedTargetInformation: '..dump(lLockedTargetInformation)) + + local lF15_TWS_Contacs = LoGetF15_TWS_Contacts() -- the same information but only for F-15 in TWS mode + WriteToLog('lF15_TWS_Contacs: '..dump(lF15_TWS_Contacs)) + + local lMechInfo = LoGetMechInfo() -- mechanical components, e.g. Flaps, Wheelbrakes,... + WriteToLog('lMechInfo: '..dump(lMechInfo)) + + local lMCPState = LoGetMCPState() -- Warnlichter + WriteToLog('lMCPState: '..dump(lMCPState)) + + local lControlPanel_HSI = LoGetControlPanel_HSI() + WriteToLog('lControlPanel_HSI: '..dump(lControlPanel_HSI)) + + local lRadioBeaconsStatus = LoGetRadioBeaconsStatus() + WriteToLog('lRadioBeaconsStatus: '..dump(lRadioBeaconsStatus)) + + local lEngineInfo = LoGetEngineInfo() + WriteToLog('lEngineInfo: '..dump(lEngineInfo)) + ]] + -- Weapon Control System + --local lNameByType = LoGetNameByType () -- args 4 (number : level1,level2,level3,level4), result string + -- values from LoGetTargetInformation().type + --WriteToLog('lNameByType: '..dump(lNameByType)) +end + +function ProcessHARDWAREConfigLowImportance(mainPanelDevice) +-- where necessary, specify HardwareID, example WeaponStatusPanel(2) + WeaponStatusPanel() + MechanicalDevicesIndicator() + StatusLamp() + FuelQuantityIndicator() + SightingSystem() + SPO15RWR() + PPDSPPanel() +end + +----------------------------- +-- Custom functions -- +----------------------------- + +function SightingSystem(hardware) + local lHardware = hardware or 1 + local lSightingSystemInfo = LoGetSightingSystemInfo() + if lSightingSystemInfo == nil then + return + end + --WriteToLog('lSightingSystemInfo: '..dump(lSightingSystemInfo)9 + --[[ + [PRF] = { + [selection] = string: "ILV" + [current] = string: "MED" + } + [laser_on] = boolean: "false" + [scale] = { + [azimuth] = number: "0.52359873056412" + [distance] = number: "10000" + } + [radar_on] = boolean: "false" + [optical_system_on] = boolean: "false" + [LaunchAuthorized] = boolean: "false" + [ECM_on] = boolean: "false" + [Manufacturer] = string: "RUS" + [TDC] = { + [y] = number: "0" + [x] = number: "0" + } + [ScanZone] = { + [coverage_H] = { + [min] = number: "0" + [max] = number: "20000" + } + [size] = { + [azimuth] = number: "1.0471974611282" + [elevation] = number: "0.17453290522099" + } + [position] = { + [exceeding_manual] = number: "0" + [distance_manual] = number: "0" + [azimuth] = number: "0" + [elevation] = number: "0" + } + } + ]] + SendDataHW("600", lSightingSystemInfo.ECM_on == true and 1 or 0, lHardware ) + SendDataHW("601", lSightingSystemInfo.laser_on == true and 1 or 0, lHardware ) + --SendDataHW("602", lSightingSystemInfo.optical_system_on == true and 1 or 0, lHardware ) + SendDataHW("603", lSightingSystemInfo.LaunchAuthorized == true and 1 or 0, lHardware ) + SendDataHW("604", lSightingSystemInfo.radar_on == true and 1 or 0, lHardware ) +end + +function PPDSPPanel(hardware) + local lHardware = hardware or 1 + local lSnares = LoGetSnares() -- Flare and Chaff + if lSnares == nil then + return + end + --WriteToLog('lSnares: '..dump(lSnares)) + + --[chaff] = number: "96" + --[flare] = number: "96" + + local lChaffLED = math.round(lSnares.chaff / 12, 0, "ceil") + 1 + local lFlareLED = math.round(lSnares.flare / 12, 0, "ceil") + 1 + + SendDataHW("800", (lChaffLED <= 1 and 0 or 1), lHardware ) + SendDataHW("801", (lChaffLED <= 2 and 0 or 1), lHardware ) + SendDataHW("802", (lChaffLED <= 3 and 0 or 1), lHardware ) + SendDataHW("803", (lChaffLED <= 4 and 0 or 1), lHardware ) + SendDataHW("804", (lChaffLED <= 5 and 0 or 1), lHardware ) + SendDataHW("805", (lChaffLED <= 6 and 0 or 1), lHardware ) + SendDataHW("806", (lChaffLED <= 7 and 0 or 1), lHardware ) + SendDataHW("807", (lChaffLED <= 8 and 0 or 1), lHardware ) + + SendDataHW("810", (lFlareLED <= 1 and 0 or 1), lHardware ) + SendDataHW("811", (lFlareLED <= 2 and 0 or 1), lHardware ) + SendDataHW("812", (lFlareLED <= 3 and 0 or 1), lHardware ) + SendDataHW("813", (lFlareLED <= 4 and 0 or 1), lHardware ) + SendDataHW("814", (lFlareLED <= 5 and 0 or 1), lHardware ) + SendDataHW("815", (lFlareLED <= 6 and 0 or 1), lHardware ) + SendDataHW("816", (lFlareLED <= 7 and 0 or 1), lHardware ) + SendDataHW("817", (lFlareLED <= 8 and 0 or 1), lHardware ) + SendDataHW("817", (lFlareLED <= 8 and 0 or 1), lHardware ) +end + +function StatusLamp(hardware) + local lHardware = hardware or 1 + local lMCPState = LoGetMCPState() -- Warning Lights + if lMCPState == nil then + return + end + --WriteToLog('lMCPState: '..dump(lMCPState)) + --[[ + [RightTailPlaneFailure] = boolean: "false" + [EOSFailure] = boolean: "false" + [ECMFailure] = boolean: "false" + [RightAileronFailure] = boolean: "false" + [MasterWarning] = boolean: "false" + [RightEngineFailure] = boolean: "false" + [CannonFailure] = boolean: "false" + [MLWSFailure] = boolean: "false" + [ACSFailure] = boolean: "false" + [RadarFailure] = boolean: "false" + [HelmetFailure] = boolean: "false" + [HUDFailure] = boolean: "false" + [LeftMainPumpFailure] = boolean: "false" + [RightWingPumpFailure] = boolean: "false" + [LeftWingPumpFailure] = boolean: "false" + [MFDFailure] = boolean: "false" + [RWSFailure] = boolean: "false" + [GearFailure] = boolean: "false" + [HydraulicsFailure] = boolean: "false" + [AutopilotFailure] = boolean: "true" + [FuelTankDamage] = boolean: "false" + [LeftAileronFailure] = boolean: "false" + [CanopyOpen] = boolean: "false" + [RightMainPumpFailure] = boolean: "false" + [StallSignalization] = boolean: "false" + [LeftEngineFailure] = boolean: "false" + [AutopilotOn] = boolean: "false" + [LeftTailPlaneFailure] = boolean: "false" + ]] + + SendDataHW("700", lMCPState.LeftTailPlaneFailure == true and 1 or 0, lHardware ) + SendDataHW("701", lMCPState.RightTailPlaneFailure == true and 1 or 0, lHardware ) + SendDataHW("702", lMCPState.MasterWarning == true and 1 or 0, lHardware ) + SendDataHW("703", lMCPState.LeftEngineFailure == true and 1 or 0, lHardware ) + SendDataHW("704", lMCPState.RightEngineFailure == true and 1 or 0, lHardware ) + SendDataHW("705", lMCPState.LeftAileronFailure == true and 1 or 0, lHardware ) + SendDataHW("706", lMCPState.RightAileronFailure == true and 1 or 0, lHardware ) + SendDataHW("707", lMCPState.LeftMainPumpFailure == true and 1 or 0, lHardware ) + SendDataHW("708", lMCPState.RightMainPumpFailure == true and 1 or 0, lHardware ) + SendDataHW("709", lMCPState.LeftWingPumpFailure == true and 1 or 0, lHardware ) + SendDataHW("710", lMCPState.RightWingPumpFailure == true and 1 or 0, lHardware ) + SendDataHW("711", lMCPState.EOSFailure == true and 1 or 0, lHardware ) + SendDataHW("712", lMCPState.ECMFailure == true and 1 or 0, lHardware ) + SendDataHW("713", lMCPState.CannonFailure == true and 1 or 0, lHardware ) + SendDataHW("714", lMCPState.MLWSFailure == true and 1 or 0, lHardware ) + SendDataHW("715", lMCPState.ACSFailure == true and 1 or 0, lHardware ) + SendDataHW("716", lMCPState.RadarFailure == true and 1 or 0, lHardware ) + SendDataHW("717", lMCPState.HelmetFailure == true and 1 or 0, lHardware ) + SendDataHW("718", lMCPState.HUDFailure == true and 1 or 0, lHardware ) + SendDataHW("719", lMCPState.MFDFailure == true and 1 or 0, lHardware ) + SendDataHW("720", lMCPState.RWSFailure == true and 1 or 0, lHardware ) + SendDataHW("721", lMCPState.GearFailure == true and 1 or 0, lHardware ) + SendDataHW("722", lMCPState.HydraulicsFailure == true and 1 or 0, lHardware ) + SendDataHW("723", lMCPState.AutopilotFailure == true and 1 or 0, lHardware ) + SendDataHW("724", lMCPState.FuelTankDamage == true and 1 or 0, lHardware ) + SendDataHW("725", lMCPState.CanopyOpen == true and 1 or 0, lHardware ) + SendDataHW("726", lMCPState.StallSignalization == true and 1 or 0, lHardware ) + SendDataHW("727", lMCPState.AutopilotOn == true and 1 or 0, lHardware ) + + local lEngineInfo = LoGetEngineInfo() + if lEngineInfo ~= nil then + --WriteToLog('lEngineInfo: '..dump(lEngineInfo)) + + SendDataHW("728", lEngineInfo.EngineStart.left, lHardware ) -- lamp start left engine 1 (0|1) + SendDataHW("729", lEngineInfo.EngineStart.right, lHardware ) -- lamp start right engine 1 (0|1) + + SendDataHW("730", (lEngineInfo.RPM.left > 99.95 and 1 or 0), lHardware ) -- lamp after burner left engine + SendDataHW("731", (lEngineInfo.RPM.right > 99.95 and 1 or 0), lHardware ) -- lam after burner right engine + end + + local lAccelerationUnits = LoGetAccelerationUnits() + if lAccelerationUnits ~= nil then + --WriteToLog('lAccelerationUnits: '..dump(lAccelerationUnits)) + SendDataHW("732", (lAccelerationUnits.y > 8.0 and 1 or 0), lHardware ) -- lamp Over-G warning + end +end + +function WeaponStatusPanel(hardware) +-- The weapon status panel, quantity and readiness of the currently selected weapon and the remaining gun ammunition are indicated. + local lHardware = hardware or 1 + gES_PayloadInfo = LoGetPayloadInfo() + if gES_PayloadInfo == nil then + return + end + --WriteToLog('gES_PayloadInfo: '..dump(gES_PayloadInfo)) + --[[ exsample + [Stations] = { + [1] = { + [CLSID] = string: "{FBC29BFE-3D24-4C64-B81D-941239D12249}" + [container] = boolean: "false" + [count] = number: "1" + [weapon] = { + [level3] = number: "7" + [level1] = number: "4" + [level4] = number: "18" + [level2] = number: "4" + } + } + [2] = { + [CLSID] = string: "{FBC29BFE-3D24-4C64-B81D-941239D12249}" + [container] = boolean: "false" + [count] = number: "1" + [weapon] = { + [level3] = number: "7" + [level1] = number: "4" + [level4] = number: "18" + [level2] = number: "4" + } + } + [3] = { + [CLSID] = string: "{FBC29BFE-3D24-4C64-B81D-941239D12249}" + [container] = boolean: "false" + [count] = number: "1" + [weapon] = { + [level3] = number: "7" + [level1] = number: "4" + [level4] = number: "18" + [level2] = number: "4" + } + } + [4] = { + [CLSID] = string: "{FBC29BFE-3D24-4C64-B81D-941239D12249}" + [container] = boolean: "false" + [count] = number: "1" + [weapon] = { + [level3] = number: "7" + [level1] = number: "4" + [level4] = number: "18" + [level2] = number: "4" + } + } + [5] = { + [wstype] = { + [level3] = number: "32" + [level1] = number: "4" + [level4] = number: "6" + [level2] = number: "7" + } + [count] = number: "20" + [CLSID] = string: "{F72F47E5-C83A-4B85-96ED-D3E46671EE9A}" + [adapter] = { + [level3] = number: "0" + [level1] = number: "0" + [level4] = number: "0" + [level2] = number: "0" + } + [container] = boolean: "true" + [weapon] = { + [level3] = number: "33" + [level1] = number: "4" + [level4] = number: "32" + [level2] = number: "7" + } + } + [6] = { + [wstype] = { + [level3] = number: "32" + [level1] = number: "4" + [level4] = number: "6" + [level2] = number: "7" + } + [count] = number: "20" + [CLSID] = string: "{F72F47E5-C83A-4B85-96ED-D3E46671EE9A}" + [adapter] = { + [level3] = number: "0" + [level1] = number: "0" + [level4] = number: "0" + [level2] = number: "0" + } + [container] = boolean: "true" + [weapon] = { + [level3] = number: "33" + [level1] = number: "4" + [level4] = number: "32" + [level2] = number: "7" + } + } + [7] = { + [CLSID] = string: "{4203753F-8198-4E85-9924-6F8FF679F9FF}" + [container] = boolean: "false" + [count] = number: "1" + [weapon] = { + [level3] = number: "38" + [level1] = number: "4" + [level4] = number: "18" + [level2] = number: "5" + } + } + [8] = { + [CLSID] = string: "{4203753F-8198-4E85-9924-6F8FF679F9FF}" + [container] = boolean: "false" + [count] = number: "1" + [weapon] = { + [level3] = number: "38" + [level1] = number: "4" + [level4] = number: "18" + [level2] = number: "5" + } + } + [9] = { + [CLSID] = string: "{7AEC222D-C523-425e-B714-719C0D1EB14D}" + [container] = boolean: "false" + [count] = number: "1" + [weapon] = { + [level3] = number: "38" + [level1] = number: "4" + [level4] = number: "91" + [level2] = number: "5" + } + } + [10] = { + [CLSID] = string: "{7AEC222D-C523-425e-B714-719C0D1EB14D}" + [container] = boolean: "false" + [count] = number: "1" + [weapon] = { + [level3] = number: "38" + [level1] = number: "4" + [level4] = number: "91" + [level2] = number: "5" + } + } + } + [CurrentStation] = number: "0" + [Cannon] = { + [shells] = number: "250" + } + ]] + --[[ + Weapon Panel + | + ------------------------------------------- + | | | | | | | | | | + 1 2 3 4 5 6 7 8 9 10 -- Panel ID + 2 4 5 7 10 9 8 6 3 1 -- gES_PayloadInfo.Station.ID + ]] + -- Payload Info + -- weapon stations (panel) 1 (left) - 10 (right), no lamp for center station + SendDataHW("100", gES_PayloadInfo.Cannon.shells, lHardware ) -- count cannon shells + SendDataHW("110", (gES_PayloadInfo.Stations[1].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 1) + SendDataHW("101", (gES_PayloadInfo.Stations[2].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 10) + SendDataHW("109", (gES_PayloadInfo.Stations[3].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 2) + SendDataHW("102", (gES_PayloadInfo.Stations[4].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 9) + SendDataHW("103", (gES_PayloadInfo.Stations[5].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 3) + SendDataHW("108", (gES_PayloadInfo.Stations[6].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 8) + SendDataHW("104", (gES_PayloadInfo.Stations[7].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 4) + SendDataHW("107", (gES_PayloadInfo.Stations[8].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 7) + SendDataHW("106", (gES_PayloadInfo.Stations[9].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 5) + SendDataHW("105", (gES_PayloadInfo.Stations[10].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 6) + --SendDataHW("CurrentStation", gES_PayloadInfo.CurrentStation, lHardware ) + -- air-to-air missils panel 1 and 11, air combat modus, CurrentStation = 1, panel 1 and 11 on + + -- wenn die Waffenstationen gleichmässig belegt sind, hat bei Auswahl CurrentStation immer den Wert der linken Station + -- bei ungleichmäßiger Belegung, hat CurrentStation immer den Wert der jeweiligen Station + -- Waffenbezeichnung als UUID, gES_PayloadInfo.Stations[X].CLSID + + -- defination + if gES_CurrentStationTmp == nil then + gES_CurrentStationTmp = -1 + end + + if gES_PayloadInfo.CurrentStation > 0 and + gES_CurrentStationTmp ~= gES_PayloadInfo.CurrentStation then + gES_CurrentStationTmp = gES_PayloadInfo.CurrentStation + + gES_TmpStationToPanel = {} + gES_TmpStationToPanel[1] = {Panel = 10, StationID = 110, CurrentID = 210, HardwareID = lHardware } + gES_TmpStationToPanel[2] = {Panel = 1, StationID = 101, CurrentID = 201, HardwareID = lHardware } + gES_TmpStationToPanel[3] = {Panel = 9, StationID = 109, CurrentID = 209, HardwareID = lHardware } + gES_TmpStationToPanel[4] = {Panel = 2, StationID = 102, CurrentID = 202, HardwareID = lHardware } + gES_TmpStationToPanel[5] = {Panel = 3, StationID = 103, CurrentID = 203, HardwareID = lHardware } + gES_TmpStationToPanel[6] = {Panel = 8, StationID = 108, CurrentID = 208, HardwareID = lHardware } + gES_TmpStationToPanel[7] = {Panel = 4, StationID = 104, CurrentID = 204, HardwareID = lHardware } + gES_TmpStationToPanel[8] = {Panel = 7, StationID = 107, CurrentID = 207, HardwareID = lHardware } + gES_TmpStationToPanel[9] = {Panel = 6, StationID = 106, CurrentID = 206, HardwareID = lHardware } + gES_TmpStationToPanel[10] = {Panel = 5, StationID = 105, CurrentID = 205, HardwareID = lHardware } + + WeaponStatusPanel_Reset(201, 210, lHardware) + + if gES_TmpStationToPanel[gES_PayloadInfo.CurrentStation] ~= nil then + SendDataHW(gES_TmpStationToPanel[gES_PayloadInfo.CurrentStation].CurrentID, 1, lHardware ) -- eigentliche Auswahl + + table.foreach(gES_PayloadInfo.Stations, WeaponStatusPanel_selectCurrentPayloadStation) -- zugehörige Stationen + end + end +end + +function FuelQuantityIndicator(hardware) +-- Fuel quantity shows the fuel remaining in all tanks + local lHardware = hardware or 1 + local lEngineInfo = LoGetEngineInfo() + if lEngineInfo == nil then + return + end + --WriteToLog('lEngineInfo: '..dump(lEngineInfo)) + --[[ + [fuel_external] = number: "0" + [Temperature] = { + [left] = number: "626.99444580078" + [right] = number: "626.99444580078" + } + [RPM] = { + [left] = number: "87.453765869141" + [right] = number: "87.453758239746" + } + [FuelConsumption] = { + [left] = number: "0.1500396137767" + [right] = number: "0.1500396137767" + } + [fuel_internal] = number: "3773.2749023438" + [EngineStart] = { + [left] = number: "0" + [right] = number: "0" + } + [HydraulicPressure] = { + [left] = number: "210" + [right] = number: "210" + } + lPayloadInfo.Stations[8].CLSID == E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF -- ext 800l Fuel Tank + ]] + + SendDataHW("300", string.format("%d", math.round((lEngineInfo.fuel_internal / 10), 0, "ceil") * 10), lHardware ) -- total fuel in kg + --SendDataHW("301", string.format("%d", lEngineInfo.fuel_internal)) -- total fuel in kg + --SendDataHW("302", string.format("%d", lEngineInfo.fuel_external)) -- external fuel in kg + + SendDataHW("304", (lEngineInfo.fuel_internal < 5000.0 and 1 or 0), lHardware ) -- Tank warning 1 + SendDataHW("305", (lEngineInfo.fuel_internal < 4000.0 and 1 or 0), lHardware ) -- Tank warning 2 + SendDataHW("306", (lEngineInfo.fuel_internal < 1500.0 and 1 or 0), lHardware ) -- Tank warning 3 + SendDataHW("307", (lEngineInfo.fuel_internal < 1000.0 and 1 or 0), lHardware ) -- Tank warning 4 + SendDataHW("308", (lEngineInfo.fuel_internal < 600.0 and 1 or 0), lHardware ) -- Bingo Fuel + +end + +function MechanicalDevicesIndicator(hardware) +-- The mechanical devices indicator shows the position of the landing gear, flaps, leading edge flaps and airbrake + local lHardware = hardware or 1 + local lMechInfo = LoGetMechInfo() -- mechanical components, e.g. Flaps, Wheelbrakes,... + if lMechInfo == nil then + return + end + --[[ + [hook] = { + [status] = number: "0" + [value] = number: "0" + } + [parachute] = { + [status] = number: "0" + [value] = number: "0" + } + [controlsurfaces] = { + [eleron] = { + [left] = number: "0" + [right] = number: "-0.21084336936474" + } + [elevator] = { + [left] = number: "-0" + [right] = number: "-0" + } + [rudder] = { + [left] = number: "0" + [right] = number: "0" + } + } + [airintake] = { + [status] = number: "0" + [value] = number: "0" + } + [canopy] = { + [status] = number: "0" + [value] = number: "0" + } + [refuelingboom] = { + [status] = number: "0" + [value] = number: "0" + } + [wing] = { + [status] = number: "0" + [value] = number: "0" + } + [noseflap] = { + [status] = number: "0" + [value] = number: "0" + } + [gear] = { + [value] = number: "0" + [nose] = { + [rod] = number: "0" + } + [main] = { + [left] = { + [rod] = number: "0" + } + [right] = { + [rod] = number: "0" + } + } + [status] = number: "0" + } + [speedbrakes] = { + [status] = number: "0" + [value] = number: "0" + } + [wheelbrakes] = { + [status] = number: "0" + [value] = number: "0" + } + [flaps] = { + [status] = number: "0" + [value] = number: "0" + }]] + --SendDataHW("500", lMechInfo.gear.status ) + --SendDataHW("501", lMechInfo.gear.value ) + --SendDataHW("502", lMechInfo.gear.nose.rod ) -- zeigt an wie weit das Fahrwerk einsackt wenn das Flugzeug auf dem Boden ist + --SendDataHW("503", lMechInfo.gear.main.left.rod ) -- zeigt an wie weit das Fahrwerk einsackt wenn das Flugzeug auf dem Boden ist + --SendDataHW("504", lMechInfo.gear.main.right.rod ) -- zeigt an wie weit das Fahrwerk einsackt wenn das Flugzeug auf dem Boden ist + --SendDataHW("500", ((lMechInfo.gear.status == 1 and lMechInfo.gear.value < 1) and 1 or 0 ) ) -- gear warning light, go up + --SendDataHW("500", ((lMechInfo.gear.status == 0 and lMechInfo.gear.value > 0) and 1 or 0 ) ) -- gear warning light, go down + SendDataHW("500", (((lMechInfo.gear.status == 1 and lMechInfo.gear.value < 1) or (lMechInfo.gear.status == 0 and lMechInfo.gear.value > 0)) and 1 or 0 ), lHardware ) -- gear warning light + SendDataHW("501", (lMechInfo.gear.value > 0.85 and 1 or 0), lHardware ) -- nose gear + SendDataHW("502", (lMechInfo.gear.value > 0.95 and 1 or 0), lHardware ) -- left gear + SendDataHW("503", (lMechInfo.gear.value > 0.97 and 1 or 0), lHardware ) -- right gear + + --SendDataHW("510", lMechInfo.speedbrakes.status ) -- speedbreakes on 1 (0|1) + SendDataHW("510", (lMechInfo.speedbrakes.value > 0.1 and 1 or 0), lHardware ) -- speedbreakes on > 0.1 (0 - 1) + + --SendDataHW("520", lMechInfo.wheelbrakes.status, lHardware ) -- not in use + --SendDataHW("521", lMechInfo.wheelbrakes.value, lHardware ) -- not in use + + local lGetTrueAirSpeed = LoGetTrueAirSpeed() + --SendDataHW("530", lMechInfo.flaps.status ) -- flap switch off 0, 1. position 1, 2. position 2 (0|1|2) + --SendDataHW("531", lMechInfo.flaps.value ) -- flap 1. position > 0.25, 2. position > 0.93 (0 - 1) + SendDataHW("531", (lMechInfo.flaps.value > 0.25 and 1 or 0), lHardware ) -- flap 1. position + SendDataHW("532", (lMechInfo.flaps.value > 0.93 and 1 or 0), lHardware ) -- flap 2. position + SendDataHW("533", ((lMechInfo.flaps.value > 0.93 and lGetTrueAirSpeed > 340) and 1 or 0), lHardware ) -- Speed Warning for Flaps, same light as gear warning light, but blinking light + SendDataHW("534", (lMechInfo.gear.value > 0.5 and 1 or 0), lHardware ) -- Intake FOD shields + + --SendDataHW("540", lMechInfo.parachute.status ) + SendDataHW("541", (lMechInfo.parachute.value < 0.5 and 1 or 0), lHardware ) +end \ No newline at end of file diff --git a/ExportsModules/Su-33.lua b/ExportsModules/Su-33.lua new file mode 100644 index 0000000..bc4fa8d --- /dev/null +++ b/ExportsModules/Su-33.lua @@ -0,0 +1,880 @@ +-- Su-33 Export +-- Version 0.9.9 BETA + +gES_FoundFCModule = true + +-- auxiliary function +dofile(gES_ExportModulePath.."FC_AuxiliaryFuntions.lua") + +----------------------------------------- +-- FLAMING CLIFFS AIRCRAFT / Su-33 -- +-- FC aircraft don't support GetDevice -- +----------------------------------------- + +function ProcessGlassCockpitFCHighImportanceConfig() + + local myData = LoGetSelfData() + + if (myData) then + local lLatitude = myData.LatLongAlt.Lat -- LATITUDE + local lLongitude = myData.LatLongAlt.Long -- LONGITUDE + local lBasicAtmospherePressure = LoGetBasicAtmospherePressure() -- BAROMETRIC PRESSURE + local lAltBar = LoGetAltitudeAboveSeaLevel() -- ALTITUDE SEA LEVEL (Meter) + local lAltRad = LoGetAltitudeAboveGroundLevel() -- ALTITUDE GROUND LEVEL (Meter) + --local lTrueAirSpeed = LoGetTrueAirSpeed() -- TRUE AIRSPEED (Meter/Second) + local lPitch, lBank, lYaw = LoGetADIPitchBankYaw() -- PITCH, BANK, YAW (Radian) + + local lHeading = myData.Heading -- HEADING (Radian) + local lVVI = LoGetVerticalVelocity() -- VERTICAL SPEED (Meter/Second) + local lIAS = LoGetIndicatedAirSpeed() -- INDICATED AIRSPEED (Meter/Second) + --local lMachNumber = LoGetMachNumber() -- MACH + local lAoA = LoGetAngleOfAttack() -- ANGLE OF ATTACK AoA (Radian) + + local lGlide = LoGetGlideDeviation() -- VOR1 HORIZONTAL DEFLECTION (-1 +1) + local lSide = LoGetSideDeviation() -- VOR1 VERTICAL DEFLECTION (-1 +1) + --local lSlipBallPosition = LoGetSlipBallPosition() -- SLIP BALL (-1 +1) + --local lAccelerationUnits = LoGetAccelerationUnits().y -- G-LOAD + + --local lNavInfoPitch = LoGetNavigationInfo().Requirements.pitch -- AP REQUIRED PITCH (Radian) + --local lNavInfoRoll = LoGetNavigationInfo().Requirements.roll -- AP REQUIRED BANK (Radian) + --local lNavInfoSpeed = LoGetNavigationInfo().Requirements.speed -- AP SPEED (Meter/Second) + --local lNavInfoAltitude = LoGetNavigationInfo().Requirements.altitude -- AP ALTITUDE (Meter) + --local lNavInfoVerticalSpeed = LoGetNavigationInfo().Requirements.vertical_speed -- AP VERTICAL SPEED (Meter/Second) + + --local lControlPanel_HSI = LoGetControlPanel_HSI() -- HSI Data + local lHSI_RMI = LoGetControlPanel_HSI().RMI_raw -- VOR1 OBS (Radian) + local lHSI_ADF = LoGetControlPanel_HSI().ADF_raw -- ADF OBS (Radian) + --local lHSI_Heading = LoGetControlPanel_HSI().Heading_raw -- Heading (Radian) + + local lEngineRPMleft = LoGetEngineInfo().RPM.left -- ENG1 RPM % + local lEngineRPMright = LoGetEngineInfo().RPM.right -- ENG2 RPM % + local lEngineTempLeft = LoGetEngineInfo().Temperature.left -- ENG1 EGT ºC + local lEngineTempRight = LoGetEngineInfo().Temperature.right -- ENG2 EGT ºC + --local lEngineFuelInternal = LoGetEngineInfo().fuel_internal -- TANK1 (INT) (KG) + --local lEngineFuelExternal = LoGetEngineInfo().fuel_external -- TANK2 (EXT) (KG) + + --local lMechInfo = LoGetMechInfo() -- mechanical components, e.g. Flaps, Wheelbrakes,... + --local lPayloadInfo = LoGetPayloadInfo() -- Paylod, e.g. bombs, guns, rockets, fuel tanks,... + + local lDistanceToWay = 999 + local lRoute = LoGetRoute() + + if (myData and lRoute) then -- if neither are nil + local myLoc = LoGeoCoordinatesToLoCoordinates(lLongitude, lLatitude) + --lDistanceToWay = math.sqrt((myLoc.x - lRoute.goto_point.world_point.x)^2 + (myLoc.y - lRoute.goto_point.world_point.y)^2) + lDistanceToWay = math.sqrt((myLoc.x - lRoute.goto_point.world_point.x)^2 + (myLoc.z - lRoute.goto_point.world_point.z)^2) + end + + if gES_GlassCockpitType == 1 then + -- HELIOS Version 1.3 + -- customizing for HELOS + lPitch = math.deg(lPitch) -- PITCH, (Radian to Grad) + lBank = math.deg(lBank) -- BANK (Radian to Grad) + lYaw = math.deg(lYaw) -- YAW (Radian to Grad) + lHSI_RMI = math.deg(lHSI_RMI) -- VOR1 OBS (Radian to Grad) + lHSI_ADF = math.deg(lHSI_ADF) -- ADF OBS (Radian to Grad) + lAoA = math.deg(lAoA) -- ANGLE OF ATTACK AoA (Radian to Grad) + lHeading = math.deg(lHeading) -- Heading (Radian to Grad) + lHSI_ADF = (360 - lHSI_ADF) + (360 - lHeading) + lHSI_RMI = 360 - lHSI_RMI + lIAS = lIAS * 3.6 -- change from m/s to km/h + + SendData("1", string.format("%.2f", lPitch) ) + SendData("2", string.format("%.2f", lBank) ) + SendData("3", string.format("%.2f", lYaw) ) + SendData("4", string.format("%.2f", lAltBar) ) + SendData("5", string.format("%.2f", lAltRad) ) + SendData("6", string.format("%.2f", lHSI_ADF) ) + SendData("7", string.format("%.2f", lHSI_RMI) ) + SendData("8", string.format("%.2f", lHeading) ) + SendData("9", string.format("%.2f", lEngineRPMleft) ) + SendData("10", string.format("%.2f", lEngineRPMright) ) + SendData("11", string.format("%.2f", lEngineTempLeft) ) + SendData("12", string.format("%.2f", lEngineTempRight) ) + SendData("13", string.format("%.2f", lVVI) ) + SendData("14", string.format("%.2f", lIAS) ) + SendData("15", string.format("%.2f", lDistanceToWay) ) + SendData("16", string.format("%.2f", lAoA) ) + SendData("17", string.format("%.2f", lGlide) ) + SendData("18", string.format("%.2f", lSide) ) + + elseif gES_GlassCockpitType == 2 then + -- HawgTouch version 1.6 + + -- IAS-MACH Indicator (IAS, MACH) {"%.4f;%.4f"} + FC_Russian_AirSpeed_1600hkm(1) + + -- AOA Indicator and Accelerometer (AOA, GLoad) + FC_Russian_AOA_Su2733(3) + + -- ADI + FC_Russian_ADI_New(4) + + -- HSI + FC_Russian_HSI(lDistanceToWay, 5) + + -- Vertical Velocity Indicator (VVI) (VVI, TurnIndicator, SlipBallPosition) + FC_Russian_VVI_New(6) + + -- Radar Altimeter (AltRad, MinAltitude, WarningFlag, MinAltitudeLamp) {"%.4f;%.4f;%.1f;%.1f"} (below 100m is warning light on) + FC_Russian_RadarAltimeter_1500m(100, 7) + + -- Barometric Altimeter (AltBar, BasicAtmospherePressure) + FC_Russian_BarometricAltimeter_late(8) + + -- Tachometer (RPM) (EngineRPMleft, EngineRPMright) {"%.4f;%.4f"} + FC_Russian_EngineRPM(9) + + -- Left Jet Engine Turbine Temperature Indicator (EngineTemp) {"%.4f"} + FC_TwoNeedlesGauge(lEngineTempLeft, 1200, 100, 10) + + -- Right Jet Engine Turbine Temperature Indicator (EngineTemp) {"%.4f"} + FC_TwoNeedlesGauge(lEngineTempRight, 1200, 100, 11) + + -- Clock from Ka-50 {CurrentHours, CurrentMinutes, CurrentSeconds, 0, FlightTimeHours, FlightTimeMinutes, 0, 0) {"%.4f;%.4f;%.4f;%.1f;%.4f;%.4f;%.4f;%.4f"} + FC_Russian_Clock_late(12) + end + else + WriteToLog("Unknown FC Error, no LoGetSelfData.") + end + +end + +function ProcessHARDWAREConfigHighImportance(mainPanelDevice) +end + +function ProcessGlassCockpitFCLowImportanceConfig() + + if gES_GlassCockpitType == 1 then + -- HELIOS Version 1.3 + + elseif gES_GlassCockpitType == 2 then + -- HawgTouch version 1.6 + + FC_WeaponPanel_SU2733(13) + + FC_RadarWarning_SPO15(14) + + -- Fuel Quantity Indicator + local lEngineInfo = LoGetEngineInfo() + local lTotalFuel = 0 + if lEngineInfo ~= nil then + --WriteToLog('lEngineInfo: '..dump(lEngineInfo)) + --[[ + [fuel_external] = number: "0" + [Temperature] = { + [left] = number: "626.99444580078" + [right] = number: "626.99444580078" + } + [RPM] = { + [left] = number: "87.453765869141" + [right] = number: "87.453758239746" + } + [FuelConsumption] = { + [left] = number: "0.1500396137767" + [right] = number: "0.1500396137767" + } + [fuel_internal] = number: "3773.2749023438" + [EngineStart] = { + [left] = number: "0" + [right] = number: "0" + } + [HydraulicPressure] = { + [left] = number: "210" + [right] = number: "210" + } + lPayloadInfo.Stations[8].CLSID == E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF -- ext 800l Fuel Tank + ]] + + lTotalFuel = lEngineInfo.fuel_internal + --lTotalFuel = string.format("%3d", math.round((lEngineInfo.fuel_internal / 10), 0, "ceil") * 10) + --lTotalFuel = string.format("%4d", lEngineInfo.fuel_internal) -- total fuel in kg + --lTotalFuel = string.format("%4d", lEngineInfo.fuel_external) -- external fuel in kg + local lTotalFuel_12_0 = 1.0 + + if lTotalFuel < 12000 then + --[[ + y_min = 0.0 -- minimaler Ausgabewert + y_max = 1.0 -- maximaler Ausgabewert + x_min = 0 -- minimaler Eingangswert + x_max = 12000 -- maximaler Eingangswert + x = 8000 -- aktueller Eingangswert + + d_y = 1 -- Delta Ausgabewerte (y_max - y_min) + d_x = 12000 -- Delta Eingangswerte (x_max - x_min) + m = 8.3333333333333333333333333333333e-5 -- Steigung der linearen Funktion (d_y / d_x) + n = 4.e-33 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max) + + y = 0.66666666666666666666666666666667 -- Ergebnis (m * x + n) + ]] + lTotalFuel_12_0 = 8.3333333333333333333333333333333e-5 * lTotalFuel + 4.e-33 + end + + -- TotalFuel_12_0 + -- Light1 + -- Light2 + -- Light3 + -- Light4 + -- BingoLight + SendData("15", string.format("%0.4f;%d;%d;%d;%d;%d", + lTotalFuel_12_0, + (lEngineInfo.fuel_internal < 5000.0 and 1 or 0), -- Tank warning 1 + (lEngineInfo.fuel_internal < 1000.0 and 1 or 0), -- Tank warning 2 4000 + (lEngineInfo.fuel_internal < 4000.0 and 1 or 0), -- Tank warning 3 1500 + (lEngineInfo.fuel_internal < 1500.0 and 1 or 0), -- Tank warning 4 1000 + (lEngineInfo.fuel_internal < 600.0 and 1 or 0))) -- Bingo Fuel + + -- Hydraulic Pressure Left + FC_OneNeedleGauge(lEngineInfo.HydraulicPressure.left, 300, 17) + end + + -- EKRAN Message + FC_EKRAN(16) + + -- Mechanical Configuration Indicator (GearWarningLight, NoseGear, LeftGear, RightGear, Airbreaks, Flaps1, Flaps2) {"%.1f;%d;%d;%d;%d;%d;%d"} + local lMechInfo = LoGetMechInfo() -- mechanical components, e.g. Flaps, Wheelbrakes,... + if lMechInfo ~= nil then + local lWarningLight = 0.0 + local lTrueAirSpeed = LoGetTrueAirSpeed() + if lTrueAirSpeed ~= nil then + lWarningLight = ((lMechInfo.flaps.value > 0.93 and lTrueAirSpeed > 340) and 1.0 or 0.0) -- Speed Warning for Flaps, same light as gear warning light, but blinking light + lWarningLight = (((lMechInfo.gear.status == 1 and lMechInfo.gear.value < 1) or (lMechInfo.gear.status == 0 and lMechInfo.gear.value > 0)) and 1.0 or lWarningLight ) -- gear warning light + end + -- WarningLight {0.0 = Off, 0.1 = blinking light, 0.2 = on} + -- WarningLight {0.0 = Off, no blinking light, 1.0 = on} + + -- left gear {0, 1} + -- right gear {0, 1} + -- nose gear {0, 1} + -- Hook Light + -- WarningLight + -- Flap + -- Intake FOD shields + -- Speedbreakes on {0, 1} + SendData("2", string.format("%.1f;%d;%d;%d;%d;%d;%d;%d", + (lMechInfo.gear.value > 0.95 and 1 or 0), -- left gear + (lMechInfo.gear.value == 1 and 1 or 0), -- right gear + (lMechInfo.gear.value > 0.85 and 1 or 0), -- nose gear + (lMechInfo.hook.value > 0.85 and 1 or 0), -- hook light + lWarningLight, + (lMechInfo.flaps.value > 0.93 and 1 or 0), -- flap + (lMechInfo.gear.value > 0.5 and 1 or 0), -- Intake FOD shields + (lMechInfo.speedbrakes.value > 0.1 and 1 or 0))) -- speedbreakes on > 0.1 (0 - 1) + + -- Wheelbrakes Hydraulic Pressure Left + FC_OneNeedleGauge(lMechInfo.wheelbrakes.value, 300, 18) + + -- Wheelbrakes Hydraulic Pressure Right + FC_OneNeedleGauge(lMechInfo.wheelbrakes.value, 300, 19) + + --WriteToLog('lMechInfo.noseflap.value: '..dump(lMechInfo.noseflap.value)) -- Vorfluegel, Balkenanzeige neben dem Radarhoehenmesser (0=oben bis 30=unten) + end + + -- Airintake + FC_Russian_AirIntake(20) + + -- Fuel Quantity Standby Indicator + FC_OneNeedleGauge(lTotalFuel, 10000, 21) + end + + --(x < 0 and 'negative' or 'non-negative') + --[[ + local lPayloadInfo = LoGetPayloadInfo() + WriteToLog('lPayloadInfo: '..dump(lPayloadInfo)) + + local lSnares = LoGetSnares() -- Flare and Chaff + WriteToLog('lSnares: '..dump(lSnares)) + + local lSightingSystemInfo = LoGetSightingSystemInfo() + WriteToLog('lSightingSystemInfo: '..dump(lSightingSystemInfo)) + + local lTWSInfo = LoGetTWSInfo() -- SPO Informationen, z.B. Radarwarner F15C + WriteToLog('lTWSInfo: '..dump(lTWSInfo)) + + local lTargetInformation = LoGetTargetInformation() -- detalierte Radar Infos z.B. F15C + WriteToLog('lTargetInformation: '..dump(lTargetInformation)) + + local lLockedTargetInformation = LoGetLockedTargetInformation() + WriteToLog('lLockedTargetInformation: '..dump(lLockedTargetInformation)) + + local lF15_TWS_Contacs = LoGetF15_TWS_Contacts() -- the same information but only for F-15 in TWS mode + WriteToLog('lF15_TWS_Contacs: '..dump(lF15_TWS_Contacs)) + + local lMechInfo = LoGetMechInfo() -- mechanical components, e.g. Flaps, Wheelbrakes,... + WriteToLog('lMechInfo: '..dump(lMechInfo)) + + local lMCPState = LoGetMCPState() -- Warnlichter + WriteToLog('lMCPState: '..dump(lMCPState)) + + local lControlPanel_HSI = LoGetControlPanel_HSI() + WriteToLog('lControlPanel_HSI: '..dump(lControlPanel_HSI)) + + local lRadioBeaconsStatus = LoGetRadioBeaconsStatus() + WriteToLog('lRadioBeaconsStatus: '..dump(lRadioBeaconsStatus)) + + local lEngineInfo = LoGetEngineInfo() + WriteToLog('lEngineInfo: '..dump(lEngineInfo)) + ]] + -- Weapon Control System + --local lNameByType = LoGetNameByType () -- args 4 (number : level1,level2,level3,level4), result string + -- values from LoGetTargetInformation().type + --WriteToLog('lNameByType: '..dump(lNameByType)) +end + +function ProcessHARDWAREConfigLowImportance(mainPanelDevice) +-- where necessary, specify HardwareID, example WeaponStatusPanel(2) + WeaponStatusPanel() + MechanicalDevicesIndicator() + StatusLamp() + FuelQuantityIndicator() + SightingSystem() + SPO15RWR() + PPDSPPanel() +end + +----------------------------- +-- Custom functions -- +----------------------------- + +function SightingSystem(hardware) + local lHardware = hardware or 1 + local lSightingSystemInfo = LoGetSightingSystemInfo() + if lSightingSystemInfo == nil then + return + end + --WriteToLog('lSightingSystemInfo: '..dump(lSightingSystemInfo)9 + --[[ + [PRF] = { + [selection] = string: "ILV" + [current] = string: "MED" + } + [laser_on] = boolean: "false" + [scale] = { + [azimuth] = number: "0.52359873056412" + [distance] = number: "10000" + } + [radar_on] = boolean: "false" + [optical_system_on] = boolean: "false" + [LaunchAuthorized] = boolean: "false" + [ECM_on] = boolean: "false" + [Manufacturer] = string: "RUS" + [TDC] = { + [y] = number: "0" + [x] = number: "0" + } + [ScanZone] = { + [coverage_H] = { + [min] = number: "0" + [max] = number: "20000" + } + [size] = { + [azimuth] = number: "1.0471974611282" + [elevation] = number: "0.17453290522099" + } + [position] = { + [exceeding_manual] = number: "0" + [distance_manual] = number: "0" + [azimuth] = number: "0" + [elevation] = number: "0" + } + } + ]] + SendDataHW("600", lSightingSystemInfo.ECM_on == true and 1 or 0, lHardware ) + SendDataHW("601", lSightingSystemInfo.laser_on == true and 1 or 0, lHardware ) + --SendDataHW("602", lSightingSystemInfo.optical_system_on == true and 1 or 0, lHardware ) + SendDataHW("603", lSightingSystemInfo.LaunchAuthorized == true and 1 or 0, lHardware ) + SendDataHW("604", lSightingSystemInfo.radar_on == true and 1 or 0, lHardware ) +end + +function PPDSPPanel(hardware) + local lHardware = hardware or 1 + local lSnares = LoGetSnares() -- Flare and Chaff + if lSnares == nil then + return + end + --WriteToLog('lSnares: '..dump(lSnares)) + + --[chaff] = number: "48" + --[flare] = number: "48" + + local lChaffLED = math.round(lSnares.chaff / 6, 0, "ceil") + 1 + local lFlareLED = math.round(lSnares.flare / 6, 0, "ceil") + 1 + + SendDataHW("800", (lChaffLED <= 1 and 0 or 1), lHardware ) + SendDataHW("801", (lChaffLED <= 2 and 0 or 1), lHardware ) + SendDataHW("802", (lChaffLED <= 3 and 0 or 1), lHardware ) + SendDataHW("803", (lChaffLED <= 4 and 0 or 1), lHardware ) + SendDataHW("804", (lChaffLED <= 5 and 0 or 1), lHardware ) + SendDataHW("805", (lChaffLED <= 6 and 0 or 1), lHardware ) + SendDataHW("806", (lChaffLED <= 7 and 0 or 1), lHardware ) + SendDataHW("807", (lChaffLED <= 8 and 0 or 1), lHardware ) + + SendDataHW("810", (lFlareLED <= 1 and 0 or 1), lHardware ) + SendDataHW("811", (lFlareLED <= 2 and 0 or 1), lHardware ) + SendDataHW("812", (lFlareLED <= 3 and 0 or 1), lHardware ) + SendDataHW("813", (lFlareLED <= 4 and 0 or 1), lHardware ) + SendDataHW("814", (lFlareLED <= 5 and 0 or 1), lHardware ) + SendDataHW("815", (lFlareLED <= 6 and 0 or 1), lHardware ) + SendDataHW("816", (lFlareLED <= 7 and 0 or 1), lHardware ) + SendDataHW("817", (lFlareLED <= 8 and 0 or 1), lHardware ) + SendDataHW("817", (lFlareLED <= 8 and 0 or 1), lHardware ) +end + +function StatusLamp(hardware) + local lHardware = hardware or 1 + local lMCPState = LoGetMCPState() -- Warning Lights + if lMCPState == nil then + return + end + --WriteToLog('lMCPState: '..dump(lMCPState)) + --[[ + [RightTailPlaneFailure] = boolean: "false" + [EOSFailure] = boolean: "false" + [ECMFailure] = boolean: "false" + [RightAileronFailure] = boolean: "false" + [MasterWarning] = boolean: "false" + [RightEngineFailure] = boolean: "false" + [CannonFailure] = boolean: "false" + [MLWSFailure] = boolean: "false" + [ACSFailure] = boolean: "false" + [RadarFailure] = boolean: "false" + [HelmetFailure] = boolean: "false" + [HUDFailure] = boolean: "false" + [LeftMainPumpFailure] = boolean: "false" + [RightWingPumpFailure] = boolean: "false" + [LeftWingPumpFailure] = boolean: "false" + [MFDFailure] = boolean: "false" + [RWSFailure] = boolean: "false" + [GearFailure] = boolean: "false" + [HydraulicsFailure] = boolean: "false" + [AutopilotFailure] = boolean: "true" + [FuelTankDamage] = boolean: "false" + [LeftAileronFailure] = boolean: "false" + [CanopyOpen] = boolean: "false" + [RightMainPumpFailure] = boolean: "false" + [StallSignalization] = boolean: "false" + [LeftEngineFailure] = boolean: "false" + [AutopilotOn] = boolean: "false" + [LeftTailPlaneFailure] = boolean: "false" + ]] + + SendDataHW("700", lMCPState.LeftTailPlaneFailure == true and 1 or 0, lHardware ) + SendDataHW("701", lMCPState.RightTailPlaneFailure == true and 1 or 0, lHardware ) + SendDataHW("702", lMCPState.MasterWarning == true and 1 or 0, lHardware ) + SendDataHW("703", lMCPState.LeftEngineFailure == true and 1 or 0, lHardware ) + SendDataHW("704", lMCPState.RightEngineFailure == true and 1 or 0, lHardware ) + SendDataHW("705", lMCPState.LeftAileronFailure == true and 1 or 0, lHardware ) + SendDataHW("706", lMCPState.RightAileronFailure == true and 1 or 0, lHardware ) + SendDataHW("707", lMCPState.LeftMainPumpFailure == true and 1 or 0, lHardware ) + SendDataHW("708", lMCPState.RightMainPumpFailure == true and 1 or 0, lHardware ) + SendDataHW("709", lMCPState.LeftWingPumpFailure == true and 1 or 0, lHardware ) + SendDataHW("710", lMCPState.RightWingPumpFailure == true and 1 or 0, lHardware ) + SendDataHW("711", lMCPState.EOSFailure == true and 1 or 0, lHardware ) + SendDataHW("712", lMCPState.ECMFailure == true and 1 or 0, lHardware ) + SendDataHW("713", lMCPState.CannonFailure == true and 1 or 0, lHardware ) + SendDataHW("714", lMCPState.MLWSFailure == true and 1 or 0, lHardware ) + SendDataHW("715", lMCPState.ACSFailure == true and 1 or 0, lHardware ) + SendDataHW("716", lMCPState.RadarFailure == true and 1 or 0, lHardware ) + SendDataHW("717", lMCPState.HelmetFailure == true and 1 or 0, lHardware ) + SendDataHW("718", lMCPState.HUDFailure == true and 1 or 0, lHardware ) + SendDataHW("719", lMCPState.MFDFailure == true and 1 or 0, lHardware ) + SendDataHW("720", lMCPState.RWSFailure == true and 1 or 0, lHardware ) + SendDataHW("721", lMCPState.GearFailure == true and 1 or 0, lHardware ) + SendDataHW("722", lMCPState.HydraulicsFailure == true and 1 or 0, lHardware ) + SendDataHW("723", lMCPState.AutopilotFailure == true and 1 or 0, lHardware ) + SendDataHW("724", lMCPState.FuelTankDamage == true and 1 or 0, lHardware ) + SendDataHW("725", lMCPState.CanopyOpen == true and 1 or 0, lHardware ) + SendDataHW("726", lMCPState.StallSignalization == true and 1 or 0, lHardware ) + SendDataHW("727", lMCPState.AutopilotOn == true and 1 or 0, lHardware ) + + local lEngineInfo = LoGetEngineInfo() + if lEngineInfo ~= nil then + --WriteToLog('lEngineInfo: '..dump(lEngineInfo)) + + SendDataHW("728", lEngineInfo.EngineStart.left, lHardware ) -- lamp start left engine 1 (0|1) + SendDataHW("729", lEngineInfo.EngineStart.right, lHardware ) -- lamp start right engine 1 (0|1) + + SendDataHW("730", (lEngineInfo.RPM.left > 100.0 and 1 or 0), lHardware ) -- lamp after burner left engine + SendDataHW("731", (lEngineInfo.RPM.right > 100.0 and 1 or 0), lHardware ) -- lam after burner right engine + end + + local lAccelerationUnits = LoGetAccelerationUnits() + if lAccelerationUnits ~= nil then + --WriteToLog('lAccelerationUnits: '..dump(lAccelerationUnits)) + SendDataHW("732", (lAccelerationUnits.y > 8.0 and 1 or 0), lHardware ) -- lamp Over-G warning + end +end + +function WeaponStatusPanel(hardware) +-- The weapon status panel, quantity and readiness of the currently selected weapon and the remaining gun ammunition are indicated. + local lHardware = hardware or 1 + gES_PayloadInfo = LoGetPayloadInfo() + if gES_PayloadInfo == nil then + return + end + --WriteToLog('gES_PayloadInfo: '..dump(gES_PayloadInfo)) + --[[ exsample + [Stations] = { + [1] = { + [CLSID] = string: "{FBC29BFE-3D24-4C64-B81D-941239D12249}" + [container] = boolean: "false" + [count] = number: "1" + [weapon] = { + [level3] = number: "7" + [level1] = number: "4" + [level4] = number: "18" + [level2] = number: "4" + } + } + [2] = { + [CLSID] = string: "{FBC29BFE-3D24-4C64-B81D-941239D12249}" + [container] = boolean: "false" + [count] = number: "1" + [weapon] = { + [level3] = number: "7" + [level1] = number: "4" + [level4] = number: "18" + [level2] = number: "4" + } + } + [3] = { + [CLSID] = string: "" + [container] = boolean: "false" + [count] = number: "0" + [weapon] = { + [level3] = number: "0" + [level1] = number: "0" + [level4] = number: "0" + [level2] = number: "0" + } + } + [4] = { + [CLSID] = string: "" + [container] = boolean: "false" + [count] = number: "0" + [weapon] = { + [level3] = number: "0" + [level1] = number: "0" + [level4] = number: "0" + [level2] = number: "0" + } + } + [5] = { + [CLSID] = string: "" + [container] = boolean: "false" + [count] = number: "0" + [weapon] = { + [level3] = number: "0" + [level1] = number: "0" + [level4] = number: "0" + [level2] = number: "0" + } + } + [6] = { + [CLSID] = string: "" + [container] = boolean: "false" + [count] = number: "0" + [weapon] = { + [level3] = number: "0" + [level1] = number: "0" + [level4] = number: "0" + [level2] = number: "0" + } + } + [7] = { + [CLSID] = string: "" + [container] = boolean: "false" + [count] = number: "0" + [weapon] = { + [level3] = number: "0" + [level1] = number: "0" + [level4] = number: "0" + [level2] = number: "0" + } + } + [8] = { + [CLSID] = string: "" + [container] = boolean: "false" + [count] = number: "0" + [weapon] = { + [level3] = number: "0" + [level1] = number: "0" + [level4] = number: "0" + [level2] = number: "0" + } + } + [9] = { + [CLSID] = string: "{37DCC01E-9E02-432F-B61D-10C166CA2798}" + [container] = boolean: "false" + [count] = number: "1" + [weapon] = { + [level3] = number: "9" + [level1] = number: "4" + [level4] = number: "7" + [level2] = number: "5" + } + } + [10] = { + [CLSID] = string: "{37DCC01E-9E02-432F-B61D-10C166CA2798}" + [container] = boolean: "false" + [count] = number: "1" + [weapon] = { + [level3] = number: "9" + [level1] = number: "4" + [level4] = number: "7" + [level2] = number: "5" + } + } + [11] = { + [CLSID] = string: "{9B25D316-0434-4954-868F-D51DB1A38DF0}" + [container] = boolean: "false" + [count] = number: "1" + [weapon] = { + [level3] = number: "7" + [level1] = number: "4" + [level4] = number: "13" + [level2] = number: "4" + } + } + [12] = { + [CLSID] = string: "{3C612111-C7AD-476E-8A8E-2485812F4E5C}" + [container] = boolean: "false" + [count] = number: "1" + [weapon] = { + [level3] = number: "9" + [level1] = number: "4" + [level4] = number: "6" + [level2] = number: "5" + } + } + } + [CurrentStation] = number: "0" + [Cannon] = { + [shells] = number: "150" + } + ]] + --[[ + Weapon Panel (Numper = Station number) + | + ------------------------------------------------------- + | | | | | | | | | | | | + L 1 2 3 4 5 6 7 8 9 10 R -- Panel ID + 1 4 5 7 9 12 11 10 8 6 3 2 -- gES_PayloadInfo.Station.ID + ]] + -- Payload Info + -- weapon stations L and R not on Panel + -- weapon station 1 (left) to 10 (right), 5 and 6 center station + SendDataHW("100", gES_PayloadInfo.Cannon.shells, lHardware ) -- count cannon shells + --SendDataHW("101", (gES_PayloadInfo.Stations[1].count > 0 and 1 or 0), lHardware ) -- L + --SendDataHW("111", (gES_PayloadInfo.Stations[2].count > 0 and 1 or 0), lHardware ) -- R + SendDataHW("110", (gES_PayloadInfo.Stations[3].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 1) + SendDataHW("101", (gES_PayloadInfo.Stations[4].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 10) + SendDataHW("102", (gES_PayloadInfo.Stations[5].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 2) + SendDataHW("109", (gES_PayloadInfo.Stations[6].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 9) + SendDataHW("103", (gES_PayloadInfo.Stations[7].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 3) + SendDataHW("108", (gES_PayloadInfo.Stations[8].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 8) + SendDataHW("104", (gES_PayloadInfo.Stations[9].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 4) + SendDataHW("107", (gES_PayloadInfo.Stations[10].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 7) + SendDataHW("106", (gES_PayloadInfo.Stations[11].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 5) + SendDataHW("105", (gES_PayloadInfo.Stations[12].count > 0 and 1 or 0), lHardware ) -- weapon presend > 0 (panel 6) + --SendDataHW("CurrentStation", gES_PayloadInfo.CurrentStation, lHardware ) + -- air-to-air missils panel 1 and 2, air combat modus, CurrentStation = 1, panel 1 and 2 on + -- wenn die Waffenstationen gleichmässig belegt sind, hat bei Auswahl CurrentStation immer den Wert der linken Station + -- bei ungleichmäßiger Belegung, hat CurrentStation immer den Wert der jeweiligen Station + -- Waffenbezeichnung als UUID, gES_PayloadInfo.Stations[X].CLSID + + -- defination + if gES_CurrentStationTmp == nil then + gES_CurrentStationTmp = -1 + end + + if gES_PayloadInfo.CurrentStation > 0 and + gES_CurrentStationTmp ~= gES_PayloadInfo.CurrentStation then + gES_CurrentStationTmp = gES_PayloadInfo.CurrentStation + + gES_TmpStationToPanel = {} + --gES_TmpStationToPanel[1] = {Panel = 'L', StationID = 'L', CurrentID = 'L', HardwareID = lHardware } -- L + --gES_TmpStationToPanel[2] = {Panel = 'R', StationID = 'R', CurrentID = 'R', HardwareID = lHardware } -- R + gES_TmpStationToPanel[3] = {Panel = 10, StationID = 110, CurrentID = 210, HardwareID = lHardware } + gES_TmpStationToPanel[4] = {Panel = 1, StationID = 101, CurrentID = 201, HardwareID = lHardware } + gES_TmpStationToPanel[5] = {Panel = 2, StationID = 102, CurrentID = 202, HardwareID = lHardware } + gES_TmpStationToPanel[6] = {Panel = 9, StationID = 109, CurrentID = 209, HardwareID = lHardware } + gES_TmpStationToPanel[7] = {Panel = 3, StationID = 103, CurrentID = 203, HardwareID = lHardware } + gES_TmpStationToPanel[8] = {Panel = 8, StationID = 108, CurrentID = 208, HardwareID = lHardware } + gES_TmpStationToPanel[9] = {Panel = 4, StationID = 104, CurrentID = 204, HardwareID = lHardware } + gES_TmpStationToPanel[10] = {Panel = 7, StationID = 107, CurrentID = 207, HardwareID = lHardware } + gES_TmpStationToPanel[11] = {Panel = 6, StationID = 106, CurrentID = 206, HardwareID = lHardware } + gES_TmpStationToPanel[12] = {Panel = 5, StationID = 105, CurrentID = 205, HardwareID = lHardware } + + WeaponStatusPanel_Reset(201, 210, lHardware) + + if gES_TmpStationToPanel[gES_PayloadInfo.CurrentStation] ~= nil then + SendDataHW(gES_TmpStationToPanel[gES_PayloadInfo.CurrentStation].CurrentID, 1, lHardware ) -- eigentliche Auswahl + + table.foreach(gES_PayloadInfo.Stations, WeaponStatusPanel_selectCurrentPayloadStation) -- zugehörige Stationen + end + elseif gES_PayloadInfo.CurrentStation == 0 and gES_CurrentStationTmp > 0 then + WeaponStatusPanel_Reset(201, 210, lHardware) + gES_CurrentStationTmp = -1 + end +end + +function FuelQuantityIndicator(hardware) +-- Fuel quantity shows the fuel remaining in all tanks + local lHardware = hardware or 1 + local lEngineInfo = LoGetEngineInfo() + if lEngineInfo == nil then + return + end + --WriteToLog('lEngineInfo: '..dump(lEngineInfo)) + --[[ + [fuel_external] = number: "0" + [Temperature] = { + [left] = number: "626.99444580078" + [right] = number: "626.99444580078" + } + [RPM] = { + [left] = number: "87.453765869141" + [right] = number: "87.453758239746" + } + [FuelConsumption] = { + [left] = number: "0.1500396137767" + [right] = number: "0.1500396137767" + } + [fuel_internal] = number: "3773.2749023438" + [EngineStart] = { + [left] = number: "0" + [right] = number: "0" + } + [HydraulicPressure] = { + [left] = number: "210" + [right] = number: "210" + } + lPayloadInfo.Stations[8].CLSID == E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF -- ext 800l Fuel Tank + ]] + + SendDataHW("300", string.format("%d", math.round((lEngineInfo.fuel_internal / 10), 0, "ceil") * 10), lHardware ) -- total fuel in kg + --SendDataHW("301", string.format("%d", lEngineInfo.fuel_internal), lHardware ) -- total fuel in kg + --SendDataHW("302", string.format("%d", lEngineInfo.fuel_external), lHardware ) -- external fuel in kg + + SendDataHW("304", (lEngineInfo.fuel_internal < 5000.0 and 1 or 0), lHardware ) -- Tank warning 1 + SendDataHW("305", (lEngineInfo.fuel_internal < 1000.0 and 1 or 0), lHardware ) -- Tank warning 2 4000 + SendDataHW("306", (lEngineInfo.fuel_internal < 4000.0 and 1 or 0), lHardware ) -- Tank warning 3 1500 + SendDataHW("307", (lEngineInfo.fuel_internal < 1500.0 and 1 or 0), lHardware ) -- Tank warning 4 1000 + SendDataHW("308", (lEngineInfo.fuel_internal < 600.0 and 1 or 0), lHardware ) -- Bingo Fuel + +end + +function MechanicalDevicesIndicator(hardware) +-- The mechanical devices indicator shows the position of the landing gear, flaps, leading edge flaps and airbrake + local lHardware = hardware or 1 + local lMechInfo = LoGetMechInfo() -- mechanical components, e.g. Flaps, Wheelbrakes,... + if lMechInfo == nil then + return + end + --WriteToLog('lMechInfo: '..dump(lMechInfo)) + --[[ + [hook] = { + [status] = number: "0" + [value] = number: "0" + } + [parachute] = { + [status] = number: "0" + [value] = number: "0" + } + [controlsurfaces] = { + [eleron] = { + [left] = number: "0" + [right] = number: "-0.21084336936474" + } + [elevator] = { + [left] = number: "-0" + [right] = number: "-0" + } + [rudder] = { + [left] = number: "0" + [right] = number: "0" + } + } + [airintake] = { + [status] = number: "0" + [value] = number: "0" + } + [canopy] = { + [status] = number: "0" + [value] = number: "0" + } + [refuelingboom] = { + [status] = number: "0" + [value] = number: "0" + } + [wing] = { + [status] = number: "0" + [value] = number: "0" + } + [noseflap] = { + [status] = number: "0" + [value] = number: "0" + } + [gear] = { + [value] = number: "0" + [nose] = { + [rod] = number: "0" + } + [main] = { + [left] = { + [rod] = number: "0" + } + [right] = { + [rod] = number: "0" + } + } + [status] = number: "0" + } + [speedbrakes] = { + [status] = number: "0" + [value] = number: "0" + } + [wheelbrakes] = { + [status] = number: "0" + [value] = number: "0" + } + [flaps] = { + [status] = number: "0" + [value] = number: "0" + }]] + --SendDataHW("500", lMechInfo.gear.status ) + --SendDataHW("501", lMechInfo.gear.value ) + --SendDataHW("502", lMechInfo.gear.nose.rod ) -- zeigt an wie weit das Fahrwerk einsackt wenn das Flugzeug auf dem Boden ist + --SendDataHW("503", lMechInfo.gear.main.left.rod ) -- zeigt an wie weit das Fahrwerk einsackt wenn das Flugzeug auf dem Boden ist + --SendDataHW("504", lMechInfo.gear.main.right.rod ) -- zeigt an wie weit das Fahrwerk einsackt wenn das Flugzeug auf dem Boden ist + --SendDataHW("500", ((lMechInfo.gear.status == 1 and lMechInfo.gear.value < 1) and 1 or 0 ) ) -- gear warning light, go up + --SendDataHW("500", ((lMechInfo.gear.status == 0 and lMechInfo.gear.value > 0) and 1 or 0 ) ) -- gear warning light, go down + SendDataHW("500", (((lMechInfo.gear.status == 1 and lMechInfo.gear.value < 1) or (lMechInfo.gear.status == 0 and lMechInfo.gear.value > 0)) and 1 or 0 ), lHardware ) -- gear warning light + SendDataHW("501", (lMechInfo.gear.value > 0.85 and 1 or 0), lHardware ) -- nose gear + SendDataHW("502", (lMechInfo.gear.value > 0.95 and 1 or 0), lHardware ) -- left gear + SendDataHW("503", (lMechInfo.gear.value == 1 and 1 or 0), lHardware ) -- right gear + + --SendDataHW("510", lMechInfo.speedbrakes.status ) -- speedbreakes on 1 (0|1) + SendDataHW("510", (lMechInfo.speedbrakes.value > 0.1 and 1 or 0), lHardware ) -- speedbreakes on > 0.1 (0 - 1) + + --SendDataHW("520", lMechInfo.wheelbrakes.status, lHardware ) -- not in use + --SendDataHW("521", lMechInfo.wheelbrakes.value, lHardware ) -- not in use + + local lGetTrueAirSpeed = LoGetTrueAirSpeed() + if lGetTrueAirSpeed == nil then + lGetTrueAirSpeed = 0 + end + --SendDataHW("530", lMechInfo.flaps.status ) -- flap switch off 0, 1. position 1, 2. position 2 (0|1|2) + --SendDataHW("531", lMechInfo.flaps.value ) -- flap 1. position > 0.25, 2. position > 0.93 (0 - 1) + SendDataHW("531", (lMechInfo.flaps.value > 0.25 and 1 or 0), lHardware ) -- flap 1. position + SendDataHW("532", (lMechInfo.flaps.value > 0.93 and 1 or 0), lHardware ) -- flap 2. position + SendDataHW("533", ((lMechInfo.flaps.value > 0.93 and lGetTrueAirSpeed > 340) and 1 or 0), lHardware ) -- Speed Warning for Flaps, same light as gear warning light, but blinking light + SendDataHW("534", (lMechInfo.gear.value > 0.5 and 1 or 0), lHardware ) -- Intake FOD shields + + --SendDataHW("540", lMechInfo.parachute.status ) + SendDataHW("541", (lMechInfo.hook.value > 0.8 and 1 or 0), lHardware ) + + --SendDataHW("550", lMechInfo.noseflap.status ) + SendDataHW("551", (lMechInfo.noseflap.value > 20.0 and 1 or 0), lHardware ) +end \ No newline at end of file diff --git a/ExportsModules/TF-51D.lua b/ExportsModules/TF-51D.lua new file mode 100644 index 0000000..7fa9543 --- /dev/null +++ b/ExportsModules/TF-51D.lua @@ -0,0 +1,343 @@ +-- TF-51D Export +-- Version 0.9.9 BETA + +gES_FoundDCSModule = true + +gES_GlassCockpitConfigEveryFrameArguments = +{ + --[[ + every frames arguments + based of "mainpanel_init.lua" + Example (http://www.lua.org/manual/5.1/manual.html#pdf-string.format) + [DeviceID] = "Format" + [4] = "%.4f", <- floating-point number with 4 digits after point + [19] = "%0.1f", <- floating-point number with 1 digit after point + [129] = "%1d", <- decimal number + ]] + + -- Flight Instruments + [11] = "%.2f", -- AirspeedNeedle + [29] = "%.1f", -- Variometer + -- Altimeter + [97] = "%.1f", -- Altimeter_Pressure + [96] = "%.1f", -- Altimeter_10000_footPtr + [24] = "%.1f", -- Altimeter_1000_footPtr + [25] = "%.1f", -- Altimeter_100_footPtr + -- Artificial horizon + [15] = "%.1f", -- AHorizon_Pitch + [14] = "%.1f", -- AHorizon_Bank + [16] = "%.1f", -- AHorizon_PitchShift + [20] = "%.1f", -- AHorizon_Caged + -- directional gyro + [12] = "%.1f", -- GyroHeading + -- turn indicator + [27] = "%.1f", -- TurnNeedle + [28] = "%.1f", -- Slipball + -- oxygen pressure indicator + [34] = "%.1f", -- Oxygen_Pressure + [33] = "%.1f", -- Oxygen_Flow_Blinker + -- fuel system + [155] = "%.2f", -- Fuel_Tank_Left + [156] = "%.2f", -- Fuel_Tank_Right + [32] = "%.1f", -- Fuel_Pressure + -- A-11 clock + [4] = "%.4f", -- CLOCK_currtime_hours + [5] = "%.4f", -- CLOCK_currtime_minutes + [6] = "%.4f", -- CLOCK_currtime_seconds + -- AN5730 remote compass + [1] = "%.4f", -- CompassHeading + [2] = "%.4f", -- CommandedCourse + [3] = "%.4f", -- CommandedCourseKnob + -- TailRadarWarning + [161] = "%.1f", -- TailRadarWarning + -- SCR-522A Control panel + [122] = "%.1f", -- A_channel_light + [123] = "%.1f", -- B_channel_light + [124] = "%.1f", -- C_channel_light + [125] = "%.1f", -- D_channel_light + [126] = "%.1f", -- Transmit_light + -- hydraulic pressure + [78] = "%.4f", -- Hydraulic_Pressure + -- Landing gears handle + [150] = "%.4f", -- Landing_Gear_Handle + [151] = "%.4f", -- Landing_Gear_Handle_Indoor + [80] = "%.1f", -- LandingGearGreenLight + [82] = "%.1f", -- LandingGearRedLight + -- gauges + [10] = "%.4f", -- Manifold_Pressure + [23] = "%.4f", -- Engine_RPM + [9] = "%.4f", -- Vacuum_Suction + [21] = "%.4f", -- Carb_Temperature + [22] = "%.4f", -- Coolant_Temperature + [30] = "%.4f", -- Oil_Temperature + [31] = "%.4f", -- Oil_Pressure + [164] = "%.1f", -- Left_Fluor_Light + [165] = "%.1f", -- Right_Fluor_Light + [59] = "%.1f", -- Hight_Blower_Lamp + -- Trimmer + [170] = "%.4f", -- Aileron_Trimmer + [172] = "%.4f", -- Rudder_Trimmer + [171] = "%.4f", -- Elevator_Trimmer + [174] = "%.4f", -- Control_Lock_Bracket + [175] = "%.4f", -- Accelerometer_main + [177] = "%.4f", -- Accelerometer_min + [178] = "%.4f", -- Accelerometer_max + [101] = "%.4f", -- Ammeter + -- light + [185] = "%.1f", -- Left_cockpit_light + [186] = "%.1f", -- Right_cockpit_light + [190] = "%.4f" -- warEmergencyPowerLimWire +} +gES_GlassCockpitConfigArguments = +{ + --[[ + arguments for export in low tick interval + based on "clickabledata.lua" + ]] + + -- Right Swich Panel + [102] = "%d", -- Generator Connect/Disconnect + [103] = "%d", -- Battery Connect/Disconnect + [104] = "%d", -- Gun Heating ON/OFF + [105] = "%d", -- Pitot Heating ON/OFF + [106] = "%d", -- Wing Position Lights Bright/Off/Dim + [107] = "%d", -- Tail Position Lights Bright/Off/Dim + [108] = "%d", -- Red Recognition Light Key/Off/Steady + [109] = "%d", -- Green Recognition Light Key/Off/Steady + [110] = "%d", -- Amber Recognition Light Key/Off/Steady + [111] = "%d", -- Recognition Lights Key + [112] = "%d", -- Circuit Protectors Reset + [100] = "%d", -- Right Fluorescent Light + [90] = "%d", -- Left Fluorescent Light + -- Flight Instrument panel + [3] = "%.4f", -- Course Set + [179] = "%.4f", -- Heading Set/Cage + [13] = "%d", -- Heading Set/Cage Button + [17] = "%.4f", -- Pitch Adjustment + [19] = "%.4f", -- Cage + [18] = "%d", -- Cage Button + [8] = "%d", -- Winding/Adjustment Clock ?? + [7] = "%d", -- Winding/Adjustment Clock ?? + [26] = "%.4f", -- Set Pressure + -- SCR-522A Control panel + [117] = "%d", -- Radio ON/OFF + [118] = "%d", -- A Channel Activate + [119] = "%d", -- B Channel Activate + [120] = "%d", -- C Channel Activate + [121] = "%d", -- D Channel Activate + [127] = "%.4f", -- Radio Lights Dimmer + [116] = "%.4f", -- Radio Audio Volume + [44] = "%d", -- Microphone On + [129] = "%d", -- Switch Locking Lever + [128] = "%.4f", -- Radio Mode Transmit/Receive/Remote + ------------- + [71] = "%.4f", -- Cockpit Lights + [66] = "%0.1f", -- Ignition Off/Right/Left/Both + [67] = "%d", -- Gun control Gun And Camera On/Gun And Camera OFF/Camera On + [72] = "%d", -- Silence Landing Gear Warning Horn Cut Off + -- Bomb Arm/Chemical + [69] = "%d", -- Left Bomb Arm/Chemical + [70] = "%d", -- Right Bomb Arm/Chemical + -- Release Mode + [68] = "%0.1f", -- Release Mode, Bombs and Rockets Safe/Bombs Train Release/Bombs Both Release/Rockets Arm + -- Engine Control Panel + [58] = "%d", -- Supercharger Switch Cover + [57] = "%0.1f", -- Supercharger AUTO/LOW/HIGH + [60] = "%d", -- High Blower Lamp Test + [61] = "%d", -- Fuel Booster On/Off + [62] = "%d", -- Oil Dilute Activate + [63] = "%d", -- Starter Activate + [64] = "%d", -- Starter Switch Cover + [65] = "%d", -- Primer Activate + -- Oxygen Regulator + [131] = "%d", -- Auto-Mix On-Off + [130] = "%0.4f", -- Oxygen Emergency By-pass + -- Fuel system + [85] = "%0.1f", -- Fuel Selector Valve, Select Right Combat Tank/Select Left Main Tank/Select Fuselage Tank/Select Right Main Tank/Select Left Combat Tank + [86] = "%d", -- Fuel Shut-Off Valve ON/OFF + -- AN/APS-13 + [114] = "%d", -- ail Warning Radar Power ON/OFF + [115] = "%d", -- Tail Warning Radar Test + [113] = "%.4f", -- Tail Warning Radar Light Control + ------------- + [79] = "%.4f", -- Hydraulic Release Knob + [94] = "%.4f", -- Flaps Control Handle + [84] = "%d", -- Parking Brake Handle + [81] = "%d", -- Safe Landing Gear Light Test + [83] = "%d", -- Unsafe Landing Gear Light Test + -- Detrola receiver + [137] = "%0.4f", -- Detrola Frequency Selector + [138] = "%0.4f", -- Detrola Volume + -- canopy + [147] = "%.4f", -- Canopy Hand Crank + [149] = "%d", -- Canopy Emergency Release Handle + -- AN/ARA-8 + [152] = "%0.1f", -- Homing Adapter Mode TRANSMIT/COMM./HOMING + [153] = "%d", -- Homing Adapter Power On/Off + [154] = "%d", -- Homing Adapter's Circuit Breaker + -- SCR-695 + [139] = "%0.1f", -- IFF Code Selector Code 1/2/3/4/5/6 + [140] = "%d", -- IFF Power On/Off + [141] = "%d", -- IFF TIME/OFF/ON + [142] = "%d", -- IFF Detonator Circuit On/Off + [143] = "%d", -- IFF Distress Signal On/Off + [145] = "%d", -- IFF Detonator Left + [146] = "%d", -- IFF Detonator Right + -- Trimmers + [91] = "%.4f", -- Aileron Trim + [92] = "%.4f", -- Elevator Trim + [93] = "%.4f", -- Rudder Trim + ------------- + [157] = "%.4f", -- Defroster + [158] = "%.4f", -- Cold Air + [159] = "%.4f", -- Hot Air + ------------- + [89] = "%d", -- Landing Light On/Off + [168] = "%d", -- Coolant Control Cover + [87] = "%0.1f", -- Close Coolant Control/Automatic Coolant Control/Open Coolant Control + [169] = "%d", -- Oil Control Cover + [88] = "%0.1f", -- Close Oil Control/Automatic Oil Control/Open Oil Control + [134] = "%0.1f", -- Carburetor Cold Air Control + [135] = "%0.1f", -- Carburetor Warm Air Control + [47] = "%0.1f", -- Mixture Control Select IDLE CUT OFF/RUN/EMERGENCY FULL RICH + [43] = "%.4f", -- Throttle + [46] = "%.4f", -- Propeller RPM + [173] = "%.4f", -- Surface Control Lock Plunger. Left Button - Lock Stick in the Forward Position', Right Button - Lock Stick in the Neutral Position + [48] = "%.4f", -- Lock Throttle + [49] = "%.4f", -- Lock Propeller & Mixture + [176] = "%.4f", -- G-meter reset + [183] = "%.4f" -- Mirror +} + +----------------------------- +-- HIGH IMPORTANCE EXPORTS -- +-- done every export event -- +----------------------------- + +function ProcessGlassCockpitDCSConfigHighImportance(mainPanelDevice) + --[[ + every frame export to GlassCockpit + Example from A-10C + Get Radio Frequencies + get data from device + local lUHFRadio = GetDevice(54) + SendData("ExportID", "Format") + SendData(2000, string.format("%7.3f", lUHFRadio:get_frequency()/1000000)) <- special function for get frequency data + ]] +end + +function ProcessHARDWAREConfigHighImportance(mainPanelDevice) + --[[ + every frame export to hardware + Example from A-10C + Get Radio Frequencies + get data from device + local UHF_RADIO = GetDevice(54) + SendDataHW("ExportID", "Format") + SendDataHW("ExportID", "Format", HardwareConfigID) + SendDataHW("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000)) + SendDataHW("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000), 2) -- export to Hardware '2' Config + ]] + + -- no dimming lights + -- TailRadarWarning + SendDataHW("161", mainPanelDevice:get_argument_value(161) > 0.3 and 1 or 0) -- Lamp TailRadarWarning + -- SCR-522A Control panel + SendDataHW("122", mainPanelDevice:get_argument_value(122) > 0.3 and 1 or 0) -- A_channel_light + SendDataHW("123", mainPanelDevice:get_argument_value(123) > 0.3 and 1 or 0) -- B_channel_light + SendDataHW("124", mainPanelDevice:get_argument_value(124) > 0.3 and 1 or 0) -- C_channel_light + SendDataHW("125", mainPanelDevice:get_argument_value(125) > 0.3 and 1 or 0) -- D_channel_light + SendDataHW("126", mainPanelDevice:get_argument_value(126) > 0.3 and 1 or 0) -- Transmit_light + -- Landing gears + SendDataHW("80", mainPanelDevice:get_argument_value(80) > 0.3 and 1 or 0) -- LandingGearGreenLight + SendDataHW("82", mainPanelDevice:get_argument_value(82) > 0.3 and 1 or 0) -- LandingGearRedLight + -- Engine + SendDataHW("59", mainPanelDevice:get_argument_value(59) > 0.3 and 1 or 0) -- Hight_Blower_Lamp + -- Cockpit Lights + SendDataHW("164", mainPanelDevice:get_argument_value(164) > 0.3 and 1 or 0) -- Left_Fluor_Light + SendDataHW("165", mainPanelDevice:get_argument_value(165) > 0.3 and 1 or 0) -- Right_Fluor_Light + SendDataHW("185", mainPanelDevice:get_argument_value(185) > 0.3 and 1 or 0) -- Left_cockpit_light + SendDataHW("186", mainPanelDevice:get_argument_value(186) > 0.3 and 1 or 0) -- Right_cockpit_light + + --[[ + -- dimming lights + -- TailRadarWarning + SendDataHW("161", string.format("%.1f", mainPanelDevice:get_argument_value(161))) -- Lamp TailRadarWarning + -- SCR-522A Control panel + SendDataHW("122", string.format("%.1f", mainPanelDevice:get_argument_value(122))) -- A_channel_light + SendDataHW("123", string.format("%.1f", mainPanelDevice:get_argument_value(123))) -- B_channel_light + SendDataHW("124", string.format("%.1f", mainPanelDevice:get_argument_value(124))) -- C_channel_light + SendDataHW("125", string.format("%.1f", mainPanelDevice:get_argument_value(125))) -- D_channel_light + SendDataHW("126", string.format("%.1f", mainPanelDevice:get_argument_value(126))) -- Transmit_light + -- Landing gears + SendDataHW("80", string.format("%.1f", mainPanelDevice:get_argument_value(80))) -- LandingGearGreenLight + SendDataHW("82", string.format("%.1f", mainPanelDevice:get_argument_value(82))) -- LandingGearRedLight + -- Engine + SendDataHW("59", string.format("%.1f", mainPanelDevice:get_argument_value(59))) -- Hight_Blower_Lamp + -- Cockpit Lights + SendDataHW("164", string.format("%.1f", mainPanelDevice:get_argument_value(164))) -- Left_Fluor_Light + SendDataHW("165", string.format("%.1f", mainPanelDevice:get_argument_value(165))) -- Right_Fluor_Light + SendDataHW("185", string.format("%.1f", mainPanelDevice:get_argument_value(185))) -- Left_cockpit_light + SendDataHW("186", string.format("%.1f", mainPanelDevice:get_argument_value(186))) -- Right_cockpit_light + ]] +end + +----------------------------------------------------- +-- LOW IMPORTANCE EXPORTS -- +-- done every gExportLowTickInterval export events -- +----------------------------------------------------- + +function ProcessGlassCockpitDCSConfigLowImportance(mainPanelDevice) + --[[ + export in low tick interval to GlassCockpit + Example from A-10C + Get Radio Frequencies + get data from device + local lUHFRadio = GetDevice(54) + SendData("ExportID", "Format") + SendData(2000, string.format("%7.3f", lUHFRadio:get_frequency()/1000000)) <- special function for get frequency data + ]] + + --[[ + local lDETROLA = GetDevice(24) + WriteToLog('lDETROLA: '..dump(lDETROLA:is_on())) + WriteToLog('lDETROLA: '..dump(lDETROLA:get_frequency())) + --SendData(2000, string.format("%7.3f", lDETROLA:get_frequency()/1000000)) + + local lINTERCOM = GetDevice(31) + WriteToLog('lINTERCOM: '..dump(lINTERCOM:is_communicator_available())) + WriteToLog('lINTERCOM: '..dump(lINTERCOM:get_noise_level())) + WriteToLog('lINTERCOM: '..dump(lINTERCOM:get_signal_level())) + ]] + --[[ + local ltmp1 = 0 + for ltmp2 = 1, 32, 1 do + ltmp1 = GetDevice(ltmp2) + WriteToLog(ltmp2..': '..dump(ltmp1)) + WriteToLog(ltmp2..' (metatable): '..dump(getmetatable(ltmp1))) + end + ]] +end + +function ProcessHARDWAREConfigLowImportance(mainPanelDevice) +--[[ + export in low tick interval to hardware + Example from A-10C + Landing Gear + mainPanelDevice, basis panel + SendDataHW("2004", mainPanelDevice:get_argument_value(659)) -- GEAR_N_SAFE + SendDataHW("2005", mainPanelDevice:get_argument_value(660)) -- GEAR_L_SAFE + SendDataHW("2006", mainPanelDevice:get_argument_value(661)) -- GEAR_R_SAFE + ]] + + --[[ + WriteToLog('list_cockpit_params(): '..dump(list_cockpit_params())) + + local ltmp1 = 0 + for ltmp2 = 1, 10, 1 do + ltmp1 = list_indication(ltmp2) + WriteToLog(ltmp2..': '..dump(ltmp1)) + --WriteToLog(ltmp2..' (metatable): '..dump(getmetatable(ltmp1))) + end + ]] +end \ No newline at end of file diff --git a/ExportsModules/UH-1H.lua b/ExportsModules/UH-1H.lua new file mode 100644 index 0000000..737e121 --- /dev/null +++ b/ExportsModules/UH-1H.lua @@ -0,0 +1,1647 @@ +-- Uh-1H Export +-- Version 0.9.9 BETA + +gES_FoundDCSModule = true + +gES_GlassCockpitConfigEveryFrameArguments = +{ + --[[ + every frames arguments + based of "mainpanel_init.lua" + Example (http://www.lua.org/manual/5.1/manual.html#pdf-string.format) + [DeviceID] = "Format" + [4] = "%.4f", <- floating-point number with 4 digits after point + [19] = "%0.1f", <- floating-point number with 1 digit after point + [129] = "%1d", <- decimal number + ]] + -- Controlls Pilot + --[184] = "%.4f", -- rudder + --[187] = "%.4f", -- stick_roll + --[186] = "%.4f", -- stick_pitch + --[200] = "%.4f", -- collective_position + -- Controlls CoPilot + --[185] = "%.4f", -- rudder_add + --[191] = "%.4f", -- stick_roll_sec + --[190] = "%.4f", -- stick_pitch_sec + --[207] = "%.4f", -- collective_position_operator + -- Gauges Pilot + [117] = "%0.4f", -- AIRSPEED_Nose + [118] = "%0.4f", -- AIRSPEED_Roof + -- Course Indicator ID-1347 + [151] = "%.4f", -- VerticalBar + [152] = "%.4f", -- HorisontalBar + [153] = "%.4f", -- ToMarker + [154] = "%.4f", -- FromMarker + [156] = "%.4f", -- RotCourseCard + [157] = "%.1f", -- VerticalOFF + [158] = "%.1f", -- HorisontalOFF + -- ADF_ARN83 + [45] = "%0.2f", -- ADF_ARN83_Frequency + [40] = "%.4f", -- ARN83_SignalLevel + -- GMC + [159] = "%.4f", -- GMC_CoursePointer1 + [160] = "%.4f", -- GMC_CoursePointer2 + [162] = "%.4f", -- GMC_HeadingMarker + [165] = "%.4f", -- GMC_Heading + [166] = "%.4f", -- GMC_Annunciator + [167] = "%.2f", -- GMC_PowerFail + -- Copilot RMI + [266] = "%.4f", -- RMI_CoursePointer1 + [267] = "%.4f", -- RMI_CoursePointer2 + [269] = "%.4f", -- RMI_Heading + -- Altimeter Indicator AAU-32/A (operator) + [168] = "%.4f", -- Pointer + [169] = "%.4f", -- Alt1AAU_10000_footCount + [170] = "%.4f", -- Alt1AAU_1000_footCount + [171] = "%.4f", -- Alt1AAU_100_footCount + [174] = "%.2f", -- AAU_32_Drum_Counter + [175] = "%.2f", -- AAU_32_Drum_Counter + [176] = "%.2f", -- AAU_32_Drum_Counter + [177] = "%.1f", -- CodeOff_flag + -- Altimeter Indicator AAU-7/A (pilot) (AAU-31/A) + [178] = "%.4f", -- Alt_10000_AAU_7A + [179] = "%.4f", -- Alt_1000_AAU_7A + [180] = "%.4f", -- Alt_100_AAU_7A + [182] = "%.4f", -- Press_AAU_7A + -- Gauges + [113] = "%.4f", -- EngOilPress + [114] = "%.4f", -- EngOilTemp + [115] = "%.4f", -- TransmOilPress + [116] = "%.4f", -- TransmOilTemp + [117] = "%.4f", -- AIRSPEED_Nose + [118] = "%.4f", -- AIRSPEED_Roof + [121] = "%.4f", -- ExhaustTemp + [122] = "%.4f", -- EngineTach + [123] = "%.4f", -- RotorTach + [119] = "%.4f", -- GasProducerTach + [120] = "%.4f", -- GasProducerTach_U + [124] = "%.4f", -- TorquePress + [149] = "%.4f", -- VoltageDC + [150] = "%.4f", -- VoltageAC + [436] = "%.4f", -- LoadmeterMainGen + [125] = "%.4f", -- LoadmeterSTBYGen + [126] = "%.4f", -- FuelPress + [239] = "%.4f", -- FuelQuantity + -- Mechanic clock + [127] = "%.4f", -- CLOCK_hours + [128] = "%.4f", -- CLOCK_minutes + [129] = "%.4f", -- CLOCK_seconds + -- + [132] = "%.4f", -- TurnPtr + [133] = "%.4f", -- SideSlip + [134] = "%.2f", -- VertVelocPilot + [251] = "%.2f", -- VertVelocCopilot + -- ADI - pilot + [142] = "%.4f", -- Attitude_Roll + [143] = "%.4f", -- Attitude_Pitch + [148] = "%.1f", -- Attitude_Off_flag + -- ADI - operator + [135] = "%.4f", -- Attitude_Roll_left + [136] = "%.4f", -- Attitude_Pitch_left + [141] = "%.1f", -- Attitude_Off_flag_left + [138] = "%.4f", -- Attitude_PitchShift + -- operator + --[149] = "%.4f", -- DCVoltmeter + --[150] = "%.4f", -- ACVoltmeter + -- UHF_ARC51 + [10] = "%.4f", -- UHF_ARC51_Freq1 + [11] = "%.4f", -- UHF_ARC51_Freq2 + [12] = "%.4f", -- UHF_ARC51_Freq3 + [13] = "%.4f", -- UHF_ARC51_Freq4 + [14] = "%.4f", -- UHF_ARC51_Freq5 + -- NAV_ARN82 + [46] = "%.4f", -- NAV_ARN82_Freq1 + [47] = "%.4f", -- NAV_ARN82_Freq2 + [48] = "%.4f", -- NAV_ARN82_Freq3 + [49] = "%.4f", -- NAV_ARN82_Freq4 + [50] = "%.4f", -- NAV_ARN82_Freq5 + -- VHF_ARC134 + [1] = "%.4f", -- VHF_ARC134_Freq1 + [2] = "%.4f", -- VHF_ARC134_Freq2 + [3] = "%.4f", -- VHF_ARC134_Freq3 + [4] = "%.4f", -- VHF_ARC134_Freq4 + -- + [56] = "%.1f", -- Marker_Beacon_Lamp + -- Panel_Shake + --[264] = "%.1f", -- Panel_Shake_Z + --[265] = "%.1f", -- Panel_Shake_Y + --[282] = "%.1f", -- Panel_Rot_X + -- Wiper + --[284] = "%.4f", -- Wiper_Pilot + --[283] = "%.4f", -- Wiper_Operator + -- Pilot Model + --[242] = "%.1f", -- Pilot_Model + --[245] = "%.1f", -- Operator_Model + -- Flexible sight station + --[263] = "%.2f", -- FlexSightHeight + --[261] = "%.4f", -- FlexSightAzimuth + --[262] = "%.4f", -- FlexSightElevation + -- Pilot sight station + --[438] = "%.4f", -- PilotSightHeight + --[442] = "%.2f", -- PilotSightGlass + -- Light + --[279] = "%.4f", -- light_ConsoleLight + --[410] = "%.4f", -- light_DomeLight + --[411] = "%.4f", -- light_DomeLightGreen + -- Damage + --[248] = "%.1f", -- DeadPilot + --[249] = "%.1f", -- DeadCoPilot + --[414] = "%.4f", -- LeftWindShield + --[413] = "%.4f", -- RightWindShield + --[412] = "%.4f", -- DownBlisters + --[417] = "%.4f", -- UpRightBlister + --[418] = "%.4f", -- UpLeftBlister + --[415] = "%.4f", -- RightWindow + --[416] = "%.4f", -- LeftWindow + --[422] = "%.4f", -- RightDoor + --[420] = "%.4f", -- LeftDoor + -- + [437] = "%.3f", -- RamTemp + -- Radar Altimeter + [443] = "%.4f", -- RALT_Needle + [467] = "%.1f", -- RALT_Off_Flag + [447] = "%.1f", -- RALT_LO_Lamp + [465] = "%.1f", -- RALT_HI_Lamp + [444] = "%.4f", -- RALT_LO_Index + [466] = "%.4f", -- RALT_HI_Index + [468] = "%0.1f", -- RALT_Digit_1 + [469] = "%0.1f", -- RALT_Digit_2 + [470] = "%0.1f", -- RALT_Digit_3 + [471] = "%0.1f", -- RALT_Digit_4 + -- FLARE CHAFF + [460] = "%1d", -- FLARE_Digit_1 + [461] = "%1d", -- FLARE_Digit_2 + [462] = "%1d", -- CHAFF_Digit_1 + [463] = "%1d", -- CHAFF_Digit_2 + -- XM130 Chaff Flare + [458] = "%.1f", -- lamp_XM130_ARMED + -- Main Panel Lights + [277] = "%.1f", -- lamp_MASTER + [276] = "%.1f", -- lamp_LOW_RPM + [275] = "%.1f", -- lamp_FIRE + -- Caution Panel Lights + [91] = "%.1f", -- lamp_ENGINE_OIL_PRESS + [92] = "%.1f", -- lamp_ENGINE_ICING + [93] = "%.1f", -- lamp_ENGINE_ICE_JET + [94] = "%.1f", -- lamp_ENGINE_CHIP_DET + [95] = "%.1f", -- lamp_LEFT_FUEL_BOOST + [96] = "%.1f", -- lamp_RIGHT_FUEL_BOOST + [97] = "%.1f", -- lamp_ENG_FUEL_PUMP + [98] = "%.1f", -- lamp_20_MINUTE + [99] = "%.1f", -- lamp_FUEL_FILTER + [100] = "%.1f", -- lamp_GOV_EMERG + [101] = "%.1f", -- lamp_AUX_FUEL_LOW + [102] = "%.1f", -- lamp_XMSN_OIL_PRESS + [103] = "%.1f", -- lamp_XMSN_OIL_HOT + [104] = "%.1f", -- lamp_HYD_PRESSURE + [105] = "%.1f", -- lamp_ENGINE_INLET_AIR + [106] = "%.1f", -- lamp_INST_INVERTER + [107] = "%.1f", -- lamp_DC_GENERATOR + [108] = "%.1f", -- lamp_EXTERNAL_POWER + [109] = "%.1f", -- lamp_CHIP_DETECTOR + [110] = "%.1f", -- lamp_IFF + -- M21 + [254] = "%.1f", -- lamp_M21_ARMED + [255] = "%.1f", -- lamp_M21_SAFE + -- + [76] = "%.1f", -- lamp_IFF_REPLY + [77] = "%.1f", -- lamp_IFF_TEST + -- Electic Gauges + [526] = "%.4f", -- DC_voltage + [532] = "%.2f", -- AC_voltage + [527] = "%.4f", -- DC_battery_I_current + [528] = "%.4f", -- DC_battery_II_current + [529] = "%.4f", -- DC_VU_I_current + [530] = "%.4f", -- DC_VU_II_current + [531] = "%.4f", -- DC_VU_III_current + [533] = "%.2f", -- AC_generator_I_current + [534] = "%.2f", -- AC_generator_II_current + [371] = "%.2f" -- AntiIce_ampermeter +} +gES_GlassCockpitConfigArguments = +{ + --[[ + arguments for export in low tick interval + based on "clickabledata.lua" + ]] + -- Electrosystem + [219] = "%1d", -- Battery + [220] = "%1d", -- Starter/Stdby GEN + [218] = "%.1f", -- DC Voltmeter Selector + [221] = "%1d", -- Non Essential bus + [214] = "%.1f", -- AC Voltmeter Selector + [215] = "%1d", -- Inverter + -- Electrosystem circuit breakers + -- Essential BUS. line 1 + [285] = "%1d", -- CB IFF APX 1 (N/F) + [287] = "%1d", -- CB IFF APX 2 (N/F) + [289] = "%1d", -- CB Prox. warn.(N/F) + [291] = "%1d", -- CB Marker beacon + [293] = "%1d", -- CB VHF Nav. (ARN-82) + [295] = "%1d", -- CB LF Nav. (ARN-83) + [297] = "%1d", -- CB Intercom CPLT(N/F) + [299] = "%1d", -- CB Intercom PLT + [349] = "%1d", -- CB ARC-102 HF Static INVTR(N/F) + [351] = "%1d", -- CB HF ANT COUPLR(N/F) + [353] = "%1d", -- CB HF ARC-102(N/F) + [355] = "%1d", -- CB FM Radio + [357] = "%1d", -- CB UHF Radio + [359] = "%1d", -- CB FM 2 Radio(N/F) + [361] = "%1d", -- CB VHF AM Radio + [321] = "%1d", -- CB Pitot tube(N/F) + [345] = "%1d", -- CB Rescue hoist CTL(N/F) + [347] = "%1d", -- CB Rescue hoist cable cutter (N/F) + -- Essential BUS. line 2 + [303] = "%1d", -- CB Wind wiper PLT + [301] = "%1d", -- CB Wind wiper CPLT + [305] = "%1d", -- CB KY-28 voice security(N/F) + [403] = "%1d", -- CB Starter Relay(N/F) + [307] = "%1d", -- CB Search light power(N/F) + [309] = "%1d", -- CB Landing light power(N/F) + [311] = "%1d", -- CB Landing & Search light control(N/F) + [313] = "%1d", -- CB Anticollision light(N/F) + [363] = "%1d", -- CB Fuselage lights(N/F) + [365] = "%1d", -- CB Navigation lights(N/F) + [367] = "%1d", -- CB Dome lights(N/F) + [369] = "%1d", -- CB Cockpit lights(N/F) + [371] = "%1d", -- CB Caution lights(N/F) + [373] = "%1d", -- CB Console lights(N/F) + [375] = "%1d", -- CB INST Panel lights(N/F) + [377] = "%1d", -- CB INST SEC lights(N/F) + [323] = "%1d", -- CB Cabin heater (Outlet valve)(N/F) + [325] = "%1d", -- CB Cabin heater (Air valve)(N/F) + [343] = "%1d", -- CB Rescue hoist PWR(N/F) + -- Essential BUS. line 3 + [327] = "%1d", -- CB RPM Warning system(N/F) + [329] = "%1d", -- CB Engine anti-ice(N/F) + [331] = "%1d", -- CB Fire detector(N/F) + [333] = "%1d", -- CB LH fuel boost pump(N/F) + [335] = "%1d", -- CB Turn & Slip indicator + [337] = "%1d", -- CB TEMP indicator(N/F) + [339] = "%1d", -- CB HYD Control(N/F) + [341] = "%1d", -- CB FORCE Trim(N/F) + [379] = "%1d", -- CB Cargo hook release(N/F) + [381] = "%1d", -- CB EXT Stores jettison(N/F) + [383] = "%1d", -- CB Spare inverter PWR(N/F) + [385] = "%1d", -- CB Inverter CTRL (N/F) + [387] = "%1d", -- CB Main inverter PWR(N/F) + [389] = "%1d", -- CB Generator & Bus Reset(N/F) + [391] = "%1d", -- CB STBY Generator Field(N/F) + [393] = "%1d", -- CB Governor Control(N/F) + [395] = "%1d", -- CB IDLE Stop release(N/F) + [397] = "%1d", -- CB RH fuel boost pump(N/F) + [399] = "%1d", -- CB Fuel TRANS(N/F) + [401] = "%1d", -- CB Fuel valves(N/F) + -- Non Essential BUS + [315] = "%1d", -- CB Heated blanket 1(N/F) + [317] = "%1d", -- CB Heated blanket 2(N/F) + [319] = "%1d", -- CB Voltmeter Non Ess Bus(N/F) + -- other circuit breakers + [405] = "%1d", -- CB Ignition system(N/F) + -- AC BUS circuit breakers + [423] = "%1d", -- CB Pilot ATTD1(N/F) + [424] = "%1d", -- CB Pilot ATTD2(N/F) + [425] = "%1d", -- CB Copilot ATTD1(N/F) + [426] = "%1d", -- CB Copilot ATTD2(N/F) + [427] = "%1d", -- CB Gyro Cmps(N/F) + [428] = "%1d", -- CB Fuel Quantity(N/F) + [429] = "%1d", -- CB 28V Trans(N/F) + [430] = "%1d", -- CB Fail Relay(N/F) + [431] = "%1d", -- CB Pressure Fuel(N/F) + [432] = "%1d", -- CB Pressure Torque(N/F) + [433] = "%1d", -- CB Pressure XMSN(N/F) + [434] = "%1d", -- CB Pressure Eng(N/F) + [435] = "%1d", -- CB Course Ind(N/F) + -- + [238] = "%1d", -- Pitot Heater + [216] = "%1d", -- Main generator (Left button - ON/OFF. Right button RESET) {-1, 0, 1} + [217] = "%1d", -- Main generator switch cover + -- + [111] = "%1d", -- Reset/Test switch {-1, 0, 1} + [112] = "%1d", -- Bright/Dim switch {-1, 0, 1} + -- Fuel system + [81] = "%1d", -- Main Fuel + [240] = "%1d", -- Test Fuel Gauge + --Transponder APX-72 + [78] = "%.1f", -- Code + [59] = "%.1f", -- Master + [60] = "%1d", -- Audio/light + + [61] = "%1d", -- Test M-1 {-1, 0, 1} + [62] = "%1d", -- Test M-2 {-1, 0, 1} + [63] = "%1d", -- Test M-3A {-1, 0, 1} + [64] = "%1d", -- Test M-C {-1, 0, 1} + -- + [65] = "%1d", -- RAD Test/Mon {-1, 0, 1} + [66] = "%1d", -- Ident/Mic {-1, 0, 1} + -- IFF + [67] = "%1d", -- IFF On/Out + + [68] = "%1d", -- MODE1-WHEEL1 + [69] = "%1d", -- MODE1-WHEEL2 + + [70] = "%1d", -- "MODE3A-WHEEL1 + [71] = "%1d", -- "MODE3A-WHEEL2 + [72] = "%1d", -- "MODE3A-WHEEL3 + [73] = "%1d", -- "MODE3A-WHEEL4 + + [74] = "%.4f", -- Reply test, Axis + [78] = "%1d", -- Reply test, Button + + [75] = "%.4f", -- Test test, Axis + [79] = "%1d", -- Test test, Button + + [130] = "%1d", -- Winding/Adjustment Clock, Axis ?? + [131] = "%1d", -- Winding/Adjustment Clock, Button ?? + -- ENGINE INTERFACE + [250] = "%.4f", -- Throttle {-1.0, 0.4} + [206] = "%1d", -- Throttle Stop + + [84] = "%1d", -- De-Ice On/Off + [80] = "%1d", -- Low RPM Warning + [86] = "%1d", -- Chip Detector {-1, 0, 1} + [85] = "%1d", -- Governor Emer/Auto + [90] = "%1d", -- Hydraulic Control + [89] = "%1d", -- Force Trim + [203] = "%1d", -- Governor {-1, 0, 1} + [278] = "%1d", -- Fire Test + -- ADI OPERATOR + -- Copilot's attutude indicator + [140] = "%1d", -- Cage Copilot's Attitude Indicator, Button + [146] = "%.4f", -- Attitude Indicator Pitch Trim Knob, Axis + -- ADI PILOT + [145] = "%.4f", -- Attitude Indicator Pitch Trim Knob, Axis + [144] = "%.4f", -- Attitude Indicator Roll Trim Knob, Axis + -- AAU32 + -- Copilot's altimeter + [172] = "%.4f", -- Pressure Adjustment, Axis + -- AAU7 + -- Pilot's altimeter + [181] = "%.4f", -- Pressure Adjustment, Axis + -- VHF ARC-134 + [7] = "%1d", -- Frequency MHz / Power. Right mouse click to cycle power. Rotate mouse wheel to change frequency value, Button + [5] = "%.4f", -- Frequency MHz / Power. Right mouse click to cycle power. Rotate mouse wheel to change frequency value, Axis + [8] = "%1d", -- Frequency kHz / Volume. Rotate mouse wheel to change frequency value. Left or Right click to adjust volume, Button + [9] = "%.4f", -- Frequency kHz / Volume. Rotate mouse wheel to change frequency value. Left or Right click to adjust volume, Axis + -- Intercom Control Panel + [29] = "%.4f", -- Intercom volume {0.3,1.0} + [23] = "%1d", -- VHF AM Radio Receiver + [24] = "%1d", -- UHF Radio Receiver + [25] = "%1d", -- VHF FM Radio Receiver + [26] = "%1d", -- Receiver 4 N/F + [27] = "%1d", -- INT Receiver + [28] = "%1d", -- Receiver NAV + [30] = "%.1f", -- Intercom Mode (PVT - hot line; INT - interphone; 1 - VHF FM transmitter; 2 - UHF transmitter; 3 - VHF AM transmitter; 4 - Not used) + [194] = "%.1f", -- Radio/ICS + -- ARC 51BX UHF Raido + [16] = "%.1f", -- Preset Channel Selector + [18] = "%.4f", -- 10 MHz Selector, Axis + [19] = "%.4f", -- 1 MHz Selector, Axis + [20] = "%.4f", -- 50 kHz Selector, Axis + + [15] = "%.1f", -- Frequency Mode Dial + [17] = "%.1f", -- Function Dial + [22] = "%1d", -- Squelch + [21] = "%.4f", -- Volume, Axis + -- VHF ARC 131 + [31] = "%.1f", -- Frequency Tens MHz + [32] = "%.1f", -- Frequency Ones MHz + [33] = "%.1f", -- Frequency Decimals MHz + [34] = "%.1f", -- Frequency Hundredths MHz + [35] = "%.1f", -- Mode OFF/TR/RETRAN(N/F)/HOME(N/F) + [36] = "%.1f", -- quelch Mode + [37] = "%.4f", -- Volume, Axis + -- ARN-82 + [52] = "%1d", -- Frequency MHz / Power. Right mouse click to cycle power. Rotate mouse wheel to change frequency value, Button + [51] = "%.4f", -- Frequency MHz / Power. Right mouse click to cycle power. Rotate mouse wheel to change frequency value, Axis + [53] = "%1d", -- Frequency kHz / Volume. Rotate mouse wheel to change frequency value. Left or Right click to adjust volume, Button + [54] = "%.4f", -- Frequency kHz / Volume. Rotate mouse wheel to change frequency value. Left or Right click to adjust volume, Axis + -- Marker beakon + [57] = "%.4f", -- Marker beacon On/Off/Volume + [55] = "%1d", -- Marker beacon sensing + -- AN/ARN-83 + [42] = "%.1f", -- ADF Loop Antenna speed {0.1,0.3} + [41] = "%1d", -- BFO (N/F) + [43] = "%1d", -- Gain control / Mode. Right mouse click to cycle mode. Rotate mouse wheel to adjust gain, Button + [44] = "%.4f", -- Gain control / Mode. Right mouse click to cycle mode. Rotate mouse wheel to adjust gain, Axis + [38] = "%1d", -- Tune control / Band selection. Right mouse click to select a band. Rotate mouse wheel to adjust tune, Button + [39] = "%.4f", -- Tune control / Band selection. Right mouse click to select a band. Rotate mouse wheel to adjust tune, Axis + -- Nav lights + [222] = "%.1f", -- Navigation lights + [223] = "%1d", -- Position Lights, STEADY/OFF/FLASH + [224] = "%1d", -- Position Lights, DIM/BRIGHT + [225] = "%1d", -- Anti-Collision Lights, ON/OFF + [202] = "%1d", -- Landing Light + [201] = "%1d", -- Search Light + [205] = "%1d", -- Landing Light Ctrl + -- Light System + [230] = "%.4f", -- "Overhead Console Panel Lights Brightness Rheostat, Axis + [231] = "%.4f", -- Pedestal Lights Brightness Rheostat, Axis + [232] = "%.4f", -- Secondary Instrument Lights Brightness Rheostat, Axis + [233] = "%.4f", -- Engine Instrument Lights Brightness Rheostat, Axis + [234] = "%.4f", -- Copilot Instrument Lights Brightness Rheostat, Axis + [235] = "%.4f", -- Pilot Instrument Lights Brightness Rheostat, Axis + [226] = "%1d", -- Dome Light Ctrl + -- HEATING SYSTEM + [236] = "%.1f", -- Bleed Air + -- GCI(ID-998/ASN) + [163] = "%.4f", -- Heading Set Knob, Axis + [161] = "%.4f", -- Compass Synchronizing, Axis + [164] = "%1d", -- ADF/VOR control + [241] = "%1d", -- DG/Slave gyro mode + -- COURSE IND + [155] = "%.4f", -- Course select knob, Axis + -- weapon system + [252] = "%1d", -- Armed/Safe/Off + [253] = "%1d", -- Left/Right/All + [256] = "%1d", -- 7.62/2.75/40 + [257] = "%.1f", -- Rocket Pair + [258] = "%1d", -- Rocket Reset + [259] = "%1d", -- Jettison Cover + [260] = "%1d", -- Jettison + -- sighting station + [281] = "%.4f", -- Sighting Station Intensity + [408] = "%1d", -- Sighting Station Lamp Switch BACKUP/OFF/MAIN + + [0] = "%1d", -- Pilot Sight Armed/Safe ?? + [439] = "%1d", -- Pilot Sight On/Off + [440] = "%.4f", -- Pilot Sighting Station Intensity, Axis + [441] = "%.4f", -- Sight Elevation, Axis + -- Windshield Wipers + [227] = "%1d", -- Pilot/Both/Operator + [229] = "%.1f", -- Wipers Speed + -- Stick + [189] = "%1d", -- Force Trim ON/OFF (Pilot) + [193] = "%1d", -- Force Trim ON/OFF (CoPilot) + -- XM 130 Chaff Flare + [450] = "%1d", -- Ripple Fire Cover + [451] = "%1d", -- Ripple Fire + [456] = "%1d", -- SAFE/ARMED Switcher + [459] = "%1d", -- MAN/PGRM Mode + [464] = "%1d", -- Flare Dispense + [457] = "%1d", -- Armed lamp Test + [453] = "%1d", -- Flare counter Reset. Rotate mouse wheel to set Number, Button + [452] = "%.4f", -- Flare counter Reset. Rotate mouse wheel to set Number, Axis + [455] = "%1d", -- Chaff counter Reset. Rotate mouse wheel to set Number, Button + [454] = "%.4f", -- Chaff counter Reset. Rotate mouse wheel to set Number, Axis + -- Radar Altimeter + [449] = "%1d", -- Radar Altimeter Power + [445] = "%.4f", -- Turn On. Low Set. + [446] = "%1d", -- Test / Hight Set. Left mouse click to Test. Rotate mouse wheel to set Hight, Button + [465] = "%1d", -- Test / Hight Set. Left mouse click to Test. Rotate mouse wheel to set Hight, Axis + -- Doors + [419] = "%1d", -- Open Left Doors + [421] = "%1d" -- Open Right Doors +} + +----------------------------- +-- HIGH IMPORTANCE EXPORTS -- +-- done every export event -- +----------------------------- + +function ProcessGlassCockpitDCSConfigHighImportance(mainPanelDevice) + if gES_GlassCockpitType == 1 then + -- HELIOS Version 1.3 + elseif gES_GlassCockpitType == 2 then + -- HawgTouch Version 1.6 + + -- Pilot Gauges + + -- Airspeed indicator + -- [117] = "%0.4f", -- AIRSPEED_Nose + -- {0.0, 20.0, 30.0, 40.0, 50.0, 60.0, 80.0, 120.0, 150.0} + -- {0.0, 0.075, 0.19, 0.32, 0.395, 0.44, 0.55, 0.825, 1.0} + + -- Attitude Indicators + -- ADI - pilot + -- [142] = "%.4f", -- Attitude_Roll + -- [143] = "%.4f", -- Attitude_Pitch + -- [148] = "%.1f", -- Attitude_Off_flag + SendData("2000", string.format("%0.4f;%0.4f;%0.1f", + mainPanelDevice:get_argument_value(142), + mainPanelDevice:get_argument_value(143), + mainPanelDevice:get_argument_value(148))) + + -- Dual tachometer + -- [122] = "%.4f", -- EngineTach + -- [123] = "%.4f", -- RotorTach + SendData("2001", string.format("%0.4f;%0.4f", + mainPanelDevice:get_argument_value(122), + mainPanelDevice:get_argument_value(123))) + + -- Altimeter Indicator (AAU-31/A) + -- Altimeter Indicator AAU-7/A (pilot) + -- [182] = "%.4f", -- Press_AAU_7A + -- [178] = "%.4f", -- Alt_10000_AAU_7A + -- [179] = "%.4f", -- Alt_1000_AAU_7A + -- [180] = "%.4f", -- Alt_100_AAU_7A + SendData("2002", string.format("%0.4f;%0.4f;%0.4f;%0.4f", + mainPanelDevice:get_argument_value(182), + mainPanelDevice:get_argument_value(178), + mainPanelDevice:get_argument_value(179), + mainPanelDevice:get_argument_value(180))) + + -- Radio Compass Indicator + -- GMC + -- [159] = "%.4f", -- GMC_CoursePointer1 + -- [160] = "%.4f", -- GMC_CoursePointer2 + -- [165] = "%.4f", -- GMC_Heading + -- [162] = "%.4f", -- GMC_HeadingMarker + -- [166] = "%.4f", -- GMC_Annunciator + -- [167] = "%.2f", -- GMC_PowerFail + SendData("2003", string.format("%0.4f;%0.4f;%0.4f;%0.4f;%0.4f;%0.2f", + mainPanelDevice:get_argument_value(159), + mainPanelDevice:get_argument_value(160), + mainPanelDevice:get_argument_value(165), + mainPanelDevice:get_argument_value(162), + mainPanelDevice:get_argument_value(166), + mainPanelDevice:get_argument_value(167))) + + -- Vertical velocity indicator + -- [134] = "%.2f", -- VertVelocPilot + -- {-4000.0, -3000.0, -1500.0, -1000.0, 1000.0, 1500.0, 3000.0, 4000.0} + -- {-1.0, -0.81, -0.54, -0.36, 0.36, 0.54, 0.81, 1.0} + + -- Exhaust gas temperature indicator + -- [121] = "%.4f", -- ExhaustTem + + -- Gas Producer Tachometer Indicator + -- [119] = "%.4f", -- GasProducerTach + -- [120] = "%.4f", -- GasProducerTach_U + SendData("2004", string.format("%0.4f;%0.4f", + mainPanelDevice:get_argument_value(119), + mainPanelDevice:get_argument_value(120))) + + -- Turn and slip indicator + -- [132] = "%.4f", -- TurnPtr + -- [133] = "%.4f", -- SideSlip + SendData("2005", string.format("%0.4f;%0.4f", + mainPanelDevice:get_argument_value(132), + mainPanelDevice:get_argument_value(133))) + + -- Torquemeter Indicator + -- [124] = "%.4f", -- TorquePress + -- {-3.0, 0.0, 100.0} + -- {0.0, 0.029, 1.0} + + -- Mechanic clock + -- [127] = "%.4f", -- CLOCK_hours + -- [128] = "%.4f", -- CLOCK_minutes + -- [129] = "%.4f", -- CLOCK_seconds + SendData("2006", string.format("%0.4f;%0.4f;%0.1f", + mainPanelDevice:get_argument_value(127), + mainPanelDevice:get_argument_value(128), + mainPanelDevice:get_argument_value(129))) + + -- Course deviation indicator + -- Course Indicator ID-1347 + -- [151] = "%.4f", -- VerticalBar + -- {-1.0, 1.0} + -- {-0.7, 0.7} + -- [152] = "%.4f", -- HorisontalBar + -- {-1.0, 1.0} + -- {-0.7, 0.7} + -- [153] = "%.4f", -- ToMarker + -- [154] = "%.4f", -- FromMarker + -- [156] = "%.4f", -- RotCourseCard + -- [157] = "%.1f", -- VerticalOFF + -- [158] = "%.1f", -- HorisontalOFF + SendData("2007", string.format("%0.4f;%0.4f;%0.4f;%0.4f;%0.4f;%0.4f;%0.4f", + mainPanelDevice:get_argument_value(151), + mainPanelDevice:get_argument_value(152), + mainPanelDevice:get_argument_value(153), + mainPanelDevice:get_argument_value(154), + mainPanelDevice:get_argument_value(156), + mainPanelDevice:get_argument_value(157), + mainPanelDevice:get_argument_value(158))) + + -- Standby magnetic compass + -- no ID + -- SendData("2008", string.format("%0.4f;%0.4f;%0.1f", + -- mainPanelDevice:get_argument_value(), + -- mainPanelDevice:get_argument_value(), + -- mainPanelDevice:get_argument_value())) + + -- Radar Altimeter - AN/APN-209 + -- [443] = "%.4f", -- RALT_Needle + -- [467] = "%.2f", -- RALT_Off_Flag + -- [447] = "%.1f", -- RALT_LO_Lamp + -- [465] = "%.1f", -- RALT_HI_Lamp + -- [444] = "%.4f", -- RALT_LO_Index + -- {-0.02, -0.01, -0.0001,0.0, 0.744} + -- {0.97, 0.99, 1.0, 0.0, 0.744} + -- [466] = "%.4f", -- RALT_HI_Index + -- {0.0, 0.744} + -- {0.0, 0.744} + -- [468] = "%0.1f", -- RALT_Digit_1 + -- {0.0, 1.0} 0.0=0, 0.1=1, 0.2=2,..., 0.9=9, 1.0=' ' + -- [469] = "%0.1f", -- RALT_Digit_2 + -- {0.0, 1.0} 0.0=0, 0.1=1, 0.2=2,..., 0.9=9, 1.0=' ' + -- [470] = "%0.1f", -- RALT_Digit_3 + -- {0.0, 1.0} 0.0=0, 0.1=1, 0.2=2,..., 0.9=9, 1.0=' ' + -- [471] = "%0.1f", -- RALT_Digit_4 + -- {0.0, 1.0} 0.0=0, 0.1=1, 0.2=2,..., 0.9=9, 1.0=' ' + SendData("2009", string.format("%0.4f;%0.2f;%0.1f;%0.1f;%.4f;%.4f;%0.1f;%0.1f;%0.1f;%0.1f", + mainPanelDevice:get_argument_value(443), + mainPanelDevice:get_argument_value(467), + mainPanelDevice:get_argument_value(447), + mainPanelDevice:get_argument_value(465), + mainPanelDevice:get_argument_value(444), + mainPanelDevice:get_argument_value(466), + mainPanelDevice:get_argument_value(468), + mainPanelDevice:get_argument_value(469), + mainPanelDevice:get_argument_value(470), + mainPanelDevice:get_argument_value(471))) + + -- CoPilot Gauges + + -- Airspeed indicator + -- [117] = "%0.4f", -- AIRSPEED_Nose + -- {0.0, 20.0, 30.0, 40.0, 50.0, 60.0, 80.0, 120.0, 150.0} + -- {0.0, 0.075, 0.19, 0.32, 0.395, 0.44, 0.55, 0.825, 1.0} + + -- Attitude Indicators + -- ADI - operator + -- [135] = "%.4f", -- Attitude_Roll_left + -- [136] = "%.4f", -- Attitude_Pitch_left + -- [141] = "%.1f", -- Attitude_Off_flag_left + -- [138] = "%.4f", -- Attitude_PitchShift + SendData("2010", string.format("%0.4f;%0.4f;%0.4f;%0.4f", + mainPanelDevice:get_argument_value(135), + mainPanelDevice:get_argument_value(136), + mainPanelDevice:get_argument_value(141), + mainPanelDevice:get_argument_value(138))) + + -- Radio compass indicator + -- GMC + -- [266] = "%.4f", -- GMC_CoursePointer1 + -- [267] = "%.4f", -- GMC_CoursePointer2 + -- [269] = "%.4f", -- GMC_Heading + SendData("2011", string.format("%0.4f;%0.4f;%0.4f", + mainPanelDevice:get_argument_value(266), + mainPanelDevice:get_argument_value(267), + mainPanelDevice:get_argument_value(269))) + + -- Altimeter indicator (AAU-32/A) + -- [168] = "%.4f", -- Pointer + -- [169] = "%.4f", -- Alt1AAU_10000_footCount + -- [170] = "%.4f", -- Alt1AAU_1000_footCount + -- [171] = "%.4f", -- Alt1AAU_100_footCount + -- [174] = "%.2f", -- AAU_32_Drum_Counter + -- [175] = "%.2f", -- AAU_32_Drum_Counter + -- [176] = "%.2f", -- AAU_32_Drum_Counter + -- [177] = "%.1f", -- CodeOff_flag + SendData("2012", string.format("%0.4f;%0.4f;%0.4f;%0.4f;%0.2f;%0.2f;%0.2f;%0.1f", + mainPanelDevice:get_argument_value(168), + mainPanelDevice:get_argument_value(169), + mainPanelDevice:get_argument_value(170), + mainPanelDevice:get_argument_value(171), + mainPanelDevice:get_argument_value(174), + mainPanelDevice:get_argument_value(175), + mainPanelDevice:get_argument_value(176), + mainPanelDevice:get_argument_value(177))) + + -- Whisky Compass + -- [269] = "%.4f", -- RMI_Heading + -- [142] = "%.4f", -- Attitude_Roll + -- [143] = "%.4f", -- Attitude_Pitch + SendData("2013", string.format("%0.4f;%0.4f;%0.4f", + mainPanelDevice:get_argument_value(269), + mainPanelDevice:get_argument_value(142), + mainPanelDevice:get_argument_value(143))) + + -- Vertical velocity indicator + -- [251] = "%.2f", -- VertVelocCopilot + -- {-4000.0, -3000.0, -1500.0, -1000.0, 1000.0, 1500.0, 3000.0, 4000.0} + -- {-1.0, -0.81, -0.54, -0.36, 0.36, 0.54, 0.81, 1.0} + + -- Fuel Pressure Indicator + -- [126] = "%.4f", -- FuelPress + -- {-2.0, 0.0, 50.0} + -- {0.0, 0.015, 1.0} + + -- Transmission oil pressure + -- [115] = "%.4f", -- TransmOilPress + -- {-3.0, 0.0, 100.0} + -- {0.0, 0.029, 1.0} + + -- DC Loadmeters (Main) + -- [436] = "%.4f", -- LoadmeterMainGen + -- {-1.5, 0.0, 12.5} + -- {0.0, 0.156, 1.0} + + -- DC Loadmeters (Standby) + -- [125] = "%.4f", -- LoadmeterSTBYGen + -- {-1.5, 0.0, 12.5} + -- {0.0, 0.09, 1.0} + + -- Engine oil pressure indicator + -- [113] = "%.4f", -- EngOilPress + -- {-3.0, 0.0, 100.0} + -- {0.0, 0.029, 1.0} + + -- AC voltmeter + -- [150] = "%.4f", -- VoltageAC + + -- DC voltmeter + -- [149] = "%.4f", -- VoltageDC + + -- Transmission oil temperature indicator + -- [116] = "%.4f", -- TransmOilTemp + -- {-70.0, -50.0, 0.0, 100.0, 150.0} + -- {0.0, 0.13, 0.38, 0.71, 1.0} + + -- Engine oil temperature + -- [114] = "%.4f", -- EngOilTemp + -- {-70.0, -50.0, 0.0, 100.0, 150.0} + -- {0.0, 0.13, 0.38, 0.71, 1.0} + + -- Fuel Quantity Indicator + -- [239] = "%.4f", -- FuelQuantity + + end +end + +function ProcessHARDWAREConfigHighImportance(mainPanelDevice) + --[[ + every frame export to hardware + Example from A-10C + Get Radio Frequencies + get data from device + local UHF_RADIO = GetDevice(54) + SendDataHW("ExportID", "Format") + SendDataHW("ExportID", "Format", HardwareConfigID) + SendDataHW("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000)) + SendDataHW("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000), 2) -- export to Hardware '2' Config + ]] + + -- no dimming lights + -- Light + SendDataHW("279", mainPanelDevice:get_argument_value(279) > 0.3 and 1 or 0) -- light_ConsoleLight + SendDataHW("410", mainPanelDevice:get_argument_value(410) > 0.3 and 1 or 0) -- light_DomeLight + SendDataHW("411", mainPanelDevice:get_argument_value(411) > 0.3 and 1 or 0) -- light_DomeLightGreen + -- Radar Altimeter + SendDataHW("447", mainPanelDevice:get_argument_value(447) > 0.3 and 1 or 0) -- RALT_LO_Lamp + SendDataHW("465", mainPanelDevice:get_argument_value(465) > 0.3 and 1 or 0) -- RALT_HI_Lamp + -- Main Panel Lights + SendDataHW("277", mainPanelDevice:get_argument_value(277) > 0.3 and 1 or 0) -- lamp_MASTER + SendDataHW("276", mainPanelDevice:get_argument_value(276) > 0.3 and 1 or 0) -- lamp_LOW_RPM + SendDataHW("275", mainPanelDevice:get_argument_value(275) > 0.3 and 1 or 0) -- lamp_FIRE + -- Caution Panel Lights + SendDataHW("91", mainPanelDevice:get_argument_value(91) > 0.3 and 1 or 0) -- lamp_ENGINE_OIL_PRESS + SendDataHW("92", mainPanelDevice:get_argument_value(92) > 0.3 and 1 or 0) -- lamp_ENGINE_ICING + SendDataHW("93", mainPanelDevice:get_argument_value(93) > 0.3 and 1 or 0) -- lamp_ENGINE_ICE_JET + SendDataHW("94", mainPanelDevice:get_argument_value(94) > 0.3 and 1 or 0) -- lamp_ENGINE_CHIP_DET + SendDataHW("95", mainPanelDevice:get_argument_value(95) > 0.3 and 1 or 0) -- lamp_LEFT_FUEL_BOOST + SendDataHW("96", mainPanelDevice:get_argument_value(96) > 0.3 and 1 or 0) -- lamp_RIGHT_FUEL_BOOST + SendDataHW("97", mainPanelDevice:get_argument_value(97) > 0.3 and 1 or 0) -- lamp_ENG_FUEL_PUMP + SendDataHW("98", mainPanelDevice:get_argument_value(98) > 0.3 and 1 or 0) -- lamp_20_MINUTE + SendDataHW("99", mainPanelDevice:get_argument_value(99) > 0.3 and 1 or 0) -- lamp_FUEL_FILTER + SendDataHW("100", mainPanelDevice:get_argument_value(100) > 0.3 and 1 or 0) -- lamp_GOV_EMERG + SendDataHW("101", mainPanelDevice:get_argument_value(101) > 0.3 and 1 or 0) -- lamp_AUX_FUEL_LOW + SendDataHW("102", mainPanelDevice:get_argument_value(102) > 0.3 and 1 or 0) -- lamp_XMSN_OIL_PRESS + SendDataHW("103", mainPanelDevice:get_argument_value(103) > 0.3 and 1 or 0) -- lamp_XMSN_OIL_HOT + SendDataHW("104", mainPanelDevice:get_argument_value(104) > 0.3 and 1 or 0) -- lamp_HYD_PRESSURE + SendDataHW("105", mainPanelDevice:get_argument_value(105) > 0.3 and 1 or 0) -- lamp_ENGINE_INLET_AIR + SendDataHW("106", mainPanelDevice:get_argument_value(106) > 0.3 and 1 or 0) -- lamp_INST_INVERTER + SendDataHW("107", mainPanelDevice:get_argument_value(107) > 0.3 and 1 or 0) -- lamp_DC_GENERATOR + SendDataHW("108", mainPanelDevice:get_argument_value(108) > 0.3 and 1 or 0) -- lamp_EXTERNAL_POWER + SendDataHW("109", mainPanelDevice:get_argument_value(109) > 0.3 and 1 or 0) -- lamp_CHIP_DETECTOR + SendDataHW("110", mainPanelDevice:get_argument_value(110) > 0.3 and 1 or 0) -- lamp_IFF + -- M21 + SendDataHW("254", mainPanelDevice:get_argument_value(254) > 0.3 and 1 or 0) -- lamp_M21_ARMED + SendDataHW("255", mainPanelDevice:get_argument_value(255) > 0.3 and 1 or 0) -- lamp_M21_SAFE + -- IFF + SendDataHW("76", mainPanelDevice:get_argument_value(76) > 0.3 and 1 or 0) -- lamp_IFF_REPLY + SendDataHW("77", mainPanelDevice:get_argument_value(77) > 0.3 and 1 or 0) -- lamp_IFF_TEST + -- Beacon + SendDataHW("56", mainPanelDevice:get_argument_value(56) > 0.3 and 1 or 0) -- lamp_Marker_Beacon + -- XM130 Chaff Flare + SendDataHW("458", mainPanelDevice:get_argument_value(458) > 0.3 and 1 or 0) -- lamp_XM130_ARMED + + --[[ + -- dimming lights + -- Light + SendDataHW("279", string.format("%.1f", mainPanelDevice:get_argument_value(279))) -- light_ConsoleLight + SendDataHW("410", string.format("%.1f", mainPanelDevice:get_argument_value(410))) -- light_DomeLight + SendDataHW("411", string.format("%.1f", mainPanelDevice:get_argument_value(411))) -- light_DomeLightGreen + -- Radar Altimeter + SendDataHW("447", string.format("%.1f", mainPanelDevice:get_argument_value(447))) -- RALT_LO_Lamp + SendDataHW("465", string.format("%.1f", mainPanelDevice:get_argument_value(465))) -- RALT_HI_Lamp + -- Main Panel Lights + SendDataHW("277", string.format("%.1f", mainPanelDevice:get_argument_value(277))) -- lamp_MASTER + SendDataHW("276", string.format("%.1f", mainPanelDevice:get_argument_value(276))) -- lamp_LOW_RPM + SendDataHW("275", string.format("%.1f", mainPanelDevice:get_argument_value(275))) -- lamp_FIRE + -- Caution Panel Lights + SendDataHW("91", string.format("%.1f", mainPanelDevice:get_argument_value(91))) -- lamp_ENGINE_OIL_PRESS + SendDataHW("92", string.format("%.1f", mainPanelDevice:get_argument_value(92))) -- lamp_ENGINE_ICING + SendDataHW("93", string.format("%.1f", mainPanelDevice:get_argument_value(93))) -- lamp_ENGINE_ICE_JET + SendDataHW("94", string.format("%.1f", mainPanelDevice:get_argument_value(94))) -- lamp_ENGINE_CHIP_DET + SendDataHW("95", string.format("%.1f", mainPanelDevice:get_argument_value(95))) -- lamp_LEFT_FUEL_BOOST + SendDataHW("96", string.format("%.1f", mainPanelDevice:get_argument_value(96))) -- lamp_RIGHT_FUEL_BOOST + SendDataHW("97", string.format("%.1f", mainPanelDevice:get_argument_value(97))) -- lamp_ENG_FUEL_PUMP + SendDataHW("98", string.format("%.1f", mainPanelDevice:get_argument_value(98))) -- lamp_20_MINUTE + SendDataHW("99", string.format("%.1f", mainPanelDevice:get_argument_value(99))) -- lamp_FUEL_FILTER + SendDataHW("100", string.format("%.1f", mainPanelDevice:get_argument_value(100))) -- lamp_GOV_EMERG + SendDataHW("101", string.format("%.1f", mainPanelDevice:get_argument_value(101))) -- lamp_AUX_FUEL_LOW + SendDataHW("102", string.format("%.1f", mainPanelDevice:get_argument_value(102))) -- lamp_XMSN_OIL_PRESS + SendDataHW("103", string.format("%.1f", mainPanelDevice:get_argument_value(103))) -- lamp_XMSN_OIL_HOT + SendDataHW("104", string.format("%.1f", mainPanelDevice:get_argument_value(104))) -- lamp_HYD_PRESSURE + SendDataHW("105", string.format("%.1f", mainPanelDevice:get_argument_value(105))) -- lamp_ENGINE_INLET_AIR + SendDataHW("106", string.format("%.1f", mainPanelDevice:get_argument_value(106))) -- lamp_INST_INVERTER + SendDataHW("107", string.format("%.1f", mainPanelDevice:get_argument_value(107))) -- lamp_DC_GENERATOR + SendDataHW("108", string.format("%.1f", mainPanelDevice:get_argument_value(108))) -- lamp_EXTERNAL_POWER + SendDataHW("109", string.format("%.1f", mainPanelDevice:get_argument_value(109))) -- lamp_CHIP_DETECTOR + SendDataHW("110", string.format("%.1f", mainPanelDevice:get_argument_value(110))) -- lamp_IFF + -- M21 + SendDataHW("254", string.format("%.1f", mainPanelDevice:get_argument_value(254))) -- lamp_M21_ARMED + SendDataHW("255", string.format("%.1f", mainPanelDevice:get_argument_value(255))) -- lamp_M21_SAFE + -- + SendDataHW("76", string.format("%.1f", mainPanelDevice:get_argument_value(76))) -- lamp_IFF_REPLY + SendDataHW("77", string.format("%.1f", mainPanelDevice:get_argument_value(77))) -- lamp_IFF_TEST + -- + SendDataHW("56", string.format("%.1f", mainPanelDevice:get_argument_value(56))) -- Marker_Beacon_Lamp + -- XM130 Chaff Flare + SendDataHW("458", string.format("%.1f", mainPanelDevice:get_argument_value(458))) -- XM130_ARMED_LAMP + ]] +end + +----------------------------------------------------- +-- LOW IMPORTANCE EXPORTS -- +-- done every gExportLowTickInterval export events -- +----------------------------------------------------- + +function ProcessGlassCockpitDCSConfigLowImportance(mainPanelDevice) + --[[ + export in low tick interval to GlassCockpit + Example from A-10C + Get Radio Frequencies + get data from device + local lUHFRadio = GetDevice(54) + SendData("ExportID", "Format") + SendData(2000, string.format("%7.3f", lUHFRadio:get_frequency()/1000000)) <- special function for get frequency data + ]] +end + +function ProcessHARDWAREConfigLowImportance(mainPanelDevice) +--[[ + export in low tick interval to hardware + Example from A-10C + Landing Gear + mainPanelDevice, basis panel + SendDataHW("2004", mainPanelDevice:get_argument_value(659)) -- GEAR_N_SAFE + SendDataHW("2005", mainPanelDevice:get_argument_value(660)) -- GEAR_L_SAFE + SendDataHW("2006", mainPanelDevice:get_argument_value(661)) -- GEAR_R_SAFE + ]] + + -- Radio comunication + -- UHF_ARC_51 + local lUHF_ARC_51 = GetDevice(22) + SendDataHW("2000", string.format("%7.3f", lUHF_ARC_51:get_frequency()/1000000)) + + local lUHF_ARC_51_PRESET = {[0.00]="1",[0.05]="2",[0.10]="3",[0.15]="4",[0.20]="5",[0.25]="6",[0.30]="7",[0.35]="8",[0.40]="9",[0.45]="10",[0.50]="11",[0.55]="12",[0.60]="13",[0.65]="14",[0.70]="15",[0.75]="16",[0.80]="17",[0.85]="18",[0.90]="19",[0.95]="20"} + SendDataHW("2001", lUHF_ARC_51_PRESET[math.round(mainPanelDevice:get_argument_value(16), 2)]) + + -- VHF_ARC_131 + local lVHF_ARC_131 = GetDevice(23) + SendDataHW("2002", string.format("%7.3f", lVHF_ARC_131:get_frequency()/1000000)) + + -- VHF_ARC_134 + local lVHF_ARC_134 = GetDevice(20) + SendDataHW("2003", string.format("%7.3f", lVHF_ARC_134:get_frequency()/1000000)) + + -- ARN_82 VHF Navigation Set NOT FUNCTIONAL + --local lARN_82 = GetDevice(26) + --WriteToLog('lARN_82: '..dump(lARN_82)) + --WriteToLog('lARN_82 (metatable): '..dump(getmetatable(lARN_82))) + --SendDataHW("2004", string.format("%7.3f", lVHF_ARC_134:get_frequency()/1000000)) + + -- XM130 FLARE CHAFF + SendDataHW("2005", string.format("%1d", math.round(mainPanelDevice:get_argument_value(460) * 10, 0)..math.round(mainPanelDevice:get_argument_value(461) * 10, 0))) -- FLARE_Digit_1 -- FLARE_Digit_2 + SendDataHW("2006", string.format("%1d", math.round(mainPanelDevice:get_argument_value(462) * 10, 0)..math.round(mainPanelDevice:get_argument_value(463) * 10, 0))) -- CHAFF_Digit_1 -- CHAFF_Digit_2 + + -- ADF_ARN83 + local lpos1, pos2, lpos3, pos4 + local lADF_ARN83 = "" + local lCockpitParams = list_cockpit_params() + if lCockpitParams ~= nil then + lpos1, pos2 = lCockpitParams:find("ADF_FREQ:", 1) + if pos2 ~= nil then + lpos3, pos4 = lCockpitParams:find("%c", pos2) + if lpos3 ~= nil then + lADF_ARN83 = lCockpitParams:sub(pos2 + 1, lpos3 - 2) + else + lADF_ARN83 = lCockpitParams:sub(pos2 + 1) + end + lADF_ARN83 = math.round(tonumber(lADF_ARN83) / 1000, 2) + end + end + + SendDataHW("2007", string.format("%s", lADF_ARN83)) + + -- generic Radio display and frequency rotarys + ------------------------------------------------- + genericRadio(nil, nil, gES_genericRadioHardwareID) + + --[[ + -- ENGINE_INTERFACE + local lENGINE_INTERFACE = GetDevice(3) + WriteToLog('lENGINE_INTERFACE:get_eng_rpm '..dump(lENGINE_INTERFACE:get_eng_rpm())) + WriteToLog('lENGINE_INTERFACE:get_fire_lamp '..dump(lENGINE_INTERFACE:get_fire_lamp())) + WriteToLog('lENGINE_INTERFACE:get_gas_prod_tach '..dump(lENGINE_INTERFACE:get_gas_prod_tach())) + WriteToLog('lENGINE_INTERFACE:get_fire_test_lamp '..dump(lENGINE_INTERFACE:get_fire_test_lamp())) + WriteToLog('lENGINE_INTERFACE:get_trans_oil_temp '..dump(lENGINE_INTERFACE:get_trans_oil_temp())) + WriteToLog('lENGINE_INTERFACE:get_eng_torq '..dump(lENGINE_INTERFACE:get_eng_torq())) + WriteToLog('lENGINE_INTERFACE:get_trans_oil_press '..dump(lENGINE_INTERFACE:get_trans_oil_press())) + WriteToLog('lENGINE_INTERFACE:get_exhaust_temp '..dump(lENGINE_INTERFACE:get_exhaust_temp())) + WriteToLog('lENGINE_INTERFACE:get_low_rpm_lamp '..dump(lENGINE_INTERFACE:get_low_rpm_lamp())) + WriteToLog('lENGINE_INTERFACE:get_eng_oil_temp '..dump(lENGINE_INTERFACE:get_eng_oil_temp())) + WriteToLog('lENGINE_INTERFACE:get_eng_oil_press '..dump(lENGINE_INTERFACE:get_eng_oil_press())) + + -- ADI_PILOT + local lADI_PILOT = GetDevice(6) + WriteToLog('lADI_PILOT:get_sideslip '..dump(lADI_PILOT:get_sideslip())) + WriteToLog('lADI_PILOT:get_bank '..dump(lADI_PILOT:get_bank())) + WriteToLog('lADI_PILOT:get_pitch '..dump(lADI_PILOT:get_pitch())) + + -- RADAR_ALTIMETER + local lRADAR_ALTIMETER = GetDevice(13) + WriteToLog('lRADAR_ALTIMETER:get_distance_limit '..dump(lRADAR_ALTIMETER:get_distance_limit())) + WriteToLog('lRADAR_ALTIMETER:get_aperture_size '..dump(lRADAR_ALTIMETER:get_aperture_size())) + WriteToLog('lRADAR_ALTIMETER:get_mode '..dump(lRADAR_ALTIMETER:get_mode())) + WriteToLog('lRADAR_ALTIMETER:get_altitude '..dump(lRADAR_ALTIMETER:get_altitude())) + ]] + --[[ + -- VHF_ARC_134 + local lVHF_ARC_134 = GetDevice(20) + WriteToLog('lVHF_ARC_134:is_on '..dump(lVHF_ARC_134:is_on())) + WriteToLog('lVHF_ARC_134:get_frequency '..dump(lVHF_ARC_134:get_frequency())) + --WriteToLog('lVHF_ARC_134:set_frequency '..dump(lVHF_ARC_134:set_frequency())) -- test parameters + --WriteToLog('lVHF_ARC_134:set_modulation '..dump(lVHF_ARC_134:set_modulation())) -- test parameters + --WriteToLog('lVHF_ARC_134:set_channel '..dump(lVHF_ARC_134:set_channel())) -- test parameters + + -- INTERCOM + local lINTERCOM = GetDevice(21) + WriteToLog('lINTERCOM:is_communicator_available '..dump(lINTERCOM:is_communicator_available())) + WriteToLog('lINTERCOM:get_noise_level '..dump(lINTERCOM:get_noise_level())) + WriteToLog('lINTERCOM:get_signal_level '..dump(lINTERCOM:get_signal_level())) + --WriteToLog('lINTERCOM:set_communicator '..dump(lINTERCOM:set_communicator())) -- test parameters + --WriteToLog('lINTERCOM:set_voip_mode '..dump(lINTERCOM:set_voip_mode())) -- test parameters + + -- UHF_ARC_51 + local lUHF_ARC_51 = GetDevice(22) + WriteToLog('lUHF_ARC_51:is_on '..dump(lUHF_ARC_51:is_on())) + WriteToLog('lUHF_ARC_51:get_frequency '..dump(lUHF_ARC_51:get_frequency())) + --WriteToLog('lUHF_ARC_51:set_frequency '..dump(lUHF_ARC_51:set_frequency())) -- test parameters + --WriteToLog('lUHF_ARC_51:set_modulation '..dump(lUHF_ARC_51:set_modulation())) -- test parameters + --WriteToLog('lUHF_ARC_51:set_channel '..dump(lUHF_ARC_51:set_channel())) -- test parameters + + -- VHF_ARC_131 + local lVHF_ARC_131 = GetDevice(23) + WriteToLog('lVHF_ARC_131:is_on '..dump(lVHF_ARC_131:is_on())) + WriteToLog('lVHF_ARC_131:get_frequency '..dump(lVHF_ARC_131:get_frequency())) + --WriteToLog('lVHF_ARC_131:set_frequency '..dump(lVHF_ARC_131:set_frequency())) -- test parameters + --WriteToLog('lVHF_ARC_131:set_modulation '..dump(lVHF_ARC_131:set_modulation())) -- test parameters + --WriteToLog('lVHF_ARC_131:set_channel '..dump(lVHF_ARC_131:set_channel())) -- test parameters + + WriteToLog('Frequency Mode Dial '..dump(mainPanelDevice:get_argument_value(15))) + WriteToLog('Function Dial '..dump(mainPanelDevice:get_argument_value(17))) + ]] + --[[ + Device test, Device 2 to 32 + is value "userdata", is only DLL intern functions + local ltmp1 = 0 + for ltmp2 = 1, 49, 1 do + ltmp1 = GetDevice(ltmp2) + WriteToLog(ltmp2..': '..dump(ltmp1)) + WriteToLog(ltmp2..' (metatable): '..dump(getmetatable(ltmp1))) + end + ]] + --[[ + WriteToLog('list_cockpit_params(): '..dump(list_cockpit_params())) + + local ltmp1 = 0 + for ltmp2 = 1, 8, 1 do + ltmp1 = list_indication(ltmp2) + WriteToLog(ltmp2..': '..dump(ltmp1)) + --WriteToLog(ltmp2..' (metatable): '..dump(getmetatable(ltmp1))) + end + ]] +end + +----------------------------- +-- Custom functions -- +----------------------------- + +function genericRadio(key, value, hardware) + local lHardware = hardware or 1 + -- Werte werden per Encoder im Bereich von 0.0 bis 2.0 in 0.1 Schritten uebergeben + -- im jeweiligen Abschnitt muessen die Eingangsdaten auf den Zulaessigen Bereich eingeschraengt werden + local lRotaryFrequency_1, lRotaryFrequency_2, lVolume, lPreset, lLoad, lSquelch, lManualPreset, lPower, lDevice, lClickAction, lSetFrequency = nil + local lMainPanelDevice = GetDevice(0) + local lMaxRadios = 3 + + if gES_genericRadio == nil then + gES_genericRadio = 0 + end + if gES_genericRadioFrequency1 == nil then + gES_genericRadioFrequency1 = 0.0 + end + if gES_genericRadioFrequency2 == nil then + gES_genericRadioFrequency2 = 0.0 + end + if gES_genericRadioPresetChannel == nil then + gES_genericRadioPresetChannel = 0.0 + end + if gES_genericRadioPower == nil then + gES_genericRadioPower = {} + end + if gES_genericRadioPresetManual == nil then + gES_genericRadioPresetManual = {} + end + if gES_genericRadioSquelch == nil then + gES_genericRadioSquelch = {} + end + + if key == "3001" then + gES_genericRadio = tonumber(value) + end + if key == "3002" then + lRotaryFrequency_1 = tonumber(value) + end + if key == "3003" then + lRotaryFrequency_2 = tonumber(value) + end + if key == "3004" then + lVolume = tonumber(value) + end + if key == "3005" then + lPreset = tonumber(value) + end + if key == "3006" then + lLoad = tonumber(value) + end + if key == "3007" then + lSquelch = tonumber(value) + end + if key == "3008" then + lManualPreset = tonumber(value) + end + if key == "3009" then + lPower = tonumber(value) + end + + if gES_genericRadio > lMaxRadios then + WriteToLog("Radio Nr. "..gES_genericRadio.." not defined.") + return + end + + if gES_genericRadio == 1 then + -- AN/ARC-131 VHF FM Radio + local lDeviceID = 23 + local lVHF_FM_RADIO = GetDevice(lDeviceID) + + -- check status of the radio + if gES_genericRadioPower[gES_genericRadio] == nil then + if lVHF_FM_RADIO:is_on() then + gES_genericRadioPower[gES_genericRadio] = 1.0 + else + gES_genericRadioPower[gES_genericRadio] = 0.0 + end + end + if gES_genericRadioPresetManual[gES_genericRadio] == nil then + gES_genericRadioPresetManual[gES_genericRadio] = 0 -- no preset channels + end + if gES_genericRadioSquelch[gES_genericRadio] == nil then + gES_genericRadioSquelch[gES_genericRadio] = ((math.round(lMainPanelDevice:get_argument_value(36), 1) == 0.1) and 0 or 1) + end + + local lVHF_FM_RADIO_FREQUENCY = math.round(lVHF_FM_RADIO:get_frequency()/1000000 , 3, "floor") + + SendDataHW("3000", string.format("%.3f", lVHF_FM_RADIO_FREQUENCY), lHardware) + SendDataHW("3001", string.format("-"), lHardware) + SendDataHW("3002", string.format("%.3f", lVHF_FM_RADIO_FREQUENCY), lHardware) + + if lRotaryFrequency_1 ~= nil and (lRotaryFrequency_1 >= 0.0 and lRotaryFrequency_1 <= 2.0) then + + local lFrequency = StrSplit(lVHF_FM_RADIO_FREQUENCY, "%.") + + if type(lFrequency) == "table" and lFrequency[1] ~= nil then + lFrequency[1] = tonumber(lFrequency[1]) + if lFrequency[2] == nil then + lFrequency[2] = 0 + else + lFrequency[2] = tonumber(lFrequency[2]) + local ltmp = string.format("%.0f", lFrequency[2] / 25) + lFrequency[2] = ltmp * 25 + end + if lRotaryFrequency_1 < gES_genericRadioFrequency1 or lRotaryFrequency_1 == 0.0 or lRotaryFrequency_1 == 2.0 then + lFrequency[1] = lFrequency[1] - 1 + if lFrequency[1] == 99 then + lFrequency[1] = 399 + end + gES_genericRadioFrequency1 = lRotaryFrequency_1 + else + lFrequency[1] = lFrequency[1] + 1 + if lFrequency[1] == 400 then + lFrequency[1] = 100 + end + gES_genericRadioFrequency1 = lRotaryFrequency_1 + end + + lFrequency[2] = string.format("%.3f", lFrequency[2] / 1000) + local ltempFrequency = string.format("%.3f", lFrequency[1] + lFrequency[2]) + ltempFrequency = tonumber(ltempFrequency) + lSetFrequency = {DeviceID = lDeviceID, + Frequency = ltempFrequency * 1000000} + + else + WriteToLog("1. genericUH-1H AN/ARC-131 VHF FM Radio, don't split frequency: "..lFrequency) + end + end + + if lRotaryFrequency_2 ~= nil and (lRotaryFrequency_2 >= 0.0 and lRotaryFrequency_2 <= 2.0) then + + local lFrequency = StrSplit(lVHF_FM_RADIO_FREQUENCY, "%.") + + if type(lFrequency) == "table" and lFrequency[1] ~= nil then + lFrequency[1] = tonumber(lFrequency[1]) + if lFrequency[2] == nil then + lFrequency[2] = 0 + else + lFrequency[2] = tonumber(lFrequency[2]) + local ltmp = string.format("%.0f", lFrequency[2] / 25) + lFrequency[2] = ltmp * 25 + end + if lRotaryFrequency_2 < gES_genericRadioFrequency2 or lRotaryFrequency_2 == 0.0 or lRotaryFrequency_2 == 2.0 then + lFrequency[2] = lFrequency[2] - 25 + if lFrequency[2] == -25 then + lFrequency[2] = 975 + end + gES_genericRadioFrequency2 = lRotaryFrequency_2 + else + lFrequency[2] = lFrequency[2] + 25 + if lFrequency[2] == 1000 then + lFrequency[2] = 0 + end + gES_genericRadioFrequency2 = lRotaryFrequency_2 + end + + lFrequency[2] = string.format("%.3f", lFrequency[2] / 1000) + local ltempFrequency = string.format("%.3f", lFrequency[1] + lFrequency[2]) + ltempFrequency = tonumber(ltempFrequency) + lSetFrequency = {DeviceID = lDeviceID, + Frequency = ltempFrequency * 1000000} + + else + WriteToLog("2. generic UH-1H AN/ARC-131 VHF FM Radio, don't split frequency: "..lFrequency) + end + end + + if lVolume ~= nil and (lVolume >= 0.0 and lVolume <= 2.0) then + lVolume = lVolume / 2 + lClickAction = {DeviceID = lDeviceID, + ButtonID = 3006, + Value = lVolume} + end +--[[ + if lPreset ~= nil and (lPreset >= 0.0 and lPreset <= 2.0) then + -- Preset 0.0 to 0.20 in 0.01 steps + if lPreset < gES_genericRadioPresetChannel or lPreset == 0.0 or lPreset == 2.0 then + lClickAction = {DeviceID = lDeviceID, + ButtonID = 3001, + Value = 0.01} + gES_genericRadioPresetChannel = lPreset + else + lClickAction = {DeviceID = lDeviceID, + ButtonID = 3002, + Value = -0.01} + gES_genericRadioPresetChannel = lPreset + end + end + if lLoad ~= nil and (lLoad == 0.0 or lLoad <= 1.0) then + lClickAction = {DeviceID = lDeviceID, + ButtonID = 3006, + Value = lLoad} + end + if lManualPreset ~= nil and (lManualPreset == 0.0 or lManualPreset <= 1.0) then + if lManualPreset == 1.0 and gES_genericRadioPresetManual[gES_genericRadio] == 1.0 then + -- Manual on + lManualPreset = 0.1 + gES_genericRadioPresetManual[gES_genericRadio] = 0 + elseif lManualPreset == 1.0 and gES_genericRadioPresetManual[gES_genericRadio] == 0 then + -- Preset on + lManualPreset = 0.0 + gES_genericRadioPresetManual[gES_genericRadio] = 1.0 + end + lClickAction = {DeviceID = lDeviceID, + ButtonID = 3005, + Value = lManualPreset} + end +]] + if lSquelch ~= nil and (lSquelch == 0.0 or lSquelch <= 1.0) then + if lSquelch == 1.0 and gES_genericRadioSquelch[gES_genericRadio] == 1.0 then + -- Squelch off + lSquelch = 0.0 + gES_genericRadioSquelch[gES_genericRadio] = 0 + elseif lSquelch == 1.0 and gES_genericRadioSquelch[gES_genericRadio] == 0 then + -- Squelch on + lSquelch = 0.1 + gES_genericRadioSquelch[gES_genericRadio] = 1.0 + end + lClickAction = {DeviceID = lDeviceID, + ButtonID = 3005, + Value = lSquelch} + end + if lPower ~= nil and (lPower == 0.0 or lPower <= 1.0) then + if lPower == 1.0 and gES_genericRadioPower[gES_genericRadio] == 1.0 then + -- Power off + lPower = 0.0 + gES_genericRadioPower[gES_genericRadio] = 0 + elseif lPower == 1.0 and gES_genericRadioPower[gES_genericRadio] == 0 then + -- Power on + lPower = 0.1 + gES_genericRadioPower[gES_genericRadio] = 1.0 + end + lClickAction = {DeviceID = lDeviceID, + ButtonID = 3007, + Value = lPower} + end + + elseif gES_genericRadio == 2 then + -- AN/ARC-51BX UHF AM Radio + local lDeviceID = 22 + local lUHF_AM_RADIO = GetDevice(lDeviceID) + + -- check status of the radio + if gES_genericRadioPower[gES_genericRadio] == nil then + if lUHF_AM_RADIO:is_on() then + gES_genericRadioPower[gES_genericRadio] = 1.0 + else + gES_genericRadioPower[gES_genericRadio] = 0.0 + end + end + if gES_genericRadioPresetManual[gES_genericRadio] == nil then + gES_genericRadioPresetManual[gES_genericRadio] = ((math.round(lMainPanelDevice:get_argument_value(15), 1) == 0.1) and 0 or 1) + end + if gES_genericRadioSquelch[gES_genericRadio] == nil then + gES_genericRadioSquelch[gES_genericRadio] = math.round(lMainPanelDevice:get_argument_value(22), 1) + end + + local lPresetChannel = math.round(lMainPanelDevice:get_argument_value(16), 2) + + local lUHF_AM_RADIO_PRESET = {[0.0]="01",[0.05]="02",[0.10]="03",[0.15]="04",[0.20]="05",[0.25]="06",[0.30]="07",[0.35]="08",[0.40]="09",[0.45]="10",[0.50]="11",[0.55]="12",[0.60]="13",[0.65]="14",[0.70]="15",[0.75]="16",[0.80]="17",[0.85]="18",[0.90]="19",[0.95]="20"} + local lUHF_AM_RADIO_FREQUENCY = math.round(lUHF_AM_RADIO:get_frequency()/1000000 , 3, "floor") + + SendDataHW("3000", string.format("%s%.3f", lUHF_AM_RADIO_PRESET[lPresetChannel], lUHF_AM_RADIO_FREQUENCY), lHardware) + SendDataHW("3001", string.format("%s", lUHF_AM_RADIO_PRESET[lPresetChannel]), lHardware) + SendDataHW("3002", string.format("%.3f", lUHF_AM_RADIO_FREQUENCY), lHardware) + + if lRotaryFrequency_1 ~= nil and (lRotaryFrequency_1 >= 0.0 and lRotaryFrequency_1 <= 2.0) then + + local lFrequency = StrSplit(lUHF_AM_RADIO_FREQUENCY, "%.") + + if type(lFrequency) == "table" and lFrequency[1] ~= nil then + lFrequency[1] = tonumber(lFrequency[1]) + if lFrequency[2] == nil then + lFrequency[2] = 0 + else + lFrequency[2] = tonumber(lFrequency[2]) + local ltmp = string.format("%.0f", lFrequency[2] / 50) + lFrequency[2] = ltmp * 50 + end + if lRotaryFrequency_1 < gES_genericRadioFrequency1 or lRotaryFrequency_1 == 0.0 or lRotaryFrequency_1 == 2.0 then + lFrequency[1] = lFrequency[1] - 1 + if lFrequency[1] == 224 then + lFrequency[1] = 399 + end + gES_genericRadioFrequency1 = lRotaryFrequency_1 + else + lFrequency[1] = lFrequency[1] + 1 + if lFrequency[1] == 400 then + lFrequency[1] = 225 + end + gES_genericRadioFrequency1 = lRotaryFrequency_1 + end + + lFrequency[2] = string.format("%.3f", lFrequency[2] / 1000) + local ltempFrequency = string.format("%.3f", lFrequency[1] + lFrequency[2]) + ltempFrequency = tonumber(ltempFrequency) + lSetFrequency = {DeviceID = lDeviceID, + Frequency = ltempFrequency * 1000000} + + else + WriteToLog("1. generic UH-1H AN/ARC-51BX UHF AM Radio, don't split frequency: "..lFrequency) + end + end + + if lRotaryFrequency_2 ~= nil and (lRotaryFrequency_2 >= 0.0 and lRotaryFrequency_2 <= 2.0) then + + local lFrequency = StrSplit(lUHF_AM_RADIO_FREQUENCY, "%.") + + if type(lFrequency) == "table" and lFrequency[1] ~= nil then + lFrequency[1] = tonumber(lFrequency[1]) + if lFrequency[2] == nil then + lFrequency[2] = 0 + else + lFrequency[2] = tonumber(lFrequency[2]) + local ltmp = string.format("%.0f", lFrequency[2] / 50) + lFrequency[2] = ltmp * 50 + end + if lRotaryFrequency_2 < gES_genericRadioFrequency2 or lRotaryFrequency_2 == 0.0 or lRotaryFrequency_2 == 2.0 then + lFrequency[2] = lFrequency[2] - 50 + if lFrequency[2] == -50 then + lFrequency[2] = 950 + end + gES_genericRadioFrequency2 = lRotaryFrequency_2 + else + lFrequency[2] = lFrequency[2] + 50 + if lFrequency[2] == 1000 then + lFrequency[2] = 0 + end + gES_genericRadioFrequency2 = lRotaryFrequency_2 + end + + lFrequency[2] = string.format("%.3f", lFrequency[2] / 1000) + local ltempFrequency = string.format("%.3f", lFrequency[1] + lFrequency[2]) + ltempFrequency = tonumber(ltempFrequency) + lSetFrequency = {DeviceID = lDeviceID, + Frequency = ltempFrequency * 1000000} + + else + WriteToLog("2. generic UH-1H AN/ARC-51BX UHF AM Radio, don't split frequency: "..lFrequency) + end + end + if lVolume ~= nil and (lVolume >= 0.0 and lVolume <= 2.0) then + lVolume = lVolume / 2 + lClickAction = {DeviceID = lDeviceID, + ButtonID = 3008, + Value = lVolume} + end + if lPreset ~= nil and (lPreset >= 0.0 and lPreset <= 2.0) then + -- Preset 0.0 to 0.95 in 0.05 steps + if lPreset < gES_genericRadioPresetChannel or lPreset == 0.0 or lPreset == 2.0 then + lPresetChannel = lPresetChannel + 0.05 + gES_genericRadioPresetChannel = lPreset + if lPresetChannel == 1.00 then + lPresetChannel = 0.0 + end + else + lPresetChannel = lPresetChannel - 0.05 + gES_genericRadioPresetChannel = lPreset + if lPresetChannel == -0.05 then + lPresetChannel = 0.95 + end + end + lClickAction = {DeviceID = lDeviceID, + ButtonID = 3001, + Value = lPresetChannel} + end + if lSquelch ~= nil and (lSquelch == 0.0 or lSquelch <= 1.0) then + if lSquelch == 1.0 and gES_genericRadioSquelch[gES_genericRadio] == 1.0 then + -- Power off + lSquelch = 0.0 + gES_genericRadioSquelch[gES_genericRadio] = 0 + elseif lSquelch == 1.0 and gES_genericRadioSquelch[gES_genericRadio] == 0 then + -- Power on + lSquelch = 1.0 + gES_genericRadioSquelch[gES_genericRadio] = 1.0 + end + lClickAction = {DeviceID = lDeviceID, + ButtonID = 3007, + Value = lSquelch} + end + if lManualPreset ~= nil and (lManualPreset == 0.0 or lManualPreset <= 1.0) then + if lManualPreset == 1.0 and gES_genericRadioPresetManual[gES_genericRadio] == 1.0 then + -- Manual on + lManualPreset = 0.1 + gES_genericRadioPresetManual[gES_genericRadio] = 0 + elseif lManualPreset == 1.0 and gES_genericRadioPresetManual[gES_genericRadio] == 0 then + -- Preset on + lManualPreset = 0.0 + gES_genericRadioPresetManual[gES_genericRadio] = 1.0 + end + lClickAction = {DeviceID = lDeviceID, + ButtonID = 3005, + Value = lManualPreset} + end + if lPower ~= nil and (lPower == 0.0 or lPower <= 1.0) then + if lPower == 1.0 and gES_genericRadioPower[gES_genericRadio] == 1.0 then + -- Power off + lPower = 0.0 + gES_genericRadioPower[gES_genericRadio] = 0 + elseif lPower == 1.0 and gES_genericRadioPower[gES_genericRadio] == 0 then + -- Power on + lPower = 0.1 + gES_genericRadioPower[gES_genericRadio] = 1.0 + end + lClickAction = {DeviceID = lDeviceID, + ButtonID = 3006, + Value = lPower} + end + + elseif gES_genericRadio == 3 then + -- AN/ARC-134 VHF AM Radio + local lDeviceID = 20 + local lVHF_AM_RADIO = GetDevice(lDeviceID) + + -- check status of the radio + if gES_genericRadioPower[gES_genericRadio] == nil then + if lVHF_AM_RADIO:is_on() then + gES_genericRadioPower[gES_genericRadio] = 1.0 + else + gES_genericRadioPower[gES_genericRadio] = 0.85 + end + end + if gES_genericRadioPresetManual[gES_genericRadio] == nil then + gES_genericRadioPresetManual[gES_genericRadio] = 0.0 -- no preset channels + end + if gES_genericRadioSquelch[gES_genericRadio] == nil then + gES_genericRadioSquelch[gES_genericRadio] = 0.0 -- no Squelch + end + + local lVHF_AM_RADIO_FREQUENCY = math.round(lVHF_AM_RADIO:get_frequency()/1000000 , 3, "floor") + + SendDataHW("3000", string.format("%.3f", lVHF_AM_RADIO_FREQUENCY), lHardware) + SendDataHW("3001", string.format("-"), lHardware) + SendDataHW("3002", string.format("%.3f", lVHF_AM_RADIO_FREQUENCY), lHardware) + + if lRotaryFrequency_1 ~= nil and (lRotaryFrequency_1 >= 0.0 and lRotaryFrequency_1 <= 2.0) then + + local lFrequency = StrSplit(lVHF_AM_RADIO_FREQUENCY, "%.") + + if type(lFrequency) == "table" and lFrequency[1] ~= nil then + lFrequency[1] = tonumber(lFrequency[1]) + if lFrequency[2] == nil then + lFrequency[2] = 0 + else + lFrequency[2] = tonumber(lFrequency[2]) + local ltmp = string.format("%.0f", lFrequency[2] / 25) + lFrequency[2] = ltmp * 25 + end + if lRotaryFrequency_1 < gES_genericRadioFrequency1 or lRotaryFrequency_1 == 0.0 or lRotaryFrequency_1 == 2.0 then + lFrequency[1] = lFrequency[1] - 1 + if lFrequency[1] == 99 then + lFrequency[1] = 399 + end + gES_genericRadioFrequency1 = lRotaryFrequency_1 + else + lFrequency[1] = lFrequency[1] + 1 + if lFrequency[1] == 400 then + lFrequency[1] = 100 + end + gES_genericRadioFrequency1 = lRotaryFrequency_1 + end + + lFrequency[2] = string.format("%.3f", lFrequency[2] / 1000) + local ltempFrequency = string.format("%.3f", lFrequency[1] + lFrequency[2]) + ltempFrequency = tonumber(ltempFrequency) + lSetFrequency = {DeviceID = lDeviceID, + Frequency = ltempFrequency * 1000000} + + else + WriteToLog("1. genericUH-1H AN/ARC-134 VHF AM Radio, don't split frequency: "..lFrequency) + end + end + + if lRotaryFrequency_2 ~= nil and (lRotaryFrequency_2 >= 0.0 and lRotaryFrequency_2 <= 2.0) then + + local lFrequency = StrSplit(lVHF_AM_RADIO_FREQUENCY, "%.") + + if type(lFrequency) == "table" and lFrequency[1] ~= nil then + lFrequency[1] = tonumber(lFrequency[1]) + if lFrequency[2] == nil then + lFrequency[2] = 0 + else + lFrequency[2] = tonumber(lFrequency[2]) + local ltmp = string.format("%.0f", lFrequency[2] / 25) + lFrequency[2] = ltmp * 25 + end + if lRotaryFrequency_2 < gES_genericRadioFrequency2 or lRotaryFrequency_2 == 0.0 or lRotaryFrequency_2 == 2.0 then + lFrequency[2] = lFrequency[2] - 25 + if lFrequency[2] == -25 then + lFrequency[2] = 975 + end + gES_genericRadioFrequency2 = lRotaryFrequency_2 + else + lFrequency[2] = lFrequency[2] + 25 + if lFrequency[2] == 1000 then + lFrequency[2] = 0 + end + gES_genericRadioFrequency2 = lRotaryFrequency_2 + end + + lFrequency[2] = string.format("%.3f", lFrequency[2] / 1000) + local ltempFrequency = string.format("%.3f", lFrequency[1] + lFrequency[2]) + ltempFrequency = tonumber(ltempFrequency) + lSetFrequency = {DeviceID = lDeviceID, + Frequency = ltempFrequency * 1000000} + + else + WriteToLog("2. generic UH-1H AN/ARC-134 VHF AM Radio, don't split frequency: "..lFrequency) + end + end + + if lVolume ~= nil and (lVolume >= 0.0 and lVolume <= 2.0) then + lVolume = lVolume / 3 + if lVolume > 0.65 then + lVolume = 0.0 + end + lClickAction = {DeviceID = lDeviceID, + ButtonID = 3003, + Value = lVolume} + end +--[[ + if lPreset ~= nil and (lPreset >= 0.0 and lPreset <= 2.0) then + -- Preset 0.0 to 0.20 in 0.01 steps + if lPreset < gES_genericRadioPresetChannel or lPreset == 0.0 or lPreset == 2.0 then + lClickAction = {DeviceID = lDeviceID, + ButtonID = 3001, + Value = 0.01} + gES_genericRadioPresetChannel = lPreset + else + lClickAction = {DeviceID = lDeviceID, + ButtonID = 3002, + Value = -0.01} + gES_genericRadioPresetChannel = lPreset + end + end + if lLoad ~= nil and (lLoad == 0.0 or lLoad <= 1.0) then + lClickAction = {DeviceID = lDeviceID, + ButtonID = 3006, + Value = lLoad} + end + if lSquelch ~= nil and (lSquelch == 0.0 or lSquelch <= 1.0) then + if lSquelch == 1.0 and gES_genericRadioSquelch[gES_genericRadio] == 1.0 then + -- Power off + lSquelch = 0.0 + gES_genericRadioSquelch[gES_genericRadio] = 0 + elseif lSquelch == 1.0 and gES_genericRadioSquelch[gES_genericRadio] == 0 then + -- Power on + lSquelch = 1.0 + gES_genericRadioSquelch[gES_genericRadio] = 1.0 + end + lClickAction = {DeviceID = lDeviceID, + ButtonID = 3007, + Value = lSquelch} + end + if lManualPreset ~= nil and (lManualPreset == 0.0 or lManualPreset <= 1.0) then + if lManualPreset == 1.0 and gES_genericRadioPresetManual[gES_genericRadio] == 1.0 then + -- Manual on + lManualPreset = 0.1 + gES_genericRadioPresetManual[gES_genericRadio] = 0 + elseif lManualPreset == 1.0 and gES_genericRadioPresetManual[gES_genericRadio] == 0 then + -- Preset on + lManualPreset = 0.0 + gES_genericRadioPresetManual[gES_genericRadio] = 1.0 + end + lClickAction = {DeviceID = lDeviceID, + ButtonID = 3005, + Value = lManualPreset} + end +]] + if lPower ~= nil and (lPower == 0.0 or lPower <= 1.0) then + if lPower == 1.0 and gES_genericRadioPower[gES_genericRadio] == 1.0 then + -- Power off + lPower = 0.85 + gES_genericRadioPower[gES_genericRadio] = 0 + elseif lPower == 1.0 and gES_genericRadioPower[gES_genericRadio] == 0 then + -- Power on + lPower = 1.0 + gES_genericRadioPower[gES_genericRadio] = 1.0 + end + lClickAction = {DeviceID = lDeviceID, + ButtonID = 3001, + Value = lPower} + end + + else + SendDataHW("3000", "-", lHardware) + SendDataHW("3001", "-", lHardware) + SendDataHW("3002", "-", lHardware) + SendDataHW("3010", 0, lHardware) + SendDataHW("3011", 0, lHardware) + SendDataHW("3012", 0, lHardware) + return + end + + SendDataHW("3010", gES_genericRadioPower[gES_genericRadio], lHardware) + SendDataHW("3011", gES_genericRadioPresetManual[gES_genericRadio], lHardware) + SendDataHW("3012", gES_genericRadioSquelch[gES_genericRadio], lHardware) + + if lClickAction ~= nil then + lDevice = GetDevice(lClickAction.DeviceID) + if type(lDevice) == "table" then + --WriteToLog("GetDevice("..lClickAction.DeviceID.."):performClickableAction("..lClickAction.ButtonID..", "..lClickAction.Value..") ") + lDevice:performClickableAction(lClickAction.ButtonID, lClickAction.Value) + end + elseif lSetFrequency ~= nil then + lDevice = GetDevice(lSetFrequency.DeviceID) + if type(lDevice) == "table" and lDevice:is_on() then + --WriteToLog("GetDevice("..lSetFrequency.DeviceID.."):set_frequency("..lSetFrequency.Frequency..") ") + lDevice:set_frequency(lSetFrequency.Frequency) + else + WriteToLog("GetDevice("..lSetFrequency.DeviceID..") is no table or Radio is not on") + end + end +end \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..6ead18e --- /dev/null +++ b/README.md @@ -0,0 +1,20 @@ +Deutsch +-------------------------------- +Dies ist ein universell einsetzbares Export Script für DCS. +Es wird der gleichzeitige Export von Daten an verschiedene Software(Hardware)-Tools ermöglicht. + +Zur Zeit werden folgende Export-Formate unterstützt. +- D.A.C. (DCS Arcaze Connector) um die Arcaze USB Controller anzusprechen (http://wiki.simple-solutions.de/en/products/Arcaze/Arcaze-USB) +- HawkTouch in der Version 1.5/1.6 (http://forums.eagle.ru/showthread.php?t=71729) mit der GaugePack.dll in der Version von hjpullmann. +- HELIOS in der Version 1.3.19 (http://www.gadrocsworkshop.com/helios/) (Unterstützt nur die DCS Module A-10C, Ka-50 und im Eingeschränkten Umfang die SU-25T und die Flaming Cliffs Flugzeuge) +und andere Software/Hardware die ihre Daten über eine UDP Netzwerkverbindung bekommen und die Daten in einem Key=Value Format verarbeiten. + +English +-------------------------------- +This is an universally insertable export script for DCS. It allows for the simultaneous export of data of different programs and hardware + +At present the following export formats are supported: +- D.A.C. (DCS Arcaze Connector) to address the Arcaze USB Controller (http://wiki.simple-solutions.de/en/products/Arcaze/Arcaze-USB) +- HawkTouch in version 1.5/1.6 (http://forums.eagle.ru/showthread.php?t=71729) with GaugePack.dll in the version from hjpullmann. +- HELIOS in the version 1.3.19 (http://www.gadrocsworkshop.com/helios/) (Only supports the DCS Module A-10C, Ka-50 and in a limited capacity the SU-25T and the Flaming Cliffs Aircraft) +and other Software/Hardware that obtain your data via a UDP network connection and then process it into a Key=Value Format. diff --git a/Scripts/Export.lua b/Scripts/Export.lua new file mode 100644 index 0000000..a951ac0 --- /dev/null +++ b/Scripts/Export.lua @@ -0,0 +1,722 @@ +-- HELIOS and Arcaze Export Script +-- Version 0.9.9 BETA +-- +-- Copyright by Michael aka McMicha 2014 +-- Contact dcs2arcaze.micha@farbpigmente.org + +-- List of all DCS Module Scripts + +---------- +-- DATA -- +---------- + +-- Glass Cockpit Software +-- for example +-- HELIOS (http://www.gadrocsworkshop.com/helios/), Type 1 +-- HawgTouch (http://forums.eagle.ru/showthread.php?t=71729), Type 2 +gES_GlassCockpitExport = true -- false for not use +gES_GlassCockpitHost = "127.0.0.1" -- IP for HELIOS or HawgToch +gES_GlassCockpitPort = 1625 -- Port for HELIOS (9089) or HawgTouch (1625) +gES_GlassCockpitSeparator = ":" +gES_GlassCockpitType = 2 -- 1 = HELIOS, 2 = HawgTouch + +-- for example D.A.C. or SIOC +gES_HARDWAREExport = true -- false for not use +gES_HARDWARE = {} +-- first hardware +gES_HARDWARE[1] = {} +gES_HARDWARE[1].Host = "127.0.0.1" -- IP for hardware 1 +gES_HARDWARE[1].SendPort = 26026 -- Port for hardware 1 +gES_HARDWARE[1].Separator = ":" +-- secound to n hardware +--gES_HARDWARE[2] = {} +--gES_HARDWARE[2].Host = "127.0.0.1" -- IP for hardware 2 +--gES_HARDWARE[2].SendPort = 9092 -- Port for hardware 2 +--gES_HARDWARE[2].Separator = ";" + +-- D.A.C. can data send +gES_HARDWAREListner = true -- false for not use +gES_HARDWAREListnerPort = 26027 -- Listener Port for D.A.C. + +gES_ExportInterval = 0.1 +gES_ExportLowTickInterval = 1 +gES_ExportModulePath = lfs.writedir().."ExportsModules\\" +gES_LogPath = lfs.writedir().."Logs\\Export.log" +gES_Debug = false +gES_FirstNewDataSend = true +gES_FirstNewDataSendCount = 5 +gES_genericRadioHardwareID = 1 + +------------ +-- SCRIPT -- +------------ + +os.setlocale("ISO-8559-1", "numeric") + +-- Simulation id +gES_SimID = string.format("%08x*",os.time()) + +-- State data for export +gES_PacketSize = 0 +gES_SendStrings = {} +gES_LastData = {} + +gES_PacketSizeHW = {} +gES_SendStringsHW = {} +gES_LastDataHW = {} + +for i = 1, #gES_HARDWARE, 1 do + gES_PacketSizeHW[i] = 0 + gES_SendStringsHW[i] = {} + gES_LastDataHW[i] = {} +end + +-- Frame counter for non important data +gES_TickCount = 0 +gES_TickCountHW = 0 + +-- Found DCS or FC Module +gES_FoundDCSModule = false +gES_FoundFCModule = false +gES_FoundNoModul = true + +--------------------------------------------- +-- DCS Export API Function Implementations -- +--------------------------------------------- + +function LuaExportStart() +-- Works once just before mission start. +-- (and before player selects their aircraft, if there is a choice!) + + -- 2) Setup udp sockets to talk to GlassCockpit + package.path = package.path..";.\\LuaSocket\\?.lua" + package.cpath = package.cpath..";.\\LuaSocket\\?.dll" + + gES_socket = require("socket") + + gES_c = gES_socket.udp() + gES_c:setsockname("*", 0) + gES_c:setoption('broadcast', true) + gES_c:settimeout(.001) -- set the timeout for reading the socket + + if gES_HARDWAREListner then + gES_c2 = gES_socket.udp() + gES_c2:setsockname("*", gES_HARDWAREListnerPort) + gES_c2:setoption('broadcast', true) + gES_c2:settimeout(.001) -- set the timeout for reading the socket + end + +-- local lrename1, lrename2 = os.rename(gES_LogPath, gES_LogPath..".old") + gES_logFile = io.open(gES_LogPath, "w+") + WriteToLog("Export Modules Script Path: "..gES_ExportModulePath) +-- if lrenmae1 == nil then +-- WriteToLog("Rename Error: "..lrename2) +-- end + + SelectModule() -- point globals to Module functions and data. +end + +function WriteToLog(message) + if gES_logFile then + gES_logFile:write(os.date("%X :")..message.."\r\n") + end +end + +function LuaExportBeforeNextFrame() + ProcessInput() +end + +function LuaExportAfterNextFrame() +end + +function LuaExportStop() +-- Works once just after mission stop. + for i=1, #gES_HARDWARE, 1 do + SendDataHW("DAC", "stop", i) + FlushDataHW(i) + end + + gES_c:close() + if gES_HARDWAREListner then + gES_c2:close() + end + + if gES_logFile then + gES_logFile:flush() + gES_logFile:close() + gES_logFile = nil + end +end + +function ProcessInput() + local lCommand, lCommandArgs, lDevice + -- C1,3001,4 + -- lComand = C + -- lCommandArgs[1] = 1 => lDevice + -- lCommandArgs[2] = 3001 + -- lCommandArgs[3] = 4 + + if gES_GlassCockpitExport then + local lInput,from,port = gES_c:receivefrom() + + if lInput then + if gES_Debug then + WriteToLog("lInput: "..lInput..", from: "..from..", port: "..port) + end + lCommand = string.sub(lInput,1,1) + + if lCommand == "R" then + ResetChangeValues() + end + + if (lCommand == "C") then + lCommandArgs = StrSplit(string.sub(lInput,2),",") + lDevice = GetDevice(lCommandArgs[1]) + if type(lDevice) == "table" then + lDevice:performClickableAction(lCommandArgs[2],lCommandArgs[3]) + end + end + end + end + + if gES_HARDWAREListner then + local lInput2,from2,port2 = gES_c2:receivefrom() -- Hardware + + if lInput2 then + if gES_Debug then + WriteToLog("lInput2: "..lInput2..", from2: "..from2..", port2: "..port2) + end + lCommand = string.sub(lInput2,1,1) + + if lCommand == "C" then + ResetChangeValuesHW() + end + + if (lCommand == "C") then + lCommandArgs = StrSplit(string.sub(lInput2,2),",") + lDevice = GetDevice(lCommandArgs[1]) + if lDevice ~= "1000" then + if type(lDevice) == "table" then + lDevice:performClickableAction(lCommandArgs[2],lCommandArgs[3]) + end + elseif lDevice == "1000" then + --genericRadio(key, value, hardware) + genericRadio(lCommandArgs[2],lCommandArgs[3], gES_genericRadioHardwareID) + end + end + end + end +end + +function LuaExportActivityNextEvent(t) + t = t + gES_ExportInterval + + gES_TickCount = gES_TickCount + 1 + + local lMyInfo = LoGetSelfData() + if lMyInfo ~= nil then + if gES_ModuleName ~= lMyInfo.Name then + SelectModule() -- point globals to Module functions and data. + end + lMyInfo = nil + end + + local lDevice = GetDevice(0) + if type(lDevice) == "table" and gES_FoundDCSModule then + + lDevice:update_arguments() + + if gES_GlassCockpitExport then + --ProcessArguments(lDevice, gES_EveryFrameArguments) -- Module arguments as appropriate + coProcessArguments_EveryFrame = coroutine.create(ProcessArguments) + status = coroutine.resume( coProcessArguments_EveryFrame, lDevice, gES_EveryFrameArguments) + if gES_Debug then + WriteToLog("coProcessArguments_EveryFrame Status: "..dump(status)) + end + --ProcessGlassCockpitDCSHighImportance(lDevice) -- Module, as appropriate; determined in SelectModule() + coProcessGlassCockpitDCSHighImportance = coroutine.create(ProcessGlassCockpitDCSHighImportance) + status = coroutine.resume( coProcessGlassCockpitDCSHighImportance, lDevice) + if gES_Debug then + WriteToLog("coProcessGlassCockpitDCSHighImportance Status: "..dump(status)) + end + end + if gES_HARDWAREExport then + --ProcessHARDWAREHighImportance(lDevice) -- Module, as appropriate; determined in SelectModule() + coProcessHARDWAREHighImportance = coroutine.create(ProcessHARDWAREHighImportance) + status = coroutine.resume( coProcessHARDWAREHighImportance, lDevice) + if gES_Debug then + WriteToLog("coProcessHARDWAREHighImportance Status: "..dump(status)) + end + end + + if gES_FirstNewDataSend and gES_FirstNewDataSendCount == 0 then + if gES_HARDWAREExport then + ResetChangeValuesHW() + end + if gES_GlassCockpitExport then + ResetChangeValues() + end + gES_FirstNewDataSend = false + else + gES_FirstNewDataSendCount = gES_FirstNewDataSendCount - 1 + end + + if gES_TickCount >= gES_ExportLowTickInterval then + if gES_GlassCockpitExport then + --ProcessArguments(lDevice, gES_Arguments) -- Module arguments as appropriate + coProcessArguments_Arguments = coroutine.create(ProcessArguments) + status = coroutine.resume( coProcessArguments_Arguments, lDevice, gES_Arguments) + if gES_Debug then + WriteToLog("coProcessArguments_Arguments Status: "..dump(status)) + end + --ProcessGlassCockpitDCSLowImportance(lDevice) -- Module as appropriate; determined in SelectModule() + coProcessGlassCockpitDCSLowImportance = coroutine.create(ProcessGlassCockpitDCSLowImportance) + status = coroutine.resume( coProcessGlassCockpitDCSLowImportance, lDevice) + if gES_Debug then + WriteToLog("coProcessGlassCockpitDCSLowImportance Status: "..dump(status)) + end + end + + if gES_HARDWAREExport then + --ProcessHARDWARELowImportance(lDevice) -- Module, as appropriate; determined in SelectModule() + coProcessHARDWARELowImportance = coroutine.create(ProcessHARDWARELowImportance) + status = coroutine.resume( coProcessHARDWARELowImportance, lDevice) + if gES_Debug then + WriteToLog("coProcessHARDWARELowImportance Status: "..dump(status)) + end + gES_TickCountHW = gES_TickCountHW + 1 + end + gES_TickCount = 0 + end + + if gES_GlassCockpitExport then + FlushData() + end + + if gES_HARDWAREExport then + for i=1, #gES_HARDWARE, 1 do + FlushDataHW(i) + end + end + elseif gES_FoundFCModule then -- Assume FC Aircraft + if gES_GlassCockpitExport then + --ProcessGlassCockpitFCHighImportance() + coProcessGlassCockpitFCHighImportance = coroutine.create(ProcessGlassCockpitFCHighImportance) + status = coroutine.resume( coProcessGlassCockpitFCHighImportance) + if gES_Debug then + WriteToLog("coProcessGlassCockpitFCHighImportance Status: "..dump(status)) + end + end + if gES_HARDWAREExport then + --ProcessHARDWAREHighImportance(lDevice) + coProcessHARDWAREHighImportance = coroutine.create(ProcessHARDWAREHighImportance) + status = coroutine.resume( coProcessHARDWAREHighImportance, lDevice) + if gES_Debug then + WriteToLog("coProcessHARDWAREHighImportance Status: "..dump(status)) + end + end + + if gES_FirstNewDataSend and gES_FirstNewDataSendCount == 0 then + if gES_HARDWAREExport then + ResetChangeValuesHW() + end + if gES_GlassCockpitExport then + ResetChangeValues() + end + gES_FirstNewDataSend = false + else + gES_FirstNewDataSendCount = gES_FirstNewDataSendCount - 1 + end + + if gES_TickCount >= gES_ExportLowTickInterval then + if gES_GlassCockpitExport then + --ProcessGlassCockpitFCLowImportance() + coProcessGlassCockpitFCLowImportance = coroutine.create(ProcessGlassCockpitFCLowImportance) + status = coroutine.resume( coProcessGlassCockpitFCLowImportance) + if gES_Debug then + WriteToLog("coProcessGlassCockpitFCLowImportance Status: "..dump(status)) + end + end + + if gES_HARDWAREExport then + --ProcessHARDWARELowImportance(lDevice) + coProcessHARDWARELowImportance = coroutine.create(ProcessHARDWARELowImportance) + status = coroutine.resume( coProcessHARDWARELowImportance, lDevice) + if gES_Debug then + WriteToLog("coProcessHARDWARELowImportance Status: "..dump(status)) + end + gES_TickCountHW = gES_TickCountHW + 1 + end + gES_TickCount = 0 + end + + if gES_GlassCockpitExport then + FlushData() + end + + if gES_HARDWAREExport then + for i=1, #gES_HARDWARE, 1 do + FlushDataHW(i) + end + end + else -- No Module found + if gES_FoundNoModul then + WriteToLog("No Module Found.") + SelectModule() -- point globals to Module functions and data. + end + end + + return t +end + +-- Helper Functions +function StrSplit(str, delim, maxNb) + -- Eliminate bad cases... + if string.find(str, delim) == nil then + return { str } + end + if maxNb == nil or maxNb < 1 then + maxNb = 0 -- No limit + end + local lResult = {} + local lPat = "(.-)" .. delim .. "()" + local lNb = 0 + local lLastPos + for part, pos in string.gfind(str, lPat) do + lNb = lNb + 1 + lResult[lNb] = part + lLastPos = pos + if lNb == maxNb then break end + end + -- Handle the last field + if lNb ~= maxNb then + lResult[lNb + 1] = string.sub(str, lLastPos) + end + return lResult +end + +function round(num, idp) + local lMult = 10^(idp or 0) + return math.floor(num * lMult + 0.5) / lMult +end + + + +-- Status Gathering Functions +function ProcessArguments(device, arguments) + local lArgument , lFormat , lArgumentValue + local lCounter = 0 + + if gES_Debug then + WriteToLog("======Begin========") + end + + for lArgument, lFormat in pairs(arguments) do + lArgumentValue = string.format(lFormat,device:get_argument_value(lArgument)) + if gES_Debug then + lCounter = lCounter + 1 + WriteToLog(lCounter..". ID: "..lArgument..", Fromat: "..lFormat..", Value: "..lArgumentValue) + end + SendData(lArgument, lArgumentValue) + end + + if gES_Debug then + WriteToLog("======End========") + end +end + +-- Network Functions for GlassCockpit +function SendData(id, value) + if string.len(value) > 3 and value == string.sub("-0.00000000",1, string.len(value)) then + value = value:sub(2) + end + + if gES_LastData[id] == nil or gES_LastData[id] ~= value then + local ldata = id .. "=" .. value + local ldataLen = string.len(ldata) + + if ldataLen + gES_PacketSize > 576 then + FlushData() + end + + table.insert(gES_SendStrings, ldata) + gES_LastData[id] = value + gES_PacketSize = gES_PacketSize + ldataLen + 1 + end +end + +-- Network Functions for Hardware +function SendDataHW(id, value, hardware) + hardware = hardware or 1 + + if gES_HARDWARE[hardware] == nil then + WriteToLog("unknown hardware ID '"..hardware.."' for value: '"..id.."="..value.."'") + return + end + + if string.len(value) > 3 and value == string.sub("-0.00000000",1, string.len(value)) then + value = value:sub(2) + end + + if gES_LastDataHW[hardware][id] == nil or gES_LastDataHW[hardware][id] ~= value then + local ldata = id .. "=" .. value + local ldataLen = string.len(ldata) + + if ldataLen + gES_PacketSizeHW[hardware] > 576 then + FlushDataHW(hardware) + end + + table.insert(gES_SendStringsHW[hardware], ldata) + gES_LastDataHW[hardware][id] = value + gES_PacketSizeHW[hardware] = gES_PacketSizeHW[hardware] + ldataLen + 1 + --WriteToLog("id=ldata: "..ldata) + --WriteToLog("gES_LastDataHW["..hardware.."]: "..dump(gES_LastDataHW[hardware])) + end +end + +function FlushData() + if #gES_SendStrings > 0 then + local lES_SimID = "" + if gES_GlassCockpitType == 1 then + lES_SimID = gES_SimID + elseif gES_GlassCockpitType == 2 then + lES_SimID = "" + end + local lPacket = lES_SimID .. table.concat(gES_SendStrings, gES_GlassCockpitSeparator) .. "\n" + gES_socket.try(gES_c:sendto(lPacket, gES_GlassCockpitHost, gES_GlassCockpitPort)) + gES_SendStrings = {} + gES_PacketSize = 0 + end +end + +function FlushDataHW(hardware) + hardware = hardware or 1 + + if gES_HARDWARE[hardware] == nil then + WriteToLog("unknown hardware ID '"..hardware.."'") + return + end + + if #gES_SendStringsHW[hardware] > 0 then + local lPacket = gES_SimID .. table.concat(gES_SendStringsHW[hardware], gES_HARDWARE[hardware].Separator) .. "\n" + gES_socket.try(gES_c:sendto(lPacket, gES_HARDWARE[hardware].Host, gES_HARDWARE[hardware].SendPort)) + gES_SendStringsHW[hardware] = {} + gES_PacketSizeHW[hardware] = 0 + + + + end +end + +function ResetChangeValues() + gES_LastData = {} + gES_TickCount = 10 +end + +function ResetChangeValuesHW() + for i = 1, #gES_HARDWARE, 1 do + gES_LastDataHW[i] = {} + end + gES_TickCount = 10 + gES_TickCountHW = 0 +end + +function SelectModule() + -- Select Module... + gES_FoundDCSModule = false + gES_FoundFCModule = false + gES_FoundNoModul = true + + local lMyInfo = LoGetSelfData() + if lMyInfo == nil then -- End SelectModule, if don't selected a aircraft + return + end + + gES_ModuleName = lMyInfo.Name + local lModuleName = gES_ModuleName..".lua" + local lModuleFile = "" + + gES_FoundNoModul = false + + for file in lfs.dir(gES_ExportModulePath) do + if lfs.attributes(gES_ExportModulePath..file,"mode") == "file" then + if file == lModuleName then + lModuleFile = gES_ExportModulePath..file + end + end + end + + WriteToLog("File Path: "..lModuleFile) + + if string.len(lModuleFile) > 1 then + ResetChangeValuesHW() + + -- load Aircraft File + dofile(lModuleFile) + for i=1, #gES_HARDWARE, 1 do + SendDataHW("File", lMyInfo.Name, i) + FlushDataHW(i) + end + + WriteToLog("File '"..lModuleFile.."' loaded") + + gES_FirstNewDataSend = true + gES_FirstNewDataSendCount = 5 + + if gES_FoundDCSModule then + local lCounter = 0 + for k, v in pairs(gES_GlassCockpitConfigEveryFrameArguments) do + lCounter = lCounter + 1 + end + if gES_Debug then + WriteToLog("gES_GlassCockpitConfigEveryFrameArguments Count: "..lCounter) + end + if lCounter > 0 then + gES_EveryFrameArguments = gES_GlassCockpitConfigEveryFrameArguments + else + -- no Arguments + gES_EveryFrameArguments = {} + end + lCounter = 0 + for k, v in pairs(gES_GlassCockpitConfigArguments) do + lCounter = lCounter + 1 + end + if gES_Debug then + WriteToLog("gES_GlassCockpitConfigArguments Count: "..lCounter) + end + if lCounter > 0 then + gES_Arguments = gES_GlassCockpitConfigArguments + else + -- no Arguments + gES_Arguments = {} + end + + ProcessGlassCockpitDCSHighImportance = ProcessGlassCockpitDCSConfigHighImportance + ProcessGlassCockpitDCSLowImportance = ProcessGlassCockpitDCSConfigLowImportance + ProcessHARDWAREHighImportance = ProcessHARDWAREConfigHighImportance + ProcessHARDWARELowImportance = ProcessHARDWAREConfigLowImportance + + elseif gES_FoundFCModule then + ProcessGlassCockpitFCHighImportance = ProcessGlassCockpitFCHighImportanceConfig + ProcessGlassCockpitFCLowImportance = ProcessGlassCockpitFCLowImportanceConfig + ProcessHARDWAREHighImportance = ProcessHARDWAREConfigHighImportance + ProcessHARDWARELowImportance = ProcessHARDWAREConfigLowImportance + else + WriteToLog("Unknown Module Type: "..lMyInfo.Name) + end + + else -- Unknown Module + ProcessGlassCockpitDCSHighImportance = ProcessGlassCockpitDCSHighImportanceNoConfig + ProcessGlassCockpitDCSLowImportance = ProcessGlassCockpitDCSLowImportanceNoConfig + ProcessGlassCockpitFCHighImportance = ProcessGlassCockpitFCHighImportanceNoConfig + ProcessGlassCockpitFCLowImportance = ProcessGlassCockpitFCLowImportanceNoConfig + ProcessHARDWAREHighImportance = ProcessHARDWARENoConfigHighImportance + ProcessHARDWARELowImportance = ProcessHARDWARENoConfigLowImportance + gES_EveryFrameArguments = {} + gES_Arguments = {} + WriteToLog("Unknown Module Name: "..lMyInfo.Name) + end +end + +-- The dump function show the content of the specified variable. +-- dump is similar to PHP function var_dump and show variables from type +-- "nil, "number", "string", "boolean, "table", "function", "thread" and "userdata" +function dump(var, depth) + depth = depth or 0 + if type(var) == "string" then + return 'string: "' .. var .. '"\n' + elseif type(var) == "nil" then + return 'nil\n' + elseif type(var) == "number" then + return 'number: "' .. var .. '"\n' + elseif type(var) == "boolean" then + return 'boolean: "' .. tostring(var) .. '"\n' + elseif type(var) == "function" then + if debug and debug.getinfo then + fcnname = tostring(var) + local info = debug.getinfo(var, "S") + if info.what == "C" then + return string.format('%q', fcnname .. ', C function') .. '\n' + else + if (string.sub(info.source, 1, 2) == [[./]]) then + return string.format('%q', fcnname .. ', defined in (' .. info.linedefined .. '-' .. info.lastlinedefined .. ')' .. info.source) ..'\n' + else + return string.format('%q', fcnname .. ', defined in (' .. info.linedefined .. '-' .. info.lastlinedefined .. ')') ..'\n' + end + end + else + return 'a function\n' + end + elseif type(var) == "thread" then + return 'thread\n' + elseif type(var) == "userdata" then + return tostring(var)..'\n' + elseif type(var) == "table" then + depth = depth + 1 + out = "{\n" + for k,v in pairs(var) do + out = out .. (" "):rep(depth*4).. "["..k.."] = " .. dump(v, depth) + end + return out .. (" "):rep((depth-1)*4) .. "}\n" + else + return tostring(var) .. "\n" + end +end + +-- round function for math libraray +-- number : value +-- decimals: number of decimal +-- method : ceil: Returns the smallest integer larger than or equal to number +-- floor: Returns the smallest integer smaller than or equal to number +function math.round(number, decimals, method) + if string.find(number, "%p" ) ~= nil then + decimals = decimals or 0 + local lFactor = 10 ^ decimals + if (method == "ceil" or method == "floor") then + -- ceil: Returns the smallest integer larger than or equal to number + -- floor: Returns the smallest integer smaller than or equal to number + return math[method](number * lFactor) / lFactor + else + return tonumber(("%."..decimals.."f"):format(number)) + end + else + return number + end +end + +-- split function for string libraray +-- stringvalue: value +-- delimiter : delimiter for split +-- for example, see http://www.lua.org/manual/5.1/manual.html#5.4.1 +function string.split(stringvalue, delimiter) + result = {}; + for match in (stringvalue..delimiter):gmatch("(.-)"..delimiter) do + table.insert(result, match); + end + return result; +end + +-- Pointed to by ProcessGlassCockpitDCSHighImportance, if the player aircraft is something else +function ProcessGlassCockpitDCSHighImportanceNoConfig(mainPanelDevice) +end +-- Pointed to by ProcessGlassCockpitDCSLowImportance, if the player aircraft is something else +function ProcessGlassCockpitDCSLowImportanceNoConfig(mainPanelDevice) +end + +----------------------------------------- +-- FLAMING CLIFFS AIRCRAFT / Su-25T -- +-- FC aircraft don't support GetDevice -- +----------------------------------------- +-- the player aircraft is a Flaming Cliffs or similar aircraft +function ProcessGlassCockpitFCHighImportanceNoConfig() +end +function ProcessGlassCockpitFCLowImportanceNoConfig() +end + +-- Hardware exports +function ProcessHARDWARENoConfigHighImportance(mainPanelDevice) +end +function ProcessHARDWARENoConfigLowImportance(mainPanelDevice) +end + +--dofile("./AriesWings/AriesRadio.luac")