Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 1 of 1

Thread: Flight Sim Controls and VS 2017. Microsoft FS 2020

Hybrid View

  1. #1
    Junior Member
    Join Date
    Oct 2018
    Posts
    2

    Flight Sim Controls and VS 2017. Microsoft FS 2020

    The goal is that Teensy's flight sim devices can be used without modification with either X-Plane or MSFS 2020.

    I'm not a good enough programmer to work outside a debugger and I don't have a MAC or LINUX box, but I did want to modify the Flight Sim Controls X-plane Plug in. I played around and provide below a VS project that can debug and compile the Teensy Controls Plug In for Windows.

    The main problem seemed to be "DWORD WINAPI launcher(void *in) // was WINAPI DWORD, looks like it was a typo". After that, mixing in the code with a working X-Plane "Hello World" example was pretty easy and it compiled and ran. I did find a couple of problems though:

    1. Using a common XP Plug In "Reload All Plug ins" did not reload The Teensy Controls Plug In. Without this you have to resort to restarting X-Plane after every edit. As noted in the code the window created to receive USB connection notifications was not being destroyed. The window creation code was fundamental to re-starting the plug in. I added code to destroy the window.

    2. Once that was done the Plug In restarted but without communication unless the teensy was disconnected and re-connected. I resolved this by adding "device_scan_needed = 1; // So threads start after reload all plugins" in TeensyControls_usb_init(void).

    On the way to MSFS 2020.
    This is prep work for MSFS 2020 which uses a similar reference system with different names. So that Teensy instrumentation can work with both X-Plane and MSFS 2020 there needs to be an abstraction of the data refs. Simply in the Teensy code use a user defined name instead of the dataref like this:

    Instead of:
    elevTrimPosition = XPlaneRef("sim/flightmodel/controls/elv_trim");

    Something like:
    elevTrimPosition = XPlaneRef("elevatortrimpos");

    When the plug in receives the dataref during initialization new code looks to see if the name is in a text file, if it is it replaces the name with the dataref in the file. If not, or there is no text file, it uses whatever the Teensy sent. The plug in will work with existing devices.

    A different text file will convert the Teensy provided user defined name to the appropriate data reference for the flight simulator used.

    A compiled plug in and the text file is attached.

    Once I have MSFS 2020, or more importantly a computer to run it, I will attempt to modify the plug in to use the 'SimConnect to connect to MFS 2020. Of course if anyone already has MSFS 2020 and a need please go ahead and modify to suit.

    Questions.

    1. Should I put this in GIT, the changes are very small from the one found here (I dont know how to do this).

    2. Anybody want to add my changes so they work on LINUX/MAC. The Re-Load Plug-Ins is useful!

    Regards.
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •