Set acc alignment to that of active gyro
This commit is contained in:
parent
fc289e95b7
commit
5b40bb4b24
|
@ -578,7 +578,6 @@ const lookupTableEntry_t lookupTables[] = {
|
|||
|
||||
const clivalue_t valueTable[] = {
|
||||
// PG_GYRO_CONFIG
|
||||
{ "align_gyro", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_ALIGNMENT }, PG_GYRO_CONFIG, offsetof(gyroConfig_t, gyro_align) },
|
||||
{ "gyro_hardware_lpf", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_GYRO_HARDWARE_LPF }, PG_GYRO_CONFIG, offsetof(gyroConfig_t, gyro_hardware_lpf) },
|
||||
#if defined(USE_32K_CAPABLE_GYRO) && defined(USE_GYRO_DLPF_EXPERIMENTAL)
|
||||
{ "gyro_32khz_hardware_lpf", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_GYRO_32KHZ_HARDWARE_LPF }, PG_GYRO_CONFIG, offsetof(gyroConfig_t, gyro_32khz_hardware_lpf) },
|
||||
|
@ -631,7 +630,6 @@ const clivalue_t valueTable[] = {
|
|||
{ "gyro_filter_debug_axis", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_GYRO_FILTER_DEBUG }, PG_GYRO_CONFIG, offsetof(gyroConfig_t, gyro_filter_debug_axis) },
|
||||
|
||||
// PG_ACCELEROMETER_CONFIG
|
||||
{ "align_acc", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_ALIGNMENT }, PG_ACCELEROMETER_CONFIG, offsetof(accelerometerConfig_t, acc_align) },
|
||||
{ "acc_hardware", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_ACC_HARDWARE }, PG_ACCELEROMETER_CONFIG, offsetof(accelerometerConfig_t, acc_hardware) },
|
||||
#if defined(USE_GYRO_SPI_ICM20649)
|
||||
{ "acc_high_range", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_ACCELEROMETER_CONFIG, offsetof(accelerometerConfig_t, acc_high_fsr) },
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "config/feature.h"
|
||||
#include "pg/pg.h"
|
||||
#include "pg/pg_ids.h"
|
||||
#include "pg/gyrodev.h"
|
||||
|
||||
#include "drivers/accgyro/accgyro.h"
|
||||
#include "drivers/accgyro/accgyro_fake.h"
|
||||
|
@ -314,10 +315,13 @@ bool accInit(uint32_t gyroSamplingInverval)
|
|||
acc.dev.mpuDetectionResult = *gyroMpuDetectionResult();
|
||||
acc.dev.acc_high_fsr = accelerometerConfig()->acc_high_fsr;
|
||||
|
||||
acc.dev.accAlign = ACC_1_ALIGN;
|
||||
#ifdef ACC_2_ALIGN
|
||||
// Copy alignment from active gyro, as all production boards use acc-gyro-combi chip.
|
||||
// Exceptions are STM32F3DISCOVERY and STM32F411DISCOVERY, and (may be) handled in future enhancement.
|
||||
|
||||
acc.dev.accAlign = gyroDeviceConfig(0)->align;
|
||||
#ifdef USE_MULTI_GYRO
|
||||
if (gyroConfig()->gyro_to_use == GYRO_CONFIG_USE_GYRO_2) {
|
||||
acc.dev.accAlign = ACC_2_ALIGN;
|
||||
acc.dev.accAlign = gyroDeviceConfig(1)->align;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -348,9 +352,6 @@ bool accInit(uint32_t gyroSamplingInverval)
|
|||
biquadFilterInitLPF(&accFilter[axis], accLpfCutHz, acc.accSamplingInterval);
|
||||
}
|
||||
}
|
||||
if (accelerometerConfig()->acc_align != ALIGN_DEFAULT) {
|
||||
acc.dev.accAlign = accelerometerConfig()->acc_align;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -453,9 +453,6 @@ static bool gyroInitSensor(gyroSensor_t *gyroSensor, const gyroDeviceConfig_t *c
|
|||
gyroSensor->gyroDev.hardware_lpf = gyroConfig()->gyro_hardware_lpf;
|
||||
gyroSensor->gyroDev.hardware_32khz_lpf = gyroConfig()->gyro_32khz_hardware_lpf;
|
||||
gyroSensor->gyroDev.initFn(&gyroSensor->gyroDev);
|
||||
if (gyroConfig()->gyro_align != ALIGN_DEFAULT) {
|
||||
gyroSensor->gyroDev.gyroAlign = gyroConfig()->gyro_align;
|
||||
}
|
||||
|
||||
// As new gyros are supported, be sure to add them below based on whether they are subject to the overflow/inversion bug
|
||||
// Any gyro not explicitly defined will default to not having built-in overflow protection as a safe alternative.
|
||||
|
|
|
@ -273,7 +273,6 @@
|
|||
#define GYRO_2_CS_PIN NONE
|
||||
#define GYRO_2_ALIGN ALIGN_DEFAULT
|
||||
#define GYRO_2_EXTI_PIN NONE
|
||||
#define ACC_2_ALIGN ALIGN_DEFAULT
|
||||
#endif
|
||||
|
||||
#if !defined(GYRO_1_SPI_INSTANCE)
|
||||
|
@ -292,10 +291,6 @@
|
|||
#define GYRO_1_ALIGN ALIGN_DEFAULT
|
||||
#endif
|
||||
|
||||
#if !defined(ACC_1_ALIGN)
|
||||
#define ACC_1_ALIGN ALIGN_DEFAULT
|
||||
#endif
|
||||
|
||||
#if defined(MPU_ADDRESS)
|
||||
#define GYRO_I2C_ADDRESS MPU_ADDRESS
|
||||
#else
|
||||
|
@ -304,8 +299,10 @@
|
|||
|
||||
#ifdef USE_MULTI_GYRO
|
||||
#define MAX_GYRODEV_COUNT 2
|
||||
#define MAX_ACCDEV_COUNT 2
|
||||
#else
|
||||
#define MAX_GYRODEV_COUNT 1
|
||||
#define MAX_ACCDEV_COUNT 1
|
||||
#endif
|
||||
|
||||
#ifdef USE_VCP
|
||||
|
|
Loading…
Reference in New Issue