diff --git a/Scripts/DCS-ExportScript/ExportsModules/UH-60L.lua b/Scripts/DCS-ExportScript/ExportsModules/UH-60L.lua index 14c292a..eb75e50 100644 --- a/Scripts/DCS-ExportScript/ExportsModules/UH-60L.lua +++ b/Scripts/DCS-ExportScript/ExportsModules/UH-60L.lua @@ -1,11 +1,11 @@ -- UH-60L Export Module -- Feel free to use, modify and repost in any way you desire. ---[[ To see the cockpit in model viewer -Load model "uh-60l_cockpit.edm" from dcs/mods/aircraft/UH-60L/Shapes" -Click Tools > Mount textures > Mount Zip and select "dcs/mods/aircraft/UH-60L/Textures/h60Textures.zip -Click open -Load model "uh-60l_cockpit.edm" from dcs/mods/aircraft/UH-60L/Shapes" -Done +--[[ To see the cockpit textures in model viewer + Load model "uh-60l_cockpit.edm" from dcs/mods/aircraft/UH-60L/Shapes" + Click Tools > Mount textures > Mount Zip and select "dcs/mods/aircraft/UH-60L/Textures/h60Textures.zip + Click open + Load model "uh-60l_cockpit.edm" from dcs/mods/aircraft/UH-60L/Shapes" + Done ]] ExportScript.FoundDCSModule = true @@ -33,7 +33,7 @@ ExportScript.ConfigEveryFrameArguments = [21] = "%.4f", -- GEN 2 Switch ON/OFF/TEST [22] = "%.4f", -- Fuel Pump Switch FUEL PRIME/OFF/APU BOOST [23] = "%.4f", -- Air Source Switch AIR/OFF/ENG - [24] = "%.4f", -- APU Control ON/OFF + [24] = "%.f", -- APU Control ON/OFF [26] = "%.4f", -- Engine 1 Control [27] = "%.4f", -- Engine 2 Control @@ -42,12 +42,12 @@ ExportScript.ConfigEveryFrameArguments = [30] = "%.4f", -- Engine 1 Starter [31] = "%.4f", -- Engine 2 Starter [32] = "%.4f", -- Stabilator Manual Slew UP/Down - [33] = "%.4f", -- - [34] = "%.4f", -- - [35] = "%.4f", -- - [36] = "%.4f", -- - [37] = "%.4f", -- - [38] = "%.4f", -- + [33] = "%.4f", -- Stabilator Auto ON/OFF + [34] = "%.4f", -- SAS 1 ON/OFF + [35] = "%.4f", -- SAS 2 ON/OFF + [36] = "%.4f", -- Trim ON/OFF + [37] = "%.4f", -- FPS ON/OFF + [38] = "%.4f", -- SAS Boost ON/OFF [40] = "%.4f", -- No. 1 Fuel Boost Pump ON/OFF @@ -56,13 +56,13 @@ ExportScript.ConfigEveryFrameArguments = [43] = "%.4f", -- Engine 2 Power Control Linkage -- AN/ARC-164 UHF Radio - [50] = "%.4f", -- AN/ARC-164 Mode - [52] = "%.4f", -- AN/ARC-164 Manual/Preset/Guard - [53] = "%.4f", -- AN/ARC-164 100s - [54] = "%.4f", -- AN/ARC-164 10s - [55] = "%.4f", -- AN/ARC-164 1s - [56] = "%.4f", -- AN/ARC-164 .1s - [57] = "%.4f", -- AN/ARC-164 .010s + [50] = "%0.2f", -- AN/ARC-164 Mode + [52] = "%0.2f", -- AN/ARC-164 Manual/Preset/Guard + [53] = "%.1f", -- AN/ARC-164 100s + [54] = "%.1f", -- AN/ARC-164 10s + [55] = "%.1f", -- AN/ARC-164 1s + [56] = "%.1f", -- AN/ARC-164 .1s + [57] = "%.1f", -- AN/ARC-164 .010s [58] = "%.4f", -- AN/ARC-164 Preset [60] = "%.4f", -- Altimeter 100s PLT @@ -245,27 +245,27 @@ ExportScript.ConfigEveryFrameArguments = [263] = "%.4f", -- Console Lights LOWER Knob [264] = "%.4f", -- Console Lights NON FLT Knob [265] = "%.4f", -- Console Lights PILOT FLT Knob - [266] = "%.4f", -- - [267] = "%.4f", -- - [268] = "%.4f", -- + [266] = "%.4f", -- Radar Altimeter Dimmer + [267] = "%.4f", -- Radar Altimeter Dimmer + [268] = "%.4f", -- Magnetic Compass Light ON/OFF [269] = "%.4f", -- Cockpit Lights BLUE/OFF/WHITE -- AN/APR-39 - [270] = "%.4f", -- AN/APR-39 Power Swotch ON/OFF + [270] = "%.4f", -- AN/APR-39 Power Switch ON/OFF [271] = "%.4f", -- AN/APR-39 Self Test Button (Inop.) [272] = "%.4f", -- AN/APR-39 Altitude HI/LOW (Inop.) - [273] = "%.4f", -- - [274] = "%.4f", -- + [273] = "%.4f", -- AN/APR-39 Volume + [274] = "%.4f", -- AN/APR-39 Brilliance [275] = "%.4f", -- Cockpit Blue Lights [276] = "%.4f", -- Cockpit White Lights - [280] = "%.4f", -- - [281] = "%.4f", -- - [282] = "%.4f", -- - [283] = "%.4f", -- - [284] = "%.4f", -- - [285] = "%.4f", -- + [280] = "%.4f", -- Pilot's Choronometer RESET/SET Button + [281] = "%.4f", -- Pilot's Choronometer MODE Button + [282] = "%.4f", -- Pilot's Choronometer START/STOP/ADVANCE Button + [283] = "%.4f", -- Copilot's Choronometer RESET/SET Button + [284] = "%.4f", -- Copilot's Choronometer MODE Button + [285] = "%.4f", -- Copilot's Choronometer START/STOP/ADVANCE Button [294] = "%.4f", -- Tail Wheel ON Light [296] = "%.4f", -- Tail Servo Select NORMAL/BACKUP (Inop.) @@ -273,8 +273,8 @@ ExportScript.ConfigEveryFrameArguments = -- Caution and Warning Lights [304] = "%.4f", -- CAP Lamp Test Switch - [305] = "%.4f", -- - [306] = "%.4f", -- + [305] = "%.4f", -- Master Caution Reset + [306] = "%.4f", -- Master Caution Reset [309] = "%.4f", -- Annunciator Brightness [310] = "%.4f", -- #1 ENG OUT Light [311] = "%.4f", -- #2 ENG OUT Light @@ -308,50 +308,50 @@ ExportScript.ConfigEveryFrameArguments = [337] = "%.4f", -- PITCH BIAS FAIL [338] = "%.4f", -- #2 FUEL FLTR BYPASS - [339] = "%.4f", -- - [340] = "%.4f", -- - [341] = "%.4f", -- - [342] = "%.4f", -- - [343] = "%.4f", -- - [344] = "%.4f", -- - [345] = "%.4f", -- - [346] = "%.4f", -- + [339] = "%.4f", -- #1 ENGINE STARTER + [340] = "%.4f", -- #1 OIL FLTR BYPASS + [341] = "%.4f", -- #2 OIL FLTR BYPASS + [342] = "%.4f", -- #2 ENGINE STARTER + [343] = "%.4f", -- #1 PRI SERVER PRESS + [344] = "%.4f", -- #1 HYD PUMP + [345] = "%.4f", -- #2 HYD PUMP + [346] = "%.4f", -- #2 PRI SERVO PRESS - [347] = "%.4f", -- - [348] = "%.4f", -- - [349] = "%.4f", -- - [350] = "%.4f", -- - [351] = "%.4f", -- - [352] = "%.4f", -- - [353] = "%.4f", -- - [354] = "%.4f", -- + [347] = "%.4f", -- TAIL ROTOR QUADRANT + [348] = "%.4f", -- IRCM INOP + [349] = "%.4f", -- AUX FUEL + [350] = "%.4f", -- #1 TAIL TRT XERVO + [351] = "%.4f", -- MAIN XMSN OIL TEMP + [352] = "%.4f", -- INT XMSN OIL TEMP + [353] = "%.4f", -- TAIL XMSN OIL TEMP + [354] = "%.4f", -- APU OIL TEMP HI - [355] = "%.4f", -- - [356] = "%.4f", -- - [357] = "%.4f", -- - [358] = "%.4f", -- - [359] = "%.4f", -- - [360] = "%.4f", -- - [361] = "%.4f", -- - [362] = "%.4f", -- + [355] = "%.4f", -- BOOST SERVO OFF + [356] = "%.4f", -- STABILATOR + [357] = "%.4f", -- SAS OFF + [358] = "%.4f", -- TRIM FAIL + [359] = "%.4f", -- LFT PITOT HEAT + [360] = "%.4f", -- FLT PATH STAB + [361] = "%.4f", -- IFF + [362] = "%.4f", -- RT PITOT HEAT - [363] = "%.4f", -- - [364] = "%.4f", -- - [365] = "%.4f", -- - [366] = "%.4f", -- - [367] = "%.4f", -- - [368] = "%.4f", -- - [369] = "%.4f", -- - [370] = "%.4f", -- + [363] = "%.4f", -- CHIP INPUT MDL - LH + [364] = "%.4f", -- CHIP INT XMSN + [365] = "%.4f", -- CHIP TAIL XMSN + [366] = "%.4f", -- CHIP INPUT MDL - RH + [367] = "%.4f", -- CHIP ACCESS MDL - LH + [368] = "%.4f", -- CHIP MAIN MDL SUMP + [369] = "%.4f", -- APU FAIL + [370] = "%.4f", -- CHIP ACCESS MDL - RH - [371] = "%.4f", -- - [372] = "%.4f", -- - [373] = "%.4f", -- - [374] = "%.4f", -- - [375] = "%.4f", -- - [376] = "%.4f", -- - [377] = "%.4f", -- - [378] = "%.4f", -- + [371] = "%.4f", -- MR DE-IACE FAIL + [372] = "%.4f", -- MR DE-ICE FAULT + [373] = "%.4f", -- TR DE-ICE FAIL + [374] = "%.4f", -- ICE DETECTED + [375] = "%.4f", -- MAIN XMSN OIL PRESS + [376] = "%.4f", -- #1 RSVR LOW + [377] = "%.4f", -- #2 RSVR LOW + [378] = "%.4f", -- BACK-UP RSVR LOW [379] = "%.4f", -- #1 ENG ANTI-ICE ON [380] = "%.4f", -- #1 ENG INLET ANTI-ICE ON @@ -375,7 +375,7 @@ ExportScript.ConfigEveryFrameArguments = [396] = "%.4f", -- GREEN BAR -- COMM Panel - [400] = "%.4f", -- Pilot/CPilot ICP XMIT Transmit Radio Selector + [400] = "%0.1f", -- Pilot/CPilot ICP XMIT Transmit Radio Selector [401] = "%.4f", -- Pilot ICP Receive Volume [402] = "%.4f", -- Pilot ICP Hot Mike Switch (Inop.) [403] = "%.4f", -- Comm 1 ON/OFF Switch @@ -444,16 +444,16 @@ ExportScript.ConfigEveryFrameArguments = [462] = "%.4f", -- Aux Fuel Transfer From OUTBD/INBD [463] = "%.4f", -- Aux Fuel Pressurization Selector - [470] = "%.4f", -- - [471] = "%.4f", -- - [472] = "%.4f", -- - [473] = "%.4f", -- - [474] = "%.4f", -- - [475] = "%.4f", -- + [470] = "%.4f", -- Copilot Door + [471] = "%.4f", -- Pilot Door + [472] = "%.4f", -- Left Gunner Window + [473] = "%.4f", -- Right Gunner Window + [474] = "%.4f", -- Left Cargo Door + [475] = "%.4f", -- Right Cargo Door - -- AN/ASN-128B + -- AN/ASN-128B GPS/DPLR [500] = "%.4f", -- AN/ASN-128B Display Selector - [501] = "%.4f", -- AN/ASN-128B Mode Selector + [501] = "%0.2f", -- AN/ASN-128B Mode Selector [502] = "%.4f", -- AN/ASN-128B Btn KYBD [503] = "%.4f", -- AN/ASN-128B Btn LTR LEFT [504] = "%.4f", -- AN/ASN-128B Btn LTR MID @@ -485,14 +485,14 @@ ExportScript.ConfigEveryFrameArguments = [558] = "%.4f", -- Countermeasures Arm Light [559] = "%.4f", -- Countermeasures Arming Switch [560] = "%.4f", -- Chaff Dispenser Mode Selector - [561] = "%.4f", -- + [561] = "%.4f", -- Chaff Dispense -- AN/ARC-201 (FM1) PLT - [600] = "%.4f", -- AN/ARC-201 (FM1) Preset Selector - [601] = "%.4f", -- AN/ARC-201 (FM1) Function Selector - [602] = "%.4f", -- AN/ARC-201 (FM1) Power Selector - [603] = "%.4f", -- AN/ARC-201 (FM1) Mode Selector - [604] = "%.4f", -- + [600] = "%0.2f", -- AN/ARC-201 (FM1) Preset Selector + [601] = "%0.2f", -- AN/ARC-201 (FM1) Function Selector + [602] = "%0.2f", -- AN/ARC-201 (FM1) Power Selector + [603] = "%0.2f", -- AN/ARC-201 (FM1) Mode Selector + [604] = "%.4f", -- AN/ARC-201 (FM1) Volume [605] = "%.4f", -- AN/ARC-201 (FM1) Btn 1 [606] = "%.4f", -- AN/ARC-201 (FM1) Btn 2 [607] = "%.4f", -- AN/ARC-201 (FM1) Btn 3 @@ -510,11 +510,11 @@ ExportScript.ConfigEveryFrameArguments = [619] = "%.4f", -- AN/ARC-201 (FM1) Btn TIME -- AN/ARN-149 ADF - [620] = "%.4f", -- AN/ARN-149 PRESET Selector + [620] = "%0.4f", -- AN/ARN-149 PRESET Selector [621] = "%.4f", -- AN/ARN-149 TONE/OFF/TEST [622] = "%.4f", -- AN/ARN-149 Volume [623] = "%.4f", -- AN/ARN-149 TAKE CMD (Inop.) - [624] = "%.4f", -- AN/ARN-149 POWER Selector + [624] = "%0.1f", -- AN/ARN-149 POWER Selector [625] = "%.4f", -- AN/ARN-149 1000s KHz Selector [626] = "%.4f", -- AN/ARN-149 100s KHz Selector [627] = "%.4f", -- AN/ARN-149 10s KHz Selector @@ -525,8 +525,8 @@ ExportScript.ConfigEveryFrameArguments = [631] = "%.4f", -- -- AN/ARN-147 - [650] = "%.4f", -- AN/ARN-147 MHz Selector - [651] = "%.4f", -- AN/ARN-147 KHz Selector + [650] = "%0.1f", -- AN/ARN-147 MHz Selector + [651] = "%0.1f", -- AN/ARN-147 KHz Selector [652] = "%.4f", -- AN/ARN-147 Marker Beacon HI/LO Switch (Inop.) [653] = "%.4f", -- AN/ARN-147 Power Selector OFF/ON/TEST [654] = "%.4f", -- AN/ARN-147 Display 100s @@ -537,11 +537,11 @@ ExportScript.ConfigEveryFrameArguments = [659] = "%.4f", -- AN/ARN-147 Display .001s -- AN/ARC-201 (FM1) CPLT - [700] = "%.4f", -- AN/ARC-201 (FM1) Preset Selector - [701] = "%.4f", -- AN/ARC-201 (FM1) Function Selector - [702] = "%.4f", -- AN/ARC-201 (FM1) Power Selector - [703] = "%.4f", -- AN/ARC-201 (FM1) Mode Selector - [704] = "%.4f", -- + [700] = "%0.2f", -- AN/ARC-201 (FM1) Preset Selector + [701] = "%0.2f", -- AN/ARC-201 (FM1) Function Selector + [702] = "%0.2f", -- AN/ARC-201 (FM1) Power Selector + [703] = "%0.2f", -- AN/ARC-201 (FM1) Mode Selector + [704] = "%.4f", -- AN/ARC-201 (FM1) Volume [705] = "%.4f", -- AN/ARC-201 (FM1) Btn 1 [706] = "%.4f", -- AN/ARC-201 (FM1) Btn 2 [707] = "%.4f", -- AN/ARC-201 (FM1) Btn 3 @@ -559,9 +559,9 @@ ExportScript.ConfigEveryFrameArguments = [719] = "%.4f", -- AN/ARC-201 (FM1) Btn TIME - [930] = "%.4f", -- SAS 1 ON/OFF Light - [931] = "%.4f", -- - [932] = "%.4f", -- + [930] = "%.4f", -- CIS Heading Mode ON/OFF + [931] = "%.4f", -- CIS Nav Mode ON/OFF + [932] = "%.4f", -- CIS Altitude Hold Mode ON/OFF -- Vertical Situation Indicator (VSI) [980] = "%.4f", -- Vertical Situation Indicator (VSI) GA Indication Light Pilot @@ -571,8 +571,9 @@ ExportScript.ConfigEveryFrameArguments = [984] = "%.4f", -- Vertical Situation Indicator (VSI) Decision Height (DH) Light CPilot [985] = "%.4f", -- Vertical Situation Indicator (VSI) MB Indication Light CPilot 3 - [1100] = "%.4f", -- - [1106] = "%.4f", -- + -- AN/AVS-7 HUD Heads Up Display + [1100] = "%.4f", -- AN/AVS-7 Power Switch OFF/ON/ADJUDST + [1106] = "%.4f", -- Pilot Dim Bright [1201] = "%.4f", -- [1202] = "%.4f", -- [1203] = "%.4f", -- @@ -583,16 +584,21 @@ ExportScript.ConfigEveryFrameArguments = [3407] = "%.4f", -- Stab Position Flag } + +--you should put switches in here. ExportScript.ConfigArguments = { } + function ExportScript.ProcessIkarusDCSConfigHighImportance(mainPanelDevice) end + function ExportScript.ProcessDACConfigHighImportance(mainPanelDevice) end + function ExportScript.ProcessIkarusDCSConfigLowImportance(mainPanelDevice) ExportScript.Radios(mainPanelDevice) @@ -600,9 +606,9 @@ function ExportScript.ProcessIkarusDCSConfigLowImportance(mainPanelDevice) ExportScript.NavInstruments(mainPanelDevice) ExportScript.NavModes(mainPanelDevice) ExportScript.VrsCalculator(mainPanelDevice) - --ExportScript.HiLowCalculator(mainPanelDevice) - --ExportScript.RadioTile(mainPanelDevice) - + ExportScript.PlayWithFire2(mainPanelDevice) + ExportScript.UhfSuperFromListIndication(mainPanelDevice) + --ExportScript.HiLowCalculator(mainPanelDevice)--Not implemented end function ExportScript.ProcessDACConfigLowImportance(mainPanelDevice) @@ -612,8 +618,9 @@ end -- Custom Functions -- -- -- -- -- -- -- -- -- -- -- -- + function ExportScript.Radios(mainPanelDevice) --- TODO: Clean up radio presentation + -- ADF Radio local ADF_digit1 = round(mainPanelDevice:get_argument_value(625)*2,0) local ADF_digit2 = round(mainPanelDevice:get_argument_value(626)*10,0) @@ -634,25 +641,23 @@ function ExportScript.Radios(mainPanelDevice) ADF_freq = "0" .. ADF_freq end - ExportScript.Tools.SendData(4000, "ADF\n" .. ADF_freq .. "\nKHz") + ExportScript.Tools.SendData(4000, "ADF KHz\n" .. ADF_freq) - -- UHF Radio - local UHF_digit1 = round(mainPanelDevice:get_argument_value(53) * 10,0) + 2 - local UHF_digit2 = round(mainPanelDevice:get_argument_value(54) * 10,0) - local UHF_digit3 = round(mainPanelDevice:get_argument_value(55) * 10,0) - local UHF_digit4 = round(mainPanelDevice:get_argument_value(56) * 10,0) - local UHF_digit5 = round(mainPanelDevice:get_argument_value(57) * 250,0) + -- Uhf new method + local UHF_freq = string.format("%3.3f", GetDevice(5):get_frequency()/1000000) + ExportScript.Tools.SendData(4001,"UHF MHz\n" .. UHF_freq) - local UHF_freq = string.format("%3.3f", UHF_digit1 .. UHF_digit2 .. UHF_digit3 - .. "." .. UHF_digit4 .. UHF_digit5) - - ExportScript.Tools.SendData(4001, "UHF\n" .. UHF_freq .. "\nMHz") + -- FM1 + local FM1_freq = string.format("%3.2f", GetDevice(6):get_frequency()/100000) + ExportScript.Tools.SendData(4002, "FM1 MHz\n" .. FM1_freq) - -- FM Radio PLT - -- Not possible via arguements + -- FM2 + local FM2_freq = string.format("%3.2f", GetDevice(10):get_frequency()/100000) + ExportScript.Tools.SendData(4003, "FM2 MHz\n" .. FM2_freq) - -- FM Radio CPLT - -- Not possible via arguements + -- VHF + local VHF_freq = string.format("%3.3f", GetDevice(8):get_frequency()/1000000) + ExportScript.Tools.SendData(4004, "VHF MHz\n" .. VHF_freq) -- VOR/ILS Nav Radio @@ -666,7 +671,7 @@ function ExportScript.Radios(mainPanelDevice) local NAV_freq = string.format("%3.3f", NAV_digit1 .. NAV_digit2 .. NAV_digit3 .. "." .. NAV_digit4 .. NAV_digit5 ..NAV_digit6) - ExportScript.Tools.SendData(4002, "NAV\n" .. NAV_freq .. "\nMHz") + ExportScript.Tools.SendData(4005, "NAV MHz\n" .. NAV_freq) --https://emojipedia.org/black-circle/ --🟢 green circle. trust me @@ -678,8 +683,8 @@ function ExportScript.Radios(mainPanelDevice) --🟡 yellow circle --❌ red X - --ExportScript.Tools.SendData(5000, "🟢⚪⚫") - --ExportScript.Tools.SendData(5001, "🔵🔘🔴") + --ExportScript.Tools.SendData(xxxx, "🟢⚪⚫") + --ExportScript.Tools.SendData(xxxx, "🔵🔘🔴") --if a radio is off then red --if radio on then yellow @@ -768,43 +773,29 @@ function ExportScript.Radios(mainPanelDevice) radio5_hf_status = "❌"--red X end - ExportScript.Tools.SendData(4003, radio0_ics_Status .. "ICS \n" - .. radio1_FmPlt_status .. "FM P \n" + ExportScript.Tools.SendData(4007, radio0_ics_Status .. "ICS \n" + .. radio1_FmPlt_status .. "FM 1 \n" .. radio2_uhf_status .. "UHF ") - ExportScript.Tools.SendData(4004, radio3_vhf_status .. "VHF \n" - .. radio4_FmCPlt_status .. "FM CP\n" - .. radio5_hf_status .. "HF ") + ExportScript.Tools.SendData(4008, radio3_vhf_status .. "VHF \n" + .. radio4_FmCPlt_status .. "FM 2\n" + .. radio5_hf_status .. "HF ") end -function ExportScript.RadioTile(mainPanelDevice)--this isnt for this module - - local radio1 = (GetDevice(25):get_frequency())/1000000 -- left radio freq unrounded - local radio2 = (GetDevice(26):get_frequency())/1000000 -- right radio freq unrounded - - ExportScript.Tools.SendData(2001, radio1) -- results in "108.000568" for channel 1 - ExportScript.Tools.SendData(2002, radio2) -- results in "108.500744" for channel 2 -end - - function ExportScript.FlightInstruments(mainPanelDevice) --- This will contain airspeed, altitude, and vertical speed ---[[ - - [100] = "%.4f", -- Airspeed Indicator - [103] = "%.4f", -- Vertical Speed Indicator (VSI) - [132] = "%.4f", -- HSI Compass Rotation PLT -]] -- TODO: this will need to be adjusted later because the arg is not linear local airspeedIndicator = round(mainPanelDevice:get_argument_value(100)*250,0) + ExportScript.Tools.SendData(4009, "Kts\n" .. airspeedIndicator) + -- TODO: this will need to be adjusted later because the arg is not linear local verticalSpeedIndicator = round(mainPanelDevice:get_argument_value(103)*4000,0) verticalSpeedIndicator = format_int(verticalSpeedIndicator) --puts a comma in it + ExportScript.Tools.SendData(4010, "VS\n" .. verticalSpeedIndicator) local compassDegrees_PLT = round(mainPanelDevice:get_argument_value(132)*360,0) @@ -815,53 +806,6 @@ function ExportScript.FlightInstruments(mainPanelDevice) local compassDegrees_CPLT_string = addZeros3(compassDegrees_CPLT) --- TODO: Make sure that copilot altimeter is done independantly. (and VSI?) (and airspeed?) - - --[[ - - [60] = "%.4f", -- Altimeter 100s PLT - [61] = "%.4f", -- Altimeter 1000s PLT - [62] = "%.4f", -- Altimeter 10000s PLT - [63] = "%.4f", -- - [64] = "%.4f", -- Kollsman Window Digit 1 PLT - [65] = "%.4f", -- Kollsman Window Digit 2 PLT - [66] = "%.4f", -- Kollsman Window Digit 3 PLT - [67] = "%.4f", -- Kollsman Window Digit 4 PLT - [68] = "%.4f", -- Altimeter Flag PLT - - [70] = "%.4f", -- Altimeter 100s CPLT - [71] = "%.4f", -- Altimeter 1000s CPLT - [72] = "%.4f", -- Altimeter 10000s CPLT - - -- Radar Altimeter PLT - [170] = "%.4f", -- Radar Altimeter Low Set Knob PLT - [171] = "%.4f", -- Radar Altimeter High Set Knob PLT - [173] = "%.4f", -- Radar Altimeter Indicator Needle PLT - [174] = "%.4f", -- Radar Altimeter 1000s Indicator PLT - [175] = "%.4f", -- Radar Altimeter 100s Indicator PLT - [176] = "%.4f", -- Radar Altimeter 10s Indicator PLT - [177] = "%.4f", -- Radar Altimeter 1s Indicator PLT - [178] = "%.4f", -- Radar Altimeter Low Bug PLT - [179] = "%.4f", -- Radar Altimeter High Bug PLT - [180] = "%.4f", -- Radar Altimeter Low Flag PLT - [181] = "%.4f", -- Radar Altimeter High Flag PLT - [182] = "%.4f", -- Radar Altimeter Off Flag PLT - - -- Radar Altimeter CPLT - [183] = "%.4f", -- Radar Altimeter Low Set Knob CPLT - [184] = "%.4f", -- Radar Altimeter High Set Knob CPLT - [186] = "%.4f", -- Radar Altimeter Indicator Needle CPLT - [187] = "%.4f", -- Radar Altimeter 1000s Indicator CPLT - [188] = "%.4f", -- Radar Altimeter 100s Indicator CPLT - [189] = "%.4f", -- Radar Altimeter 10s Indicator CPLT - [190] = "%.4f", -- Radar Altimeter 1s Indicator CPLT - [191] = "%.4f", -- Radar Altimeter Low Bug CPLT - [192] = "%.4f", -- Radar Altimeter High Bug CPLT - [193] = "%.4f", -- Radar Altimeter Low Flag CPLT - [194] = "%.4f", -- Radar Altimeter High Flag CPLT - [195] = "%.4f", -- Radar Altimeter Off Flag CPLT - ]] - local radarAltimeterDisplay local radarAltimeterDisplay_1000s = round(mainPanelDevice:get_argument_value(174)*10,0) local radarAltimeterDisplay_100s = round(mainPanelDevice:get_argument_value(175)*10,0) @@ -901,24 +845,30 @@ function ExportScript.FlightInstruments(mainPanelDevice) local radarAltimeterDisplay_withComma = format_int(radarAltimeterDisplay) --put a comma local altitudeToDisplay = radarAltimeterDisplay_withComma - if radarAltimeterDisplay == "1500" then -- this is the max limit of the radalt, so use baro + local altitudeSign = "R" -- Determines which sign the use for the altitude + if radarAltimeterDisplay == "1500" or mainPanelDevice:get_argument_value(182) < 0.5 then -- this is the max limit of the radalt and the radalt flag off, so use baro. altitudeToDisplay = format_int(baroAltimeterDisplay) + altitudeSign = "B" + end + + ExportScript.Tools.SendData(4011, "ALT\n" .. altitudeToDisplay .. " " .. altitudeSign) -- Pilot Tile - ExportScript.Tools.SendData(4005, "HDG " .. compassDegrees_PLT_string - .. "\nKTS " .. airspeedIndicator + ExportScript.Tools.SendData(4034, "HDG " .. compassDegrees_PLT_string + .. "\nKts " .. airspeedIndicator .. "\nALT " .. altitudeToDisplay .. "\nVSI " .. verticalSpeedIndicator) -- Copilot Tile - ExportScript.Tools.SendData(4006, "HDG " .. compassDegrees_CPLT_string - .. "\nKTS " .. airspeedIndicator + ExportScript.Tools.SendData(4035, "HDG " .. compassDegrees_CPLT_string + .. "\nKts " .. airspeedIndicator .. "\nALT " .. altitudeToDisplay .. "\nVSI " .. verticalSpeedIndicator) end + function ExportScript.NavInstruments(mainPanelDevice) -- Pilot Side @@ -946,6 +896,7 @@ function ExportScript.NavInstruments(mainPanelDevice) courseWindow_PLT = addZeros3(courseWindow_PLT) + local distanceWindow_100s = round((mainPanelDevice:get_argument_value(139)*10),0) local distanceWindow_10s = round((mainPanelDevice:get_argument_value(140)*10),0) local distanceWindow_1s = round((mainPanelDevice:get_argument_value(141)*10),0) @@ -960,7 +911,7 @@ function ExportScript.NavInstruments(mainPanelDevice) .. distanceWindow_1s .. "." .. distanceWindow_01s) end - ExportScript.Tools.SendData(4007, distanceWindow) + ExportScript.Tools.SendData(4054, distanceWindow .. "\nKM") -- Copilot Side @@ -985,39 +936,55 @@ function ExportScript.NavInstruments(mainPanelDevice) local courseWindow_CPLT = string.format("%.1d" , courseWindow_CPLT_100s .. courseWindow_CPLT_10s .. courseWindow_CPLT_1s) courseWindow_CPLT = addZeros3(courseWindow_CPLT) + ExportScript.Tools.SendData(4044, "CRS\n" .. courseWindow_PLT .. "°") + ExportScript.Tools.SendData(4045, "CRS\n" .. courseWindow_CPLT .. "°") + + ExportScript.Tools.SendData(4046, "HDG\n" .. compassDegrees_PLT_string .. "°") + ExportScript.Tools.SendData(4047, "HDG\n" .. compassDegrees_CPLT_string .. "°") + + ExportScript.Tools.SendData(4048, "BUG\n" .. hsiHeadingBug_PLT .. "°") + ExportScript.Tools.SendData(4049, "BUG\n" .. hsiHeadingBug_CPLT .. "°") + + ExportScript.Tools.SendData(4050, "N1\n" .. hsiBearingNeedle_1_PLT .. "°") + ExportScript.Tools.SendData(4051, "N1\n" .. hsiBearingNeedle_1_CPLT .. "°") + + ExportScript.Tools.SendData(4052, "N2\n" .. hsiBearingNeedle_2_PLT .. "°") + ExportScript.Tools.SendData(4053, "N2\n" .. hsiBearingNeedle_2_CPLT .. "°") + + -- Pilot Tile Nav - ExportScript.Tools.SendData(4010, "HDG " .. compassDegrees_PLT_string + ExportScript.Tools.SendData(4036, "HDG " .. compassDegrees_PLT_string .. "\nBUG " .. hsiHeadingBug_PLT .. "\nN1 " .. hsiBearingNeedle_1_PLT .. "\nN2 " .. hsiBearingNeedle_2_PLT) -- Copilot Tile Nav - ExportScript.Tools.SendData(4011, "HDG " .. compassDegrees_CPLT_string + ExportScript.Tools.SendData(4037, "HDG " .. compassDegrees_CPLT_string .. "\nBUG " .. hsiHeadingBug_CPLT .. "\nN1 " .. hsiBearingNeedle_1_CPLT .. "\nN2 " .. hsiBearingNeedle_2_CPLT) -- Pilot Tile GPS Nav - ExportScript.Tools.SendData(4010, "HDG " .. compassDegrees_PLT_string + ExportScript.Tools.SendData(4038, "HDG " .. compassDegrees_PLT_string .. "\nBUG " .. hsiHeadingBug_PLT .. "\nCRS " .. courseWindow_PLT .. "\nN1 " .. hsiBearingNeedle_1_PLT) -- Copilot Tile GPS Nav - ExportScript.Tools.SendData(4011, "HDG " .. compassDegrees_CPLT_string + ExportScript.Tools.SendData(4039, "HDG " .. compassDegrees_CPLT_string .. "\nBUG " .. hsiHeadingBug_CPLT .. "\nCRS " .. courseWindow_CPLT .. "\nN1 " .. hsiBearingNeedle_1_CPLT) -- Pilot Tile VOR/NDB NAV - ExportScript.Tools.SendData(4010, "HDG " .. compassDegrees_PLT_string + ExportScript.Tools.SendData(4040, "HDG " .. compassDegrees_PLT_string .. "\nBUG " .. hsiHeadingBug_PLT .. "\nCRS " .. courseWindow_PLT .. "\nN2 " .. hsiBearingNeedle_2_PLT) -- Copilot Tile VOR/NDB NAV - ExportScript.Tools.SendData(4011, "HDG " .. compassDegrees_CPLT_string + ExportScript.Tools.SendData(4041, "HDG " .. compassDegrees_CPLT_string .. "\nBUG " .. hsiHeadingBug_CPLT .. "\nCRS " .. courseWindow_CPLT .. "\nN2 " .. hsiBearingNeedle_2_CPLT) @@ -1026,6 +993,7 @@ function ExportScript.NavInstruments(mainPanelDevice) end + function ExportScript.NavModes(mainPanelDevice) --this function will serve to blank out any modes that are not "on" @@ -1177,6 +1145,7 @@ function ExportScript.NavModes(mainPanelDevice) end + function ExportScript.VrsCalculator(mainPanelDevice) --this is a VRS calculator --Conditions for vrs are Out of ground effect (30meters high), less than 30 kts, and more than 500fpm decent @@ -1220,11 +1189,10 @@ function ExportScript.VrsCalculator(mainPanelDevice) end - radarAltimeterDisplay = string.format("%.1d" , radarAltimeterDisplay_1000s .. radarAltimeterDisplay_100s .. radarAltimeterDisplay_10s .. radarAltimeterDisplay_1s) - ExportScript.Tools.SendData(4038,radarAltimeterDisplay) + ExportScript.Tools.SendData(4042, "RADALT\n" .. radarAltimeterDisplay .. " ft") if tonumber(radarAltimeterDisplay) < limit_altitude then @@ -1246,10 +1214,11 @@ function ExportScript.VrsCalculator(mainPanelDevice) isInVrs = 1 end - ExportScript.Tools.SendData(4037, isInVrs) + ExportScript.Tools.SendData(4043, isInVrs) end + function ExportScript.HiLowCalculator(mainPanelDevice) --TODO: maybe @@ -1275,19 +1244,686 @@ function ExportScript.HiLowCalculator(mainPanelDevice) end ---[[ -Ideas for more functions: -- rad alt readout with danger colors -- stab deg vs kias limit readout/meter +function ExportScript.PlayWithFire2(mainPanelDevice) + + -- Container for all of the cockpit parameters -- + local cockpitParamContainer = getCockpitParam() + + ---------------- + -- Engine TRQ -- + ---------------- + local PDU_PLT_E1_TRQ = string.format("%.0f", cockpitParamContainer.PDU_PLT_E1_TRQ) + local PDU_PLT_E2_TRQ = string.format("%.0f", cockpitParamContainer.PDU_PLT_E2_TRQ) + + ExportScript.Tools.SendData(4200, "TRQ 1\n" .. PDU_PLT_E1_TRQ .. "%") + ExportScript.Tools.SendData(4201, "TRQ 2\n" .. PDU_PLT_E2_TRQ .. "%") + ExportScript.Tools.SendData(4202, "TRQ" + .. "\n1-" .. PDU_PLT_E1_TRQ .. "%" + .. "\n2-" .. PDU_PLT_E2_TRQ .. "%") + + local is_E1_TRQ_emer = 0 + local is_E2_TRQ_emer = 0 + local is_TRQ_emer = 0 + local TRQ_caut_limit = 100 + local TRQ_warn_limit = 135 + + if tonumber(PDU_PLT_E1_TRQ) > TRQ_caut_limit + then is_E1_TRQ_emer = 1 + end + + if tonumber(PDU_PLT_E2_TRQ) > TRQ_caut_limit + then is_E2_TRQ_emer = 1 + end + + if is_E1_TRQ_emer == 1 or + is_E2_TRQ_emer == 1 + then is_TRQ_emer = 1 + end + ExportScript.Tools.SendData(4300, is_E1_TRQ_emer) + ExportScript.Tools.SendData(4301, is_E1_TRQ_emer) + ExportScript.Tools.SendData(4302, is_TRQ_emer) + ------------------- + -- Engine TRQ END-- + ------------------- + + + ---------------- + -- Engine RPM -- + ---------------- + local PDU_PLT_E1NP_HI = string.format("%.0f", cockpitParamContainer.PDU_PLT_E1NP_HI) + local PDU_PLT_RRPM_HI = string.format("%.0f", cockpitParamContainer.PDU_PLT_RRPM_HI) + local PDU_PLT_E2NP_HI = string.format("%.0f", cockpitParamContainer.PDU_PLT_E2NP_HI) + + ExportScript.Tools.SendData(4203, "RPM 1\n" .. PDU_PLT_E1NP_HI .. "%") + ExportScript.Tools.SendData(4204, "RRPM\n" .. PDU_PLT_RRPM_HI .. "%") + ExportScript.Tools.SendData(4205, "RPM 2\n" .. PDU_PLT_E2NP_HI .. "%") + + ExportScript.Tools.SendData(4206, "RPM\n" .. "1-" .. PDU_PLT_E1NP_HI .. "%" + .. "\nR-" .. PDU_PLT_RRPM_HI .. "%" + .. "\n2-" .. PDU_PLT_E2NP_HI .. "%") + + local is_E1_NP_emer = 0 + local is_RRPM_emer = 0 + local is_E2_NP_emer = 0 + local is_RPM_emer = 0 + + local RPM_caut_limitLo = 94 + local RPM_caut_limitHi = 102 + local RRPM_caut_limitLo = 94 + local RRPM_caut_limitHi = 102 + + + if tonumber(PDU_PLT_E1NP_HI) > RPM_caut_limitHi or + tonumber(PDU_PLT_E1NP_HI) < RPM_caut_limitLo + then is_E1_NP_emer = 1 + end + + if tonumber(PDU_PLT_E2NP_HI) > RPM_caut_limitHi or + tonumber(PDU_PLT_E2NP_HI) < RPM_caut_limitLo + then is_E2_NP_emer = 1 + end + + if tonumber(PDU_PLT_RRPM_HI) > RRPM_caut_limitHi or + tonumber(PDU_PLT_RRPM_HI) < RRPM_caut_limitLo + then is_RRPM_emer = 1 + end + + --conditions to catch the off status + --this prevents shut-down engines as "emergency" status + if tonumber(PDU_PLT_E1NP_HI) == 0 then is_E1_NP_emer = 0 end + if tonumber(PDU_PLT_RRPM_HI) == 0 then is_RRPM_emer = 0 end + if tonumber(PDU_PLT_E2NP_HI) == 0 then is_E2_NP_emer = 0 end + + + if is_E1_NP_emer == 1 or is_E2_NP_emer == 1 or is_RRPM_emer == 1 + then is_RPM_emer = 1 + end + + ExportScript.Tools.SendData(4303, is_E1_NP_emer) + ExportScript.Tools.SendData(4304, is_RRPM_emer) + ExportScript.Tools.SendData(4305, is_E2_NP_emer) + ExportScript.Tools.SendData(4306, is_RPM_emer) + -------------------- + -- Engine RPM END-- + -------------------- + + + --------------- + -- Engine Ng -- + --------------- + local CDU_NG1_DIGITS = string.format("%.1f", cockpitParamContainer.CDU_NG1_DIGITS/10) + local CDU_NG2_DIGITS = string.format("%.1f", cockpitParamContainer.CDU_NG2_DIGITS/10) + + ExportScript.Tools.SendData(4207, "Ng 1\n" .. CDU_NG1_DIGITS .. "%") + ExportScript.Tools.SendData(4208, "Ng 2\n" .. CDU_NG2_DIGITS .. "%") + ExportScript.Tools.SendData(4209, "Ng\n1-" .. CDU_NG1_DIGITS .. "%\n2-" .. CDU_NG2_DIGITS .. "%") + + + local is_NG1_emer = 0 + local is_NG2_emer = 0 + local is_NG_emer = 0 + local TRQ_caut_limit = 99 + local TRQ_warn_limit = 105 + + if tonumber(CDU_NG1_DIGITS) > TRQ_caut_limit + then is_NG1_emer = 1 + end + + if tonumber(CDU_NG2_DIGITS) > TRQ_caut_limit + then is_NG2_emer = 1 + end + + --this isnt actually needed for this because the limit is only high end + if tonumber(CDU_NG1_DIGITS) == 0 then is_NG1_emer = 0 end + if tonumber(CDU_NG2_DIGITS) == 0 then is_NG2_emer = 0 end + + + if is_NG1_emer == 1 or is_NG2_emer == 1 + then is_NG_emer = 1 + end + + ExportScript.Tools.SendData(4307, is_E1_TRQ_emer) + ExportScript.Tools.SendData(4308, is_E1_TRQ_emer) + ExportScript.Tools.SendData(4309, is_TRQ_emer) + ------------------- + -- Engine Ng END -- + ------------------- + + + ---------------- + -- Engine TGT -- + ---------------- + local CDU_TGT1_DIGITS = string.format("%.0f", cockpitParamContainer.CDU_TGT1_DIGITS) + local CDU_TGT2_DIGITS = string.format("%.0f", cockpitParamContainer.CDU_TGT2_DIGITS) + + ExportScript.Tools.SendData(4210, "TGT 1\n" .. CDU_TGT1_DIGITS .. "°") + ExportScript.Tools.SendData(4211, "TGT 2\n" .. CDU_TGT2_DIGITS .. "°") + ExportScript.Tools.SendData(4212, "TGT\n1-" .. CDU_TGT1_DIGITS .. "°\n2-" .. CDU_TGT2_DIGITS .. "°") + + + local is_TGT1_emer = 0 + local is_TGT2_emer = 0 + local is_TGT_emer = 0 + local TRQ_caut_limit = 810 + local TRQ_warn_limit = 878 + + if tonumber(CDU_TGT1_DIGITS) > TRQ_caut_limit + then is_TGT1_emer = 1 + end + + if tonumber(CDU_TGT2_DIGITS) > TRQ_caut_limit + then is_TGT2_emer = 1 + end + + if is_TGT1_emer == 1 or is_TGT2_emer == 1 + then is_TGT_emer = 1 + end + + ExportScript.Tools.SendData(4310, is_TGT1_emer) + ExportScript.Tools.SendData(4311, is_TGT2_emer) + ExportScript.Tools.SendData(4312, is_TGT_emer) + ------------------- + -- Engine TGT END-- + ------------------- + + + + + + + ---------------------- + -- Engine OIL Press -- + ---------------------- + local CDU_E1OILPRESS_HI = string.format("%.0f", cockpitParamContainer.CDU_E1OILPRESS_HI) + local CDU_E2OILPRESS_HI = string.format("%.0f", cockpitParamContainer.CDU_E2OILPRESS_HI) + + ExportScript.Tools.SendData(4213, "OIL P1\n" .. CDU_E1OILPRESS_HI) + ExportScript.Tools.SendData(4214, "OIL P2\n" .. CDU_E2OILPRESS_HI) + ExportScript.Tools.SendData(4215, "OIL P\n1-" .. CDU_E1OILPRESS_HI .. "\n2-" .. CDU_E2OILPRESS_HI) + + local is_E1_OILPRESS_emer = 0 + local is_E2_OILPRESS_emer = 0 + local is_OILPRESS_emer = 0 + local OILPRESS_caut_limitLo = 45 + local OILPRESS_warn_limitLo = 20 + local OILPRESS_caut_limitHi = 100 + local OILPRESS_warn_limitHi = 100 + + if tonumber(CDU_E1OILPRESS_HI) < OILPRESS_caut_limitLo or + tonumber(CDU_E1OILPRESS_HI) > OILPRESS_caut_limitHi + then is_E1_OILPRESS_emer = 1 + end + + if tonumber(CDU_E2OILPRESS_HI) < OILPRESS_caut_limitLo or + tonumber(CDU_E2OILPRESS_HI) > OILPRESS_caut_limitHi + then is_E2_OILPRESS_emer = 1 + end + + if tonumber(CDU_E1OILPRESS_HI) == 0 then is_E1_OILPRESS_emer = 0 end + if tonumber(CDU_E2OILPRESS_HI) == 0 then is_E2_OILPRESS_emer = 0 end + + if is_E1_OILPRESS_emer == 1 or is_E2_OILPRESS_emer == 1 + then is_OILPRESS_emer = 1 + end + + ExportScript.Tools.SendData(4313, is_E1_OILPRESS_emer) + ExportScript.Tools.SendData(4314, is_E2_OILPRESS_emer) + ExportScript.Tools.SendData(4315, is_OILPRESS_emer) + -------------------------- + -- Engine OIL Press END -- + -------------------------- + + --------------------- + -- Engine OIL Temp -- + --------------------- + local CDU_E1OILTEMP_HI = string.format("%.0f", cockpitParamContainer.CDU_E1OILTEMP_HI) + local CDU_E2OILTEMP_HI = string.format("%.0f", cockpitParamContainer.CDU_E2OILTEMP_HI) + + ExportScript.Tools.SendData(4216, "OIL T1\n".. CDU_E1OILTEMP_HI .. "°") + ExportScript.Tools.SendData(4217, "OIL T2\n".. CDU_E2OILTEMP_HI .. "°") + ExportScript.Tools.SendData(4218, "OIL T\n1-" .. CDU_E1OILTEMP_HI .. "°\n2-" .. CDU_E2OILTEMP_HI .. "°") + + local is_E1_OILTEMP_emer = 0 + local is_E2_OILTEMP_emer = 0 + local is_OILTEMP_emer = 0 + local OILTEMP_caut_limit = 135 + local OILPRESS_warn_limit = 150 + + if tonumber(CDU_E1OILTEMP_HI) > OILTEMP_caut_limit + then is_E1_OILTEMP_emer = 1 + end + + if tonumber(CDU_E2OILTEMP_HI) > OILTEMP_caut_limit + then is_E2_OILTEMP_emer = 1 + end + + if is_E1_OILTEMP_emer == 1 or is_E2_OILTEMP_emer == 1 + then is_OILTEMP_emer = 1 + end + + ExportScript.Tools.SendData(4316, is_E1_OILTEMP_emer) + ExportScript.Tools.SendData(4317, is_E2_OILTEMP_emer) + ExportScript.Tools.SendData(4318, is_OILTEMP_emer) + ------------------------- + -- Engine OIL Temp END -- + ------------------------- + + + ------------------------------------------- + -- Engine XMSN Transmission and Pressure -- + ------------------------------------------- + local CDU_XMSNTEMP_HI = string.format("%2.1f", cockpitParamContainer.CDU_XMSNTEMP_HI) + local CDU_XMSNPRESS_HI = string.format("%2.1f", cockpitParamContainer.CDU_XMSNPRESS_HI) + + + ExportScript.Tools.SendData(4219, "XMSN T\n" .. CDU_XMSNTEMP_HI .. "°") + ExportScript.Tools.SendData(4220, "XMSN P\n" .. CDU_XMSNPRESS_HI) + ExportScript.Tools.SendData(4221, "XMSN" + .. "\nT " .. CDU_XMSNTEMP_HI .. "°" + .. "\nP " .. CDU_XMSNPRESS_HI) + + + + local is_XMSN_TEMP_emer = 0 + local is_XMSN_PRESS_emer = 0 + local is_XMSN_emer = 0 + local XMSN_TEMP_caut_limit = 105 + local XMSN_TEMP_warn_limit = 140 + local XMSN_PRESS_caut_limitHi = 65 + local XMSN_PRESS_warn_limitHi = 130 + local XMSN_PRESS_caut_limitLo = 30 + local XMSN_PRESS_warn_limitLo = 20 + + + if tonumber(CDU_XMSNTEMP_HI) > XMSN_TEMP_caut_limit + then is_XMSN_TEMP_emer = 1 + end + + + if tonumber(CDU_XMSNPRESS_HI) > XMSN_PRESS_caut_limitHi or + tonumber(CDU_XMSNPRESS_HI) < XMSN_PRESS_caut_limitLo + then is_XMSN_PRESS_emer = 1 + end + + if tonumber(CDU_XMSNTEMP_HI) == 0 then is_XMSN_TEMP_emer = 0 end + if tonumber(CDU_XMSNPRESS_HI) == 0 then is_XMSN_PRESS_emer = 0 end + + if is_XMSN_TEMP_emer == 1 or is_XMSN_PRESS_emer == 1 + then is_XMSN_emer = 1 + end + + ExportScript.Tools.SendData(4319, is_XMSN_TEMP_emer) + ExportScript.Tools.SendData(4320, is_XMSN_PRESS_emer) + ExportScript.Tools.SendData(4321, is_XMSN_emer) + ----------------------------------------------- + -- Engine XMSN Transmission and Pressure END -- + ----------------------------------------------- + + ---------------------------- + -- Fuel Dashboard readout -- + ---------------------------- + local CDU_FUEL_DIGITS = string.format("%.0f", cockpitParamContainer.CDU_FUEL_DIGITS) + + local CDU_FUEL_L_HI = string.format("%.0f", cockpitParamContainer.CDU_FUEL_L_HI) + local CDU_FUEL_R_HI = string.format("%.0f", cockpitParamContainer.CDU_FUEL_R_HI) + + ExportScript.Tools.SendData(4222, "TOT FUEL\n" .. CDU_FUEL_DIGITS) + ExportScript.Tools.SendData(4223, "FUEL L\n" .. CDU_FUEL_L_HI) + ExportScript.Tools.SendData(4224, "FUEL R\n" .. CDU_FUEL_R_HI) + ExportScript.Tools.SendData(4225, "FUEL " .. CDU_FUEL_DIGITS .. "\nL " + .. CDU_FUEL_L_HI .. "\nR " + .. CDU_FUEL_R_HI) + + + local is_FUEL_L_emer = 0 + local is_FUEL_R_emer = 0 + local is_FUEL_emer = 0 + local FUEL_caut_limit = 200 + + if tonumber(CDU_FUEL_L_HI) < FUEL_caut_limit + then is_FUEL_L_emer = 1 + end + + if tonumber(CDU_FUEL_R_HI) < FUEL_caut_limit + then is_FUEL_R_emer = 1 + end + + if tonumber(CDU_FUEL_L_HI) == 0 then is_FUEL_L_emer = 0 end + if tonumber(CDU_FUEL_R_HI) == 0 then is_FUEL_R_emer = 0 end + + if is_FUEL_L_emer == 1 or is_FUEL_R_emer == 1 + then is_FUEL_emer = 1 + end + + ExportScript.Tools.SendData(4322, is_FUEL_emer) + ExportScript.Tools.SendData(4323, is_FUEL_L_emer) + ExportScript.Tools.SendData(4324, is_FUEL_R_emer) + ExportScript.Tools.SendData(4325, is_FUEL_emer) + + + local fuel_OUTBD_L = cockpitParamContainer.AFMS_DISPLAY_OUTBD_L + local fuel_INBD_L = cockpitParamContainer.AFMS_DISPLAY_INBD_L + local fuel_INBD_R = cockpitParamContainer.AFMS_DISPLAY_INBD_R + local fuel_OUTBD_R = cockpitParamContainer.AFMS_DISPLAY_OUTBD_R + + local emptyFuelString = "cccc" + + if string.find(fuel_OUTBD_L, "cccc") then + fuel_OUTBD_L = emptyFuelString + else + fuel_OUTBD_L = format_int(fuel_OUTBD_L) + end + + if string.find(fuel_INBD_L, "cccc") then + fuel_INBD_L = emptyFuelString + else + fuel_INBD_L = format_int(fuel_INBD_L) + end + + if string.find(fuel_INBD_R, "cccc") then + fuel_INBD_R = emptyFuelString + else + fuel_INBD_R = format_int(fuel_INBD_R) + end + + if string.find(fuel_OUTBD_R, "cccc") then + fuel_OUTBD_R = emptyFuelString + else + fuel_OUTBD_R = format_int(fuel_OUTBD_R) + end + + + ExportScript.Tools.SendData(4226, "FUEL OL\n" .. fuel_OUTBD_L) + ExportScript.Tools.SendData(4227, "FUEL IL\n" .. fuel_INBD_L) + ExportScript.Tools.SendData(4228, "FUEL IR\n" .. fuel_INBD_R) + ExportScript.Tools.SendData(4229, "FUEL OR\n" .. fuel_OUTBD_R) + + ExportScript.Tools.SendData(4230, "AUX FUEL " + .. "\nOL " .. fuel_OUTBD_L + .. "\nIL " .. fuel_INBD_L + .. "\nIR " .. fuel_INBD_R + .. "\nOR " .. fuel_OUTBD_R) + + ExportScript.Tools.SendData(4231, "AUX FUEL " + .. "\nOL " .. fuel_OUTBD_L + .. "\nIL " .. fuel_INBD_L + ) + + ExportScript.Tools.SendData(4232, "AUX FUEL " + .. "\nIR " .. fuel_INBD_R + .. "\nOR " .. fuel_OUTBD_R) + + + -- Fuel Tile + ExportScript.Tools.SendData(4233, "FUEL " .. CDU_FUEL_DIGITS + .. "\nOL " .. fuel_OUTBD_L + .. "\nIL " .. fuel_INBD_L + .. "\nIR " .. fuel_INBD_R + .. "\nOR " .. fuel_OUTBD_R) + + ---------------------------- + -- Fuel Dashboard readout -- + ---------------------------- + + + ------------ + -- unused -- + ------------ + + local UHF_FREQ = cockpitParamContainer.UHF_FREQ + local VHF_AM_FREQ = cockpitParamContainer.VHF_AM_FREQ + + --ExportScript.Tools.SendData(4205, + --ExportScript.Tools.SendData(4205, + --ExportScript.Tools.SendData(4205, + + ------------ + -- unused -- + ------------ + --seems to be 1 or 0. I have never seen the lights lit + local PDU_PLT_OVERSPEED1 = cockpitParamContainer.PDU_PLT_OVERSPEED1 + local PDU_PLT_OVERSPEED2 = cockpitParamContainer.PDU_PLT_OVERSPEED2 + local PDU_PLT_OVERSPEED3 = cockpitParamContainer.PDU_PLT_OVERSPEED3 + + --ExportScript.Tools.SendData(4222,PDU_PLT_OVERSPEED1) --@127% + --ExportScript.Tools.SendData(4223,PDU_PLT_OVERSPEED2) --@137% + --ExportScript.Tools.SendData(4224,PDU_PLT_OVERSPEED3) --@142% +end + + +function ExportScript.UhfSuperFromListIndication(mainPanelDevice) + + local listIndicationList_8 = ExportScript.Tools.split(list_indication(8), "%c") + + local uhf_currentFreq = listIndicationList_8[7] + local uhf_currentChannel = listIndicationList_8[10] + local uhf_preset_1 = listIndicationList_8[13] + local uhf_preset_2 = listIndicationList_8[16] + local uhf_preset_3 = listIndicationList_8[19] + local uhf_preset_4 = listIndicationList_8[22] + local uhf_preset_5 = listIndicationList_8[25] + local uhf_preset_6 = listIndicationList_8[28] + local uhf_preset_7 = listIndicationList_8[31] + local uhf_preset_8 = listIndicationList_8[34] + local uhf_preset_9 = listIndicationList_8[37] + local uhf_preset_10 = listIndicationList_8[40] + local uhf_preset_11 = listIndicationList_8[43] + local uhf_preset_12 = listIndicationList_8[46] + local uhf_preset_13 = listIndicationList_8[49] + local uhf_preset_14 = listIndicationList_8[52] + local uhf_preset_15 = listIndicationList_8[55] + local uhf_preset_16 = listIndicationList_8[58] + local uhf_preset_17 = listIndicationList_8[61] + local uhf_preset_18 = listIndicationList_8[64] + local uhf_preset_19 = listIndicationList_8[67] + local uhf_preset_20 = listIndicationList_8[70] + + ExportScript.Tools.SendData(5000, "1-" .. uhf_preset_1 + .. "\n2-" .. uhf_preset_2 + .. "\n3-" .. uhf_preset_3 + .. "\n4-" .. uhf_preset_4) + + ExportScript.Tools.SendData(5001, "5-" .. uhf_preset_5 + .. "\n6-" .. uhf_preset_6 + .. "\n7-" .. uhf_preset_7 + .. "\n8-" .. uhf_preset_8) + + ExportScript.Tools.SendData(5002, "9-" .. uhf_preset_9 + .. "\n10-" .. uhf_preset_10 + .. "\n11-" .. uhf_preset_11 + .. "\n12-" .. uhf_preset_12) + + ExportScript.Tools.SendData(5003, "13-" .. uhf_preset_13 + .. "\n14-" .. uhf_preset_14 + .. "\n15-" .. uhf_preset_15 + .. "\n16-" .. uhf_preset_16) + + ExportScript.Tools.SendData(5004, "17-" .. uhf_preset_17 + .. "\n18-" .. uhf_preset_18 + .. "\n19-" .. uhf_preset_19 + .. "\n20-" .. uhf_preset_20) +end + + +--[[ Ideas: - set qfe readout -- uhf preset channel select readout 1-20 -- engine limits and indications. idk how to do this + + + + + + list_indication(5) is the gps screen + {E3271375-F014-4a53-BC1A-DB32275BB728}\ +01:MIZ 1 030MG90\ +-----------------------------------------\ +{6A4A4765-A8C2-4f16-A356-99FC13FB4E0E}\ +PP:\ +-----------------------------------------\ +{F93262D8-81DA-4404-9D23-63EAD41CA4ED}\ +38T KM\ +-----------------------------------------\ +{BC0570F9-8CAA-4edb-A614-F18303135535}\ +5721 8068\ +-----------------------------------------\ + + +list_indication(5) is the pilot chronometer + +{7A2B92CA-D6CB-4880-82CA-F3D6C44EC5B4}\ + 8\ +-----------------------------------------\ +{E196B5C4-2AB1-4175-A201-2723C514CD98}\ +:\ +-----------------------------------------\ +{CE961280-F5C1-4208-9265-D93473D3F8A8}\ +02\ +-----------------------------------------\ +{F5351414-608F-4cda-A80D-64F28B90658A}\ +29\ +-----------------------------------------\ +{656D59C0-10AC-4790-92E8-88763557DF19}\ +LT\ + + +list_indication(5) is the copilot chronometer + +{B04EA839-7FD0-4d67-9474-C78F56DBA2CD}\ + 5\ +-----------------------------------------\ +{7D7AEF15-B21F-489c-90C7-C4BA1A430732}\ +:\ +-----------------------------------------\ +{45CB9AC2-AA0F-417f-9C65-BED507883579}\ +03\ +-----------------------------------------\ +{044E12A5-931D-4f41-8740-D1D50420CF61}\ +29\ +-----------------------------------------\ +{100D742E-380B-4a0d-BEC1-5973BC3E2305}\ +UTC\ + + +8 has UHF Freq and presets + +"-----------------------------------------\ +base\ +\ +children are {\ +-----------------------------------------\ +{92E00554-EBD9-474d-866F-3E7D4A09CE19}\ +225000\ +-----------------------------------------\ +{BFF7732B-06B0-41aa-8D73-037D2A01374B}\ +01\ +-----------------------------------------\ +{E1B2F571-3E48-4947-BF22-74AE5602598C}\ +264\ +-----------------------------------------\ +{E4D33090-B35F-4245-82B2-90DE3786D2D1}\ +265\ +-----------------------------------------\ +{6111C94E-87DB-4001-8E93-749C83D46B80}\ +256\ +-----------------------------------------\ +{631649A5-F1FA-451f-AEF5-F44ADF9E881D}\ +254\ +-----------------------------------------\ +{2F232224-B053-4915-9F00-C776FCEC8EC3}\ +250\ +-----------------------------------------\ +{CC83A116-5298-4e19-A1AF-8EBCF3DCD099}\ +270\ +-----------------------------------------\ +{09B58A29-A292-475a-B209-EBCDA35B5235}\ +257\ +-----------------------------------------\ +{19CC337D-FCE1-486b-BB1D-8AE46A937A1F}\ +258\ +-----------------------------------------\ +{DBE2AE0B-C05C-4bcd-904D-E106DBCF91EE}\ +262\ +-----------------------------------------\ +{55126454-C40C-4351-BF6D-2019B2A38165}\ +259\ +-----------------------------------------\ +{A2E899EC-1FBE-4cec-9712-DF3DEC3A6CC1}\ +268\ +-----------------------------------------\ +{BDD67E9C-D9A1-4c07-B9DD-2823B1E88C6A}\ +269\ +-----------------------------------------\ +{FD9F2D5E-176E-4cf0-A457-A5B15C6AAE55}\ +260\ +-----------------------------------------\ +{80D85F17-3F0C-48b1-A9D4-E688652C781F}\ +263\ +-----------------------------------------\ +{BD3DD1BD-A7D0-486f-9949-012FA15A0ABC}\ +261\ +-----------------------------------------\ +{96F5513D-D646-4550-8AAF-8EEDFEBF7D74}\ +267\ +-----------------------------------------\ +{90BB2B26-6A5F-446c-96FF-3938350DAE94}\ +251\ +-----------------------------------------\ +{CF7F80D2-9619-42a2-87E0-167ED0CCF240}\ +253\ +-----------------------------------------\ +{88AB6311-53AC-4bd5-BEFF-B483B32C7CF8}\ +266\ +-----------------------------------------\ +{62BAE925-BDB9-4917-8D36-51E7A82C175E}\ +252\ +}\ + +9 is pilot FM radio display +{4DFD518A-44F7-4ec9-B20F-AE3A3AEFD167}\ +33333@\ +}\ + +10 is copilot FM radio display +{4DFD518A-44F7-4ec9-B20F-AE3A3AEFD167}\ +33333@\ +}\ + +11 is alighment unit +-,,,,,,|,,,,,,,+\ +}\ + +12 is fuel screen info +{29108B03-8C8F-48e9-BB98-2396877B8009}\ +cccc%\ +-----------------------------------------\ +{B5290D11-022B-4956-8D17-0D1360DB35DA}\ +cccc%\ +-----------------------------------------\ +{9F38BD3B-49F5-4337-854E-51F2115E89B4}\ +cccc%\ +-----------------------------------------\ +{6AAB8051-E6B0-4e36-9A2D-A823A7A0422F}\ +cccc%\ + +return GetDevice(5):get_frequency() resut is 225000000 + +return GetDevice(6):get_frequency() results 30000000 + +return GetDevice(8):get_frequency() results 124000000 + +return GetDevice(10):get_frequency() results 30000000 ]] + ------------------------------ -- General Helper Functions -- ------------------------------ + +function percentSignFromFuel(s) + return s:gsub("%\%", "") +end + + function ExportScript.Linearize(current_value, raw_tab, final_tab) -- (c) scoobie if current_value <= raw_tab[1] then @@ -1323,11 +1959,13 @@ function format_int(number) --https://stackoverflow.com/questions/10989788/forma return minus .. int:reverse():gsub("^,", "") .. fraction end + function trim(s) --http://lua-users.org/wiki/CommonFunctions -- from PiL2 20.4 return (s:gsub("^%s*(.-)%s*$", "%1")) end + function addZeros3(number) number = string.format("%.1d" , number) if #number == 2 then @@ -1336,4 +1974,26 @@ function addZeros3(number) number = "00" .. number end return number -end \ No newline at end of file +end + + +-- inspired by https://github.com/ciribob/DCS-SimpleRadioStandalone/blob/a3021661a084e8dca285ffad7cf640b3c1dbccb2/Scripts/DCS-SRS/Scripts/DCS-SRS-Export.lua#L4195 +function getCockpitParam() + local ListIindicator = list_cockpit_params() --list_indication(IndicatorID) + local TmpReturn = {} + --if ListIindicator == "" then + -- return nil + --end + local ListindicatorMatch = ListIindicator:gmatch("([^\n]+):([^\n]+)") + + while true do + local Key, Value = ListindicatorMatch() + if not Key then + break + end + TmpReturn[Key] = Value + end + return TmpReturn +end + +