Hi,
For all the cockpit builders here: I post this in the Pilot Lounge section as it's related to all accusim aircrafts, I hope it's OK.
There was a post by Guenseli explaining how to make use of FSUIPC, L:Vars, macros and LUA to use our home made cockpits switches and controllers with special accusim functions otherwise not accessible via classic offsets.
http://a2asimulations.com/forum/viewtopic.php?f=29&t=21420Many thanks to him. Using virtual joystick functionality of SIOC it was possible to use OpenCockpits hardware plugged in a networked computer and control specific accusim functions .
Having done that, my main concern was about my gauges, some are made with Gauge Composer, others are physical gauges with servos, all controlled from another computer linked with IOCP server and WideFS.
The problem: For instance making a GC gauge for manifold pressure using the usual MP offset doesn't give a correct reading, as accusim manifold pressure is different (and much more complex). So digging into L:Vars dump of P-47, I realized that those 'real' values for gauges were here, in the L:Vars.
The solution: A simple LUA script that reads L:Vars value (for instance L:ManifoldPressure1) and writes the value in a free (user reserved?) FSUIPC offset (from 66C0 to 66FF), and then link to those 'new' offsets with GC or SIOC over the network.
Early LUA script for the P-47 and a few gauges:
Code:
while 1 do
-- Read the values from L:Vars
cat = ipc.readLvar("L:CarbAirTemp1")
cht = ipc.readLvar("L:EngCylinderHeadTemp_1")
OILT = ipc.readLvar("L:EngOilTemp1")
OILP = ipc.readLvar("L:Eng1OilPressure")
FUELP = ipc.readLvar("L:FuelPressure1")
RPM = ipc.readLvar("L:EngRPM_1")
MP = ipc.readLvar("L:ManifoldPressure1")
-- Formatting the values for use with SIOC/GC (need to improve that and pass reals instead of integers?)
cht = cht * 10
cat = cat * 10
OILT = OILT * 100
OILP = OILP * 10
FUELP = FUELP * 100
if MP < 10 then
MP = 10
end
MP = MP - 10
MP = MP * 100
-- Write value into new FSUIPC Offsets accessible other the network
ipc.writeSD(0x66c0, cat)
ipc.writeSD(0x66c4, cht)
ipc.writeSD(0x66c8, OILT)
ipc.writeSD(0x66D2, OILP)
ipc.writeSD(0x66D6, FUELP)
ipc.writeSD(0x66E0, RPM)
ipc.writeSD(0x66E4, MP)
ipc.sleep(68)
end
The script is a never ended loop, for now I trigger the launch with a keypress and the stop with another, but I will link it to a switch, for instance battery switch would seem to be a good choice: battery on, trigger the script, battery off, kill the script.
So now I have correct readings on my home made gauges, including all the jittering of RPM when too low. And it will also work with physical gauges as far as you can choose the offset for it.
The only thing I need now is A2A guys make a accu-simmed Yak 3 ... (please ! That's a very interesting aircraft, with pneumatic starter and flaps, a new challenge for you!

)