Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Mar 28, 2024

Conversation

nekomona
Copy link
Contributor

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

  • either before applying sensorOffset (e.g. BMI160)
    fusedRotation = sfusion.getQuaternionQuat();
    setFusedRotationReady();
    acceleration = sfusion.getLinearAccVec();
    setAccelerationReady();
    fusedRotation *= sensorOffset;
  • or after it (e.g. ICM42688).
    fusedRotation = sfusion.getQuaternionQuat();
    fusedRotation *= sensorOffset;
    acceleration = sfusion.getLinearAccVec();
    setFusedRotationReady();
    setAccelerationReady();

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.

@nekomona nekomona force-pushed the sensor-offset-patch branch from 7bf7b56 to d32eb62 Compare March 28, 2024 12:32
@Eirenliel Eirenliel merged commit e09ca3c into SlimeVR:main Mar 28, 2024
1 check passed
@nekomona nekomona deleted the sensor-offset-patch branch March 29, 2024 01:23
l0ud pushed a commit to l0ud/SlimeVR-Tracker-ESP-BMI270 that referenced this pull request Apr 1, 2024
…limeVR#314)

Merge applying of sensorOffset and data ready flag

Co-authored-by: nekomona <[email protected]>
Meeman77 pushed a commit to Meeman77/SlimeVR-Tracker-ESP that referenced this pull request May 1, 2024
…limeVR#314)

Merge applying of sensorOffset and data ready flag

Co-authored-by: nekomona <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants