FSUIPC: Use a Hat Switch for Pan View

FSUIPC: Using a Hat Switch for Pan View

Being able to look around the outside view while in your cockpit simulator is a crucial part of ground and air operations. For those of us without wraparound multi-display visual systems, this means we need to be able to quickly pan the camera’s viewpoint.

Luckily, FSX/Prepar3D provides the ability to pan the camera view using joystick buttons or keyboard key presses. There are nine preset controls for doing this, eight directional and a reset:

  • Up
  • Right Up
  • Right
  • Right Right
  • Down
  • Left Down
  • Left
  • Left Up
  • Reset

You could assign these controls directly through FSX/Prepar3D, but I have all controllers disabled in FSX/Prepar3D. If this option is enabled, FSX/Prepar3D tends to assign random functions to new/changed USB devices. Instead, in this article, we are going to configure pan view using a hat switch with Pete Dowson’s FSUIPC interface program.

To be able to look in all directions, the process is a little different depending on if you have an 8-way or 4-way hat switch, so I will cover both.

8-WAY HAT SWITCH

If you have an 8-way Hat Switch, like the Saitek Pro Flight Yoke does, you can simply assign each hat switch direction button under the Buttons + Switches tab in FSUIPC:

  • Check the Select for FS Control box
  • Choose the appropriate Control sent when button pressed dropdown option, such as ‘Pan Left’ or ‘Pan Right’.
  • Check the Control to repeat while held box.
  • Repeat for all 8 buttons on the hat switch.

In this FSUIPC example, the hat switch is on Joystick #2, and pressing right on the Hat Switch (button #27) is set to repeat the ‘Pan Right’ control.

fsuipc1

The problem that arises here is resetting the view once you move off center. This is especially important when you don’t see any of the cockpit, such as with a cockpit simulator, because you lose any reference of what center is.

One easy option is to set the Control sent when button released dropdown option to ‘Pan View Reset’ for each of your hat switch buttons. However, this will make it snap back to center as soon as you release the button, which you may find annoying pretty quick.

fsuipc2

Another option is to assign some other button or key to the ‘Pan View Reset control and uncheck Control to repeat while held. Then, pressing that button will get you back facing the right direction.

In my case, however, I wanted to keep it all on my hat switch. So, I just re-assigned the Up hat switch button to ‘Pan View Reset’ and unchecked Control to repeat while held. I can still look Left Up and Right Up, just not directly Up. To be honest, I seldom look up anyway and, this way pressing up on the hat switch always centers my view.

4-WAY HAT SWITCH

When I replaced the Saitek yoke with my Simujabs Column Yoke, I asked them to install a custom hat switch. They did, but used a 4-way switch. To make a 4-way switch control 8 directions, we have to use the Compound Button Conditions feature within FSUIPC.

Compound Button Conditions allow FSUIPC to send different commands when two buttons are pushed at the same time. This will allow us to send the ‘Pan Right Up’ command when we push the hat switch diagonally right and up.

First, I programmed the four basic pan view directions into FSUIPC from inside FSX/Prepar3D. Then, we have to manually modify the FSUIPC.ini text file. Locate this file in your …/FSX/Modules/ folder, open it in notepad, and look for the [Buttons] section. Here, we can see the basic four directions assigned.

NOTE: Anything text here after the ; symbol are my own comments.

14=R2,25,C65734,0 ; PAN UP
15=R2,26,C65671,0 ; PAN LEFT
16=R2,27,C65672,0 ; PAN RIGHT
17=R2,24,C65735,0 ; PAN DOWN

To explain these in detail, let us look at the first PAN UP line:

  • The number before the = is the internal button index of FSUIPC and should increment by one for each button and not duplicate. In this case, it is my 14th button assignment in FSUIPC.
  • Next, the R in R2 means repeat the command and the number is the FSUIPC device number (here, the Simujabs Yoke showed up as Device 2).
  • The next number is the joystick button ID itself, so pressing UP on the Simujabs hat switch is button #25.
  • The next word is the function to send to FSX/Prepar3D. The options available here are as follows:
    • C65734  – Pan Up
    • C65856  – Pan Right Up
    • C65672  – Pan Right
    • C65857  – Pan Right Down
    • C65735  – Pan Down
    • C65855  – Pan Left Down
    • C65671  – Pan Left
    • C65854  – Pan Left Up
    • C65875  – Pan Reset
  • The last number is for the parameter. Zero is typically used here.

Then, using Compound Button Conditions, I manually modified the hat switch assignments in the FSUIPC.ini text file to read like this:

14=R2,25,C65734,0 ; PAN UP
15=CR(+2,26)2,25,C65854,0 ; PAN LEFT UP
16=CR(+2,27)2,25,C65856,0 ; PAN RIGHT UP
17=R2,26,C65671,0 ; PAN LEFT
18=R2,27,C65672,0 ; PAN RIGHT
19=CR(+2,26)2,24,C65855,0 ; PAN LEFT DOWN
20=CR(+2,27)2,24,C65857,0 ; PAN RIGHT DOWN
21=R2,24,C65735,0 ; PAN DOWN

Note the new lines containing ‘CR’, this means Compound Repeating. Looking at line 15, the data in parenthesis is the condition (joystick 2, button 26) that must be met along with the rest of the line (joystick 2, button 25). The + symbol means this button must be pressed. A – symbol can also be used to mean the button must be released. You can have up to 16 conditions on a single line, if you so desire.

Now, my line 15 means that if button 25 and 26 are pushed together, send command C65854 (Pan Right Up) repeatedly. And, as such, this causes the camera to pan up and right at the same time.

NOTE: Be sure if you add/remove lines under the [Buttons] section of the FSUIPC.ini file, that you renumber the index values to be in order.

TIP: CP can be used in place of CR if you only wanted to send the command once (Compound Pulse). CU could also be used to send a command when the conditional buttons are released.

Finally, to use the handy Pan Reset again, I simply updated the C value for the Up button line to send the Pan Reset command instead:

14=R2,25,C65875,0 ; PAN RESET

It is a little tricky when viewing up and left/right as it sometimes it catches the Pan Reset first, but it does work. Again, I do not look up very often anyway, so it is a minor issue anyway.

I learned quite a number of things regarding FSUIPC and input devices during this task, so I hope I was able to convey this information to my visitors as well!

Leave a Reply

Your email address will not be published. Required fields are marked *