bolderflight / invensense-imu

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

initialized bias variables to 0 #48

Closed JeroenGar closed 5 years ago

JeroenGar commented 5 years ago

The bias variables for accelerometer, gyroscope and magnetometer were previously not initialized. This resulted in weird behaviour when not using the setCal() functions. The example projects works fine but if you start using the library in bigger projects some of the values were overflowing (or showed other weird values) because of old data from other variables being present in the bias variables.

C/C++ does not initialize variables to a given value automatically. Thus when a variable is assigned a memory location by the compiler, the default value of that variable is whatever (garbage) value happens to already be in that memory location.

This bug is also described in #46.