vPilot and CPFlight ASP R/T - Multiple PTT

A how-to is an informal, often short, description of how to accomplish some specific task (Wikipedia)
Post Reply
bcars
Posts: 319
Joined: 06 Jun 2012, 03:00
Location: USA

vPilot and CPFlight ASP R/T - Multiple PTT

Post by bcars » 14 Apr 2019, 20:13

I fly on Vatsim and use vPilot as the client. I have configured the normal Yoke PTT switches, but wanted to add support for handling the ASP R/T switches as well. I currently have FSUIPC handling the Yoke PTT pushbuttons and sending a Keycode that is recognized by vPilot. I extended this capability by adding support for the ASP R/T switches.

I have 2 ACES yokes ( Capt and FO) as well as 2 CPFlight ASP V2 modules ( capt and FO)
(note: this solution will also work with the original ASP modules.

vPilot can only accept one input. Either a Joystick button or a keypress. It cannot handle more than one input. Therefore, I had to provide a way to have externally triggered events ( buttons, gates) send a single Keypress to vPilot.
FSUIPC wil be 'simulating' the press of F14 based on various button inputs.

Step1 : Configure vPilot PTT

I don't really have a keyboard, but had to tell vPilot to look for a keypress. This is only way to allow multiple inputs to be recognized by vPilot. vPilot "THINKS" the input is from F14, How F14 was 'pressed' is not relevant. Note: F14 is what I used, you can use any keypress code)

My vPilot is setup to recognize F14 as the PTT. I chose F14 just so it would not be a 'normal' function key that something else might detect. This is actually accomplished in Windows by pressing Shift F2 (in my case for F14) F13-24 are entered via Shift-F1 ... Shift-F12.

Since vPilot cannot recognize the Shift-F2 (F14) directly ( it treats the Shift Key as the key you want to use) , I had to set vPilot to use the keycode by editing the vPilotConfig.xml ( same directory as the vPilot.exe) Find and edit the following line:
<PTTConfiguration DeviceType="Keyboard" Name="Keyboard" ButtonOrKey="125" />

If you notice, I told vPilot to look for a Keyboard input from F14. ButtonOrKey="125" 125 is the internal keycode for F14, if you want to set it to something else that is fine.

Step 2: Configure the PTT Buttons

This step involves detecting the Buttons and sending a KeyPress event with the proper code.
For the 2 ACES Yokes ( Capt and FO) I assign the appropriate Control Wheel Buttons on the yokes via FSUIPC in the normal way, In the FSUIPC Buttons dialog, let FSUIPC buttons detect the button and assign it to send a KeyPress of F14 ( K125). Note: remember to check the Repeat action while button is held)
This takes care of the Yoke PTT

Step 3: Configure CPFlight ASP R/T switches

The CPFlight hardware is controlled via Prosim, so we have to find a way to have Prosim send the keypress that vPilot is looking for. Prosim doesn't have a way to send Keypresses, so it can't do this directly.

FSUIPC has a nice feature called Virtual Joystick Buttons. These are buttons that do not Physically exist, but can be "Programmed" to be recognized as a button press. These are 'set' or "read" via the FSUIPC Offset x'3340'. 3340 is 9 DWORDS representing 32 buttons on each of 9 virtual joysticks. The virtual joysticks are numbered starting with 64. ( This is also how wideClient can send joystick button presses from remote clients, but I digress)

The joystick buttons are numbered 1-32, however the offsets are 32 bits so they are addressed as offset 0..31 so vJoystick 64, button 1 is offset 3340.0, button 2 is offset 3340.1 etc

I chose to use virtual joystick 65 , since I already have WideClient using some buttons from a Bodner card on a client machine. So Joystick 65 would be 3344 ( each virtual joystick is 32 bits or 4 bytes)

Prosim can't send the keypress, however it can set FSUIPC offsets based on some input.
The way I did this was to see if we could get Prosim to tell us when one of the ASP R/T buttons was pressed. There is GATE called ASP ASP RT OUT that does this. ( Look in Combined Config, MISC, GATES and scroll down until you find it.)
I assigned the ASP ASP RT OUT to an FSUIPC Offset that was an Unsiged 32 bit value (U32). For the Value I entered 3344.0 This says that when the switch is held to the RT position, set Bit 0 of offset 3344 to 1. ( prosim can only set a 1 or 0)
So when I switch the R/T I/C switch to the R/T position, Prosim will set the Virtual Joystick 65 button 1 (offset 3344.0 bit 0 ). You can use the same process for the FO ASP button. I just set offset 3344.1 -- Joy 65 button 2.

Step 4: Configure FSUIPC to handle virtual joystick button

Now that we have Prosim configured, all we need to do is have FSUIPC handle the virtual joystick button the same way it handles the Yoke PTT buttons. (Note: you need P3d or FSX running, and Prosim737.exe running)
Open the FSUIPC config from the P3D Addon menu. Go to the Buttons tab. From the CPFlight pedestal, press the CPFlight ASP R/T switch. FSUIPC should recognize that Joy 65, button 1 was pressed. Now just assign it the same as you did the Yoke PTT send keypress and repeat.
You can do the same thing for the F/O asp module.
(Note: Since I used F14, pressing Shift F2 results in FSUIPC setting a code of 115,9. So I had to manually add the line the FSUIPC5.INI
698=R65,0,K125,8 -{Key press: F14}-


This same technique can be used to have Prosim 'send' virtual buttons for any other controls you might want to control through FSUIPC ( for things Prosim can't handle directly ) It is not limited to CPFlight hardware.
Thanks
Bruce

Post Reply

Return to “ProSim737 - How-tos”