sparkfun / SparkFun_LSM9DS1_Arduino_Library

Arduino library for the LSM9DS1 9DOF IMU.
Other
64 stars 78 forks source link

Initialising IMU overwrites settings #27

Open nuhash opened 4 years ago

nuhash commented 4 years ago

When calling LSM9DS1::begin(...), it calls LSM9DS1::init() which overrides any user defined settings https://github.com/sparkfun/SparkFun_LSM9DS1_Arduino_Library/blob/7269199c7a38a70becf454148474c6f05028e5b7/src/SparkFunLSM9DS1.cpp#L155

Perhaps call LSM9DS1::init() within the constructor instead to set default values for the settings. Users can then change them as necessary prior to calling LSM9DS1::begin().

choller commented 3 years ago

The funny thing here is that pretty much every example for this library that I found configures settings and then calls begin(..). All of these examples are broken and use default settings.

I think the solution proposed by @nuhash is the right way to go.