I am very new for scripting lua file. So, I am sorry for my inquiry may be out of question.
I have registered version of FSUIPC6 as attached log file (sorry for the allowable size, I have cut same lines in the middle), my sim is P3D V5.1 HF1, and the aircraft is QW787.
Since I could got my purpose successfully with PMDG737 on which I could move throttle and yoke by motorized servo in autopilot condition utilizing mobiflight and arduino, I am trying to get same thing with QW787 too.
However, there are no information on the related offset as in PMDG. Only things I could get are Lvars that are shown in QW's document.
I have checked which Lvars are the ones necessary for getting the information about the condition of autopilot, and real movement of aileron and elevator by utilizing Spad.next. Eventually, I have got the Lvars as follows;
QW_MCP_L_AP_Button ; 1 or 0
QW_aileron_left ; numerial with +
QW_elevator_left; numerical with +
Reviewing this forum, and documents as FSUIPC Lua Library.pdf, FSUIPC Lua Plug-Ins.pdf and so on in the FSUIPC folder.
I have tried to make following lua file named ap_qw.lua.
function ap_on("L:QW_MCP_L_AP_Button", value)
value=ipc.readLvar("L:QW_MCP_L_AP_Button")
ipc.writeUW("66C0", value)
end
function servo_ai("L:QW_aileron_left", value)
value=ipc.readLvar("L:QW_aileron_left")
ipc.writeUW("66C1", value)
end
function servo_el ("L:QW_elevator_left", value)
value=ipc.readLvar("L:QW_elevator_left")
ipc.writeUW("66C2", value)
end
event.Lvar("L:QW_MCP_L_AP_Button", 100, "ap_on", value)
event.Lvar("L:QW_aileron_left", 100, "servo_ai", value)
event.Lvar("L:QW_elevator_left", 100, "servo_el", value)
I have copied this file into the folder of C:\Users\shibe_fsx\Documents\Prepar3D v5 Add-ons\FSUIPC6.
Then, start sim, I have got log file above mentioned and had attached ini file in which I could see the lines
[LuaFiles]
1=ap_qw
[Auto]
1=ap_qw
as stated in the FSUIPC document. Lines of [LuaFiles] were automatically set. Lines of [Auto] were set by myself.
During running the sim I made several different options in recording log so as written in the log file. In case of running mobiflight, read command was repeatedly appeared.
However, I could not see any figure changes related to Lvars. They are all "0" in offset of 66C1, 66C2 even though those figures are changing according to the real movement of aileron and elevator in the sim.
Again, I am very new, so my script should be wrong.
Any advice would be very appreciated.
Moto Miyawaki
FSUIPC6.ini
mod_FSUIPC6.log