1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-14 20:10:18 +03:00

Merge pull request #5807 from etracer65/gyro_both_validation

Only allow gyro_to_use = BOTH if both detected gyros are the same type
This commit is contained in:
Michael Keller 2018-05-05 18:34:42 +12:00 committed by GitHub
commit b0ee38d77b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 61 additions and 10 deletions

View file

@ -2374,11 +2374,27 @@ static void cliGpsPassthrough(char *cmdline)
#endif
#if defined(USE_GYRO_REGISTER_DUMP) && !defined(SIMULATOR_BUILD)
static void cliPrintGyroRegisters(uint8_t whichSensor)
{
tfp_printf("# WHO_AM_I 0x%X\r\n", gyroReadRegister(whichSensor, MPU_RA_WHO_AM_I));
tfp_printf("# CONFIG 0x%X\r\n", gyroReadRegister(whichSensor, MPU_RA_CONFIG));
tfp_printf("# GYRO_CONFIG 0x%X\r\n", gyroReadRegister(whichSensor, MPU_RA_GYRO_CONFIG));
}
static void cliDumpGyroRegisters(char *cmdline)
{
tfp_printf("# WHO_AM_I 0x%X\r\n", gyroReadRegister(MPU_RA_WHO_AM_I));
tfp_printf("# CONFIG 0x%X\r\n", gyroReadRegister(MPU_RA_CONFIG));
tfp_printf("# GYRO_CONFIG 0x%X\r\n", gyroReadRegister(MPU_RA_GYRO_CONFIG));
#ifdef USE_DUAL_GYRO
if ((gyroConfig()->gyro_to_use == GYRO_CONFIG_USE_GYRO_1) || (gyroConfig()->gyro_to_use == GYRO_CONFIG_USE_GYRO_BOTH)) {
tfp_printf("\r\n# Gyro 1\r\n");
cliPrintGyroRegisters(GYRO_CONFIG_USE_GYRO_1);
}
if ((gyroConfig()->gyro_to_use == GYRO_CONFIG_USE_GYRO_2) || (gyroConfig()->gyro_to_use == GYRO_CONFIG_USE_GYRO_BOTH)) {
tfp_printf("\r\n# Gyro 2\r\n");
cliPrintGyroRegisters(GYRO_CONFIG_USE_GYRO_2);
}
#else
cliPrintGyroRegisters(GYRO_CONFIG_USE_GYRO_1);
#endif // USE_DUAL_GYRO
UNUSED(cmdline);
}
#endif