mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-13 19:40:31 +03:00
Fix BMI160 gate and optimize directives (#13237)
* Add BMI160 gate and other defines * Fix make test * Remove redundant directives
This commit is contained in:
parent
c996d5f77b
commit
2ee519e29c
2 changed files with 10 additions and 20 deletions
|
@ -240,7 +240,7 @@ retry:
|
||||||
case ACC_ICM20608G:
|
case ACC_ICM20608G:
|
||||||
#if defined(USE_ACC_MPU6500) || defined(USE_ACC_SPI_MPU6500)
|
#if defined(USE_ACC_MPU6500) || defined(USE_ACC_SPI_MPU6500)
|
||||||
#ifdef USE_ACC_SPI_MPU6500
|
#ifdef USE_ACC_SPI_MPU6500
|
||||||
if (mpu6500AccDetect(dev) || mpu6500SpiAccDetect(dev)) {
|
if (mpu6500SpiAccDetect(dev)) {
|
||||||
#else
|
#else
|
||||||
if (mpu6500AccDetect(dev)) {
|
if (mpu6500AccDetect(dev)) {
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -75,7 +75,8 @@
|
||||||
#if !defined(USE_GYRO_L3G4200D) && !defined(USE_GYRO_MPU3050) && !defined(USE_GYRO_MPU6050) && \
|
#if !defined(USE_GYRO_L3G4200D) && !defined(USE_GYRO_MPU3050) && !defined(USE_GYRO_MPU6050) && \
|
||||||
!defined(USE_GYRO_MPU6500) && !defined(USE_GYRO_SPI_ICM20689) && !defined(USE_GYRO_SPI_MPU6000) && \
|
!defined(USE_GYRO_MPU6500) && !defined(USE_GYRO_SPI_ICM20689) && !defined(USE_GYRO_SPI_MPU6000) && \
|
||||||
!defined(USE_GYRO_SPI_MPU6500) && !defined(USE_GYRO_SPI_MPU9250) && !defined(USE_GYRO_L3GD20) && \
|
!defined(USE_GYRO_SPI_MPU6500) && !defined(USE_GYRO_SPI_MPU9250) && !defined(USE_GYRO_L3GD20) && \
|
||||||
!defined(USE_GYRO_SPI_ICM42605) && !defined(USE_GYRO_SPI_ICM42688P) && !defined(USE_ACCGYRO_BMI270) && \
|
!defined(USE_GYRO_SPI_ICM42605) && !defined(USE_GYRO_SPI_ICM42688P) && \
|
||||||
|
!defined(USE_ACCGYRO_BMI160) && !defined(USE_ACCGYRO_BMI270) && \
|
||||||
!defined(USE_ACCGYRO_LSM6DSV16X) && !defined(USE_ACCGYRO_LSM6DSO) && !defined(USE_VIRTUAL_GYRO)
|
!defined(USE_ACCGYRO_LSM6DSV16X) && !defined(USE_ACCGYRO_LSM6DSO) && !defined(USE_VIRTUAL_GYRO)
|
||||||
#error At least one USE_GYRO device definition required
|
#error At least one USE_GYRO device definition required
|
||||||
#endif
|
#endif
|
||||||
|
@ -409,7 +410,7 @@ STATIC_UNIT_TESTED gyroHardware_e gyroDetect(gyroDev_t *dev)
|
||||||
case GYRO_ICM20602:
|
case GYRO_ICM20602:
|
||||||
case GYRO_ICM20608G:
|
case GYRO_ICM20608G:
|
||||||
#ifdef USE_GYRO_SPI_MPU6500
|
#ifdef USE_GYRO_SPI_MPU6500
|
||||||
if (mpu6500GyroDetect(dev) || mpu6500SpiGyroDetect(dev)) {
|
if (mpu6500SpiGyroDetect(dev)) {
|
||||||
#else
|
#else
|
||||||
if (mpu6500GyroDetect(dev)) {
|
if (mpu6500GyroDetect(dev)) {
|
||||||
#endif
|
#endif
|
||||||
|
@ -540,22 +541,13 @@ STATIC_UNIT_TESTED gyroHardware_e gyroDetect(gyroDev_t *dev)
|
||||||
|
|
||||||
static bool gyroDetectSensor(gyroSensor_t *gyroSensor, const gyroDeviceConfig_t *config)
|
static bool gyroDetectSensor(gyroSensor_t *gyroSensor, const gyroDeviceConfig_t *config)
|
||||||
{
|
{
|
||||||
#if defined(USE_GYRO_MPU6050) || defined(USE_GYRO_MPU3050) || defined(USE_GYRO_MPU6500) || defined(USE_GYRO_SPI_MPU6500) || defined(USE_GYRO_SPI_MPU6000) \
|
#ifdef USE_VIRTUAL_GYRO
|
||||||
|| defined(USE_ACC_MPU6050) || defined(USE_GYRO_SPI_MPU9250) || defined(USE_GYRO_SPI_ICM20601) || defined(USE_GYRO_SPI_ICM20649) \
|
UNUSED(config);
|
||||||
|| defined(USE_GYRO_SPI_ICM20689) || defined(USE_GYRO_L3GD20) || defined(USE_ACCGYRO_BMI160) || defined(USE_ACCGYRO_BMI270) \
|
#else
|
||||||
|| defined(USE_ACCGYRO_LSM6DSO) || defined(USE_GYRO_SPI_ICM42605) || defined(USE_GYRO_SPI_ICM42688P) || defined(USE_ACCGYRO_LSM6DSV16X)
|
|
||||||
|
|
||||||
bool gyroFound = mpuDetect(&gyroSensor->gyroDev, config);
|
bool gyroFound = mpuDetect(&gyroSensor->gyroDev, config);
|
||||||
|
|
||||||
#if !defined(USE_VIRTUAL_GYRO) // Allow resorting to virtual accgyro if defined
|
|
||||||
if (!gyroFound) {
|
if (!gyroFound) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
UNUSED(gyroFound);
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
UNUSED(config);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const gyroHardware_e gyroHardware = gyroDetect(&gyroSensor->gyroDev);
|
const gyroHardware_e gyroHardware = gyroDetect(&gyroSensor->gyroDev);
|
||||||
|
@ -566,12 +558,10 @@ static bool gyroDetectSensor(gyroSensor_t *gyroSensor, const gyroDeviceConfig_t
|
||||||
|
|
||||||
static void gyroPreInitSensor(const gyroDeviceConfig_t *config)
|
static void gyroPreInitSensor(const gyroDeviceConfig_t *config)
|
||||||
{
|
{
|
||||||
#if defined(USE_GYRO_MPU6050) || defined(USE_GYRO_MPU3050) || defined(USE_GYRO_MPU6500) || defined(USE_GYRO_SPI_MPU6500) || defined(USE_GYRO_SPI_MPU6000) \
|
#ifdef USE_VIRTUAL_GYRO
|
||||||
|| defined(USE_ACC_MPU6050) || defined(USE_GYRO_SPI_MPU9250) || defined(USE_GYRO_SPI_ICM20601) || defined(USE_GYRO_SPI_ICM20649) \
|
|
||||||
|| defined(USE_GYRO_SPI_ICM20689) || defined(USE_ACCGYRO_BMI160) || defined(USE_ACCGYRO_BMI270) || defined(USE_ACCGRYO_LSM6DSO)
|
|
||||||
mpuPreInit(config);
|
|
||||||
#else
|
|
||||||
UNUSED(config);
|
UNUSED(config);
|
||||||
|
#else
|
||||||
|
mpuPreInit(config);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue