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

fix(mpu6050): use correct variables #648

Merged
merged 1 commit into from
Jul 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions components/mpu6050/mpu6050.c
Original file line number Diff line number Diff line change
Expand Up @@ -1226,10 +1226,9 @@ esp_err_t mpu6050_calibrate(mpu6050_dev_t *dev, float *accel_bias_res, float *gy
{
CHECK_ARG(dev && accel_bias_res && gyro_bias_res);

int16_t temp_offset[3];
int32_t accel_bias[3] = { 0, 0, 0 };
int32_t gyro_bias[3] = { 0, 0, 0 };
int32_t accel_bias_reg[3] = { 0, 0, 0 };
int16_t accel_bias_reg[3] = { 0, 0, 0 };
uint16_t accel_temp[3] = { 0, 0, 0 };
uint16_t gyro_temp[3] = { 0, 0, 0 };
uint8_t mask_bit[3] = { 0, 0, 0 };
Expand Down Expand Up @@ -1359,9 +1358,9 @@ esp_err_t mpu6050_calibrate(mpu6050_dev_t *dev, float *accel_bias_res, float *gy
*/

// Read factory accelerometer trim values:
CHECK(mpu6050_get_accel_offset(dev, MPU6050_X_AXIS, &(temp_offset[0])));
CHECK(mpu6050_get_accel_offset(dev, MPU6050_Y_AXIS, &(temp_offset[1])));
CHECK(mpu6050_get_accel_offset(dev, MPU6050_Z_AXIS, &(temp_offset[2])));
CHECK(mpu6050_get_accel_offset(dev, MPU6050_X_AXIS, &accel_bias_reg[0]));
CHECK(mpu6050_get_accel_offset(dev, MPU6050_Y_AXIS, &accel_bias_reg[1]));
CHECK(mpu6050_get_accel_offset(dev, MPU6050_Z_AXIS, &accel_bias_reg[2]));

for (int i = 0; i < 3; i++)
{
Expand Down
Loading