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

Magnetometer support in sfusion #340

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

furrycoding
Copy link

@furrycoding furrycoding commented Aug 23, 2024

Added magnetometer support for sfusion sensors
Currently, only LSM6DSR with QMC5883L via sensor hub is supported (LSM6DSO might work, DSV probably won't since I didn't even look at the datasheet lol)

Sensors that support magnetometers receive a driver for it as a template argument. That driver is structured pretty much like a normal sfusion driver. Later I want to also add an option to pass it directly to SoftFusionSensor (for mags that are directly connected to the main I2C bus)

TODO:

  • Add axis remapping
  • Support mag driver passed directly to SoftFusionSensor
  • Check the registers and test LSM6DSO/DSV
  • Disable mag calibartion when there's no driver
  • Fine-tune magnetic disturbance rejection in VQF
  • Detecting errors when I2C writes to mag fail

@furrycoding
Copy link
Author

furrycoding commented Aug 28, 2024

Accidentally discovered that sfusion getting merged broke BMI160 axis remapping
Before - extraParam gets assigned to an int -> no downcasting
After - extraParam gets assigned to an uint8_t -> downcast to 8 bits, while 18 bits are needed for full axis remap
(without mag 9 bits are needed, however the upper bit is zero in the default remap, so it doesn't break a BMI that has no mag)
Latest commit in this PR fixes the issue

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.

1 participant