BitsAndDroids / FlightConnector-Rust

Connect and interface your diy hardware to mfs2020.
4 stars 0 forks source link

Inclusion of only selected outputs in switchHandling() #293

Open Xenomorphologist opened 5 days ago

Xenomorphologist commented 5 days ago

Hi, I noticed switchHandling() in BitsAndDroidsFlightConnector.cpp switches for all possible outputs, which takes up a lot of program space. If instead, the user could choose the specific outputs to include, a lot of program space can be saved. In my case, when I use dataHandling() the program exceeds the microcontroller's storage capacity. However, when I remove unused switch cases from switchHandling(), the program size decreases to be within capacity and that is the only way I can run my program.

BitsAndDroids commented 5 days ago

You are right. Currently, the generator is quite basic. My proposed first step is to pass a bundle as input and generate a library based on those settings. This change should slim the library down immensely, mainly for lower memory devices. The same would apply to unused output variables, which could then be excluded.

As an extra step, some types can be optimized in the library. For instance, I need to cut back on the use of Strings (which need to go anyway) or use fixed-width variables (i.e., the heading could never be > 360, so it could be an int of width 16).

Xenomorphologist commented 5 days ago

Passing a bundle as input would definitely be a nice feature. Also, thank you for making this useful software 👍

BitsAndDroids commented 2 days ago

As a first step im adding flags that disable certain parts of the code. I.e. #define DISABLE_LIGHTS will cut out all logic that handles light events. Same for AP availability events. Once done I'll update the docs to include these flags.