Use the ExportScript.Tools.negate() function to negate the values.

Change KPP Glide Beacon and KPP Localizer Beacon export format (ID 36, 37).

Add Barometric altimeter (Altimeter Feet) (ID 730, 731, 732, 733, 734, 735, 736, 737).

Add VD-20 Presseure correction (forn and back seat) (ID 56, 393).
This commit is contained in:
mcmicha 2017-03-08 23:48:34 +01:00
parent bfb0d75eb5
commit 64fc4773d3

View File

@ -29,8 +29,8 @@ ExportScript.ConfigEveryFrameArguments =
--[40] = "%.4f", -- KPP 1273K sideslip {-1.0, 1.0}
[35] = "%.4f", -- KPP Course Deviation Bar {-1.0, 1.0}
[34] = "%.4f", -- KPP Alt Deviation Bar {-1.0, 1.0}
[36] = "%.4f", -- KPP Glide Beacon
[37] = "%.4f", -- KPP Localizer Beacon
[36] = "%1d", -- KPP Glide Beacon
[37] = "%1d", -- KPP Localizer Beacon
[29] = "%.4f", -- KPP Arretir
[32] = "%.4f", -- KPP SDU Roll {-1.0, 1.0}
[33] = "%.4f", -- KPP SDU Pitch {-1.0, 1.0}
@ -40,8 +40,8 @@ ExportScript.ConfigEveryFrameArguments =
[43] = "%.4f", -- HSI bearing needle {1.0, 0.0} {0.0, math.pi * 2.0}
[47] = "%.4f", -- HSI Course Deviation Bar {-0.8, 0.8}{-1.0, 1.0}
[45] = "%.4f", -- HSI Alt Deviation Bar {-0.8, 0.8}{-1.0, 1.0}
[46] = "%.4f", -- HSI Glide Beacon
[44] = "%.4f", -- HSI Localizer Beacon
[46] = "%.4f", -- HSI Glide Beacon G
[44] = "%.4f", -- HSI Localizer Beacon K
-- RSBN
[189] = "%.4f", -- RSBN NAV Chan {0.0, 0.39} {1.0, 40.0}
[190] = "%.4f", -- RSBN LAND Chan {0.0, 0.39} {1.0, 40.0}
@ -54,7 +54,7 @@ ExportScript.ConfigEveryFrameArguments =
[53] = "%.4f", -- VD-20 m {0.0, 1.0}{0.0, 1000.0}
[54] = "%.4f", -- VD-20 km Ind {0.0, 1.0}{0.0, 20.0}
[55] = "%.4f", -- VD-20 m Ind {0.0, 1.0}{0.0, 1000.0}
[56] = "%.4f", -- VD-20 PRESS {0.0, 1.0}{670.0, 826.0}
--[56] = "%.4f", -- VD-20 PRESS {0.0, 1.0}{670.0, 826.0}
-- Barometric altimeter
-- Altimeter Feet , copy of A-10 altimeter
[637] = "%.4f", -- Altimeter_100_footPtr {0.0, 1.0}{0.0, 1000.0}
@ -219,7 +219,17 @@ ExportScript.ConfigEveryFrameArguments =
[390] = "%.4f", -- Backseat - VD-20 m {0.0, 1.0}{0.0, 1000.0}
[391] = "%.4f", -- Backseat - VD-20 km Ind {0.0, 1.0}{0.0, 20.0}
[392] = "%.4f", -- Backseat - VD-20 m Ind {0.0, 1.0}{0.0, 1000.0}
[393] = "%.4f", -- Backseat - VD-20 PRESS {0.0, 1.0}{670.0, 826.0}
--[393] = "%.4f", -- Backseat - VD-20 PRESS {0.0, 1.0}{670.0, 826.0}
-- Barometric altimeter
-- Altimeter Feet , copy of A-10 altimeter
[737] = "%.4f", -- Altimeter_100_footPtr {0.0, 1.0}{0.0, 1000.0}
[732] = "%.4f", -- Altimeter_10000_footCount {0.0, 1.0}{0.0, 10.0}
[731] = "%.4f", -- Altimeter_1000_footCount {0.0, 1.0}{0.0, 10.0}
[730] = "%.4f", -- Altimeter_100_footCount {0.0, 1.0}{0.0, 10.0}
[736] = "%.4f", -- pressure_setting_0 {0.0, 1.0}{0.0, 10.0}
[735] = "%.4f", -- pressure_setting_1 {0.0, 1.0}{0.0, 10.0}
[734] = "%.4f", -- pressure_setting_2 {0.0, 1.0}{0.0, 10.0}
[733] = "%.4f", -- pressure_setting_3 {0.0, 1.0}{0.0, 10.0}
-- AIRSPEED AND MACH
[386] = "%.4f", -- Backseat - IAS {0.0, 0.08, 0.186, 0.296, 0.436, 0.55, 0.635, 0.705, 0.765, 0.824, 1.0}{0.0, 100.0, 150.0, 200.0, 300.0, 400.0, 500.0, 600.0, 700.0, 800.0, 1200.0}
[387] = "%.4f", -- Backseat - TAS {0.0, 0.08, 0.186, 0.296, 0.436, 0.55, 0.635, 0.705, 0.765, 0.824, 1.0}{0.0, 100.0, 150.0, 200.0, 300.0, 400.0, 500.0, 600.0, 700.0, 800.0, 1200.0}
@ -379,7 +389,7 @@ ExportScript.ConfigArguments =
[313] = "%1d", -- Stop Turbo Switch, ON/OFF
[326] = "%1d", -- Engine Button
[320] = "%1d", -- Emergency Fuel Switch
[322] = "%1d", -- Engine Start Mode Switch, START/FALSE START/COLD CRANKING {-1.0,0.0,1.0}
[322] = "%.1f", -- Engine Start Mode Switch, START/FALSE START/COLD CRANKING {0.0,0.1,0.2}
[144] = "%1d", -- CB Engine Switch, ON/OFF
[145] = "%1d", -- CB AGD-GMK Switch, ON/OFF
[146] = "%1d", -- CB Inverter 1 (AC 115V) Switch, ON/OFF
@ -641,76 +651,92 @@ function ExportScript.ProcessIkarusDCSConfigHighImportance(mainPanelDevice)
--[31] = "%.4f", -- KPP 1273K pitch {-0.5, 0.5} {-math.pi / 2.0, math.pi / 2.0}
--[40] = "%.4f", -- KPP 1273K sideslip {-1.0, 1.0}
local lPitch = mainPanelDevice:get_argument_value(31)
local lSideslip = mainPanelDevice:get_argument_value(40)
if lSideslip < 0.0 then
lSideslip = lSideslip - lSideslip - lSideslip -- negate
else
lSideslip = 0 - lSideslip
end
lPitch = lPitch * 2
ExportScript.Tools.SendData(31, string.format("%.4f", lPitch))
ExportScript.Tools.SendData(40, string.format("%.4f", lSideslip))
ExportScript.Tools.SendData(40, string.format("%.4f", ExportScript.Tools.negate(mainPanelDevice:get_argument_value(40)))) -- negate
-- HSI correction
--[41] = "%.4f", -- HSI heading {1.0, 0.0} {0.0, math.pi * 2.0}
--[42] = "%.4f", -- HSI commanded course needle (yellow needle) {1.0, 0.0} {0.0, math.pi * 2.0}
local lHeading = mainPanelDevice:get_argument_value(41)
local lCommandCourse = mainPanelDevice:get_argument_value(42)
if lHeading < 0.0 then
lHeading = lHeading - lHeading - lHeading -- negate
else
lHeading = 0 - lHeading -- negate
end
lCommandCourse = lCommandCourse * 0.5 -- 180 degree turn
lCommandCourse = lCommandCourse + 0.5 -- 180 degree turn
ExportScript.Tools.SendData(41, string.format("%.4f", lHeading))
ExportScript.Tools.SendData(41, string.format("%.4f", ExportScript.Tools.negate(mainPanelDevice:get_argument_value(41)))) -- negate
ExportScript.Tools.SendData(42, string.format("%.4f", lCommandCourse))
--[56] = "%.4f", -- VD-20 PRESS {0.0, 1.0}{670.0, 826.0}
--local lPressure = mainPanelDevice:get_argument_value(56)
--ExportScript.Tools.WriteToLog('lPressure: '..ExportScript.Tools.dump(lPressure))
--[51] = "%.4f", -- MACH
--local lMACH = mainPanelDevice:get_argument_value(51)
--ExportScript.Tools.WriteToLog('lMACH: '..ExportScript.Tools.dump(lMACH))
-- Back Seat
-- ADI correction
--[368] = "%.4f", -- KPP 1273K pitch {-0.5, 0.5} {-math.pi / 2.0, math.pi / 2.0}
--[377] = "%.4f", -- KPP 1273K sideslip {-1.0, 1.0}
local lPitch2 = mainPanelDevice:get_argument_value(368)
local lSideslip2 = mainPanelDevice:get_argument_value(377)
if lSideslip2 < 0.0 then
lSideslip2 = lSideslip2 - lSideslip2 - lSideslip2 -- negate
else
lSideslip2 = 0 - lSideslip2
end
lPitch2 = lPitch2 * 2
ExportScript.Tools.SendData(368, string.format("%.4f", lPitch2))
ExportScript.Tools.SendData(377, string.format("%.4f", lSideslip2))
ExportScript.Tools.SendData(377, string.format("%.4f", ExportScript.Tools.negate(mainPanelDevice:get_argument_value(377)))) -- negate
-- HSI correction
--[378] = "%.4f", -- HSI heading {1.0, 0.0} {0.0, math.pi * 2.0}
--[379] = "%.4f", -- HSI commanded course needle (wihte needle) {1.0, 0.0} {0.0, math.pi * 2.0}
local lHeading2 = mainPanelDevice:get_argument_value(378)
local lCommandCourse2 = mainPanelDevice:get_argument_value(379)
if lHeading2 < 0.0 then
lHeading2 = lHeading2 - lHeading2 - lHeading2 -- negate
else
lHeading2 = 0 - lHeading2 -- negate
end
lCommandCourse2 = lCommandCourse2 + 0.5 -- 180 degree turn
ExportScript.Tools.SendData(378, string.format("%.4f", lHeading2))
ExportScript.Tools.SendData(378, string.format("%.4f", ExportScript.Tools.negate(mainPanelDevice:get_argument_value(378)))) -- negate
ExportScript.Tools.SendData(379, string.format("%.4f", lCommandCourse2))
-- VD-20 Presseure correction
--[56] = "%.4f", -- VD-20 PRESS {0.0, 1.0}{670.0, 826.0}
local lVD_20_PRESS = mainPanelDevice:get_argument_value(56)
--ExportScript.Tools.WriteToLog('Pressure: '..ExportScript.Tools.dump(lVD_20_PRESS))
--[[
y_min = 0.0 -- minimaler Ausgabewert
y_max = 0.89 -- maximaler Ausgabewert
x_min = 0.0 -- minimaler Eingangswert
x_max = 0.76793104410172 -- maximaler Eingangswert
x = 0.57506740093231 -- aktueller Eingangswert
d_y = 0.89 -- Delta Ausgabewerte (y_max - y_min)
d_x = 0.76793104410172 -- Delta Eingangswerte (x_max - x_min)
m = 1.158958225267568124678891052043 -- Steigung der linearen Funktion (d_y / d_x)
n = 0.0000000000000000000000000000002387929418604 (2.387929418604e-32) -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max)
y = 0.66648 -- Ergebnis (m * x + n)
]]
if gVD_20_PRESS ~= lVD_20_PRESS then
gVD_20_PRESS = lVD_20_PRESS
lVD_20_PRESS = 1.158958225267568124678891052043 * lVD_20_PRESS + 0.0000000000000000000000000000002387929418604
--ExportScript.Tools.WriteToLog('Pressure2: '..ExportScript.Tools.dump(lVD_20_PRESS))
ExportScript.Tools.SendData(56, string.format("%.4f", lVD_20_PRESS))
end
--[393] = "%.4f", -- Backseat - VD-20 PRESS {0.0, 1.0}{670.0, 826.0}
local lVD_20_PRESS_Backseat = mainPanelDevice:get_argument_value(393)
--ExportScript.Tools.WriteToLog('Pressure: '..ExportScript.Tools.dump(lVD_20_PRESS_Backseat))
--[[
y_min = 0.0 -- minimaler Ausgabewert
y_max = 0.89 -- maximaler Ausgabewert
x_min = 0.0 -- minimaler Eingangswert
x_max = 0.76793104410172 -- maximaler Eingangswert
x = 0.57506740093231 -- aktueller Eingangswert
d_y = 0.89 -- Delta Ausgabewerte (y_max - y_min)
d_x = 0.76793104410172 -- Delta Eingangswerte (x_max - x_min)
m = 1.158958225267568124678891052043 -- Steigung der linearen Funktion (d_y / d_x)
n = 0.0000000000000000000000000000002387929418604 (2.387929418604e-32) -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max)
y = 0.66648 -- Ergebnis (m * x + n)
]]
if gVD_20_PRESS_Backseat ~= lVD_20_PRESS_Backseat then
gVD_20_PRESS_Backseat = lVD_20_PRESS_Backseat
lVD_20_PRESS_Backseat = 1.158958225267568124678891052043 * lVD_20_PRESS_Backseat + 0.0000000000000000000000000000002387929418604
--ExportScript.Tools.WriteToLog('Pressure2: '..ExportScript.Tools.dump(lVD_20_PRESS_Backseat))
ExportScript.Tools.SendData(393, string.format("%.4f", lVD_20_PRESS_Backseat))
end
end
function ExportScript.ProcessDACConfigHighImportance(mainPanelDevice)
@ -784,7 +810,9 @@ function ExportScript.ProcessDACConfigLowImportance(mainPanelDevice)
]]
end
-- global VD-20 Pressure variable
gVD_20_PRESS = 0
gVD_20_PRESS_Backseat = 0
-----------------------------
-- Custom functions --
-----------------------------