leech001 / MPU6050

STM32 HAL library for GY-521 (MPU6050) with Kalman filter
GNU General Public License v3.0
338 stars 82 forks source link

Fix NaN in sqrt formula #12

Open sjonkeesse opened 11 months ago

sjonkeesse commented 11 months ago

When Gyro_X_Raw and Gyro_Z_Raw are both -32768, this results in NaN in the square root calculation when the calculation to the power of two is done with var x var. Using the math method pow() solves the problem.

image