[BMI270] Fix bug in data frame size calculation #157

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

Originally created by @jabberrock on 11/20/2024

Previously, required_length was always 0 because we shifting by a huge number, rather than the bit position. So the check for incomplete frames would never trigger. The final data frame in a FIFO read is sometimes an incomplete frame, and therefore we would read garbage for the data frame. There are often incomplete frames when we call LEDManager to blink the LED, because the FIFO overruns.

  1. During gyroscope calibration, we often read random gyroscope samples, which throws off the calibration results.
  2. During 6-sided accelerometer calibration, we often read random acceleration samples which causes rest detection to move on to collecting the next side, even if we don't move the tracker.
  3. During normal operation, we will rarely read random gyroscope and accelerometer samples. These are usually one-offs and probably don't affect tracking.

This change fixes the bounds check so that we correctly identify incomplete frames and discard them.

*Originally created by @jabberrock on 11/20/2024* Previously, required_length was always 0 because we shifting by a huge number, rather than the bit position. So the check for incomplete frames would never trigger. The final data frame in a FIFO read is sometimes an incomplete frame, and therefore we would read garbage for the data frame. There are often incomplete frames when we call LEDManager to blink the LED, because the FIFO overruns. 1. During gyroscope calibration, we often read random gyroscope samples, which throws off the calibration results. 2. During 6-sided accelerometer calibration, we often read random acceleration samples which causes rest detection to move on to collecting the next side, even if we don't move the tracker. 3. During normal operation, we will rarely read random gyroscope and accelerometer samples. These are usually one-offs and probably don't affect tracking. This change fixes the bounds check so that we correctly identify incomplete frames and discard them.
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#157