Awesome
flutter-pi-sensor-tester
This project bases on dart_periphery and the light-weight Flutter Engine Embedder for Raspberry Pi.
UI-Overview
Test setup with a Raspberry Pi 3 with attached LEDs, sensors and a small touch screen running the led demo.
Video snippet for reordering UI elements
Overview
This subproject of dart-periphery based on flutter-pi implements an isolate/stream architecture designed to transfer sensor data from an isolate to the Flutter UI.
Isolate Interface: This consists of the steps InitTask, MainTask, and ExitTask, along with a limited back channel for controlling the isolate. This setup is typically used for sensor measurements:
InitTask
: Initializes the sensor.MainTask
: Collects sensor data and passes it to a stream.ExitTask
: Disposes of the sensor.
Listening Mode: Features InitTask
and user-defined handling for isolate events. This variant
remains on standby for data; once data is processed, the result is passed to the stream and subsequently
to the Flutter UI. This model is used for actuator control, such as operating an LED.
Support for Multiple Streams: Enables handling of multiple data streams simultaneously.
Import hints:
- The project is currently in its early stages, and development is ongoing including API changes.
- For using real hardware, go to the configuration panel and disable the simulation mode checkbox.
- Application can be build for the other Flutter desktop variants: MacOS, Windows and Linux and tested in the simulation mode.
- Dart isolates can be tricky compared to programming languages like Java. Therefore, the first version of the API may appear somewhat unrefined and incomplete.
- The project code is free to use, but be aware, the icons from Flaticon must attribute the creator of the icon - for further details see the AboutTab with an automated list of used icons including their attribution link.
- Used colors looks on your device perhaps a little strange. This demo was tested on a small external touch screen with a limited color dynamic. The used colors are result of this restriction.
Known errors: Demo crashes in hardware mode after closing a demo and open the next demo. There is a problem with the re-init of the periphery C-library in context of the isolates. Investigations are ongoing.
Starting The isolate related code can be found here:
Next steps:
- Improve documentation
- Extend this demo to use a Flutter state management library like riverpod
- TBD: Extend the isolate API for code generation support to reduce manual coding.