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

Controlling encoder LEDs #17

Closed themazen closed 3 years ago

themazen commented 3 years ago

Is it possible to control the encoder LEDs just like the button LEDs? With e.g. "simvar_led": "AUTOPILOT_FLIGHT_DIRECTOR_ACTIVE" I'd like to configure the different Autopilot toggles to the encoder press events and still have visual feedback, if the APs are on or off.

All LEDs of one encoder treated as one would be fine. The LEDs should all still be on when the encoder is turned.

It would also be nice to turn all LEDs of the specific encoder off. So turning the encoder does not create misleading LED positions. (This can still be done by a mask over the hardware ;) )

maartentamboer commented 3 years ago

The encoder leds are actually a bit of a pain. You can set them from the PC, but everytime you rotate the encoder it goes back to the current indicator mode.

But thinking about that I could probably cache the led ring status and write it back each time on CC data is called: https://github.com/maartentamboer/X-Touch-Mini-FS2020/blob/fe1a7622d7a22c52c83f2ce8020503dd740b63b9/rotaryencoder.py#L79

I'll need to do some testing for this hopefully next weekend

maartentamboer commented 3 years ago

This is possible from PR https://github.com/maartentamboer/X-Touch-Mini-FS2020/pull/25

For your specific use case you can add a trigger. This will set the 1st led ring based on the AUTOPILOT_FLIGHT_DIRECTOR_ACTIVE

    {
      "simvar": "AUTOPILOT_FLIGHT_DIRECTOR_ACTIVE",
      "condition": [
        "{% if data.get_simvar_value('AUTOPILOT_FLIGHT_DIRECTOR_ACTIVE') == 1.0 %}",
          "{{ data.set_encoder_led(1, True) }}",
        "{% else %}",
          "{{ data.set_encoder_led(1, False) }}",
        "{% endif %}"
      ]
    }

I will close this issue once a new release has been made

maartentamboer commented 3 years ago

Fixed in the latest release https://github.com/maartentamboer/X-Touch-Mini-FS2020/releases/tag/v1.1.0