1 (edited by Daba 2018-08-04 09:45:14)

Topic: An idea to improve data transfer efficiency.

My latest project http://remotexy.com/en/editor/d088671f1 … e82dbd4d5/ has about 40 buttons, plus a couple of other controls.

Each button uses a uint8_t variable, 0 or 1 when the button is pressed. This leads to a large, inefficient data block, which I believe exceeds the "packet" size of Bluetooth. This makes the application slow and sluggish to respond to button presses.

I think in most cases, buttons would be mutually exclusive, so it would be great if we could create one or more "button groups", and use a single variable to transmit which button is pressed within each group. If that variable were a uint8_t, you could have up to 255 buttons in one group, where value 0 (or 255) could represent "no button pressed".

I have also discovered that you can write 0 back to the button variable as soon as you have "seen" it in your code, which prevents you "seeing" it multiple times before RemoteXY writes it back to zero. So instead of having to clear 40 variables, the "button group" idea means you only have to clear 1, which makes your sketch much tidier and efficient.

Within each button group, you would decide what value to set in the interface, so you easily use "switch - case" constructs in your sketch, very much more efficient than a long list of "if (RemoteXY.ButtonXYZ) statements.

2B, or not 2B, that is the pencil ...