How f2heal/vhp-vibro-glove2 works
Main Components
• Firmware Controller – The heart of the system is the microcontroller running the main firmware (VHP-Vibro-Glove2.ino). This central component orchestrates the glove’s operations.
• Hardware Abstraction/Peripheral Modules – Within the src folder, several header files define key hardware-related modules:
– BatteryMonitor: Monitors the battery status.
– BleComm: Manages Bluetooth Low Energy communications.
– PwmTactor: Controls pulse-width modulated actuation for haptic feedback.
– BoardDefs and Settings: Define board-specific definitions, configurations, and user settings.
– Message and SStream: Likely used for constructing and processing messages between components.
– Additional serialization logic provided in the “att” subdirectory (Serialize, Slice, StdShim) which probably handles data encoding/decoding.
• Tests – The tests directory illustrates unit tests (e.g., SStream-test.cpp, SampleCache-test.cpp) verifying functionality, indicating modularity in design.
• Web UI – A separate “webui” directory contains HTML, JS, and CSS files. Even though its integration details aren’t all laid out, it suggests a higher-level interface (or control panel) for configuring or visualizing glove parameters.
Relationships and Interactions
• The serialization layer (att/ subcomponents) sits between the raw data produced by sensors or modules and the messaging system. This is critical for data integrity and should be depicted as transforming raw input into protocol-compliant messages.
• The Web UI component, while separate, likely provides an alternative method to control, monitor, or preset configurations (as evidenced by the presence of JSON presets and different web assets). This should be shown as an external interface that can send/receive configuration data with the underlying system.
• If applicable, include the development and testing workflow nodes, pointing out how unit tests interact with individual modules.
Architectural Patterns and Design Principles
• Separation of Concerns: The firmware is organized into discrete modules (one for each hardware or protocol function), which makes unit testing and maintenance easier.
• Modular Hardware Abstraction: Use of distinct header files for each subsystem (battery, BLE, tactor control) indicates an abstraction layer for hardware-specific implementations.
• Data Serialization/Message Passing: The att/ components indicate a careful design for consistent communication both within the device and across modules (e.g., external BLE communication).
• Integration of a Web-Based Interface: The clear separation of a web interface (with its own HTML/CSS/JS files) suggests that the system is also designed to be interacted with via browser, possibly for configuration or real-time monitoring.
Relevant Technologies and Components
• Arduino/Embedded C++ as the primary language and execution environment (indicated by the .ino file).
• CMake for build configuration (as indicated by CMakeLists.txt).
• BLE (Bluetooth Low Energy) for wireless communication.
• PWM control for tactors (vibratory actuators in the glove).
• Web technologies (HTML, CSS, JavaScript) for the user interface.
• Testing frameworks or mocks as indicated in the tests directory.
Elements
• A central “Firmware Core” block (labeled with VHP-Vibro-Glove2.ino).
• A “Web UI” block representing the browser-based interface, connected with configuration / data flow links to the main firmware (if applicable).
• Optional: Blocks for “Testing” to indicate that unit tests verify the functionality of modules.