-
-
Notifications
You must be signed in to change notification settings - Fork 106
Getting started with XPlane
MobiFlight now provides a direct way to interface with X-Plane by using native X-Plane DataRefs and Commands.
X-Plane knows about two different kind of ways to interact with the simulator:
DataRefs are like Sim Variables inside X-Plane that allow you to access state information from the plane, cockpit, and simulator like speed, altitude, altimeter reading, warning lights, etc. You can "read" DataRefs and use them in Output Configs. You can also "write" to some (not all) DataRefs which allows you to use them in Input Configs. For writing to a DataRef you have to provide the new value that you define in your Input Action in MobiFlight.
Commands are meant for Input Actions only. They are really simple to use because they don't require any parameters. Generally it is recommended to use commands for inputs because you don't have to worry about calculating the correct new value first (e.g., COM1 frequency range goes from 119.000 to 136.990).
Both, DataRefs & Commands are identified by an individual name which has a path structure, for example:
- DataRef "Autopilot Heading" -
sim/cockpit2/autopilot/heading_dial_deg_mag_pilot
- Command "B737 Autopilot Heading Decrement" -
laminar/B738/autopilot/heading_dn
All X-Plane DataRefs and Commands can be found listed and searchable with convenient filter options and a full-text search:
X-Plane comes with many thousands DataRefs and Commands defined which are all provided as Vendor
Laminar Research and Aircraft
Generic. This is very similar to the way you can find the presets for Microsoft Flight Simulator 2020.
Since the amount of available presets can be quite overwhelming, You can also use the excellent Datareftool plugin by Lee Baker to locate the data you are looking for. It is an interactive way to identify the DataRef that changes or the Command that is triggered by an interaction with your mouse in the cockpit.
The DataRefTool can be installed like other X-Plane plugins:
- Download the zip-file from DataRefTool website
- Unzip the content of the zip-file to your X-Plane installation directory in the
\Resources\Plugins
-folder Make sure that the DataRefTool-plugin directory contains a "64"-folder now - Restart X-Plane
- Load into a flight
- In the menu click
plugins
>DataRefTool
>Search
A new window will open:
The list of DataRefs and Commands is typically quite long but it is easy to filter the list so that you only see DataRefs or Commands that are currently changing. Additionally, you can also filter the names with sensible guesses like "radio", "freq", etc.
-
clicking on the last button, top-right window area, until
- button shows "dat" - filter list is now only showing DataRefs
- button shows "Cmd" - filter list is now only showing Commands
-
clicking on the second last button, top-right area
- button shows "ch" or "CH" - filter list is now only showing changing values
Cool, so now that we know how to determine the correct DataRef or Command it is super simple to read, write or execute them through MobiFlight.
As an example, we wish to show the autopilot selected heading value, and with DataRefTool we determined, that sim/cockpit2/autopilot/heading_dial_deg_mag_pilot
seems to react to the heading knob being turned and is what we are looking for.
Simply click the "Outputs" tab on Mobiflight and add a new configuration line, lets call it for example "Autopilot Heading". Once you have named it, and clicked the "Active" checkbox, open the configuration dialog by clicking the button on the right side, and select "X-Plane DataRef" as the variable type.
Click on Show Preset Code
so that the code box appears, and paste the dataref path into the field, and click "OK".
With X-plane running, click "Run" on MobiFlight and your autopilot heading should be visible in the "Flight Sim Value" column in the Mobiflight window. You can then configure the "Display" settings on the config item to show the data on a 7-segment display or LCD, like with any flight sim data.
This can be done in two ways by:
- executing Commands and
- writing a new value directly to a Dataref.
So we want to adjust the heading bug. We are finding out with Datareftool that the commands that react to the heading bug in the cockpit are laminar/B738/autopilot/heading_dn
and laminar/B738/autopilot/heading_up
and it changes when I twist the heading knob in the virtual cockpit. So we set those as the Commands for an encoder for onLeft and onRight events:
OnRight looks essentially the same, but uses the "_up" event of course.
The above commands are for the excellent freeware "Zibo" mod of the Boeing 737 NG, so they naturally work only for that plane, but using the Datareftool you can look up pretty much anything from X-Plane, and should be able to make things work for any plane.
Note: You cannot write to all DataRefs, some are read-only. You can check this from the X-plane
datarefs.txt
list, and also from DataRefTool that shows you if it can be writen to or not, using the Edit button when you select a dataref.
If it is writable, you can define a value for each position using for example a selector switch, or use an encoder with a suitable if() statement on the transform field, to limit the range of positions to the ones the switch can do. ( if(
This example is also from Zibo 737, from the datarefs text file, and it is writable so we ca do this:
This example uses a rotary encoder to control the bank angle selector switch. Not completely realistic, but works. That particular bank angle selector has 5 positions with values 0,1,2,3 and 4, so the OnRight value has "if(
For toggle switches you would first look for a pair of ON/OFF commands, but if you find a writable dataref, you can also write 1 for onPress and 0 for onRelease events of the switch.
Before the native X-Plane integration, MobiFlight supported X-Plane only through XPUIPC which was mimicing the FSUIPC with its Offset oriented way of accessing sim variables and perform input events. The theoretical advantage was, that a MobiFlight config could theoretically be used for a simulator with FSUIPC interface (like FSX or P3D) and also for X-Plane with XPUIPC. However, practice has shown that this benefit was not really relevant because most cockpits would need access to special sim variables and it required a lot of knowledge to extend XPUIPC with own offsets.
If you are a XPUIPC user, there is currently no automated way of migrating your XPUIPC config to the new X-Plane native style. There is two types of configs that you would want to migrate:
- Configs that use a standard FSUIPC offset - here you have to look up the corresponding DataRef of Command yourself with the DataRefTool, because XPUIPC has them built-in and they are not listed in a config file anywhere.
- Configs that use an offset that is defined in
XpuipcOffsetConfig.cfg
- in this case, you can look up the DataRef of Command name by looking through your config.
In any case, it will be some work yes, but still quite straight forward to migrate an "FSUIPC Offset" config to a "X-Plane native" config.
In case you would like to still continue using the XPUIPC interface, see the old how-to guide with more information. You also might be interested in the XPUIPCOffsets.cfg Notepad++ plugin for editing the config file.
- MobiFlight Connector Installation
- Mobiflight Connector BETA version installation
- Modules
- MobiFlight Connector Files Structure
- MobiFlight Connector Uninstall
- Modules Reset to factory default
- Verifying the WASM module installation and locating the MSFS2020 community folder
- Verifying the WASM module installation and locating the MSFS2024 community folder
- Using a Winwing FCU with MobiFlight
- Providing logs from MobiFlight
- MobiFlight Connector How does it work
- Mobiflight Connector Main Window
- Flash module with MobiFlight firmware
- Input and Output devices
- Joysticks
- Midi Boards
- Sim Variables (for Output)
- Input Actions
- Merging configuration files
- Disabling specific COM ports
- Examples Output LEDs
- Examples Input Switch
- Example 7 segment display
- Example Servo motor
- Controlling LEDs with an output shift register
- Adding lots of buttons with an input shift register
- Beginner's guide to input multiplexers
- Key Matrix with standard MobiFlight and Multiplexers
- Tutorial Easy Driver and x.27 or x.40 Stepper Motor
- Tutorial for Airbus VS display via 7-Segment LED Module
- Example Analog Input Potentiometer
- Baron G58 Tutorial Gear, Flaps, Mags, ELT Input Output Programming
- Using Mobiflight to control arduino-based 3rd party panels (RealSimGear GNS530)
- How to use a VNH2SP30 DC motor shield with MobiFlight
- Using 3D printer mainboards
- Playing sounds by sending keystrokes to AutoHotKey
- Using the selector knob on a Honeycomb Bravo
- Using an adjustable 12 position switch as a GA starter
- Brightness of LCD displays with I2C
- Using three-position switches
- Transponder with one Rotary
- Workflow for Creating Flight Simulation Panels ‐ Part 1
- MSFS2020 RPN Tips and Tricks
- MSFS2020 Using the Custom Input Code Box
- MSFS2020 Install WASM module and Event List
- MSFS2020 How to Create and Use User Defined Lvars
- MSFS2020 How to Create a Blinking LED configuration
- MSFS2020 User Defined WASM Module Events Best Practices
- MSFS2020 Developer Mode, Model Behavior dialog and Console window
- MSFS2020 PMDG 737‐700 List of Events that require use of FSUIPC7
- MSFS2020 PMDG 737‐700 Calibrate throttle idle and reverse thrust using interpolation (Valkyrie)
- MSFS2020 PMDG 737-700 Chrono unit functions implemented in Mobiflight
- Configuring PMDG 737 Parking Brake Lever Auto-Release with a Servo in Mobiflight
- Using encoder to drive a value back and forth within a given range
- Adding a custom board to MobiFlight
- User guide - Community Board and Custom Devices
- Developing your own custom devices/boards