Seahawk240 / Microsoft-FS2020-To-Arduino

A Simple Program which enables communication between a Serial Device (like an Arduino) and the Flight Simulator 2020
48 stars 7 forks source link

Extended Functionality -> Data Flow Control #37

Open Seahawk240 opened 3 years ago

Seahawk240 commented 3 years ago

Okay, let's tackle this issue

What, why and how do I want/should implement that...

-Send Only Serial Data that Changed Why? ->Espacially for applications like indicator-panels which rely on variables which change only occasionaly it dramatically reduces DataFlow.

How?
->Activatable by Checkbox/Radio Button
->Create a Function which checks for changed data and sends it either
    =>When Data has changed
    =>When a certain time has passed (i.e. 5 seconds)

-Send Serial Data when requested Why? ->Sometimes it's better when the MCU can decide itself when and how much data it gets

How?
->Activatable by Checkbox/Radio Button
->Three Different Operation Modes choosable by sending commands from MCU to the program
    =>Send Variable/Data Continously - ON
    =>Send Variable/Data Continously - OFF
    =>Send Variable/Data Once
    These commands will attach to the variable IDs or the row numbers
    but maybe I find a even better solution.
    Something like:
    =>@9998/ID:mode$
    whilst ID is the variable ID
    and mode marks the wanted operation mode
    (Something like: 
    =>0 = Data OFF
    =>1 = Data Once
    =>2 = Data ON
Seahawk240 commented 3 years ago

Thanks for @Discman777 and @ollivier44 for the suggestions and feedback regarding this topic! This Topic will replace the following:

20

24

32

Discman777 commented 3 years ago

Thanks for posting your plan on this topic, here’s my feedback…

I like having the ability of controlling the data flow for any particular variable On/Off/Once. One other addition would be a way to turn off all variables in one shot. The MCU can use that to conveniently issue a reset and then add the desired variables one at a time.

The “Once” option may be less useful. That’s because the MCU may miss a transmission when the variable is only sent once. Should the MCU failed to service the serial port long enough (for whatever reason), the buffer would overflow and goodbye data; since there is no flow control protocol (RTS/CTS) in use. Thus, I’d suggest lower priority for this feature.

Also, to put things into perspective, let me offer this observation. A typical variable packet takes around 0.9mS average to be transmitted (at 115200 bauds). Say, if you have 100 variables in your Exports list, they would take 100mS to process. Which means you would see each value being refreshed 10 times a second, which is pretty good.

All in all, having the “On/Off/ResetAll” control would be a very handy feature. It minimizes the data flow and reduces workload on the MCU--for project that requires a large number of variables (I am biased!).

Thanks very much.