Jump to content
The simFlight Network Forums

[GUIDE] X56 HOTAS: How to use the Mode Switch (M1,M2,M3) to control multiple functions in FSUIPC7


Recommended Posts

Posted

Hi everyone,

I wanted to share with the community a solution I successfully implemented for my Logitech X56 HOTAS in MSFS, using the power of FSUIPC7. My goal was to use the 3-position mode switch (M1, M2, M3) to dynamically change the function of one of the throttle's rotary encoders, allowing me to control Altitude, Heading, and the VOR OBS with a single knob.

After some trial and error, and with some great community help, I've arrived at a robust and flexible solution that I'd like to detail here. I hope this helps other users of the X56 or joysticks with similar features!
The Concept

The logic is simple: we use the mode switch (M1, M2, M3) to "tell" FSUIPC which mode is currently active. We do this by writing a number (1, 2, or 3) to a small FSUIPC memory area called an "offset." Think of it as a digital notepad.
Then, we program the rotary encoder's buttons to first read the number from that notepad before they act. Based on the number, they will execute the correct action (increase/decrease HDG, OBS, or ALT).


Step 1: Identify and Program the Mode Switch

First, we need to tell FSUIPC to monitor the mode switch and write a value to our "notepad" (we will use the offset 0x66C0).

  1. In FSUIPC, go to Assignments -> Buttons & Switches. Create a profile for your aircraft (e.g., "Cessna 172").
  2. Move the mode switch to the M1 position. Take note of the button number that FSUIPC detects.
  3. Do the same for M2 and M3. (In my case, these were buttons 133, 134, and 135 on my throttle).
  4. Now, assign an action to each button:
    • For the M1 button: Select the control "Offset Byte Set", in the Offset field, type x66C0, and in the Parameter field, type 1.
    • For the M2 button: Select "Offset Byte Set", Offset x66C0, Parameter 2.
    • For the M3 button: Select "Offset Byte Set", Offset x66C0, Parameter 3.

That's it! Your mode switch is now saving its current state within FSUIPC.

Step 2: Create the Lua Scripts

The cleanest way to make the encoder "read" the state is with two small Lua scripts—one for increasing values, and one for decreasing.

Open Notepad and create a new file in your FSUIPC7 installation folder. Save it as X56_Rotary_Inc.lua (remember to change the "Save as type" to "All files"). Paste the following code into it:

-- Script to INCREASE values
-- Reads the current mode we set with the M1/M2/M3 switch
mode = ipc.readUB(0x66C0)

if mode == 1 then
    ipc.control(65879) -- Heading Bug Inc
elseif mode == 2 then
    ipc.control(65663) -- VOR1 OBS Inc
elseif mode == 3 then
    ipc.control(65892) -- AP Altitude Var Inc
end

Create a second file named X56_Rotary_Dec.lua and paste this code:

-- Script to DECREASE values
-- Reads the current mode we set with the M1/M2/M3 switch
mode = ipc.readUB(0x66C0)

if mode == 1 then
    ipc.control(65880) -- Heading Bug Dec
elseif mode == 2 then
    ipc.control(65662) -- VOR1 OBS Dec
elseif mode == 3 then
    ipc.control(65893) -- AP Altitude Var Dec
end

Step 3: Assign the Scripts to the Rotary Encoder

Now, let's link the physical encoder buttons to our new scripts.

  1. Go back to Assignments -> Buttons & Switches.
  2. Identify your encoder's buttons. For me, they were button 29 (increment) and button 30 (decrement).
  3. For the increment button (e.g., Btn 29):
    • In the "Control sent when button pressed" dropdown list, scroll to the bottom, find and select the script "Lua X56_Rotary_Inc".
    • Check the box for "Control to repeat while held".
  4. For the decrement button (e.g., Btn 30):
    • Select the script "Lua X56_Rotary_Dec".
    • Check the box for "Control to repeat while held".
  5. Click OK to save.

Step 4: Final Test and Important Tip

Before you test, remember the Golden Rule: create a clean, new controls profile for your X56 inside MSFS itself, and make sure it has no default assignments for the buttons you've just programmed in FSUIPC. This prevents conflicts!

Now, load your aircraft, engage the autopilot, and test your new setup! The mode switch should now work perfectly as a function selector for your rotary encoder.

I hope this guide helps other X56 owners get the most out of FSUIPC7!

Ps: attached, I left my configuration files in case you need them.

Happy flying!

 

FSUIPC7.ini X56_Rotary_Dec.lua X56_Rotary_Inc.lua

Posted

Thanks for this - I will move it to the User Contributions section.

Also note that another way to use the mode switch to have different assignments to the same button/switch depending on the mode switch positiin is to use compound assignments. You need to manually edit the FSUIPC7.ini file ro do this, and tge methos is documented in the Advanced User guide. However, this is only applicable to button (and key) assignments, not for axis assignments.

John

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.