Jump to content
The simFlight Network Forums

PMDG: How to assign "A/P disengage" to joystick button?


Recommended Posts

The PMDG aircraft uses local variables, rather than the default commands which can be selected from that drop-down list.

 

Can I suggest that you check out LINDA? That's an add-on which works through FSUIPC and uses the LUA language to assign functions such as the ones you want.

http://fs-linda.com/

Cheers,

 

Ian P.

Link to comment
Share on other sites

I would like to assign the "A/P disengage" to a Joystick button. Can anybody tell me, how to realize this with FSUIPC? I tried to assign some predefined functions but with no result.

 

If this is for the 737NGX, then the document in the PMDG SDK installed with the update they released ("PMDG_NGX_SDK.h") lists:

 

#define EVT_MCP_DISENGAGE_BAR (THIRD_PARTY_EVENT_ID_MIN + 406)
 
Earlier in the same document THIRD_PARTY_EVENT_ID_MIN is defined by
 
#define THIRD_PARTY_EVENT_ID_MIN         0x00011000 // equals to 69632
 
So, the <custom control> to be assigned in FSUIPC is  69632 + 406 = 70038.
 
Whether it needs any parameter value I don't know. You'd need to experiment. Maye '1' (for "TRUE").
 
Pete
Link to comment
Share on other sites

Bingo! I was just to post the same question. In PMDG_NGX_SDK.h:

 

//Yoke Animations

#define EVT_YOKE_L_AP_DISC_SWITCH   (THIRD_PARTY_EVEN_ID_MIN + 1004)

#define EVT_YOKE_L_AP_DISC_SWITCH   (THIRD_PARTY_EVEN_ID_MIN + 1005)

 

So the rest is like Pete explained already (thank you so much!!!)

 

Now I'm looking for the A/T disconnect button on the throttles.

 

Any idea?

 

Thanks,

Dirk.

Link to comment
Share on other sites

Now I'm looking for the A/T disconnect button on the throttles.

 

Same file:

 

#define EVT_CONTROL_STAND_AT1_DISENGAGE_SWITCH (THIRD_PARTY_EVENT_ID_MIN + 682)
#define EVT_CONTROL_STAND_AT2_DISENGAGE_SWITCH (THIRD_PARTY_EVENT_ID_MIN + 685)
 
The TOGA buttons also listed.
 
Pete
Link to comment
Share on other sites

Great! 

 

In the first example (and I guess in case with AT too) you need to enter parameters as follows:

 

<70636>

Parameter 0

 

Control sent when button released

<70636>

Parameter 1

 

 

In this case the yoke disconnect logic will work right: the  red warning/alarm will light/sound then extinguish.

 

Thanks,

Dirk.

Link to comment
Share on other sites

I really need an example of how to find a reference to the parameters (0 and 1) that I used rather instinctively in the above example either in PMDG_NGX_SDK.h or PMDG+737NGX_SDK+10FEB12.pdf documents. It will help me to understand how they are used in other more complex controls. Please give me an idea with this or similar.

 

Much thanks,

Dirk.

Link to comment
Share on other sites

Pete,

 

Unfortunately AP disc / AT disc logic doesn't work right via <custom control> assigned in FSUIPC as per my experiment above. To some reason it works only on the first instance: you press AP discon button, the warning goes off, you press AP discon again and it extinguishes. Then if you engage AP and press AP discon button again the warning goes off and extinguishes on its own without waiting for the second AP discon button press.

 

I checked the correct logic through internal PMDG key assignments and also with this lua:

 

 

-- PMDG737 lua --

 

function NGX_AP_soft_disconnect ()

 
    ipc.writeLvar('ngx_switch_1004_a', 100);
    ipc.control(65580, 536870912)
    ipc.sleep(150);
    ipc.writeLvar('ngx_switch_1004_a', 0);
 
    DspShow (" AP ", "soft")
 
end
 
event.button("B", 6, 1, "NGX_AP_soft_disconnect")

 

The latter two always wait for the second press on AP discon button. Same inconsistency shows up with ATHR disconnect.

 

Thanks,

Dirk. 

Link to comment
Share on other sites

One more question, please:

 

Is it ok to have both Lua AXE (airbus) and Lua PMDG737 entries in [Auto] section of FSUIPC? Can it potentially affect performance or create any confusion as both lua files in Modules folder are read? Is it better to remove an unused lua from Modules folder?

 

Thanks,

Dirk.

Link to comment
Share on other sites

Now FSUIPC control for AP1 disconnect works properly with the following:

 

Value

<70636>

 

Parameter 536870912

 

I tried the above Parameter from the Linda's Lua for 737NGX (as suggested by Ian P). I have no idea where they took it from, but obviously it is not in PMDG's SDK docs.

 

Thanks,

Dirk. 

  • Like 1
Link to comment
Share on other sites

Now FSUIPC control for AP1 disconnect works properly with the following:

 

Value

<70636>

 

Parameter 536870912

 

I tried the above Parameter from the Linda's Lua for 737NGX (as suggested by Ian P). I have no idea where they took it from, but obviously it is not in PMDG's SDK docs.

 

I do not use any PMDG aircraft and I don't know anything about the parameters other than what is in that PMDG SDK document. I expect that trhe parameters are all based on the equivalent mouse action which you would otherwise use on the cockpit on screen, i.e. these as listed in that document:

 

#define MOUSE_FLAG_RIGHTSINGLE   0x80000000
#define MOUSE_FLAG_MIDDLESINGLE  0x40000000
#define MOUSE_FLAG_LEFTSINGLE    0x20000000
#define MOUSE_FLAG_RIGHTDOUBLE   0x10000000
#define MOUSE_FLAG_MIDDLEDOUBLE  0x08000000
#define MOUSE_FLAG_LEFTDOUBLE    0x04000000
#define MOUSE_FLAG_RIGHTDRAG     0x02000000
#define MOUSE_FLAG_MIDDLEDRAG    0x01000000
#define MOUSE_FLAG_LEFTDRAG      0x00800000
#define MOUSE_FLAG_MOVE          0x00400000
#define MOUSE_FLAG_DOWN_REPEAT   0x00200000
#define MOUSE_FLAG_RIGHTRELEASE  0x00080000
#define MOUSE_FLAG_MIDDLERELEASE 0x00040000
#define MOUSE_FLAG_LEFTRELEASE   0x00020000
#define MOUSE_FLAG_WHEEL_FLIP    0x00010000   // invert direction of mouse wheel
#define MOUSE_FLAG_WHEEL_SKIP    0x00008000   // look at next 2 rect for mouse wheel commands
#define MOUSE_FLAG_WHEEL_UP      0x00004000
#define MOUSE_FLAG_WHEEL_DOWN    0x00002000
 
Those are in hexadecimal. The value 536870912 is the same as hexadecimal 0x20000000, which means "MOUSE_FLAG_LEFTSINGLE" -- in other words a single click with the left mouse button.
 
FSUIPC also accepts hexadecimal parameters. Just precede the value with an 'x', i.e. x20000000.
 
Pete
  • Like 1
Link to comment
Share on other sites

Awesome, thank you. I'm surprised how I can play now with these numbers and lua expressions without any knowledge or understanding. I've never studied any basic programming,  can't write a single string or a logical expression, however during yesterday I managed to assign all my GF buttons and rotaries (8 panels) and some joystick buttons to internal pmdg737ngx functions from scratch just using the above information, and I did that in a few ways (fsuipc controls and lua files) for comparison. I just can see some similar patterns that I shuffle for my needs, is it what is called 'hacking'?

 

Is there any performance benefit of using Custom control facility in FSUIPC vs. properly written lua file with the same functionality? Lua is very convenient, as you can store all the controls in one file, and not buried in FSUIPC.ini that has already too much in itself and potentially can be modified over time by newer versions.

 

Thanks,

Dirk.

Link to comment
Share on other sites

Is there any performance benefit of using Custom control facility in FSUIPC vs. properly written lua file with the same functionality? Lua is very convenient, as you can store all the controls in one file, and not buried in FSUIPC.ini that has already too much in itself and potentially can be modified over time by newer versions.

 

 

There's not really much difference for actioning controls. 

 

INI file assignments are not modified by new versions. In fact the Installer doesn't touch the file at all.

 

If you are using profiles in FSUIPC you can have all the assignments for different profiles in separate INI files. This facility was added recently and is described in a new document installed in your FSUIPC Documents folder.

 

Pete

Link to comment
Share on other sites

If you are using profiles in FSUIPC you can have all the assignments for different profiles in separate INI files. This facility was added recently and is described in a new document installed in your FSUIPC Documents folder.

 

Pete

 

Very interesting and can be very useful, I'll go through it.

 

Thanks,

Dirk.

Link to comment
Share on other sites

 

If you are using profiles in FSUIPC you can have all the assignments for different profiles in separate INI files. This facility was added recently and is described in a new document installed in your FSUIPC Documents folder.

 

Pete

 

Which document, Pete? I was looking for "Profile" in both FSUIPC4 User Guide and FSUIPC4 for Advanced Users and couldn't find anything about separate ini files.

 

Thanks,

Dirk.

Link to comment
Share on other sites

Which document, Pete? I was looking for "Profile" in both FSUIPC4 User Guide and FSUIPC4 for Advanced Users and couldn't find anything about separate ini files.

 

Thanks,

Dirk.

 

Ah, sorry. Yes, I was getting ahead of myself.

 

It WILL be installed by the next full install update, but meanwhile it is included in the latest ZIP file with the updated module and changes document. Please see the Download Links subforum.

 

Pete

Link to comment
Share on other sites

  • 5 months later...

The PMDG aircraft uses local variables, rather than the default commands which can be selected from that drop-down list.

 

Can I suggest that you check out LINDA? That's an add-on which works through FSUIPC and uses the LUA language to assign functions such as the ones you want.

http://fs-linda.com/

Cheers,

 

Ian P.

So with LINDA can you assign complex keystrokes for example CTRL+SHIFT+(keystroke) to any of the available commands?

 

If yes, What are the available combinations availble?

SHIFT+(keystroke)

CTRL+(keystroke)

ALT+(keystroke)

CAPS LOCK+(keystroke)

CTRL+SHIFT+(keystroke)

ALT+SHIFT+(keystroke)

 

Any others? Any of the above?

 

Cheers, 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy 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.