maartentamboer / X-Touch-Mini-FS2020

Control FS2020 with a Behringer X-Touch Mini
https://dev-tty.nl/X-Touch-Mini-FS2020/
MIT License
59 stars 19 forks source link

Turning the X-Tocuh button LEDs on/off? #11

Closed P1NBA11ER closed 3 years ago

P1NBA11ER commented 3 years ago

How do I control the LEDs on the x-touch to get the lights on/off when enabling disabling a cockpit feature? For example, I've mapped a few buttons to turn the taxi/landing lights on and off but I'd like to get the lights on the x-touch to go on and off with them but I don't see anything obvious. No rush on this and thanks again for putting together this great little tool.

maartentamboer commented 3 years ago

You can bind the light of a button to any boolean simvar value. A list of these values for lights can be found in https://github.com/odwdinc/Python-SimConnect/blob/master/SimConnect/RequestList.py#L406

So to toggle the landing lights and indicate this with the led you can place this code in your config file

    {
      "index": 11,
      "event_press": "LANDING_LIGHTS_TOGGLE",
      "simvar_led": "LIGHT_LANDING"
    },

https://github.com/maartentamboer/X-Touch-Mini-FS2020/blob/main/Configurations/config_default.json

maartentamboer commented 3 years ago

A list of events regarding lighting can be found here: https://github.com/odwdinc/Python-SimConnect/blob/master/SimConnect/EventList.py#L758

P1NBA11ER commented 3 years ago

Ok thanks, very helpful and I'm getting there but wow. It seems like events for lots of obvious things don't exist. For example, the landing lights on the A320 have three positions but it's only possible to control two of the three. Also, I don't seem to see any simvar value for the landing gear up/down either.

maartentamboer commented 3 years ago

Yeah the API from Microsoft is a relic from the old FSX days and maybe even before that. General rule of thumb is that simvars are just for reading and events are for writing, but this is not always true. So for the landing gear you can use the GEAR_TOGGLE event https://github.com/odwdinc/Python-SimConnect/blob/master/SimConnect/EventList.py#L806 And to illuminate the button GEAR_HANDLE_POSITION should work.

I'm not sure if you fly the FlyByWire A32NX. A benefit of that one is that you can browse the source code and look for events and simvars that are specifically for that plane. https://github.com/flybywiresim/a32nx

So it looks like you can maybe set the simvar LIGHT LANDING:1 LIGHT LANDING:2 and LIGHT LANDING:3 https://github.com/flybywiresim/a32nx/blob/487e3741ef1e5ad7f47a81a9fd91c4379784c102/A32NX/SimObjects/AirPlanes/Asobo_A320_NEO/Checklist/Library.xml#L1183

If you want to map this to 3 different buttons it will probably work. Here is an example for 1 button

      "event_press": {
        "event": "LIGHT LANDING:1",
        "type": "manual",
        "value": 1,
        "description": "A32NX - set AP Speed Hold to selected mode"
      },

If you have any other use case in mind, like one button that toggles between those simvars. I can probably add that in the code. So let me know

P1NBA11ER commented 3 years ago

I actually thought last night that I should probably dig through the nx mod code but having only enough programming knowledge to recognize basic formatting errors makes it hard.

I did get the landing lights to kinda do what I wanted using the following...

    {
      "index": 10,
      "event_press": "LANDING_LIGHTS_ON",
      "simvar_led": "LIGHT_LANDING"
    },
    {
      "index": 11,
      "event_press": "LANDING_LIGHTS_SET",
      "simvar_led": "LIGHT_LANDING"
    },

In this config button 10 turns them both on and button 11 turns them both off. Both buttons light up when on but I think having one button to turn each off/on makes more sense. IRL a pilot will put them in position 2 while taxiing (lights not stowed but still off) however for sim purposes, a simple on/off makes the most sense to me.

I think what I really need to do is create a spreadsheet mapping out how all the controls should behave and try filling it in from there. I'd like to get this x-touch covering all the basic controls used while flying the A320nx. So the entire AP panel, the EFIS panel (changes nav display), commonly used lighting and the spoilers/airbrakes. I managed to get the latter working on the fader but the cockpit doesn't show the handle moving for some reason.

JBP77 commented 3 years ago

Hi, sorry for "hijacking" this thread. First of all: great tool! Thanks for this! I do have challenges getting my LEDs on the push buttons work at all. I am using the default configuration of the tool with a TBM930 and tried with other aircraft as well. I can trigger all the events with the keys just fine, but the LEDs just don't indicate the status. They briefly light up while I press the button, but the they stay off again. So I can control everything just fine, but the LEDs are not working for me with the standard config. In the Behringer software I also uploaded your two layer files to make sure it's properly configered, but this didn't help either. Would you have any advice for me? Thanks for your support!!!

maartentamboer commented 3 years ago

That looks like either getting data from the sim is not working or there is a problem with the midi output connection that's supposed to light the LEDs. Can you try pressing the second encoder whilst in the TBM? and see if it synchronizes the current heading?

maartentamboer commented 3 years ago

Closed due to inactivity