Two things:
1. If possible, how do I get the export values to update faster? Is it possible to just make specific values update faster, rather than all? I think this would help me judge the accuracy of the rad alt export better.
EDIT: Moved the ID to HighImportance and this seems to have done the trick.
2. Here is the rad alt script. Please check it out and let me know how it's working. It appears to be within a few feet for me in my limited testing so far:
function ExportScript.RADAR_ALTITUDE(mainPanelDevice)
local radar_altitude_value = mainPanelDevice:get_argument_value(73)
local altitude_table = {
{0.0000, 0},
{0.0155, 0}, -- on ground
{0.1681, 50},
{0.2220, 100}, -- average between 0.2080 and 0.2220
{0.2950, 150},
{0.3682, 200}, -- new value
{0.4597, 300},
{0.5705, 500}, -- new value
{0.6933, 1000}, -- average between 0.6933 and 0.7145
{0.7733, 1500},
{0.8159, 2000}, -- average between 0.8159 and 0.8224
{0.9011, 3000}, -- average between 0.9011 and 0.9630
{0.9839, 5000}
}
local function interpolate(value, table)
for i = 1, #table - 1 do
if value >= table[i][1] and value <= table[i + 1][1] then
local ratio = (value - table[i][1]) / (table[i + 1][1] - table[i][1])
return table[i][2] + ratio * (table[i + 1][2] - table[i][2])
end
end
return 0 -- return 0 if value is out of bounds
end
local radar_altitude_feet = interpolate(radar_altitude_value, altitude_table)
local formatted_radar_altitude = string.format("%d", radar_altitude_feet)
ExportScript.Tools.SendData(export_ids.RADAR_ALTITUDE, formatted_radar_altitude)
end