Skip to content

Commit

Permalink
Merge remote-tracking branch 'emuflight/master' into 20230620_rebase_…
Browse files Browse the repository at this point in the history
…PR890_BMI270_as_FIFO_without_normal_driver
  • Loading branch information
nerdCopter committed Oct 27, 2023
2 parents 7c83158 + b2117eb commit f6f4fa4
Show file tree
Hide file tree
Showing 15 changed files with 47 additions and 31 deletions.
2 changes: 2 additions & 0 deletions src/main/blackbox/blackbox.c
Original file line number Diff line number Diff line change
Expand Up @@ -1229,10 +1229,12 @@ static bool blackboxWriteSysinfo(void) {
BLACKBOX_PRINT_HEADER_LINE("gyro_lowpass_hz_roll", "%d", gyroConfig()->gyro_lowpass_hz[ROLL]);
BLACKBOX_PRINT_HEADER_LINE("gyro_lowpass_hz_pitch", "%d", gyroConfig()->gyro_lowpass_hz[PITCH]);
BLACKBOX_PRINT_HEADER_LINE("gyro_lowpass_hz_yaw", "%d", gyroConfig()->gyro_lowpass_hz[YAW]);
#ifdef USE_GYRO_LPF2
BLACKBOX_PRINT_HEADER_LINE("gyro_lowpass2_type", "%d", gyroConfig()->gyro_lowpass2_type);
BLACKBOX_PRINT_HEADER_LINE("gyro_lowpass2_hz_roll", "%d", gyroConfig()->gyro_lowpass2_hz[ROLL]);
BLACKBOX_PRINT_HEADER_LINE("gyro_lowpass2_hz_pitch", "%d", gyroConfig()->gyro_lowpass2_hz[PITCH]);
BLACKBOX_PRINT_HEADER_LINE("gyro_lowpass2_hz_yaw", "%d", gyroConfig()->gyro_lowpass2_hz[YAW]);
#endif
BLACKBOX_PRINT_HEADER_LINE("gyro_notch_hz", "%d,%d", gyroConfig()->gyro_soft_notch_hz_1,
gyroConfig()->gyro_soft_notch_hz_2);
BLACKBOX_PRINT_HEADER_LINE("gyro_notch_cutoff", "%d,%d", gyroConfig()->gyro_soft_notch_cutoff_1,
Expand Down
12 changes: 11 additions & 1 deletion src/main/cms/cms_menu_imu.c
Original file line number Diff line number Diff line change
Expand Up @@ -493,9 +493,12 @@ static uint8_t gyroConfig_gyro_lowpass1_type;
static uint16_t gyroConfig_gyro_lowpass_hz_roll;
static uint16_t gyroConfig_gyro_lowpass_hz_pitch;
static uint16_t gyroConfig_gyro_lowpass_hz_yaw;
#ifdef USE_GYRO_LPF2
static uint8_t gyroConfig_gyro_lowpass2_type;
static uint16_t gyroConfig_gyro_lowpass2_hz_roll;
static uint16_t gyroConfig_gyro_lowpass2_hz_pitch;
static uint16_t gyroConfig_gyro_lowpass2_hz_yaw;
#endif
#ifdef USE_GYRO_DATA_ANALYSE
static uint16_t gyroConfig_gyro_q;
static uint8_t gyroConfig_gyro_notch_count;
Expand Down Expand Up @@ -524,9 +527,12 @@ static long cmsx_menuGyro_onEnter(void) {
gyroConfig_gyro_lowpass_hz_roll = gyroConfig()->gyro_lowpass_hz[ROLL];
gyroConfig_gyro_lowpass_hz_pitch = gyroConfig()->gyro_lowpass_hz[PITCH];
gyroConfig_gyro_lowpass_hz_yaw = gyroConfig()->gyro_lowpass_hz[YAW];
#ifdef USE_GYRO_LPF2
gyroConfig_gyro_lowpass2_type = gyroConfig()->gyro_lowpass2_type;
gyroConfig_gyro_lowpass2_hz_roll = gyroConfig()->gyro_lowpass2_hz[ROLL];
gyroConfig_gyro_lowpass2_hz_pitch = gyroConfig()->gyro_lowpass2_hz[PITCH];
gyroConfig_gyro_lowpass2_hz_yaw = gyroConfig()->gyro_lowpass2_hz[YAW];
#endif
#ifdef USE_GYRO_DATA_ANALYSE
gyroConfig_gyro_q = gyroConfig()->dyn_notch_q;
gyroConfig_gyro_notch_count = gyroConfig()->dyn_notch_count;
Expand Down Expand Up @@ -558,9 +564,12 @@ static long cmsx_menuGyro_onExit(const OSD_Entry *self) {
gyroConfigMutable()->gyro_lowpass_hz[ROLL] = gyroConfig_gyro_lowpass_hz_roll;
gyroConfigMutable()->gyro_lowpass_hz[PITCH] = gyroConfig_gyro_lowpass_hz_pitch;
gyroConfigMutable()->gyro_lowpass_hz[YAW] = gyroConfig_gyro_lowpass_hz_yaw;
#ifdef USE_GYRO_LPF2
gyroConfigMutable()->gyro_lowpass2_type = gyroConfig_gyro_lowpass2_type;
gyroConfigMutable()->gyro_lowpass2_hz[ROLL] = gyroConfig_gyro_lowpass2_hz_roll;
gyroConfigMutable()->gyro_lowpass2_hz[PITCH] = gyroConfig_gyro_lowpass2_hz_pitch;
gyroConfigMutable()->gyro_lowpass2_hz[YAW] = gyroConfig_gyro_lowpass2_hz_yaw;
#endif
#ifdef USE_GYRO_DATA_ANALYSE
gyroConfigMutable()->dyn_notch_q = gyroConfig_gyro_q;
gyroConfigMutable()->dyn_notch_count = gyroConfig_gyro_notch_count;
Expand Down Expand Up @@ -589,11 +598,12 @@ static long cmsx_menuGyro_onExit(const OSD_Entry *self) {
static OSD_Entry cmsx_menuFilterGlobalEntries[] = {
{ "-- FILTER GLB --", OME_Label, NULL, NULL, 0 },

{ "GYRO LPF TYPE", OME_TAB, NULL, &(OSD_TAB_t) { (uint8_t *) &gyroConfig_gyro_lowpass1_type, 4, cms_FilterType }, 0 },
{ "GYRO LPF ROLL", OME_UINT16, NULL, &(OSD_UINT16_t) { &gyroConfig_gyro_lowpass_hz_roll, 0, 16000, 1 }, 0 },
{ "GYRO LPF PITCH", OME_UINT16, NULL, &(OSD_UINT16_t) { &gyroConfig_gyro_lowpass_hz_pitch, 0, 16000, 1 }, 0 },
{ "GYRO LPF YAW", OME_UINT16, NULL, &(OSD_UINT16_t) { &gyroConfig_gyro_lowpass_hz_yaw, 0, 16000, 1 }, 0 },
{ "GYRO LPF TYPE", OME_TAB, NULL, &(OSD_TAB_t) { (uint8_t *) &gyroConfig_gyro_lowpass1_type, 4, cms_FilterType }, 0 },
#ifdef USE_GYRO_LPF2
{ "GYRO LPF2 TYPE", OME_TAB, NULL, &(OSD_TAB_t) { (uint8_t *) &gyroConfig_gyro_lowpass2_type, 4, cms_FilterType }, 0 },
{ "GYRO LPF2 ROLL", OME_UINT16, NULL, &(OSD_UINT16_t) { &gyroConfig_gyro_lowpass2_hz_roll, 0, 16000, 1 }, 0 },
{ "GYRO LPF2 PITCH", OME_UINT16, NULL, &(OSD_UINT16_t) { &gyroConfig_gyro_lowpass2_hz_pitch, 0, 16000, 1 }, 0 },
{ "GYRO LPF2 YAW", OME_UINT16, NULL, &(OSD_UINT16_t) { &gyroConfig_gyro_lowpass2_hz_yaw, 0, 16000, 1 }, 0 },
Expand Down
6 changes: 4 additions & 2 deletions src/main/flight/pid.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,8 @@ void resetPidProfile(pidProfile_t *pidProfile) {
.dterm_ABG_half_life = 50,
.emuGravityGain = 50,
.angle_filter = 100,
#ifdef USE_GYRO_DATA_ANALYSE
.dtermDynNotch = false,
.dterm_dyn_notch_q = 400,
#endif
);
}

Expand Down Expand Up @@ -237,7 +235,9 @@ static FAST_RAM filterApplyFnPtr angleSetpointFilterApplyFn = nullFilterApply;
static FAST_RAM_ZERO_INIT pt1Filter_t angleSetpointFilter[2];
static FAST_RAM filterApplyFnPtr dtermABGapplyFn = nullFilterApply;
static FAST_RAM_ZERO_INIT alphaBetaGammaFilter_t dtermABG[XYZ_AXIS_COUNT];
#ifdef USE_GYRO_DATA_ANALYSE
static FAST_RAM_ZERO_INIT biquadFilter_t dtermNotch[XYZ_AXIS_COUNT][5];
#endif

#if defined(USE_ITERM_RELAX)
static FAST_RAM_ZERO_INIT pt1Filter_t windupLpf[XYZ_AXIS_COUNT];
Expand Down Expand Up @@ -673,7 +673,9 @@ static FAST_RAM_ZERO_INIT float stickMovement[XYZ_AXIS_COUNT];
static FAST_RAM_ZERO_INIT float lastRcDeflectionAbs[XYZ_AXIS_COUNT];
static FAST_RAM_ZERO_INIT float previousError[XYZ_AXIS_COUNT];
static FAST_RAM_ZERO_INIT float previousMeasurement[XYZ_AXIS_COUNT];
#ifdef USE_GYRO_DATA_ANALYSE
static FAST_RAM_ZERO_INIT float previousNotchCenterFreq[XYZ_AXIS_COUNT][5];
#endif
static FAST_RAM_ZERO_INIT timeUs_t crashDetectedAtUs;

void pidController(const pidProfile_t *pidProfile, const rollAndPitchTrims_t *angleTrim, timeUs_t currentTimeUs) {
Expand Down
2 changes: 0 additions & 2 deletions src/main/flight/pid.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,8 @@ typedef struct pidProfile_s {
uint16_t dterm_ABG_alpha;
uint16_t dterm_ABG_boost;
uint8_t dterm_ABG_half_life;
#ifdef USE_GYRO_DATA_ANALYSE
uint8_t dtermDynNotch;
uint16_t dterm_dyn_notch_q;
#endif
} pidProfile_t;

#ifndef USE_OSD_SLAVE
Expand Down
22 changes: 10 additions & 12 deletions src/main/interface/msp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1194,11 +1194,21 @@ bool mspProcessOutCommand(uint8_t cmdMSP, sbuf_t *dst) {
sbufWriteU16(dst, gyroConfig()->gyro_lowpass_hz[ROLL]);
sbufWriteU16(dst, gyroConfig()->gyro_lowpass_hz[PITCH]);
sbufWriteU16(dst, gyroConfig()->gyro_lowpass_hz[YAW]);
#ifdef USE_GYRO_LPF2
sbufWriteU16(dst, gyroConfig()->gyro_lowpass2_hz[ROLL]);
sbufWriteU16(dst, gyroConfig()->gyro_lowpass2_hz[PITCH]);
sbufWriteU16(dst, gyroConfig()->gyro_lowpass2_hz[YAW]);
#else
sbufWriteU16(dst, 0);
sbufWriteU16(dst, 0);
sbufWriteU16(dst, 0);
#endif
sbufWriteU8(dst, gyroConfig()->gyro_lowpass_type);
#ifdef USE_GYRO_LPF2
sbufWriteU8(dst, gyroConfig()->gyro_lowpass2_type);
#else
sbufWriteU8(dst, 0);
#endif
sbufWriteU16(dst, currentPidProfile->dFilter[ROLL].dLpf2);
sbufWriteU16(dst, currentPidProfile->dFilter[PITCH].dLpf2);
sbufWriteU16(dst, currentPidProfile->dFilter[YAW].dLpf2);
Expand Down Expand Up @@ -1833,17 +1843,10 @@ mspResult_e mspProcessInCommand(uint8_t cmdMSP, sbuf_t *src) {
currentPidProfile->dFilter[YAW].dLpf2 = sbufReadU16(src);
//MSP 1.51 removes SmartDTermSmoothing and WitchCraft
//MSP 1.51 adds and refactors dynamic_filter
#ifdef USE_GYRO_DATA_ANALYSE
gyroConfigMutable()->dyn_notch_count = sbufReadU8(src); //dynamic_gyro_notch_count
gyroConfigMutable()->dyn_notch_q = sbufReadU16(src);
gyroConfigMutable()->dyn_notch_min_hz = sbufReadU16(src);
gyroConfigMutable()->dyn_notch_max_hz = sbufReadU16(src); //dynamic_gyro_notch_max_hz
#else
sbufReadU8(src);
sbufReadU16(src);
sbufReadU16(src);
sbufReadU16(src);
#endif
//end 1.51 add/refactor dynamic_filter
//MSP 1.51
gyroConfigMutable()->gyro_ABG_alpha = sbufReadU16(src);
Expand All @@ -1855,13 +1858,8 @@ mspResult_e mspProcessInCommand(uint8_t cmdMSP, sbuf_t *src) {
currentPidProfile->dterm_ABG_half_life = sbufReadU8(src);
//end MSP 1.51
//MSP 1.51 dynamic dTerm notch
#ifdef USE_GYRO_DATA_ANALYSE
currentPidProfile->dtermDynNotch = sbufReadU8(src); //dterm_dyn_notch_enable
currentPidProfile->dterm_dyn_notch_q = sbufReadU16(src); //dterm_dyn_notch_q
#else
sbufReadU8(src);
sbufReadU16(src);
#endif
//end MSP 1.51 dynamic dTerm notch
}
// reinitialize the gyro filters with the new values
Expand Down
6 changes: 2 additions & 4 deletions src/main/interface/settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -394,11 +394,9 @@ static const char *const lookupTableMixerImplType[] = {
"LEGACY", "SMOOTH", "2PASS"
};

#ifdef USE_GYRO_DATA_ANALYSE
static const char *const lookupTableDynNotchAxisType[] = {
"RP", "RPY"
};
#endif

#define LOOKUP_TABLE_ENTRY(name) { name, ARRAYLEN(name) }

Expand Down Expand Up @@ -489,9 +487,7 @@ const lookupTableEntry_t lookupTables[] = {
LOOKUP_TABLE_ENTRY(lookupTableOsdLogoOnArming),
#endif
LOOKUP_TABLE_ENTRY(lookupTableMixerImplType),
#ifdef USE_GYRO_DATA_ANALYSE
LOOKUP_TABLE_ENTRY(lookupTableDynNotchAxisType),
#endif
};

#undef LOOKUP_TABLE_ENTRY
Expand All @@ -513,10 +509,12 @@ const clivalue_t valueTable[] = {
{ "gyro_lowpass_hz_pitch", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 0, 16000 }, PG_GYRO_CONFIG, offsetof(gyroConfig_t, gyro_lowpass_hz[PITCH]) },
{ "gyro_lowpass_hz_yaw", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 0, 16000 }, PG_GYRO_CONFIG, offsetof(gyroConfig_t, gyro_lowpass_hz[YAW]) },

#ifdef USE_GYRO_LPF2
{ "gyro_lowpass2_type", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_FILTER_TYPE }, PG_GYRO_CONFIG, offsetof(gyroConfig_t, gyro_lowpass2_type) },
{ "gyro_lowpass2_hz_roll", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 0, 16000 }, PG_GYRO_CONFIG, offsetof(gyroConfig_t, gyro_lowpass2_hz[ROLL]) },
{ "gyro_lowpass2_hz_pitch", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 0, 16000 }, PG_GYRO_CONFIG, offsetof(gyroConfig_t, gyro_lowpass2_hz[PITCH]) },
{ "gyro_lowpass2_hz_yaw", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 0, 16000 }, PG_GYRO_CONFIG, offsetof(gyroConfig_t, gyro_lowpass2_hz[YAW]) },
#endif

{ "gyro_abg_alpha", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 0, 1000 }, PG_GYRO_CONFIG, offsetof(gyroConfig_t, gyro_ABG_alpha) },
{ "gyro_abg_boost", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 0, 2000 }, PG_GYRO_CONFIG, offsetof(gyroConfig_t, gyro_ABG_boost) },
Expand Down
2 changes: 0 additions & 2 deletions src/main/interface/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,7 @@ typedef enum {
TABLE_OSD_LOGO_ON_ARMING,
#endif
TABLE_MIXER_IMPL_TYPE,
#ifdef USE_GYRO_DATA_ANALYSE
TABLE_DYN_NOTCH_AXIS_TYPE,
#endif
LOOKUP_TABLE_COUNT
} lookupTableIndex_e;

Expand Down
10 changes: 6 additions & 4 deletions src/main/sensors/gyro.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,10 @@ typedef struct gyroSensor_s {
gyroLowpassFilter_t lowpassFilter[XYZ_AXIS_COUNT];

// lowpass2 gyro soft filter
#ifdef USE_GYRO_LPF2
filterApplyFnPtr lowpass2FilterApplyFn;
gyroLowpassFilter_t lowpass2Filter[XYZ_AXIS_COUNT];
#endif

// ABG filter
filterApplyFnPtr gyroABGFilterApplyFn;
Expand Down Expand Up @@ -251,13 +253,11 @@ PG_RESET_TEMPLATE(gyroConfig_t, gyroConfig,
.checkOverflow = GYRO_OVERFLOW_CHECK_ALL_AXES,
.yaw_spin_recovery = YAW_SPIN_RECOVERY_AUTO,
.yaw_spin_threshold = 1950,
#ifdef USE_GYRO_DATA_ANALYSE
.dyn_notch_axis = RPY,
.dyn_notch_q = 400,
.dyn_notch_count = 3, // default of 3 is similar to the matrix filter.
.dyn_notch_min_hz = 150,
.dyn_notch_max_hz = 600,
#endif
.imuf_mode = GTBCM_GYRO_ACC_FILTER_F,
.imuf_rate = IMUF_RATE_16K,
.imuf_roll_q = 6000,
Expand Down Expand Up @@ -309,13 +309,11 @@ PG_RESET_TEMPLATE(gyroConfig_t, gyroConfig,
.gyro_offset_yaw = 0,
.yaw_spin_recovery = YAW_SPIN_RECOVERY_AUTO,
.yaw_spin_threshold = 1950,
#ifdef USE_GYRO_DATA_ANALYSE
.dyn_notch_axis = RPY,
.dyn_notch_q = 350,
.dyn_notch_count = 3, // default of 3 is similar to the matrix filter.
.dyn_notch_min_hz = 150,
.dyn_notch_max_hz = 600,
#endif
.gyro_ABG_alpha = 0,
.gyro_ABG_boost = 275,
.gyro_ABG_half_life = 50,
Expand Down Expand Up @@ -762,13 +760,15 @@ void gyroInitLowpassFilterLpf(gyroSensor_t *gyroSensor, int slot, int type) {
lpfHz[PITCH] = gyroConfig()->gyro_lowpass_hz[PITCH];
lpfHz[YAW] = gyroConfig()->gyro_lowpass_hz[YAW];
break;
#ifdef USE_GYRO_LPF2
case FILTER_LOWPASS2:
lowpassFilterApplyFn = &gyroSensor->lowpass2FilterApplyFn;
lowpassFilter = gyroSensor->lowpass2Filter;
lpfHz[ROLL] = gyroConfig()->gyro_lowpass2_hz[ROLL];
lpfHz[PITCH] = gyroConfig()->gyro_lowpass2_hz[PITCH];
lpfHz[YAW] = gyroConfig()->gyro_lowpass2_hz[YAW];
break;
#endif
default:
return;
}
Expand Down Expand Up @@ -907,11 +907,13 @@ static void gyroInitSensorFilters(gyroSensor_t *gyroSensor) {
FILTER_LOWPASS,
gyroConfig()->gyro_lowpass_type
);
#ifdef USE_GYRO_LPF2
gyroInitLowpassFilterLpf(
gyroSensor,
FILTER_LOWPASS2,
gyroConfig()->gyro_lowpass2_type
);
#endif
gyroInitFilterNotch1(gyroSensor, gyroConfig()->gyro_soft_notch_hz_1, gyroConfig()->gyro_soft_notch_cutoff_1);
gyroInitFilterNotch2(gyroSensor, gyroConfig()->gyro_soft_notch_hz_2, gyroConfig()->gyro_soft_notch_cutoff_2);
#ifdef USE_GYRO_DATA_ANALYSE
Expand Down
4 changes: 0 additions & 4 deletions src/main/sensors/gyro.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,10 @@ typedef struct smithPredictor_s {
} smithPredictor_t;
#endif // USE_SMITH_PREDICTOR

#ifdef USE_GYRO_DATA_ANALYSE
typedef enum {
RP = 0,
RPY = 1
} dynamicGyroAxisType_e;
#endif

typedef struct gyroConfig_s {
uint8_t gyro_align; // gyro alignment
Expand Down Expand Up @@ -154,13 +152,11 @@ typedef struct gyroConfig_s {
int16_t yaw_spin_threshold;

uint16_t gyroCalibrationDuration; // Gyro calibration duration in 1/100 second
#if defined(USE_GYRO_DATA_ANALYSE)
uint8_t dyn_notch_axis;
uint16_t dyn_notch_q;
uint8_t dyn_notch_count;
uint16_t dyn_notch_min_hz;
uint16_t dyn_notch_max_hz;
#endif
#if defined(USE_GYRO_IMUF9001)
uint16_t imuf_mode;
uint16_t imuf_rate;
Expand Down
2 changes: 2 additions & 0 deletions src/main/sensors/gyro_filter_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ static FAST_CODE void GYRO_FILTER_FUNCTION_NAME(gyroSensor_t *gyroSensor) {
#endif

// apply static notch filters and software lowpass filters
#ifdef USE_GYRO_LPF2
gyroADCf = gyroSensor->lowpass2FilterApplyFn((filter_t *)&gyroSensor->lowpass2Filter[axis], gyroADCf);
#endif
gyroADCf = gyroSensor->lowpassFilterApplyFn((filter_t *)&gyroSensor->lowpassFilter[axis], gyroADCf);
gyroADCf = gyroSensor->notchFilter1ApplyFn((filter_t *)&gyroSensor->notchFilter1[axis], gyroADCf);
gyroADCf = gyroSensor->notchFilter2ApplyFn((filter_t *)&gyroSensor->notchFilter2[axis], gyroADCf);
Expand Down
2 changes: 2 additions & 0 deletions src/main/target/NBDBBBLV2/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,11 @@ void targetConfiguration(void)
gyroConfigMutable()->gyro_lowpass_hz[ROLL] = 200;
gyroConfigMutable()->gyro_lowpass_hz[PITCH] = 200;
gyroConfigMutable()->gyro_lowpass_hz[YAW] = 200;
#ifdef USE_GYRO_LPF2
gyroConfigMutable()->gyro_lowpass2_hz[ROLL] = 250;
gyroConfigMutable()->gyro_lowpass2_hz[PITCH] = 250;
gyroConfigMutable()->gyro_lowpass2_hz[YAW] = 250;
#endif
gyroConfigMutable()->yaw_spin_threshold = 1950;
rxConfigMutable()->mincheck = 1075;
rxConfigMutable()->maxcheck = 1900;
Expand Down
2 changes: 2 additions & 0 deletions src/main/target/NBDBBBLV3/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,11 @@ void targetConfiguration(void)
gyroConfigMutable()->gyro_lowpass_hz[ROLL] = 200;
gyroConfigMutable()->gyro_lowpass_hz[PITCH] = 200;
gyroConfigMutable()->gyro_lowpass_hz[YAW] = 200;
#ifdef USE_GYRO_LPF2
gyroConfigMutable()->gyro_lowpass2_hz[ROLL] = 250;
gyroConfigMutable()->gyro_lowpass2_hz[PITCH] = 250;
gyroConfigMutable()->gyro_lowpass2_hz[YAW] = 250;
#endif
gyroConfigMutable()->yaw_spin_threshold = 1950;
rxConfigMutable()->mincheck = 1075;
rxConfigMutable()->maxcheck = 1900;
Expand Down
2 changes: 2 additions & 0 deletions src/main/target/NBDHMBF41S/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@ void targetConfiguration(void)
gyroConfigMutable()->gyro_lowpass_type = FILTER_PT1;
gyroConfigMutable()->gyro_lowpass_hz = 200;
#ifdef USE_GYRO_LPF2
gyroConfigMutable()->gyro_lowpass2_hz = 200;
#endif
gyroConfigMutable()->yaw_spin_threshold = 1950;
gyroConfigMutable()->dyn_lpf_gyro_min_hz = 160;
gyroConfigMutable()->dyn_lpf_gyro_max_hz = 400;
Expand Down
2 changes: 2 additions & 0 deletions src/main/target/NBDHMBF4PRO/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,11 @@ void targetConfiguration(void) {
gyroConfigMutable()->gyro_lowpass_hz[ROLL] = 200;
gyroConfigMutable()->gyro_lowpass_hz[PITCH] = 200;
gyroConfigMutable()->gyro_lowpass_hz[YAW] = 200;
#ifdef USE_GYRO_LPF2
gyroConfigMutable()->gyro_lowpass2_hz[ROLL] = 250;
gyroConfigMutable()->gyro_lowpass2_hz[PITCH] = 250;
gyroConfigMutable()->gyro_lowpass2_hz[YAW] = 250;
#endif
gyroConfigMutable()->yaw_spin_threshold = 1950;
// gyroConfigMutable()->dyn_lpf_gyro_min_hz = 200;
// gyroConfigMutable()->dyn_lpf_gyro_max_hz = 500;
Expand Down
2 changes: 2 additions & 0 deletions src/test/unit/sensor_gyro_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ TEST(SensorGyro, Update)
pgResetAll();
// turn off filters
gyroConfigMutable()->gyro_lowpass_hz[ROLL] = 0;
#ifdef USE_GYRO_LPF2
gyroConfigMutable()->gyro_lowpass2_hz[ROLL] = 0;
#endif
gyroConfigMutable()->gyro_soft_notch_hz_1 = 0;
gyroConfigMutable()->gyro_soft_notch_hz_2 = 0;
gyroInit();
Expand Down

0 comments on commit f6f4fa4

Please sign in to comment.