Mapping events to hat switch directions on joystick

Discuss on the SimConnect SDK can be used by programmers to write add-on components for Prepar3D
Post Reply
keilyn6
Posts: 8
Joined: Wed Jan 04, 2023 7:31 pm

Mapping events to hat switch directions on joystick

Post by keilyn6 »

I was wondering if there was a way to map a specific hat switch direction to an event. I am trying to add elevator trim to the IsimObject Simple Airplane, and realistically in an actual aircraft, the hat switch is used to to adjust the elevator trim (pressing up = trim up, pressing down = trim down). I am currently using the HOTAS as the input, but the hat switch is mapped to one button no matter the direction, (whether you press up, down, left, or right).

I was wondering if there was a way to specify the directions and map them to a specific event, similar to the View (Pan). Pressing Up on the hat switch allows for you to look up, and pressing down allows for you to look down. Is there a way using the hat switch and RegisterProperty that will allow me to map an upward press on the hat switch to trim up, and a downward press on the hat switch to trim down?
Clifton Crane
Lockheed Martin
Posts: 1207
Joined: Tue Sep 25, 2012 2:34 pm

Re: Mapping events to hat switch directions on joystick

Post by Clifton Crane »

Hi keilyn6,

Yes, this should be possible. You can use the EVENTTYPE_POV enum when registering your property. When your callback is hit, you should be provided the state of the hat switch in the data member. I believe values should be 0-315 representing degrees in a clockwise order. A value of -1 would indicate the hat switch was returned to center.

Regards,
Clifton
Clifton Crane
Prepar3D® Software Engineer Sr.
Post Reply