Scratchpad output to the A10C II Profile on 1 Tile

This commit is contained in:
Bailey 2022-07-19 03:20:15 +09:00 committed by GitHub
parent 213e7b4c29
commit d230bccbfb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -806,9 +806,19 @@ function ExportScript.ProcessIkarusDCSConfigLowImportance(mainPanelDevice)
ExportScript.Tools.SendData(2000, ExportScript.Tools.RoundFreqeuncy((UHF_RADIO:get_frequency()/1000000))) -- ExportScript.Tools.RoundFreqeuncy(frequency (MHz|KHz), format ("7.3"), PrefixZeros (false), LeastValue (0.025)) ExportScript.Tools.SendData(2000, ExportScript.Tools.RoundFreqeuncy((UHF_RADIO:get_frequency()/1000000))) -- ExportScript.Tools.RoundFreqeuncy(frequency (MHz|KHz), format ("7.3"), PrefixZeros (false), LeastValue (0.025))
]] ]]
-- Export ScratchPad -- Export ScratchPad. Recommend 11pt font in DCS-Interface
local lScratchPad = ExportScript.Tools.getListIndicatorValue(5) local lScratchPadGet = ExportScript.Tools.getListIndicatorValue(5)
ExportScript.Tools.SendData(2040, ExportScript.Tools.coerce_nil_to_string(lScratchPad.Scratch_PAD)) local lScratchPad = ExportScript.Tools.coerce_nil_to_string(lScratchPadGet.Scratch_PAD) -- .. lScratchPad.Scratch_PAD_Mode
local lScratchPadMode = ExportScript.Tools.coerce_nil_to_string(lScratchPadGet.Scratch_PAD_Mode)
-- https://www.tutorialspoint.com/string-gsub-function-in-lua-programming
lScratchPadMode = string.gsub(lScratchPadMode, "%s+", "") -- removes spaces
local lScratchPadTotal = lScratchPad .. lScratchPadMode -- combines the scratchpad and the mode
if lScratchPadTotal == '' then lScratchPadTotal = '[Sctch]\n[Pad]' end -- abbreviation for scratch due to 7 charPerLine later
ExportScript.Tools.SendData(2040, lScratchPadTotal)
local lScratchPadStacked = splitLines(lScratchPadTotal, 7) -- splits into newlines
lScratchPadStacked = string.gsub(lScratchPadStacked,' ]','_]') -- takes care of the blank space
lScratchPadStacked = string.gsub(lScratchPadStacked,' \n]','_]') -- removes new line with only bracket
ExportScript.Tools.SendData(2041, lScratchPadStacked)
-- AN/ARC-164 UHF and UHF Preset Channel -- AN/ARC-164 UHF and UHF Preset Channel
--------------------------------------------------- ---------------------------------------------------
@ -1157,7 +1167,7 @@ function ExportScript.ProcessDACConfigLowImportance(mainPanelDevice)
--ExportScript.Tools.WriteToLog(ltmp2..' (metatable): '..ExportScript.Tools.dump(getmetatable(ltmp1))) --ExportScript.Tools.WriteToLog(ltmp2..' (metatable): '..ExportScript.Tools.dump(getmetatable(ltmp1)))
end end
]] ]]
--[[ --[[
-- LITENING_INTERFACE -- LITENING_INTERFACE
local lLITENING_INTERFACE = GetDevice(11) local lLITENING_INTERFACE = GetDevice(11)
ExportScript.Tools.WriteToLog('lLITENING_INTERFACE:get_station '..ExportScript.Tools.dump(lLITENING_INTERFACE:get_station())) ExportScript.Tools.WriteToLog('lLITENING_INTERFACE:get_station '..ExportScript.Tools.dump(lLITENING_INTERFACE:get_station()))
@ -1209,7 +1219,7 @@ function ExportScript.ProcessDACConfigLowImportance(mainPanelDevice)
--ExportScript.Tools.WriteToLog('lINTERCOM:set_communicator '..ExportScript.Tools.dump(lINTERCOM:set_communicator())) -- test the parameters --ExportScript.Tools.WriteToLog('lINTERCOM:set_communicator '..ExportScript.Tools.dump(lINTERCOM:set_communicator())) -- test the parameters
--ExportScript.Tools.WriteToLog('lINTERCOM:set_voip_mode '..ExportScript.Tools.dump(lINTERCOM:set_voip_mode())) -- test the parameters --ExportScript.Tools.WriteToLog('lINTERCOM:set_voip_mode '..ExportScript.Tools.dump(lINTERCOM:set_voip_mode())) -- test the parameters
]] ]]
--[[ --[[
local ltmp1 = 0 local ltmp1 = 0
for ltmp2 = 1, 73, 1 do for ltmp2 = 1, 73, 1 do
ltmp1 = GetDevice(ltmp2) ltmp1 = GetDevice(ltmp2)
@ -1218,7 +1228,7 @@ function ExportScript.ProcessDACConfigLowImportance(mainPanelDevice)
end end
]] ]]
--getIndicatorData(3) --getIndicatorData(3)
end end
@ -1226,6 +1236,27 @@ end
-- Custom functions -- -- Custom functions --
----------------------------- -----------------------------
-- formats the string by putting newlines in the appropriate places
function splitLines(stringIn, charPerLine)
local rows = DIV(#stringIn,charPerLine)
for i = 1, rows, 1 do -- the i's represent the displacement and multipliers needed for the self iterations
stringIn = string.insert(stringIn, '\n', (charPerLine * i) + (i-1))
end
return stringIn
end
-- workaround for floor division. typically //
-- http://lua-users.org/wiki/SimpleRound
function DIV(a,b)
return (a - a % b) / b
end
-- used to insert newlines at the right areas
-- https://stackoverflow.com/questions/59561776/how-do-i-insert-a-string-into-another-string-in-lua
function string.insert(str1, str2, pos)
return str1:sub(1,pos)..str2..str1:sub(pos+1)
end
----------------------------- -----------------------------
-- CDU Export based on Jan Boeckers DCS BIOS -- CDU Export based on Jan Boeckers DCS BIOS
-- https://github.com/dcs-bios/dcs-bios -- https://github.com/dcs-bios/dcs-bios