bolderflight / invensense-imu

Arduino and CMake library for communicating with the InvenSense MPU-6500, MPU-9250 and MPU-9255 nine-axis IMUs.
MIT License
513 stars 214 forks source link

Added accelerometer low-pass filter bandwidth and get functions #76

Closed ChisholmKyle closed 3 years ago

ChisholmKyle commented 4 years ago

There are no breaking changes. The function setDlpfBandwidth still modifies both gyro and accel bandwidth in the exact same as before. If someone wants a different accel filter bandwidth, the function setDlpfAccBandwidth must be called AFTER setDlpfBandwidth

For the calibrateX() methods, the comments in MPU9250.cpp suggest that the sensor ranges, dlpf bandwidth, and srd are restored to previous values after calibration. However, the functions setGyroRange, setSrd etc. modify the internal private member so the original setting is lost. This fixes the issue by saving the parameters before setting them for calibration.

I added getX() functions so that it's easy to externally serialize and transmit 16-bit counts then transform to physical units on host given all necessary scaling information.