Skip to content

Commit

Permalink
catch nil list indicator
Browse files Browse the repository at this point in the history
  • Loading branch information
ciribob committed Mar 21, 2022
1 parent bf8deb0 commit 9a485f0
Showing 1 changed file with 49 additions and 47 deletions.
96 changes: 49 additions & 47 deletions Scripts/DCS-SRS/Scripts/DCS-SimpleRadioStandalone.lua
Original file line number Diff line number Diff line change
Expand Up @@ -755,21 +755,23 @@ function SR.exportRadioAH64D(_data)

end

-- figure out selected
if _radioPanel['Rts_VHF_'] == '<' then
_data.selected = 1
elseif _radioPanel['Rts_UHF_'] == '<' then
_data.selected = 2
elseif _radioPanel['Rts_FM1_'] == '<' then
_data.selected = 3
elseif _radioPanel['Rts_FM2_'] == '<' then
_data.selected = 4
elseif _radioPanel['Rts_HF_'] == '<' then
_data.selected = 5
end
if _radioPanel then
-- figure out selected
if _radioPanel['Rts_VHF_'] == '<' then
_data.selected = 1
elseif _radioPanel['Rts_UHF_'] == '<' then
_data.selected = 2
elseif _radioPanel['Rts_FM1_'] == '<' then
_data.selected = 3
elseif _radioPanel['Rts_FM2_'] == '<' then
_data.selected = 4
elseif _radioPanel['Rts_HF_'] == '<' then
_data.selected = 5
end

if _radioPanel['Guard'] == 'G' then
_data.radios[3].secFreq = 243e6
if _radioPanel['Guard'] == 'G' then
_data.radios[3].secFreq = 243e6
end
end

_data.control = 1
Expand Down Expand Up @@ -2396,7 +2398,7 @@ function SR.exportRadioFA18C(_data)
end

-- Check if XP UFC is being displayed
if _ufc.UFC_OptionDisplay2 == "2 " then
if _ufc and _ufc.UFC_OptionDisplay2 == "2 " then
-- Check if on XP
if _ufc.UFC_ScratchPadString1Display == "X" then
if iff.status <= 0 then
Expand Down Expand Up @@ -2448,7 +2450,7 @@ function SR.exportRadioFA18C(_data)
_data.iff = _fa18.iff

-- Parse ENT keypress
if _fa18ent then
if _fa18ent and _ufc then
_fa18ent = false
-- Check if on D/L page and D/L ON
if _ufc.UFC_OptionDisplay4 == "VOCA" and _ufc.UFC_ScratchPadString1Display == "O" and _ufc.UFC_ScratchPadString2Display == "N" then
Expand Down Expand Up @@ -3812,43 +3814,43 @@ local _mirageEncStatus = false
local _previousEncState = 0
function SR.exportRadioM2000C(_data)

local RED_devid = 20
local GREEN_devid = 19
local RED_devid = 20
local GREEN_devid = 19
local RED_device = GetDevice(RED_devid)
local GREEN_device = GetDevice(GREEN_devid)
local has_cockpit_ptt = false;
local has_cockpit_ptt = false;
local RED_ptt = false
local GREEN_ptt = false
pcall(function()
RED_ptt = RED_device:is_ptt_pressed()
GREEN_ptt = GREEN_device:is_ptt_pressed()
has_cockpit_ptt = true
end)
pcall(function()
RED_ptt = RED_device:is_ptt_pressed()
GREEN_ptt = GREEN_device:is_ptt_pressed()
has_cockpit_ptt = true
end)
_data.capabilities = { dcsPtt = false, dcsIFF = true, dcsRadioSwitch = false, intercomHotMic = false, desc = "" }
_data.control = 0
-- Different PTT/select control if the module version supports cockpit PTT
if has_cockpit_ptt then
_data.control = 1
_data.capabilities.dcsPtt = true
_data.capabilities.dcsRadioSwitch = true
if (GREEN_ptt) then
_data.selected = 1 -- radios[2] GREEN V/UHF
_data.ptt = true
elseif (RED_ptt) then
_data.selected = 2 -- radios[3] RED UHF
_data.ptt = true
else
_data.selected = -1
_data.ptt = false
end
end
-- Different PTT/select control if the module version supports cockpit PTT
if has_cockpit_ptt then
_data.control = 1
_data.capabilities.dcsPtt = true
_data.capabilities.dcsRadioSwitch = true
if (GREEN_ptt) then
_data.selected = 1 -- radios[2] GREEN V/UHF
_data.ptt = true
elseif (RED_ptt) then
_data.selected = 2 -- radios[3] RED UHF
_data.ptt = true
else
_data.selected = -1
_data.ptt = false
end
end

_data.radios[2].name = "TRT ERA 7000 V/UHF"
_data.radios[2].freq = SR.getRadioFrequency(19)
Expand Down

0 comments on commit 9a485f0

Please sign in to comment.