diff --git a/src/main/build/debug.c b/src/main/build/debug.c index d3ae5fb3f4..ac10f2f14f 100644 --- a/src/main/build/debug.c +++ b/src/main/build/debug.c @@ -99,5 +99,6 @@ const char * const debugModeNames[DEBUG_COUNT] = { "TIMING_ACCURACY", "RX_EXPRESSLRS_SPI", "RX_EXPRESSLRS_PHASELOCK", - "RX_STATE_TIME" + "RX_STATE_TIME", + "FUSION", }; diff --git a/src/main/build/debug.h b/src/main/build/debug.h index 8494550257..c5a8a16fca 100644 --- a/src/main/build/debug.h +++ b/src/main/build/debug.h @@ -98,6 +98,7 @@ typedef enum { DEBUG_RX_EXPRESSLRS_SPI, DEBUG_RX_EXPRESSLRS_PHASELOCK, DEBUG_RX_STATE_TIME, + DEBUG_FUSION, DEBUG_COUNT } debugType_e; diff --git a/src/main/cli/cli.c b/src/main/cli/cli.c index 5298958ae7..f7193debee 100644 --- a/src/main/cli/cli.c +++ b/src/main/cli/cli.c @@ -3632,11 +3632,11 @@ static void cliDumpGyroRegisters(const char *cmdName, char *cmdline) UNUSED(cmdline); #ifdef USE_MULTI_GYRO - if ((gyroConfig()->gyro_to_use == GYRO_CONFIG_USE_GYRO_1) || (gyroConfig()->gyro_to_use == GYRO_CONFIG_USE_GYRO_BOTH)) { + if ((gyroConfig()->gyro_to_use == GYRO_CONFIG_USE_GYRO_1) || (gyroConfig()->gyro_to_use >= GYRO_CONFIG_USE_GYRO_BOTH_SIMPLE)) { cliPrintLinef("\r\n# Gyro 1"); 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)) { + if ((gyroConfig()->gyro_to_use == GYRO_CONFIG_USE_GYRO_2) || (gyroConfig()->gyro_to_use >= GYRO_CONFIG_USE_GYRO_BOTH_SIMPLE)) { cliPrintLinef("\r\n# Gyro 2"); cliPrintGyroRegisters(GYRO_CONFIG_USE_GYRO_2); } diff --git a/src/main/cli/settings.c b/src/main/cli/settings.c index 819b5ae15c..d2d43aecbe 100644 --- a/src/main/cli/settings.c +++ b/src/main/cli/settings.c @@ -191,7 +191,7 @@ static const char * const lookupTableAlignment[] = { #ifdef USE_MULTI_GYRO static const char * const lookupTableGyro[] = { - "FIRST", "SECOND", "BOTH" + "FIRST", "SECOND", "BOTH_SIMPLE", "BOTH_VARIANCE" }; #endif diff --git a/src/main/cms/cms_menu_imu.c b/src/main/cms/cms_menu_imu.c index edb0be75b6..fffd38ff43 100644 --- a/src/main/cms/cms_menu_imu.c +++ b/src/main/cms/cms_menu_imu.c @@ -81,7 +81,7 @@ static const char * const osdTableThrottleLimitType[] = { #ifdef USE_MULTI_GYRO static const char * const osdTableGyroToUse[] = { - "FIRST", "SECOND", "BOTH" + "FIRST", "SECOND", "BOTH_SIMP", "BOTH_VAR" }; #endif @@ -742,7 +742,7 @@ static const OSD_Entry cmsx_menuFilterGlobalEntries[] = { "GYRO NF2", OME_UINT16, NULL, &(OSD_UINT16_t) { &gyroConfig_gyro_soft_notch_hz_2, 0, 500, 1 } }, { "GYRO NF2C", OME_UINT16, NULL, &(OSD_UINT16_t) { &gyroConfig_gyro_soft_notch_cutoff_2, 0, 500, 1 } }, #ifdef USE_MULTI_GYRO - { "GYRO TO USE", OME_TAB | REBOOT_REQUIRED, NULL, &(OSD_TAB_t) { &gyroConfig_gyro_to_use, 2, osdTableGyroToUse} }, + { "GYRO TO USE", OME_TAB | REBOOT_REQUIRED, NULL, &(OSD_TAB_t) { &gyroConfig_gyro_to_use, 3, osdTableGyroToUse} }, #endif { "BACK", OME_Back, NULL, NULL }, diff --git a/src/main/drivers/accgyro/accgyro.h b/src/main/drivers/accgyro/accgyro.h index 29ba307ac5..853e057f80 100644 --- a/src/main/drivers/accgyro/accgyro.h +++ b/src/main/drivers/accgyro/accgyro.h @@ -38,6 +38,7 @@ #define GYRO_SCALE_2000DPS (2000.0f / (1 << 15)) // 16.384 dps/lsb scalefactor for 2000dps sensors #define GYRO_SCALE_4000DPS (4000.0f / (1 << 15)) // 8.192 dps/lsb scalefactor for 4000dps sensors +#define GYRO_VARIANCE_WINDOW 9 typedef enum { GYRO_NONE = 0, @@ -90,6 +91,18 @@ typedef enum { GYRO_EXTI_NO_INT } gyroModeSPI_e; +typedef struct gyroVariance_s { + uint16_t windex; + uint16_t w; + float axisWindow[GYRO_VARIANCE_WINDOW]; + float varianceWindow[GYRO_VARIANCE_WINDOW]; + float axisSumVar; + float axisVar; + float axisSumMean; + float axisMean; + float inverseN; +} gyroVariance_t; + typedef struct gyroDev_s { #if defined(SIMULATOR_BUILD) && defined(SIMULATOR_MULTITHREAD) pthread_mutex_t lock; @@ -128,6 +141,7 @@ typedef struct gyroDev_s { fp_rotationMatrix_t rotationMatrix; uint16_t gyroSampleRateHz; uint16_t accSampleRateHz; + gyroVariance_t variance[XYZ_AXIS_COUNT]; uint8_t accDataReg; uint8_t gyroDataReg; } gyroDev_t; diff --git a/src/main/msp/msp.c b/src/main/msp/msp.c index d2b60a254d..b7b4e26bfd 100644 --- a/src/main/msp/msp.c +++ b/src/main/msp/msp.c @@ -1741,7 +1741,8 @@ static bool mspProcessOutCommand(int16_t cmdMSP, sbuf_t *dst) case GYRO_CONFIG_USE_GYRO_2: gyroAlignment = gyroDeviceConfig(1)->alignment; break; - case GYRO_CONFIG_USE_GYRO_BOTH: + case GYRO_CONFIG_USE_GYRO_BOTH_SIMPLE: + case GYRO_CONFIG_USE_GYRO_BOTH_VARIANCE: // for dual-gyro in "BOTH" mode we only read/write gyro 0 default: gyroAlignment = gyroDeviceConfig(0)->alignment; @@ -2813,7 +2814,8 @@ static mspResult_e mspProcessInCommand(mspDescriptor_t srcDesc, int16_t cmdMSP, case GYRO_CONFIG_USE_GYRO_2: gyroDeviceConfigMutable(1)->alignment = gyroAlignment; break; - case GYRO_CONFIG_USE_GYRO_BOTH: + case GYRO_CONFIG_USE_GYRO_BOTH_SIMPLE: + case GYRO_CONFIG_USE_GYRO_BOTH_VARIANCE: // For dual-gyro in "BOTH" mode we'll only update gyro 0 default: gyroDeviceConfigMutable(0)->alignment = gyroAlignment; diff --git a/src/main/sensors/gyro.c b/src/main/sensors/gyro.c index abccba6d9b..ccb4ce7cb3 100644 --- a/src/main/sensors/gyro.c +++ b/src/main/sensors/gyro.c @@ -26,6 +26,8 @@ #include "platform.h" +#include "arm_math.h" + #include "build/debug.h" #include "common/axis.h" @@ -110,7 +112,7 @@ void pgResetFn_gyroConfig(gyroConfig_t *gyroConfig) gyroConfig->gyroMovementCalibrationThreshold = 48; gyroConfig->gyro_hardware_lpf = GYRO_HARDWARE_LPF_NORMAL; gyroConfig->gyro_lpf1_type = FILTER_PT1; - gyroConfig->gyro_lpf1_static_hz = GYRO_LPF1_DYN_MIN_HZ_DEFAULT; + gyroConfig->gyro_lpf1_static_hz = GYRO_LPF1_DYN_MIN_HZ_DEFAULT; // NOTE: dynamic lpf is enabled by default so this setting is actually // overridden and the static lowpass 1 is disabled. We can't set this // value to 0 otherwise Configurator versions 10.4 and earlier will also @@ -151,7 +153,8 @@ FAST_CODE bool gyroIsCalibrationComplete(void) case GYRO_CONFIG_USE_GYRO_2: { return isGyroSensorCalibrationComplete(&gyro.gyroSensor2); } - case GYRO_CONFIG_USE_GYRO_BOTH: { + case GYRO_CONFIG_USE_GYRO_BOTH_SIMPLE: + case GYRO_CONFIG_USE_GYRO_BOTH_VARIANCE: { return isGyroSensorCalibrationComplete(&gyro.gyroSensor1) && isGyroSensorCalibrationComplete(&gyro.gyroSensor2); } #endif @@ -239,6 +242,12 @@ STATIC_UNIT_TESTED void performGyroCalibration(gyroSensor_t *gyroSensor, uint8_t if (axis == Z) { gyroSensor->gyroDev.gyroZero[axis] -= ((float)gyroConfig()->gyro_offset_yaw / 100); } + + for (int axis = 0; axis < XYZ_AXIS_COUNT; axis++) { + memset(&gyroSensor->gyroDev.variance[axis], 0, sizeof(gyroVariance_t)); + gyroSensor->gyroDev.variance[axis].inverseN = 1.0f / 8.0f; + gyroSensor->gyroDev.variance[axis].w = 8; + } } } @@ -402,6 +411,30 @@ static FAST_CODE void gyroUpdateSensor(gyroSensor_t *gyroSensor) } } +FAST_CODE float gyroVariance(gyroVariance_t *variance, float gyroRate) { + variance->axisWindow[variance->windex] = gyroRate; + variance->axisSumMean += variance->axisWindow[variance->windex]; + + float varianceElement = variance->axisWindow[variance->windex] - variance->axisMean; + varianceElement = varianceElement * varianceElement; + variance->axisSumVar += varianceElement; + variance->varianceWindow[variance->windex] = varianceElement; + variance->windex++; + + if (variance->windex > variance->w) { + variance->windex = 0; + } + + variance->axisSumMean -= variance->axisWindow[variance->windex]; + variance->axisSumVar -= variance->varianceWindow[variance->windex]; + + //New mean + variance->axisMean = variance->axisSumMean * variance->inverseN; + variance->axisVar = variance->axisSumVar * variance->inverseN; + + return variance->axisVar * 100.0f + 0.5f; +} + FAST_CODE void gyroUpdate(void) { switch (gyro.gyroToUse) { @@ -422,7 +455,7 @@ FAST_CODE void gyroUpdate(void) gyro.gyroADC[Z] = gyro.gyroSensor2.gyroDev.gyroADC[Z] * gyro.gyroSensor2.gyroDev.scale; } break; - case GYRO_CONFIG_USE_GYRO_BOTH: + case GYRO_CONFIG_USE_GYRO_BOTH_SIMPLE: gyroUpdateSensor(&gyro.gyroSensor1); gyroUpdateSensor(&gyro.gyroSensor2); if (isGyroSensorCalibrationComplete(&gyro.gyroSensor1) && isGyroSensorCalibrationComplete(&gyro.gyroSensor2)) { @@ -431,6 +464,33 @@ FAST_CODE void gyroUpdate(void) gyro.gyroADC[Z] = ((gyro.gyroSensor1.gyroDev.gyroADC[Z] * gyro.gyroSensor1.gyroDev.scale) + (gyro.gyroSensor2.gyroDev.gyroADC[Z] * gyro.gyroSensor2.gyroDev.scale)) / 2.0f; } break; + case GYRO_CONFIG_USE_GYRO_BOTH_VARIANCE: + gyroUpdateSensor(&gyro.gyroSensor1); + gyroUpdateSensor(&gyro.gyroSensor2); + if (isGyroSensorCalibrationComplete(&gyro.gyroSensor1) && isGyroSensorCalibrationComplete(&gyro.gyroSensor2)) { + float gyroScaled1, gyroScaled2, varianceGyro1, varianceGyro2; + gyroScaled1 = gyro.gyroSensor1.gyroDev.gyroADC[X] * gyro.gyroSensor1.gyroDev.scale; + gyroScaled2 = gyro.gyroSensor2.gyroDev.gyroADC[X] * gyro.gyroSensor2.gyroDev.scale; + varianceGyro1 = gyroVariance(&gyro.gyroSensor1.gyroDev.variance[X], gyroScaled1); + varianceGyro2 = gyroVariance(&gyro.gyroSensor2.gyroDev.variance[X], gyroScaled2); + gyro.gyroADC[X] = ((gyroScaled1 * varianceGyro2) + (gyroScaled2 * varianceGyro1)) / (varianceGyro1 + varianceGyro2); + DEBUG_SET(DEBUG_FUSION, 0, lrintf(gyroScaled1)); + DEBUG_SET(DEBUG_FUSION, 1, lrintf(gyroScaled2)); + DEBUG_SET(DEBUG_FUSION, 2, lrintf(gyro.gyroADC[X])); + + gyroScaled1 = gyro.gyroSensor1.gyroDev.gyroADC[Y] * gyro.gyroSensor1.gyroDev.scale; + gyroScaled2 = gyro.gyroSensor2.gyroDev.gyroADC[Y] * gyro.gyroSensor2.gyroDev.scale; + varianceGyro1 = gyroVariance(&gyro.gyroSensor1.gyroDev.variance[Y], gyroScaled1); + varianceGyro2 = gyroVariance(&gyro.gyroSensor2.gyroDev.variance[Y], gyroScaled2); + gyro.gyroADC[Y] = ((gyroScaled1 * varianceGyro2) + (gyroScaled2 * varianceGyro1)) / (varianceGyro1 + varianceGyro2); + + gyroScaled1 = gyro.gyroSensor1.gyroDev.gyroADC[Z] * gyro.gyroSensor1.gyroDev.scale; + gyroScaled2 = gyro.gyroSensor2.gyroDev.gyroADC[Z] * gyro.gyroSensor2.gyroDev.scale; + varianceGyro1 = gyroVariance(&gyro.gyroSensor1.gyroDev.variance[Z], gyroScaled1); + varianceGyro2 = gyroVariance(&gyro.gyroSensor2.gyroDev.variance[Z], gyroScaled2); + gyro.gyroADC[Z] = ((gyroScaled1 * varianceGyro2) + (gyroScaled2 * varianceGyro1)) / (varianceGyro1 + varianceGyro2); + } + break; #endif } @@ -495,7 +555,8 @@ FAST_CODE void gyroFiltering(timeUs_t currentTimeUs) DEBUG_SET(DEBUG_DUAL_GYRO_SCALED, 3, lrintf(gyro.gyroSensor2.gyroDev.gyroADC[Y] * gyro.gyroSensor2.gyroDev.scale)); break; - case GYRO_CONFIG_USE_GYRO_BOTH: + case GYRO_CONFIG_USE_GYRO_BOTH_SIMPLE: + case GYRO_CONFIG_USE_GYRO_BOTH_VARIANCE: DEBUG_SET(DEBUG_DUAL_GYRO_RAW, 0, gyro.gyroSensor1.gyroDev.gyroADCRaw[X]); DEBUG_SET(DEBUG_DUAL_GYRO_RAW, 1, gyro.gyroSensor1.gyroDev.gyroADCRaw[Y]); DEBUG_SET(DEBUG_DUAL_GYRO_RAW, 2, gyro.gyroSensor2.gyroDev.gyroADCRaw[X]); @@ -577,7 +638,8 @@ void gyroReadTemperature(void) gyroSensorTemperature = gyroReadSensorTemperature(gyro.gyroSensor2); break; - case GYRO_CONFIG_USE_GYRO_BOTH: + case GYRO_CONFIG_USE_GYRO_BOTH_SIMPLE: + case GYRO_CONFIG_USE_GYRO_BOTH_VARIANCE: gyroSensorTemperature = MAX(gyroReadSensorTemperature(gyro.gyroSensor1), gyroReadSensorTemperature(gyro.gyroSensor2)); break; #endif // USE_MULTI_GYRO diff --git a/src/main/sensors/gyro.h b/src/main/sensors/gyro.h index 5ff3eb8889..6fb98d78ac 100644 --- a/src/main/sensors/gyro.h +++ b/src/main/sensors/gyro.h @@ -155,7 +155,8 @@ typedef enum { #define GYRO_CONFIG_USE_GYRO_1 0 #define GYRO_CONFIG_USE_GYRO_2 1 -#define GYRO_CONFIG_USE_GYRO_BOTH 2 +#define GYRO_CONFIG_USE_GYRO_BOTH_SIMPLE 2 +#define GYRO_CONFIG_USE_GYRO_BOTH_VARIANCE 3 enum { FILTER_LPF1 = 0, diff --git a/src/main/sensors/gyro_init.c b/src/main/sensors/gyro_init.c index 0d434a9a89..aba0ab1f23 100644 --- a/src/main/sensors/gyro_init.c +++ b/src/main/sensors/gyro_init.c @@ -616,7 +616,7 @@ bool gyroInit(void) } #if defined(USE_MULTI_GYRO) - if ((gyro.gyroToUse == GYRO_CONFIG_USE_GYRO_BOTH && !((gyroDetectionFlags & GYRO_ALL_MASK) == GYRO_ALL_MASK)) + if ((gyro.gyroToUse >= GYRO_CONFIG_USE_GYRO_BOTH_SIMPLE && !((gyroDetectionFlags & GYRO_ALL_MASK) == GYRO_ALL_MASK)) || (gyro.gyroToUse == GYRO_CONFIG_USE_GYRO_1 && !(gyroDetectionFlags & GYRO_1_MASK)) || (gyro.gyroToUse == GYRO_CONFIG_USE_GYRO_2 && !(gyroDetectionFlags & GYRO_2_MASK))) { if (gyroDetectionFlags & GYRO_1_MASK) { @@ -632,14 +632,14 @@ bool gyroInit(void) // Only allow using both gyros simultaneously if they are the same hardware type. if (((gyroDetectionFlags & GYRO_ALL_MASK) == GYRO_ALL_MASK) && gyro.gyroSensor1.gyroDev.gyroHardware == gyro.gyroSensor2.gyroDev.gyroHardware) { gyroDetectionFlags |= GYRO_IDENTICAL_MASK; - } else if (gyro.gyroToUse == GYRO_CONFIG_USE_GYRO_BOTH) { + } else if (gyro.gyroToUse >= GYRO_CONFIG_USE_GYRO_BOTH_SIMPLE) { // If the user selected "BOTH" and they are not the same type, then reset to using only the first gyro. gyro.gyroToUse = GYRO_CONFIG_USE_GYRO_1; gyroConfigMutable()->gyro_to_use = gyro.gyroToUse; eepromWriteRequired = true; } - if (gyro.gyroToUse == GYRO_CONFIG_USE_GYRO_2 || gyro.gyroToUse == GYRO_CONFIG_USE_GYRO_BOTH) { + if (gyro.gyroToUse == GYRO_CONFIG_USE_GYRO_2 || gyro.gyroToUse >= GYRO_CONFIG_USE_GYRO_BOTH_SIMPLE) { static DMA_DATA uint8_t gyroBuf2[GYRO_BUF_SIZE]; // SPI DMA buffer required per device gyro.gyroSensor2.gyroDev.dev.txBuf = gyroBuf2; @@ -655,7 +655,7 @@ bool gyroInit(void) writeEEPROM(); } - if (gyro.gyroToUse == GYRO_CONFIG_USE_GYRO_1 || gyro.gyroToUse == GYRO_CONFIG_USE_GYRO_BOTH) { + if (gyro.gyroToUse == GYRO_CONFIG_USE_GYRO_1 || gyro.gyroToUse >= GYRO_CONFIG_USE_GYRO_BOTH_SIMPLE) { static DMA_DATA uint8_t gyroBuf1[GYRO_BUF_SIZE]; // SPI DMA buffer required per device gyro.gyroSensor1.gyroDev.dev.txBuf = gyroBuf1; diff --git a/src/main/target/CLRACINGF7/target.h b/src/main/target/CLRACINGF7/target.h index d7e1df5622..ad20beb06c 100644 --- a/src/main/target/CLRACINGF7/target.h +++ b/src/main/target/CLRACINGF7/target.h @@ -57,7 +57,7 @@ #define GYRO_2_ALIGN CW90_DEG //#define ACC_2_ALIGN CW90_DEG -#define GYRO_CONFIG_USE_GYRO_DEFAULT GYRO_CONFIG_USE_GYRO_BOTH +#define GYRO_CONFIG_USE_GYRO_DEFAULT GYRO_CONFIG_USE_GYRO_BOTH_SIMPLE #define USE_MAG #define USE_MAG_HMC5883 @@ -161,4 +161,3 @@ #define USABLE_TIMER_CHANNEL_COUNT 9 #define USED_TIMERS ( TIM_N(2) | TIM_N(3) | TIM_N(4) | TIM_N(5) | TIM_N(8) ) - diff --git a/src/main/target/EXF722DUAL/target.h b/src/main/target/EXF722DUAL/target.h index e20eafe03b..07a725687c 100644 --- a/src/main/target/EXF722DUAL/target.h +++ b/src/main/target/EXF722DUAL/target.h @@ -56,7 +56,7 @@ #define GYRO_2_ALIGN CW90_DEG -#define GYRO_CONFIG_USE_GYRO_DEFAULT GYRO_CONFIG_USE_GYRO_BOTH +#define GYRO_CONFIG_USE_GYRO_DEFAULT GYRO_CONFIG_USE_GYRO_BOTH_SIMPLE #define USE_VCP #define USE_UART1 @@ -125,7 +125,7 @@ #define USE_ADC #define ADC_INSTANCE ADC3 -#define ADC3_DMA_OPT 0 // DMA 2 Stream 0 Channel 2 +#define ADC3_DMA_OPT 0 // DMA 2 Stream 0 Channel 2 #define USE_I2C #define USE_I2C_DEVICE_2 diff --git a/src/main/target/IFLIGHT_H743_AIO/target.h b/src/main/target/IFLIGHT_H743_AIO/target.h index 53dc9f8eec..19cb52a351 100644 --- a/src/main/target/IFLIGHT_H743_AIO/target.h +++ b/src/main/target/IFLIGHT_H743_AIO/target.h @@ -27,7 +27,7 @@ #define USE_BEEPER #define BEEPER_PIN PD15 -#define BEEPER_INVERTED +#define BEEPER_INVERTED #define USE_UART @@ -129,13 +129,13 @@ #define GYRO_1_CS_PIN SPI1_NSS_PIN #define GYRO_1_SPI_INSTANCE SPI1 -#define GYRO_1_ALIGN CW0_DEG +#define GYRO_1_ALIGN CW0_DEG #define GYRO_2_CS_PIN SPI2_NSS_PIN #define GYRO_2_SPI_INSTANCE SPI2 #define GYRO_2_ALIGN CW0_DEG -#define GYRO_CONFIG_USE_GYRO_DEFAULT GYRO_CONFIG_USE_GYRO_BOTH +#define GYRO_CONFIG_USE_GYRO_DEFAULT GYRO_CONFIG_USE_GYRO_BOTH_SIMPLE #define USE_FLASHFS #define USE_FLASH_TOOLS @@ -148,7 +148,7 @@ #define FLASH_CS_PIN SPI3_NSS_PIN #define FLASH_SPI_INSTANCE SPI3 #define ENABLE_BLACKBOX_LOGGING_ON_SPIFLASH_BY_DEFAULT - + #define USE_MAX7456 #define MAX7456_SPI_INSTANCE SPI4 #define MAX7456_SPI_CS_PIN SPI4_NSS_PIN diff --git a/src/main/target/IFLIGHT_H743_AIO_V2/target.h b/src/main/target/IFLIGHT_H743_AIO_V2/target.h index eb286bb627..2fbf0e79cb 100644 --- a/src/main/target/IFLIGHT_H743_AIO_V2/target.h +++ b/src/main/target/IFLIGHT_H743_AIO_V2/target.h @@ -27,7 +27,7 @@ #define USE_BEEPER #define BEEPER_PIN PD2 -#define BEEPER_INVERTED +#define BEEPER_INVERTED #define USE_UART @@ -129,13 +129,13 @@ #define GYRO_1_CS_PIN SPI1_NSS_PIN #define GYRO_1_SPI_INSTANCE SPI1 -#define GYRO_1_ALIGN CW0_DEG +#define GYRO_1_ALIGN CW0_DEG #define GYRO_2_CS_PIN SPI2_NSS_PIN #define GYRO_2_SPI_INSTANCE SPI2 #define GYRO_2_ALIGN CW0_DEG -#define GYRO_CONFIG_USE_GYRO_DEFAULT GYRO_CONFIG_USE_GYRO_BOTH +#define GYRO_CONFIG_USE_GYRO_DEFAULT GYRO_CONFIG_USE_GYRO_BOTH_SIMPLE #define USE_FLASHFS #define USE_FLASH_TOOLS @@ -148,7 +148,7 @@ #define FLASH_CS_PIN SPI3_NSS_PIN #define FLASH_SPI_INSTANCE SPI3 #define ENABLE_BLACKBOX_LOGGING_ON_SPIFLASH_BY_DEFAULT - + #define USE_MAX7456 #define MAX7456_SPI_INSTANCE SPI4 #define MAX7456_SPI_CS_PIN SPI4_NSS_PIN diff --git a/src/main/target/SPRACINGF7DUAL/target.h b/src/main/target/SPRACINGF7DUAL/target.h index 92eb42bfb5..e265e76c37 100644 --- a/src/main/target/SPRACINGF7DUAL/target.h +++ b/src/main/target/SPRACINGF7DUAL/target.h @@ -65,7 +65,7 @@ #define GYRO_2_ALIGN CW270_DEG #endif -#define GYRO_CONFIG_USE_GYRO_DEFAULT GYRO_CONFIG_USE_GYRO_BOTH +#define GYRO_CONFIG_USE_GYRO_DEFAULT GYRO_CONFIG_USE_GYRO_BOTH_SIMPLE #define USE_BARO #define USE_BARO_BMP280 @@ -159,12 +159,12 @@ #define USE_ADC // It's possible to use ADC1 or ADC3 on this target, same pins. //#define ADC_INSTANCE ADC1 -//#define ADC1_DMA_OPT 0 // DMA 2 Stream 0 Channel 0 +//#define ADC1_DMA_OPT 0 // DMA 2 Stream 0 Channel 0 // Using ADC3 frees up DMA2_Stream0 for SPI1_RX (not necessarily, SPI1_RX has DMA2_Stream2 as well) #define ADC_INSTANCE ADC3 -#define ADC3_DMA_OPT 0 // DMA 2 Stream 0 Channel 2 +#define ADC3_DMA_OPT 0 // DMA 2 Stream 0 Channel 2 #define VBAT_ADC_PIN PC1 @@ -206,4 +206,3 @@ //#define USABLE_TIMER_CHANNEL_COUNT 17 // 4xPWM, 8xESC, 2xESC via UART3 RX/TX, 1xLED Strip, 1xIR, CAM_C #define USABLE_TIMER_CHANNEL_COUNT 17 #define USED_TIMERS (TIM_N(1) | TIM_N(2) | TIM_N(3) | TIM_N(4) | TIM_N(5) | TIM_N(8) | TIM_N(9)) - diff --git a/src/main/target/SPRACINGH7EXTREME/target.h b/src/main/target/SPRACINGH7EXTREME/target.h index 3af9f095fe..00ff199d02 100644 --- a/src/main/target/SPRACINGH7EXTREME/target.h +++ b/src/main/target/SPRACINGH7EXTREME/target.h @@ -161,7 +161,7 @@ #define GYRO_2_ALIGN ALIGN_CUSTOM #define GYRO_2_CUSTOM_ALIGN SENSOR_ALIGNMENT( 0, 0, 225) -#define GYRO_CONFIG_USE_GYRO_DEFAULT GYRO_CONFIG_USE_GYRO_BOTH +#define GYRO_CONFIG_USE_GYRO_DEFAULT GYRO_CONFIG_USE_GYRO_BOTH_VARIANCE #define USE_FLASHFS #define USE_FLASH_TOOLS