-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from llamaXc/feature-jf-17-tf51d
add changes from ANR0ID on DCS Forums
- Loading branch information
Showing
3 changed files
with
205 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
local ufcUtils = require("ufcPatch\\utilities\\ufcPatchUtils") | ||
|
||
ufcPatchJF17 = {} | ||
|
||
-- JF-17 Thunder: Shows UFCP values | ||
function ufcPatchJF17.generateUFCData() | ||
|
||
local MainPanel = GetDevice(0) | ||
local Radio1 = GetDevice(25) | ||
local Radio2 = GetDevice(26) | ||
|
||
--Initial Data | ||
local PwrSwpos = MainPanel:get_argument_value(904) | ||
|
||
if PwrSwpos == 1 then | ||
|
||
Radio1Freq = Radio1:get_frequency() | ||
Radio2Freq = Radio2:get_frequency() | ||
|
||
MasterArmStatus = MainPanel:get_argument_value(509) | ||
AAlight = MainPanel:get_argument_value(163) | ||
AG1light = MainPanel:get_argument_value(164) | ||
AG2light = MainPanel:get_argument_value(165) | ||
UFCPL4Button = MainPanel:get_argument_value(724) | ||
UFCPR4Button = MainPanel:get_argument_value(725) | ||
|
||
JF17Data3 = ufcUtils.getDCSListIndication(3) --1st Line of UFCP | ||
JF17Data4 = ufcUtils.getDCSListIndication(4) --2nd Line of UFCP | ||
JF17Data5 = ufcUtils.getDCSListIndication(5) --3rd Line of UFCP | ||
JF17Data6 = ufcUtils.getDCSListIndication(6) --4th Line of UFCP | ||
|
||
UFCP1 = JF17Data3.txt_win1 | ||
UFCP2 = JF17Data4.txt_win2 | ||
UFCP3 = JF17Data5.txt_win3 | ||
UFCP4 = JF17Data6.txt_win4 | ||
|
||
UFCP4_R_Three = string.sub(UFCP4, 6, 8) --Shows the last three digits of the string (Comm2 Channel) | ||
end | ||
--Radio Freq Display | ||
|
||
local Radio1digits = {math.floor(Radio1Freq / 1000)} | ||
|
||
local Radio1String = "" | ||
for index, value in ipairs(Radio1digits) do | ||
local Radio1digitToAppend = value | ||
if value >= 400000 then | ||
Radio1digitToAppend = 400000 | ||
end | ||
Radio1String = Radio1String..Radio1digitToAppend | ||
end | ||
|
||
local Radio2digits = {math.floor(Radio2Freq / 1000)} | ||
|
||
local Radio2String = "" | ||
for index, value in ipairs(Radio2digits) do | ||
local Radio2digitToAppend = value | ||
if value >= 400000 then | ||
Radio2digitToAppend = 400000 | ||
end | ||
Radio2String = Radio2String..Radio2digitToAppend | ||
end | ||
|
||
--Radio Freq Display cont | ||
if UFCPL4Button == 1 then | ||
RadioDisplay = Radio1String | ||
RadioDisplay1 = "C" | ||
RadioDisplay2 = "1" | ||
elseif UFCPR4Button == 1 then | ||
RadioDisplay = Radio2String | ||
RadioDisplay1 = "C" | ||
RadioDisplay2 = "2" | ||
end | ||
|
||
--Master Arm Status | ||
if MasterArmStatus < 0 then | ||
MasterArmIndicator = "S" | ||
elseif MasterArmStatus == 0 then | ||
MasterArmIndicator = "X" | ||
elseif MasterArmStatus > 0 then | ||
MasterArmIndicator = "A" | ||
end | ||
|
||
--AG Mode | ||
if AAlight ~= 0 then | ||
ModeIndicator = "A" | ||
elseif AG1light ~= 0 then | ||
ModeIndicator = "1" | ||
elseif AG2light ~= 0 then | ||
ModeIndicator = "2" | ||
end | ||
|
||
-- Generate the required SimApp Pro values to "mock" the F18 UFC with JF-17 values | ||
-- In theory, you could replace these with a custom value from another module, and have them appear on the DCS UFC | ||
return ufcUtils.buildSimAppProUFCPayload({ | ||
option1=JF17Data3.txt_win1, | ||
option2=JF17Data4.txt_win2, | ||
option3=JF17Data5.txt_win3, | ||
option4=JF17Data6.txt_win4, | ||
option5=UFCP4_R_Three, | ||
scratchPadNumbers=RadioDisplay, | ||
scratchPadString1=RadioDisplay1, | ||
scratchPadString2=RadioDisplay2, | ||
com1=MasterArmIndicator, | ||
com2=ModeIndicator | ||
}) | ||
|
||
end | ||
|
||
return ufcPatchJF17 --v1.0 by ANDR0ID |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
local ufcUtils = require("ufcPatch\\utilities\\ufcPatchUtils") | ||
|
||
ufcPatchTF51D = {} | ||
|
||
function ufcPatchTF51D.generateUFCData() | ||
|
||
local MainPanel = GetDevice(0) | ||
local VHFRadio = GetDevice(24) | ||
|
||
local VHFFreq = VHFRadio:get_frequency() | ||
|
||
|
||
--Altimeter | ||
local barodigits = { | ||
math.floor(MainPanel:get_argument_value(96) * 100000) | ||
} | ||
|
||
local AltitudeString = "" | ||
for index, value in ipairs(barodigits) do | ||
local barodigitToAppend = value | ||
if value >= 9999 then | ||
barodigitToAppend = 9999 | ||
end | ||
AltitudeString = tostring(value) | ||
if value < 10 then | ||
AltitudeString = "000"..value | ||
elseif value >= 1000 then | ||
AltitudeString = ""..value | ||
elseif (value >= 100 and value <= 999) then | ||
AltitudeString = "0"..value | ||
elseif (value >= 10 and value <= 99) then | ||
AltitudeString = "00"..value | ||
end | ||
end | ||
|
||
--Heading | ||
local Headingdigits = {math.floor(MainPanel:get_argument_value(12) * 360)} | ||
|
||
local HeadingString = "" | ||
for index, value in ipairs(Headingdigits) do | ||
local HeadingdigitToAppend = value | ||
if value >= 360 then | ||
HeadingdigitToAppend = 0 | ||
end | ||
HeadingString = tostring(value) | ||
if value < 10 then | ||
HeadingString = "00"..value.."T" | ||
elseif value >= 100 then | ||
HeadingString = ""..value.."T" | ||
elseif value >= 10 then | ||
HeadingString = "0"..value.."T" | ||
end | ||
end | ||
|
||
--SCR-522A VHF | ||
local VHFdigits = {math.floor(VHFFreq / 1000)} | ||
|
||
local VHFString = "" | ||
for index, value in ipairs(VHFdigits) do | ||
local VHFdigitToAppend = value | ||
if value >= 157000 then | ||
VHFdigitToAppend = 157000 | ||
end | ||
VHFString = VHFString..VHFdigitToAppend | ||
end | ||
|
||
--Send info to UFC components | ||
return ufcUtils.buildSimAppProUFCPayload({ | ||
scratchPadNumbers=VHFString, --Freq of Slectected Radio | ||
option1=AltitudeString, | ||
option2=HeadingString, | ||
option3="XXXX", | ||
option4="XXXX", | ||
option5="XXXX", | ||
com1="5", | ||
com2="1", | ||
scratchPadString1="V", | ||
scratchPadString2="H" | ||
}) | ||
end | ||
|
||
return ufcPatchTF51D --v1.0 by ANDR0ID |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters