mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-23 16:25:31 +03:00
Correct accelerometer initialization for MPU6000 and MPU9250 (#5559)
Accelerometer should be initialized to 16G scale.
This commit is contained in:
parent
11e22e634f
commit
59dbe0e4e3
2 changed files with 5 additions and 5 deletions
|
@ -120,7 +120,7 @@ void mpu6000SpiGyroInit(gyroDev_t *gyro)
|
|||
|
||||
void mpu6000SpiAccInit(accDev_t *acc)
|
||||
{
|
||||
acc->acc_1G = 512 * 8;
|
||||
acc->acc_1G = 512 * 4;
|
||||
}
|
||||
|
||||
uint8_t mpu6000SpiDetect(const busDevice_t *bus)
|
||||
|
@ -205,8 +205,8 @@ static void mpu6000AccAndGyroInit(gyroDev_t *gyro)
|
|||
spiBusWriteRegister(&gyro->bus, MPU_RA_GYRO_CONFIG, INV_FSR_2000DPS << 3);
|
||||
delayMicroseconds(15);
|
||||
|
||||
// Accel +/- 8 G Full Scale
|
||||
spiBusWriteRegister(&gyro->bus, MPU_RA_ACCEL_CONFIG, INV_FSR_8G << 3);
|
||||
// Accel +/- 16 G Full Scale
|
||||
spiBusWriteRegister(&gyro->bus, MPU_RA_ACCEL_CONFIG, INV_FSR_16G << 3);
|
||||
delayMicroseconds(15);
|
||||
|
||||
spiBusWriteRegister(&gyro->bus, MPU_RA_INT_PIN_CFG, 0 << 7 | 0 << 6 | 0 << 5 | 1 << 4 | 0 << 3 | 0 << 2 | 0 << 1 | 0 << 0); // INT_ANYRD_2CLEAR
|
||||
|
|
|
@ -106,7 +106,7 @@ void mpu9250SpiGyroInit(gyroDev_t *gyro)
|
|||
|
||||
void mpu9250SpiAccInit(accDev_t *acc)
|
||||
{
|
||||
acc->acc_1G = 512 * 8;
|
||||
acc->acc_1G = 512 * 4;
|
||||
}
|
||||
|
||||
bool mpu9250SpiWriteRegisterVerify(const busDevice_t *bus, uint8_t reg, uint8_t data)
|
||||
|
@ -148,7 +148,7 @@ static void mpu9250AccAndGyroInit(gyroDev_t *gyro) {
|
|||
|
||||
mpu9250SpiWriteRegisterVerify(&gyro->bus, MPU_RA_SMPLRT_DIV, gyro->mpuDividerDrops);
|
||||
|
||||
mpu9250SpiWriteRegisterVerify(&gyro->bus, MPU_RA_ACCEL_CONFIG, INV_FSR_8G << 3);
|
||||
mpu9250SpiWriteRegisterVerify(&gyro->bus, MPU_RA_ACCEL_CONFIG, INV_FSR_16G << 3);
|
||||
mpu9250SpiWriteRegisterVerify(&gyro->bus, MPU_RA_INT_PIN_CFG, 0 << 7 | 0 << 6 | 0 << 5 | 1 << 4 | 0 << 3 | 0 << 2 | 1 << 1 | 0 << 0); // INT_ANYRD_2CLEAR, BYPASS_EN
|
||||
|
||||
#if defined(USE_MPU_DATA_READY_SIGNAL)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue