Jump to content

AS A320 Key Mapping with FSUIPC


Barlow

Recommended Posts

I am trying to map all the essential functions from the Aerosoft A320 (e.g. Autopilot 1 and 2, APPR, LS, FCU-Functions..) to my Keyboard.
I read that FSUIPC is the right software for that and that LINDA does not work for Keyboards at all.


When a Key is mapped to an "Aerosoft"-function in FSUIPC the Airplane does not react to that command.

 

I tried to choose the Function that should be controlled via the dropdown menu in FSUIPC, but also by entering the control value which I took from the lists in the FSUIPC Documentation folder. 

 

I do not know if I need LUA Plugins for that and where to find them nor how to properly implement them into FSUIPC. Are LUA Plugins the solution to my problem? 

Thank you very much in advance. 

Link to comment
Share on other sites

25 minutes ago, Barlow said:

I do not know if I need LUA Plugins for that and where to find them nor how to properly implement them into FSUIPC. Are LUA Plugins the solution to my problem? 

 

For sure. It's the easy way of doing it. You'll need some basic knowledge of how they work, but it's not difficult at all.

Just look at it and understand what does each function and voila.

 

Here is an example to switch the Ext.Power. with a key:

 

________________________________________________

 

function AB_EXT_ExtPwr_conn () 
    ipc.writeLvar("MCDU_EXTPOWER", 1)
end

function AB_EXT_ExtPwr_disc ()
    AB_OVH_EXT_PWR_off ()
    ipc.writeLvar("MCDU_EXTPOWER", 0)
end

 

function AB_EXT_ExtPwr_toggle ()
    var = ipc.readLvar("MCDU_EXTPOWER")
    if var == 1 then
        AB_EXT_ExtPwr_disc()
    else
        AB_EXT_ExtPwr_conn()
    end
end

 

event.flag(1, "AB_EXT_ExtPwr_toggle")

 

________________________________________________

 

Download Linda profile for Aerosoft A320 here: https://www.avsim.com/forums/topic/539164-new-aerosoft-a3xx-professional-v06-beta-24-jul-18/

There's a lua called "actions.lua" where you'll find all the Lvars. Just copy the ones you are interested in and add a flag for each one at the bottom of your Lua file.

 

Hope this helps.

 

 

Link to comment
Share on other sites

I followed the instructions on how to install Linda and to import the A320 Modules via the LINDA GUI. 
I also found the action.lua file. The code is more or less easy to understand (if you have at least a basic knowledge of programming).

But I do not see any option in the GUI oder the code itself to bind one of these functions to a button on my keyboard. 


I know how to bind the buttons of my Joystick to these functions but i have no clue how to bin the keys of my keyboard to them.

 

I can feel that the solution is near, but i cant see it yet. ;) '

Thank you very much for your help so far.

Link to comment
Share on other sites

Ok. You do not need to install Linda. Just extract the actions.lua inside the zip of the Aerosoft profile to pick the Lvars from it. Make a new lua yourself with only the functions you need.

 

Important, be sure to add your Lua to the [AUTO] section of FSUIPC.ini.

Then, after adding flags for each one of the functions inside Lua (like example posted above) with different numbers: 

event.flag(1...)

event.flag(2...)

and so on...

 

Finally assign a key via FSUIPC Lua Toogle "your lua file name". The parameter will be the number of every flag.

 

Link to comment
Share on other sites

In the meantime I understood what you mean and did exactly that.

1. I created an "A320_functions.lua" file and added your code snippet from above for testing. The *.lua file is in the same path as my fsuip.ini file at "/fsx/modules/".


2. I added the following code to "fsuipc.ini":

[LuaFiles]
1=ipcReady
2=linda
3=actions
4=config-hid
5=config-mcp
6=config-mcp2
7=config-mcp2a
8=config-user
9=A320_functions

3. I restarted FSX and with your help found the LUA-Sections within the "Key Presses" Section von FSUIPC.

 

4. I filled out the form as seen in the attached picture.

EDIT: I renamed my A320_functions.lua to AirbusFunctions.lua to get rid of the underscore. But thats not the solution.

But when I press the H-Key on my Keyboard, still nothing happens. 

Please login to display this image.

Link to comment
Share on other sites

Everything seems fine. Are you sure you added your Lua to the [AUTO] section of FSUIPC.ini?

 

[AUTO] 

1=Lua A320_functions (or whatever the number it corresponds).

 

Important tip, do not forget the "Lua" before the plugin name: Lua A320_functions

 

 

Link to comment
Share on other sites

My FSUIPC.ini did not include an [AUTO] section at first but an [LUAFiles] section.

I createt a new Auto-Section and added my LUA-Filename to both section. I did not work. 
After that, i deleted the Auto-Section and tested again. But it still does not work.

Link to comment
Share on other sites

Sorry, now I see that we are talking about FSX. I thought we were on P3D4. 

 

The same should apply, but maybe this variables are not present in the 32 bit Airbus.

Try to download the LINDA profile for Aerosoft 32 bit (Extended or Airbus Series) in LINDA forum and pick some other function from the actions.lua.

And keep the AUTO section.

 

[AUTO] 

1=Lua A320_functions

 

As an example from the 32 bit Airbus:

 

________________________________________________

function ND_RANGE_inc ()
    i = ipc.readLvar("L:AB_MPL_ND_Range")
    if i < 5 then
        ipc.writeLvar("L:AB_MPL_ND_Range", i+1)
        ipc.sleep(10)
        ASC_KnobRotate ()
        ND_RANGE_show ()
    end
end

function ND_RANGE_dec ()
    i = ipc.readLvar("L:AB_MPL_ND_Range")
    if i > 0 then
        ipc.writeLvar("L:AB_MPL_ND_Range", i-1)
        ipc.sleep(10)
        ASC_KnobRotate ()
        ND_RANGE_show ()
    end
end

________________________________________________

 

Hope this helps and works for you.

Link to comment
Share on other sites

 

Apologize if I also ask you for help with this, maybe you can point me in the right direction, too

 

I already managed to put a switch (Runway Turnoff Lights) to "on" with one key, and to "off" with another , but I dont get it to toggle with one key only

I made the following LUA  taken form "actions.Lua"  and asigned a key to it with Parameter 1 in FSUIPC.  

What am I doing wrong ?    Thanks a lot

 

function AB_OVH_Ext_RUNWAY_on ()
    LVarSet = "AB_VC_OVH_ExtLight_RwyTO_Sw"
    ipc.writeLvar(LVarSet, 1)
    AB_MPL_LightSwitch ()
    DspShow ("RwyL", "on")
end

function AB_OVH_Ext_RUNWAY_off ()
    LVarSet = "AB_VC_OVH_ExtLight_RwyTO_Sw"
    ipc.writeLvar(LVarSet, 0)
    AB_MPL_LightSwitch ()
    DspShow ("RwyL", "off")
end

function AB_OVH_Ext_RUNWAY_toggle ()
    if _tl("AB_VC_OVH_ExtLight_RwyTO_Sw", 0) then
        AB_OVH_Ext_RUNWAY_on ()
    else
        AB_OVH_Ext_RUNWAY_off ()
    end
end


event.flag(1, "AB_OVH_Ext_RUNWAY_toggle")
 

Link to comment
Share on other sites

12 hours ago, suniram said:

 

Apologize if I also ask you for help with this, maybe you can point me in the right direction, too

 

I already managed to put a switch (Runway Turnoff Lights) to "on" with one key, and to "off" with another , but I dont get it to toggle with one key only

I made the following LUA  taken form "actions.Lua"  and asigned a key to it with Parameter 1 in FSUIPC.  

What am I doing wrong ?    Thanks a lot

 

function AB_OVH_Ext_RUNWAY_on ()
    LVarSet = "AB_VC_OVH_ExtLight_RwyTO_Sw"
    ipc.writeLvar(LVarSet, 1)
    AB_MPL_LightSwitch ()
    DspShow ("RwyL", "on")
end

function AB_OVH_Ext_RUNWAY_off ()
    LVarSet = "AB_VC_OVH_ExtLight_RwyTO_Sw"
    ipc.writeLvar(LVarSet, 0)
    AB_MPL_LightSwitch ()
    DspShow ("RwyL", "off")
end

function AB_OVH_Ext_RUNWAY_toggle ()
    if _tl("AB_VC_OVH_ExtLight_RwyTO_Sw", 0) then
        AB_OVH_Ext_RUNWAY_on ()
    else
        AB_OVH_Ext_RUNWAY_off ()
    end
end


event.flag(1, "AB_OVH_Ext_RUNWAY_toggle")
 

 

Not tested, but this should work. Just replace the actions you want into flaggable functions

________________________________________________

function AB_OVH_Ext_RUNWAY_on () 
    ipc.writeLvar("AB_VC_OVH_ExtLight_RwyTO_Sw", 1)
end

function AB_OVH_Ext_RUNWAY_off ()
    AB_OVH_Ext_RUNWAY_off ()
    ipc.writeLvar("AB_VC_OVH_ExtLight_RwyTO_Sw", 0)
end

 

function AB_OVH_Ext_RUNWAY_toggle ()
    var = ipc.readLvar("AB_VC_OVH_ExtLight_RwyTO_Sw")
    if var == 1 then
        AB_OVH_Ext_RUNWAY_off()
    else
        AB_OVH_Ext_RUNWAY_on()
    end
end

 

event.flag(1, "AB_OVH_Ext_RUNWAY_toggle")

________________________________________________

 

 

 

Link to comment
Share on other sites

29 minutes ago, suniram said:

there is a doubled "AB_OVH_Ext_RUNWAY_off ()"  in that code, thats just a typo right?  Removing that I got it working now.

THANKS A LOT !!

 

 

 

Yep. Glad it worked. ;)

Link to comment
Share on other sites

I did everything that was said above. 
Approx. 20% of the function work now. 
The 80% don't work at all eventough I did the same for each and every function.

It's really frustrating. -.-

 

I can adjust the Autobreak or Arm/Disarm the Spoilers, but I cannot toggle LS-Button or the Engine Master switches for example. It's the case with many more functions.

Link to comment
Share on other sites

I found out that, for example, the on and off functions for the flight director work, but the toggle function does not. Any ideas whats the reason for this?

 

function Autopilot_FD_on ()
    LVarSet = "L:AB_MPL_FD"
    ipc.writeLvar(LVarSet, 1)
    SmallOverheadPushButtons ()
    DspShow ("FD", "on")
end

function Autopilot_FD_off ()
    LVarSet = "L:AB_MPL_FD"
    ipc.writeLvar(LVarSet, 0)
    SmallOverheadPushButtons ()
    DspShow ("FD", "off")
end

function Autopilot_FD_toggle ()
	if _tl("AB_MPL_FD", 0) then
		Autopilot_FD_on ()
	else
		Autopilot_FD_off ()
	end
end

event.flag(0, "Autopilot_FD_off")
event.flag(1, "Autopilot_FD_on")
event.flag(2, "Autopilot_FD_toggle")

I am using the the Aerosoft A320 v1.30 for FSX and FSUIPC.

EDIT: I tested some more functions. The root of my problem is, that the toggle functions do not work. The simple "switch state" functions however seem to work without any problems.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy & Terms of Use