maartentamboer / X-Touch-Mini-FS2020

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

Improve aircraft matching #111

Closed mkx173 closed 2 years ago

mkx173 commented 2 years ago

I've added a new function that can match aircrafts by its base aircraft.cfg location. The aircraft_contains field in config.json can now be a list. The keywords in aircraft_contains is now case insensitive. Everything is fully compatible with previours configuration files.

To use the new function, change the aircraft_contains to the base name of that aircraft (or a part of the base name) and add "use_aircraft_base_matching": true to the global configuration.

"aircraft": [
  {
    "aircraft_contains": "FlyByWire_A320_NEO",
    "file": "config_a320.json"
  }
]

The base information for an aircraft can be found in the aircraft.cfg file under any livery folder for that aircraft. Or you can simply look at the output of the program. Something like this:

[VARIATION]
base_container = "..\FlyByWire_A320_NEO"

If for some reason you don't want to use base matching, you can also add more keywords to aircraft_contains.

"aircraft": [
  {
    "aircraft_contains": ["a320", "a32nx", "fbw", "fly by wire"],
    "file": "config_a320.json"
  }
]

Note: I added a CustomSimconnect class since the request system state function is not currently available in the Simconnect package. It can be removed once it is added. I also added a workaround for Simconnect 0.4.24 since the field is not defined in 0.4.24. It is actually fixed in 0.4.25 but that version have a bug that prevents the program from running.

maartentamboer commented 2 years ago

I simply copied the original implementation from simconnect and made some modifications. I know it is messy but I don't have time to rewrite it.

What part is copied and where is it from? just wondering that due to potential license compliance issues

mkx173 commented 2 years ago

Thanks for pointing out. Some code in aircraftstaterequest.py is adapted from the original python-simconnect project. I've added a notice in the header. Also that project is under GPLv3 so you might want to change the license? If not I could probably do a rewrite in a few days.

maartentamboer commented 2 years ago

I hope you can do a rewrite or something like that since I don't want to change the license of the project. Honestly not a big fan of GPL and all the limitations that come with it

mkx173 commented 2 years ago

Just finished the rewrite. Much easier than I thought. Maybe the original author just made it too complicated lol.

maartentamboer commented 2 years ago

I'm currently not able to test the release. Can you give the pre-release a run and let me know if everything is working as usual? https://github.com/maartentamboer/X-Touch-Mini-FS2020/releases/tag/v1.10.0 After that I can make it an official release

mkx173 commented 2 years ago

Hello I just did some testing and both new and legacy matching works fine.

maartentamboer commented 2 years ago

Great, I've officially released it now. Thanks for contributing 👍