MobiFlight Community Support

Welcome to the forum for MobiFlight! Feel free to reach out to the community in case you have questions, issues or just want to share great ideas or details about your latest home cockpit project.

You like MobiFlight? Donate via PayPal and support the MobiFlight development. Thanks! 

icon
Avatar
emmanuel.morales
Posts: 10
Hi guys,

I am newbie in this world, I have fsx, fsuipc, arduino mega 2560 and mobiflight of course.

I want to be able to manage fcu for now of the a320 aerosoft v 1.31.... I do not want jeheell at least not for now.

I have the lua scrip out of linda-config and I read the tutorial how ro set lvars with mobiflight but I am lost.

I know aerosoft at least from what I read is hard but I want aerosoft. Anyone could guide me thru. I am not sure whats the action type in the input, I am not sure what goes first fsuicp or mobiflight and if someone has the lua file that I need inputs and outputs onlu for FCU.


Thank you so much and hope to get help.

Emmanuel from México
2019-02-19 03:36
Avatar
emmanuel.morales
Posts: 10
PLEASE HELP...
2019-02-21 01:00
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 2189
Supporter
Hi

As you already accept.... Aerosoft A320 is not realy good for Homecockpits.
Thats why not many people exist that use it.... And mostly those people just build verry basic Stuff and not things like the FMS.
Maby your lucky and somebody here will reply.... But i not think that anybody here already build a FMS for Aerosoft Bus.

I just overfly the Lvar List.
all needed Button Inputs for the Left and Right FCU are inlcuded and listed.

Basicly you need the script or you work with single Lua Macros via FSUIPC (Reg version) .
Technical you can do that as i see it at the moment.

NOTE:
Much more easy would be a setting of internal Key Commands. Please check out if you have internal in Aerosoft a way to set Joystick Inputs or Ke Commands to those FCU Keys.
If yes you not need scripting.
Good Luck !
2019-02-21 15:41
Avatar
emmanuel.morales
Posts: 10
yhanks pizman,

perhaps someone can give me a little push to start with.

1..- so, I put the lvars file into the modules file of FSX.

2.- whats next to create inputs in mobiflight (BTW I have some as events id for default aircraft and they work) need new inputs or just override them??

3.- now for the input: what should be the Action type: Key, LUA macreo FSUIPC offset and whatever te action type is how should I fill in the rest like value, mask value, offdet, etc.

4.- now in FSUIPC in the Logging tab, under log details, which options shoul I mark IPC reads, IPC writes, button and key operations, events, axis controls, log lua plugins, etc. ?

5.- then I go to key presses?

sorry I am lost, what should I configure first, is it Mobiflight or FSUIPC?

please some one helps,

thanks

emanuel

*I did not know how to upload images.
2019-02-23 03:29
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 2189
Supporter
Again my Friend.... I have no experience there and give only basic hints.

Mobiflight itself can NOT controll Lvars. Mobiflight can only simulate Key Presses, Joystickbuttons (With VJoy PlugIn) can Controll Offsets and can Run Lua Scripts or Macros (LUA PlugIn) ...... It can also fire EventId but thats not helpfull in that case.

Your Lvars are a "other" technic that is basicly not compatible with Mobilfight.

What you need now is something like a adapter.... a Tool that recive a command from Mobiflight ( vie one of technics i say above) and this tool THEN execute the command to the Lvar.

This is basicly done with the LUA Scripts. You write a Code that say " IF Something is TRUE ( For example if Key "x" is pressed ) then Write the Lvar for FMS Button "A" with parameter 1 so it will be pressed in Sim "

Here you got lots of ways. You can write for example macros that are fired one time and execute the command.... You can assign those Macros in FSUIPC to a key for example.
Then you say in Mobiflight that your Input Button on Pin xy should simulate a "x" key..... FSUIPC see this "x" key and say "Start Macro xy" and this macro finaly write your Lvar.

Another way is to use Joysick Commands...... OR you can fire this macros directly via the LUA PlugIn of Mobiflight (to save the key press transmit)
Maby the most professional solution is to Write with Mobiflight a Offset (Bits) and a Global script will observe this Offsets and execute the Lvar Commands in case if a bit is change.

*****
Summary :
For a Beginner i think the Single Macro is maby the best solution. If you get more experience you can try a global script. But here i´m out. never do this before!
Good Luck !
2019-02-23 04:53
Avatar
thatchi
Posts: 81
Emmanuel.
Look at this thread. I did a prototype mcp for aerosoft Airbus , but it not complete and only able to display speed, heading, alt and vs.
There how to instruction .
When have time , I will try to finish the inputs with buttons and encoders. It is doable, but I am so busy with work for now.
If u able to complete it, please share.
Good luck. :)
2019-02-23 14:18
Avatar
thatchi
Posts: 81
Sorry. The thread.
https://www.mobiflight.com/forum/topic/1930.html
2019-02-23 14:18
Avatar
emmanuel.morales
Posts: 10
THATCHI,

I see your prototype, but am still not understanding the logic for inputs with encoders. this is the LUA scripst I am using:

--SPD
ipc.writeSW(0x66C0, ipc.readLvar("L:AB_AP_Speed_Select"))
ipc.writeSW(0x66C6, ipc.readLvar("L:AB_AP_Mach_Select")))*100)

--HDG
ipc.writeUW(0x66C8, ipc.readLvar("L:AB_AP_HDG_Select")*182.0444444444444)
ipc.writeUW(0x66D1, ipc.readLvar("Autopilot_TRK_set")*182)
--ALT
ipc.writeUW(0x66D5, ipc.readLvar("L:AB_AP_ALT_Select"))
--VS
ipc.writeSW(0x66C2,ipc.readLvar("L:AB_AP_Vs_Select2"))
ipc.writeSW(0x66C4,ipc.readLvar("L:AB_AP_FPA_Select2")*10)

--HDG/TRK
ipc.writeSW(0x66CC,ipc.readLvar("AB_AP_HDGTRK"))
--SPD/MACH
ipc.writeSW(0x66CE,ipc.readLvar("AB_AP_SPDMACH"))


while 1 do

--HDG/TRK
HdgTrkLvar=ipc.readLvar("AB_AP_HDGTRK")
HdgTrkOffset=ipc.readSW(0x66CC)

if HdgTrkOffset~= HdgTrkLvar then
--ipc.writeLvar("AB_AP_HDGTRK",HdgTrkOffset)
ipc.writeSW(0x66CC,ipc.readLvar("AB_AP_HDGTRK"))
end

--SPD/MACH
SpdMachLvar=ipc.readLvar("AB_AP_SPDMACH")
SpdMachOffset=ipc.readSW(0x66CE)

if SpdMachOffset ~= SpdMachLvar then
--ipc.writeLvar("AB_AP_SPDMACH",SpdMachOffset)
ipc.writeSW(0x66CE,ipc.readLvar("AB_AP_SPDMACH"))
end

--
SPDmode_cur = ipc.readLvar("L:AB_AP_SPDmode_set") --0x66D9
HDGmode_cur = ipc.readLvar("L:AB_AP_HDGmode_set") -- 0x66DA

-- Selected / Managed Display
if SPDmode_cur ~= SPDmode_pre then
SPDmode_pre = SPDmode_cur
if SPDmode_cur == 1 then
ipc.writeUB(0x66D9,SPDmode_cur) --managed
else
ipc.writeUB(0x66D9,SPDmode_cur) --selected
end
end

if HDGmode_cur ~= HDGmode_pre then
HDGmode_pre = HDGmode_cur
if HDGmode_cur == 1 then
ipc.writeUB(0x66DA,HDGmode_cur) --managed
else
ipc.writeUB(0x66DA,HDGmode_cur) --selected
end

end

ipc.sleep(20)


--SPD

SpdMachVar = ipc.readLvar("AB_AP_SPDMACH")
if SpdMachVar == 0 then

SpdLvar = ipc.readLvar("L:AB_AP_Speed_Select")
SpdOffset=ipc.readSW(0x66C0)

if SpdOffset > 399 then
ipc.writeSW(0x66C0, 399)
elseif SpdOffset < 100 then
ipc.writeSW(0x66C0, 100)
end
if SpdOffset~=SpdLvar then
ipc.writeLvar("L:AB_AP_Speed_Select",SpdOffset)
end

elseif SpdMachVar == 1 then

--MachLvar = ipc.readLvar("L:AB_AP_Mach_Select")*100
MachLvar= tonumber(string.format("%.2f", ipc.readLvar("L:AB_AP_Mach_Select")))
MachLvar=MachLvar*100
MachOffset=ipc.readSW(0x66C6)

if MachOffset < 10 then
ipc.writeSW(0x66C6, 10)
elseif MachOffset > 84 then
ipc.writeSW(0x66C6, 84)
end

if MachOffset ~= MachLvar then
ipc.writeLvar("L:AB_AP_Mach_Select",MachOffset/100)
end

end


ipc.sleep(20)
--HDG
AB_hdgtrk = ipc.readLvar("L:AB_AP_HDGTRK")

HdgLvar=ipc.readLvar("L:AB_AP_HDG_Select")*182.0444444444444
HdgOffset = ipc.readUW(0x66C8)


TrkLvar=ipc.readLvar("Autopilot_TRK_set")*182.0444444444444
TrkOffset = ipc.readUW(0x66D1)

if AB_hdgtrk == 0 then

if HdgOffset ~= HdgLvar then

currentValue =(ipc.readUW(0x66C8))*0.0054931640625
ipc.writeLvar("L:AB_AP_HDG_Select", currentValue)

end

else


if TrkOffset ~= TrkLvar then
currentValue = ipc.readUW(0x66D1)*0.0054931640625
ipc.writeLvar("Autopilot_TRK_set", currentValue)
end

end
ipc.sleep(20)
--ALT
AltLvar=ipc.readLvar("L:AB_AP_ALT_Select")
AltOffset=ipc.readUW(0x66D5)

if AltOffset < 100 then
ipc.writeUW(0x66D5,100)
elseif AltOffset >49000 and AltOffset < 55000 then
ipc.writeUW(0x66D5,49000)
elseif AltOffset > 55000 then
ipc.writeUW(0x66D5,100)
end

if AltOffset~=AltLvar then
ipc.writeLvar("L:AB_AP_ALT_Select",AltOffset)
end

ipc.sleep(20)
--VS
if ipc.readLvar("AB_AP_HDGTRK") == 0 then
VsHdgLvar=ipc.readLvar("L:AB_AP_Vs_Select2")
VsHdgOffset=ipc.readSW(0x66C2)

if VsHdgOffset < -60 then
ipc.writeSW(0x66C2,-60)
elseif VsHdgOffset > 60 then
ipc.writeSW(0x66C2,60)
end
if VsHdgOffset ~=VsHdgLvar then
ipc.writeLvar("L:AB_AP_Vs_Select2", VsHdgOffset)
end
else
VsTrkLvar=ipc.readLvar("L:AB_AP_FPA_Select2")
VsTrkOffset=ipc.readSW(0x66C4)/10

if VsTrkOffset < -9.5 then
ipc.writeSW(0x66C4,-95)
elseif VsTrkOffset > 9.5 then
ipc.writeSW(0x66C4,95)
end
if VsTrkOffset ~= VsTrkLvar then
ipc.writeLvar("L:AB_AP_FPA_Select2", VsTrkOffset)
end


end
if SpdOffset~=SpdLvar then
ipc.writeLvar("L:AB_AP_Speed_Select",SpdOffset)
end

elseif SpdMachVar == 1 then

--MachLvar = ipc.readLvar("L:AB_AP_Mach_Select")*100
MachLvar= tonumber(string.format("%.2f", ipc.readLvar("L:AB_AP_Mach_Select")))
MachLvar=MachLvar*100
MachOffset=ipc.readSW(0x66C6)

if MachOffset < 10 then
ipc.writeSW(0x66C6, 10)
elseif MachOffset > 84 then
ipc.writeSW(0x66C6, 84)
end

if MachOffset ~= MachLvar then
ipc.writeLvar("L:AB_AP_Mach_Select",MachOffset/100)
end

end


ipc.sleep(20)
--HDG
AB_hdgtrk = ipc.readLvar("L:AB_AP_HDGTRK")

HdgLvar=ipc.readLvar("L:AB_AP_HDG_Select")*182.0444444444444
HdgOffset = ipc.readUW(0x66C8)


TrkLvar=ipc.readLvar("Autopilot_TRK_set")*182.0444444444444
TrkOffset = ipc.readUW(0x66D1)

if AB_hdgtrk == 0 then

if HdgOffset ~= HdgLvar then

currentValue =(ipc.readUW(0x66C8))*0.0054931640625
ipc.writeLvar("L:AB_AP_HDG_Select", currentValue)

end

else


if TrkOffset ~= TrkLvar then
currentValue = ipc.readUW(0x66D1)*0.0054931640625
ipc.writeLvar("Autopilot_TRK_set", currentValue)
end

end
ipc.sleep(20)
--ALT
AltLvar=ipc.readLvar("L:AB_AP_ALT_Select")
AltOffset=ipc.readUW(0x66D5)

if AltOffset < 100 then
ipc.writeUW(0x66D5,100)
elseif AltOffset >49000 and AltOffset < 55000 then
ipc.writeUW(0x66D5,49000)
elseif AltOffset > 55000 then
ipc.writeUW(0x66D5,100)
end

if AltOffset~=AltLvar then
ipc.writeLvar("L:AB_AP_ALT_Select",AltOffset)
end

ipc.sleep(20)
--VS
if ipc.readLvar("AB_AP_HDGTRK") == 0 then
VsHdgLvar=ipc.readLvar("L:AB_AP_Vs_Select2")
VsHdgOffset=ipc.readSW(0x66C2)

if VsHdgOffset < -60 then
ipc.writeSW(0x66C2,-60)
elseif VsHdgOffset > 60 then
ipc.writeSW(0x66C2,60)
end
if VsHdgOffset ~=VsHdgLvar then
ipc.writeLvar("L:AB_AP_Vs_Select2", VsHdgOffset)
end
else
VsTrkLvar=ipc.readLvar("L:AB_AP_FPA_Select2")
VsTrkOffset=ipc.readSW(0x66C4)/10

if VsTrkOffset < -9.5 then
ipc.writeSW(0x66C4,-95)
elseif VsTrkOffset > 9.5 then
ipc.writeSW(0x66C4,95)
end
if VsTrkOffset ~= VsTrkLvar then
ipc.writeLvar("L:AB_AP_FPA_Select2", VsTrkOffset)
end


end

end



so in MF a created an input:
-action type: FSUIPC offset.
-load preset: in blank.
-base setting: +offsset: 0x66C0
+value type: Int +syse in bytes: 2
+mask value with: 0xFFFF ... bcd mode: no checked
-more options: set value: on left side: $-1 on right side: $+1

in FSUIPC, I set a key to start the lua, but nothings happens, I just need to get the first one input/encoder to start with so I can understand the logic.


thanks
emmanuel
2019-02-26 18:12
Avatar
emmanuel.morales
Posts: 10
I just cannot get it to work. :confused:
2019-03-15 00:38
icon