Hello, I've been making a LUA script to get outputs of systems in A2A Comanche 250. With the code, the display in the lua window shows the correct and steady numbers.
When I look at the data, for use with link2fs, the data is "jittering". Changing from correct to incorrect. This only happens, however, when I have more than 4 ipc.write's active (turning off with comments),
four or less and it fine. I've tried changing the delay and it doesn't help.
Is there something I'm' doing wrong?
Any help is greatly appreciated.
Here is the code...
-- rounds the integer
function round(num)
num = tonumber(num)
if num == nil then return 0 end
if num >= 0 then return math.floor(num+.5)
else return math.ceil(num-.5) end
end
while 1 do
Amps = round(ipc.readLvar("L:Ammeter1"))
EGT = round(ipc.readLvar("L:Eng1_EGTGauge"))
FuelFlow = round(ipc.readLvar("L:Eng1_GPH"))
OilTemp = round(ipc.readLvar("L:Eng1_OilTemp"))
OilPressure = round(ipc.readLvar("L:Eng1_OilPressure"))
EngRpm = round(ipc.readLvar("L:Eng1_RPMGauge"))
FuelPressure = round(ipc.readLvar("L:Eng1_FuelPressure"))
BattVolts = round(ipc.readLvar("L:Voltmeter"))
CylHeadTemp = round(ipc.readLvar("L:Eng1_CHTGauge"))
ipc.writeUW(0x66c0,Amps)
--ipc.writeUW(0x66c1,EGT)
ipc.writeUW(0x66c2,FuelFlow)
--ipc.writeUW(0x66c3,OilTemp)
ipc.writeUW(0x66c4,OilPressure)
--ipc.writeUW(0x66c5,EngRpm)
ipc.writeUW(0x66c6,FuelPressure)
--ipc.writeUW(0x66c7,BattVolts)
ipc.writeUW(0x66c8,CylHeadTemp)
ipc.display("Amps: "..Amps.."\nEGT: "..EGT.."\nFuel Flow: "..FuelFlow.."\nOil Temp: "..OilTemp.."\nOil Pressure: "..OilPressure.."\
Eng RPM: "..EngRpm.."\nFuel Pressure: "..FuelPressure.."\nBatt Volts: "..BattVolts.."\nCyl Head Temp: "..CylHeadTemp,1,"")
ipc.sleep(1000)
end
Thanks
StevenT