electricui / electricui-embedded

Add communications functionality to connect your hardware to a local user interface.
https://electricui.com
MIT License
64 stars 5 forks source link

Introduce concept of read-only variables #48

Closed Scottapotamas closed 6 years ago

Scottapotamas commented 6 years ago

Background

For many uses, the microcontroller may not want to provide write access to a given variable.

This could be values stored in ROM, non-editable values like calibration registers, or values which shouldn't be modified by the UI but managing a copied array is heavier than needed (situations where DMA is writing sensor values into a ring buffer at a high rate, etc).

The eUIMessage object structure currently uses a uint8 for the type metadata, but we only use a few bits of that byte.

Proposal and impact

I propose using one of those spare 'type' bits to specify a writable flag.

Affected behaviours

The user interface then needs to do something useful with this information, but can be addressed later and in the correct issues trackers.

Scottapotamas commented 6 years ago

946d8de85a8c3cabd71bd821c0182aa9b166acbc adds support for read only variables.

Remaining work is to modify the handshake process to provide this information to the UI.

Scottapotamas commented 6 years ago

Refactored the handshake callbacks as part of the (off-branch) 2ad87e1e5f18b49604e490035124f50908a3a602 commit. This code has not been tested on hardware, and doesn't have written unit tests, but does compile without warnings.

Breaking changes:

Remaining work:

Scottapotamas commented 6 years ago

This was merged in #62, and #47 somewhat encompases the higher level test requirements.

UI support should be tracked outside the scope of this repo.