What's happening to the outputs?
by Bits and Droids | 21-03-2023
Since the update got pushed back a little, I thought it would be good to keep you guys informed on what is happening behind the scenes. Therefore, I present another development update on version 0.9 (Yes, so much has changed that 0.8.9 didn't feel right anymore). I've got a feeling that I had a bad case of coding block (if that exists). Luckily this week, I've re-kindled my mojo/flow/vibe or any other buzzword you want to throw at it and hammered out line after line. By following the colors in the overview, I'm giving you a quick tour of the changes implemented surrounding the output menu.
See all those checkboxes on the left side? They were hardcoded into the connector. This meant that I had the bright idea to add an input by creating a category tab -> add each checkbox separately -> check each checkbox. Just checking which checkbox was checked and which wasn't has taken up around 200/300 lines of code. This doesn't make any sense in any way, but luckily I came to my senses. I've stripped out all the output checkbox logic and replaced it with a JSON (an external document that stores the data) file that holds all the outputs so far sorted by category. The connector reads this file -> reads the categories and stores them -> creates a tab for each category -> creates a checkbox for each output in that category. I only have to add an output to the JSON file and the connector populates the rest. When we, later on, add the possibility of adding LVARS in the mix, we can use the same logic for a different problem. Modular, maintainable, and transparent.
The outputs will no longer be set up and finetuned from the main screen. It received its own tab in the toolbar. I wanted to separate the functionality (starting and stopping the connector, switching boards, etc.) from the finetuning and settings. This creates a calmer overview and brings out the complexity when needed.
Sets can be created, deleted, and edited from the output menu as well. You'll find an overview of all the current sets you have created together with controls to edit or remove them in the green area. You enter a unique name to your liking, and it will appear in the list below.
In the red zone, you'll find the currently selected set and all the outputs it contains. The checkboxes aren't visible until you hit the edit button. Here my goal is to create a clear overview of the highlighted set and show in a quick summary what you put in the set. If you want to edit the settings, the checkboxes appear, and you are free to add/remove outputs to your liking.
This is working and tested; the next step will be to implement the logic that passes the required outputs to Microsoft flight simulator 2020. We have to route the return values to the correct set push them towards our boards. I'll keep you posted on the progress!