Merge code for applying sensorOffset and setting data ready flag #208

Closed
opened 2026-04-05 17:52:13 +02:00 by MrUnknownDE · 0 comments
Owner

Originally created by @nekomona on 2/27/2024

Previous codes have ambiguity in when to computing delta angle for update check:

This PR set the applying of sensorOffset to be a common behavior before computing delta angle and setting the ready flag, removing the duplicated code distributed in each sensor's class.

With this PR, the update to fusedQuaternion and acceleration are also limited to setFusedRotation and setAcceleration methods, which may simplify future modifications for multi-threading.

*Originally created by @nekomona on 2/27/2024* Previous codes have ambiguity in when to computing delta angle for update check: - either before applying `sensorOffset` (e.g. BMI160) https://github.com/SlimeVR/SlimeVR-Tracker-ESP/blob/b744c536764559c71b3d062552d159511fe8b69a/src/sensors/bmi160sensor.cpp#L364-L370 - or after it (e.g. ICM42688). https://github.com/SlimeVR/SlimeVR-Tracker-ESP/blob/b744c536764559c71b3d062552d159511fe8b69a/src/sensors/icm42688sensor.cpp#L175-L179 This PR set the applying of `sensorOffset` to be a common behavior before computing delta angle and setting the ready flag, removing the duplicated code distributed in each sensor's class. With this PR, the update to `fusedQuaternion` and `acceleration` are also limited to `setFusedRotation` and `setAcceleration` methods, which may simplify future modifications for multi-threading.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/SlimeVR-Tracker-ESP#208