5.0.0
Version 5.0.0
This release introduce significant improvements to both functionality and performance. The update focuses on enhancing user experience, optimizing resource utilization, and introducing new features to elevate the overall capabilities of the system.
ESP Rowing Monitor now able to handle multiple boards and ergometers better via profiles as well as improved memory management (to avoid crashes) and regression algorithm (special thanks to the ORM project).
However this release includes breaking changes to the stroke detection algorithm (specificalyl the torque based) that may require re-calibration or slight adjustment of the used rowing profile if torque based stroke detection is used as well as to the WebSocket API.
Performance Optimizations
Improve algorithm
Achieved notable performance enhancements, reducing execution time for processing every new data point (saved approximately 21% for IMPULSE_DATA_ARRAY_LENGTH
of 18) by the following changes:
- Enhanced the accuracy of the Theil-Sen Quadratic regression algorithm by removing the median calculation (and use full set of data) for the TS Quadratic Regression calculation.
- Implemented weighted average for angular velocity and acceleration calculation, enhancing torque-based stroke detection and smoothing force curves.
- Appropriately reserved memory for all vectors.
- Utilized swap (O(1)) instead of clear (O(N)) when resetting series.
- Employed partial_sort_copy in the Series class to reduce the amount of copy.
- Utilized a combination of nth_element and max_element to calculate the median.
Notes:
- While swap was beneficial for resetting the driveHandleForces, it was found to result in regression compared to using clear for some scenarios, hence the decision to retain the existing approach in certain cases was made.
- Benchmarking indicated that nth_element + max_element was less performant for the Series class, suggesting that the overhead of copying outweighs the benefits of O(n) complexity for small arrays.
Take proper advantage of dual core CPUs
- Implemented RTOS xTask to offload data string creation (for SD and WebSocket) and broadcast to WebSocket clients to core 0.
- Offload the writing to SD Card to core 0.
Memory Management Improvements
- Optimized memory usage in the Series class for better performance during long recovery periods to save free heap (as well as free heap quicker).
Other improvements
- Use binary data for WebSocket data transfer for metrics.
- Enhanced performance by separating settings and rowing data in data broadcasts and do not send settings object on every broadcast (reducing broadcast size).
- Simplify WebSocket metrics data API to reduce the amount bytes to be transferred.
- Introduced BleSignalStrength setting for adjusting BLE TX_power to balance power consumption and dBm strength.
New Features
Reworked Structure of Settings
Completely restructured the settings framework to facilitate more flexible handling of different boards and rowing machines.
- Split settings between board and machine-specific files, allowing for easier inclusion and combination, providing enhanced flexibility and extensibility.
- Resolved bugs related to settings usage, improving overall code efficiency.
- Added a profile for Blue KayakFirst ergo.
- Added a profile for Orange KayakFirst ergo.
- Added a profile for Generic ergo.
- Added a profile for Generic ESP board.
- Added a profile for FireBeetle board.
Delta Time Logging Feature
Added the option to log delta times to the SD card (settable via WebSocket) and/or through the WebSocket (settable via WebSocket) to eliminate the need for Serial connection during calibration logging.
Simulation from File
Enabled simulation of rowing sessions from files uploaded to the MCU file system, offering longer session simulations and better benchmarking of memory usage.
Improve and simplify calibration run logging
Added a calibration logging setting to enable/disable extra calibration data on specific runs to output standard data that can be parsed.
General Updates and Fixes
Improve linting and refactoring
- Fixed minor linting errors and updated linting rules.
- Removed dead code and added missing consts.
- Added sanity check to baud rate setting.
- Utilized
analogReadMilliVolts
native function for battery measurements. - Reversed the if statement logic to follow code convention of using guard clauses.
Bug Fixes
- Corrected time stamp usage for power management, addressing issues related to idle state detection.
- Ensured consistency in the return type of the OLSLinearSeries size by using
size_t
. - Resolved a bug causing a crash when BLE service is disabled, ensuring proper initialization.
- Removed a naive WiFi reconnect implementation, utilizing the built-in reconnect feature for better reliability.
Miscellaneous
- Altered log levels for frequent messages to save on execution time.
Full Changelog: 4.2.0...5.0.0