Skip to content

Commit

Permalink
Merge remote-tracking branch 'emuflight/master' into 20230515_rebase_…
Browse files Browse the repository at this point in the history
…master_Peck07_20220726_BMI270_targets
  • Loading branch information
nerdCopter committed Oct 27, 2023
2 parents 03fdfbe + b2117eb commit f870088
Show file tree
Hide file tree
Showing 14 changed files with 108 additions and 5 deletions.
5 changes: 5 additions & 0 deletions src/main/blackbox/blackbox.c
Original file line number Diff line number Diff line change
Expand Up @@ -1180,8 +1180,10 @@ static bool blackboxWriteSysinfo(void) {
BLACKBOX_PRINT_HEADER_LINE("dterm_lowpass2_hz_roll", "%d", currentPidProfile->dFilter[ROLL].dLpf2);
BLACKBOX_PRINT_HEADER_LINE("dterm_lowpass2_hz_pitch", "%d", currentPidProfile->dFilter[PITCH].dLpf2);
BLACKBOX_PRINT_HEADER_LINE("dterm_lowpass2_hz_yaw", "%d", currentPidProfile->dFilter[YAW].dLpf2);
#ifdef USE_GYRO_DATA_ANALYSE
BLACKBOX_PRINT_HEADER_LINE("dterm_dyn_notch_enable", "%d", currentPidProfile->dtermDynNotch);
BLACKBOX_PRINT_HEADER_LINE("dterm_dyn_notch_q", "%d", currentPidProfile->dterm_dyn_notch_q);
#endif
BLACKBOX_PRINT_HEADER_LINE("dterm_ABG_alpha", "%d", currentPidProfile->dterm_ABG_alpha);
BLACKBOX_PRINT_HEADER_LINE("dterm_ABG_boost", "%d", currentPidProfile->dterm_ABG_boost);
BLACKBOX_PRINT_HEADER_LINE("dterm_ABG_half_life", "%d", currentPidProfile->dterm_ABG_half_life);
Expand Down Expand Up @@ -1227,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 All @@ -1240,6 +1244,7 @@ static bool blackboxWriteSysinfo(void) {
BLACKBOX_PRINT_HEADER_LINE("dynamic_gyro_notch_count", "%d", gyroConfig()->dyn_notch_count);
BLACKBOX_PRINT_HEADER_LINE("dynamic_gyro_notch_min_hz", "%d", gyroConfig()->dyn_notch_min_hz);
BLACKBOX_PRINT_HEADER_LINE("dynamic_gyro_notch_max_hz", "%d", gyroConfig()->dyn_notch_max_hz);
BLACKBOX_PRINT_HEADER_LINE("dynamic_gyro_notch_axis", "%d", gyroConfig()->dyn_notch_axis);
#endif
BLACKBOX_PRINT_HEADER_LINE("gyro_ABG_alpha", "%d", gyroConfig()->gyro_ABG_alpha);
BLACKBOX_PRINT_HEADER_LINE("gyro_ABG_boost", "%d", gyroConfig()->gyro_ABG_boost);
Expand Down
39 changes: 37 additions & 2 deletions src/main/cms/cms_menu_imu.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@ static const char * const cms_FilterType[] = {
"PT1", "BIQUAD", "PT2", "PT3", "PT4",
};

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

static long cmsx_menuImu_onEnter(void) {
pidProfileIndex = getCurrentPidProfileIndex();
tmpPidProfileIndex = pidProfileIndex + 1;
Expand Down Expand Up @@ -487,13 +493,19 @@ 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;
static uint16_t gyroConfig_gyro_notch_min_hz;
static uint16_t gyroConfig_gyro_notch_max_hz;
static uint8_t gyroConfig_gyro_notch_axis;
#endif
static uint16_t gyroConfig_gyro_abg_alpha;
static uint16_t gyroConfig_gyro_abg_boost;
static uint8_t gyroConfig_gyro_abg_half_life;
Expand All @@ -515,17 +527,22 @@ 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;
gyroConfig_gyro_notch_min_hz = gyroConfig()->dyn_notch_min_hz;
gyroConfig_gyro_notch_max_hz = gyroConfig()->dyn_notch_max_hz;
gyroConfig_gyro_notch_axis = gyroConfig()->dyn_notch_axis;
#endif
gyroConfig_gyro_abg_alpha = gyroConfig()->gyro_ABG_alpha;
gyroConfig_gyro_abg_boost = gyroConfig()->gyro_ABG_boost;
gyroConfig_gyro_abg_half_life = gyroConfig()->gyro_ABG_half_life;

#ifndef USE_GYRO_IMUF9001
gyroConfig_imuf_roll_q = gyroConfig()->imuf_roll_q;
gyroConfig_imuf_pitch_q = gyroConfig()->imuf_pitch_q;
Expand All @@ -547,13 +564,19 @@ 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;
gyroConfigMutable()->dyn_notch_min_hz = gyroConfig_gyro_notch_min_hz;
gyroConfigMutable()->dyn_notch_max_hz = gyroConfig_gyro_notch_max_hz;
gyroConfigMutable()->dyn_notch_axis = gyroConfig_gyro_notch_axis;
#endif
gyroConfigMutable()->gyro_ABG_alpha = gyroConfig_gyro_abg_alpha;
gyroConfigMutable()->gyro_ABG_boost = gyroConfig_gyro_abg_boost;
gyroConfigMutable()->gyro_ABG_half_life = gyroConfig_gyro_abg_half_life;
Expand All @@ -575,19 +598,23 @@ 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 },
#endif
#ifdef USE_GYRO_DATA_ANALYSE
{ "DYN NOTCH Q", OME_UINT16, NULL, &(OSD_UINT16_t) { &gyroConfig_gyro_q, 0, 1000, 1 }, 0 },
{ "DYN NOTCH COUNT", OME_UINT8, NULL, &(OSD_UINT8_t) { &gyroConfig_gyro_notch_count, 1, 5, 1 }, 0 },
{ "DYN NOTCH MIN HZ", OME_UINT16, NULL, &(OSD_UINT16_t) { &gyroConfig_gyro_notch_min_hz, 30, 1000, 1 }, 0 },
{ "DYN NOTCH MAX HZ", OME_UINT16, NULL, &(OSD_UINT16_t) { &gyroConfig_gyro_notch_max_hz, 200, 1000, 1 }, 0 },
{ "DYN NOTCH AXIS", OME_TAB, NULL, &(OSD_TAB_t) { (uint8_t *) &gyroConfig_gyro_notch_axis, 1, cms_dynNotchAxisType }, 0 },
#endif
#ifndef USE_GYRO_IMUF9001
{ "IMUF W", OME_UINT16, NULL, &(OSD_UINT16_t) { &gyroConfig_imuf_w, 0, 512, 1 }, 0 },
{ "ROLL Q", OME_UINT16, NULL, &(OSD_UINT16_t) { &gyroConfig_imuf_roll_q, 100, 16000, 100 }, 0 },
Expand Down Expand Up @@ -709,8 +736,10 @@ static uint16_t cmsx_dterm_lowpass2_type;
static uint16_t cmsx_dterm_lowpass2_hz_roll;
static uint16_t cmsx_dterm_lowpass2_hz_pitch;
static uint16_t cmsx_dterm_lowpass2_hz_yaw;
#ifdef USE_GYRO_DATA_ANALYSE
static uint8_t cmsx_dterm_dyn_notch_enable ;
static uint16_t cmsx_dterm_dyn_notch_q;
#endif
static uint16_t cmsx_dterm_abg_alpha;
static uint16_t cmsx_dterm_abg_boost;
static uint8_t cmsx_dterm_abg_half_life;
Expand All @@ -725,8 +754,10 @@ static long cmsx_FilterPerProfileRead(void) {
cmsx_dterm_lowpass2_hz_roll = pidProfile->dFilter[ROLL].dLpf2;
cmsx_dterm_lowpass2_hz_pitch = pidProfile->dFilter[PITCH].dLpf2;
cmsx_dterm_lowpass2_hz_yaw = pidProfile->dFilter[YAW].dLpf2;
#ifdef USE_GYRO_DATA_ANALYSE
cmsx_dterm_dyn_notch_enable = pidProfile->dtermDynNotch;
cmsx_dterm_dyn_notch_q = pidProfile->dterm_dyn_notch_q;
#endif
cmsx_dterm_abg_alpha = pidProfile->dterm_ABG_alpha;
cmsx_dterm_abg_boost = pidProfile->dterm_ABG_boost;
cmsx_dterm_abg_half_life = pidProfile->dterm_ABG_half_life;
Expand All @@ -744,8 +775,10 @@ static long cmsx_FilterPerProfileWriteback(const OSD_Entry *self) {
pidProfile->dFilter[ROLL].dLpf2 = cmsx_dterm_lowpass2_hz_roll;
pidProfile->dFilter[PITCH].dLpf2 = cmsx_dterm_lowpass2_hz_pitch;
pidProfile->dFilter[YAW].dLpf2 = cmsx_dterm_lowpass2_hz_yaw;
#ifdef USE_GYRO_DATA_ANALYSE
pidProfile->dtermDynNotch = cmsx_dterm_dyn_notch_enable;
pidProfile->dterm_dyn_notch_q = cmsx_dterm_dyn_notch_q;
#endif
pidProfile->dterm_ABG_alpha = cmsx_dterm_abg_alpha;
pidProfile->dterm_ABG_boost = cmsx_dterm_abg_boost;
pidProfile->dterm_ABG_half_life = cmsx_dterm_abg_half_life;
Expand All @@ -763,8 +796,10 @@ static OSD_Entry cmsx_menuFilterPerProfileEntries[] = {
{ "DTERM LPF2 ROLL", OME_UINT16, NULL, &(OSD_UINT16_t){ &cmsx_dterm_lowpass2_hz_roll, 0, 500, 1 }, 0 },
{ "DTERM LPF2 PITCH", OME_UINT16, NULL, &(OSD_UINT16_t){ &cmsx_dterm_lowpass2_hz_pitch, 0, 500, 1 }, 0 },
{ "DTERM LPF2 YAW", OME_UINT16, NULL, &(OSD_UINT16_t){ &cmsx_dterm_lowpass2_hz_yaw, 0, 500, 1 }, 0 },
#ifdef USE_GYRO_DATA_ANALYSE
{ "DTERM DYN ENABLE", OME_TAB, NULL, &(OSD_TAB_t) { (uint8_t *) &cmsx_dterm_dyn_notch_enable, 1, cms_offOnLabels }, 0 },
{ "DTERM DYN NOT Q", OME_UINT16, NULL, &(OSD_UINT16_t){ &cmsx_dterm_dyn_notch_q, 0, 2000, 1 }, 0 },
#endif
{ "DTERM ABG ALPHA", OME_UINT16, NULL, &(OSD_UINT16_t){ &cmsx_dterm_abg_alpha, 0, 1000, 1 }, 0 },
{ "DTERM ABG BOOST", OME_UINT16, NULL, &(OSD_UINT16_t){ &cmsx_dterm_abg_boost, 0, 2000, 1 }, 0 },
{ "DTERM ABG HL", OME_UINT8, NULL, &(OSD_UINT8_t) { &cmsx_dterm_abg_half_life, 0, 250, 1 }, 0 },
Expand Down
6 changes: 5 additions & 1 deletion src/main/flight/pid.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,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 @@ -671,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 Expand Up @@ -811,7 +815,7 @@ void pidController(const pidProfile_t *pidProfile, const rollAndPitchTrims_t *an
float dDelta = ((feathered_pids * pureMeasurement) + ((1 - feathered_pids) * pureError)) * pidFrequency; //calculating the dterm determine how much is calculated using measurement vs error
//filter the dterm
#ifdef USE_GYRO_DATA_ANALYSE
if (isDynamicFilterActive() && pidProfile->dtermDynNotch) {
if (isDynamicFilterActive() && pidProfile->dtermDynNotch && axis <= gyroConfig()->dyn_notch_axis+1) {
for (int p = 0; p < gyroConfig()->dyn_notch_count; p++) {
if (getCenterFreq(axis, p) != previousNotchCenterFreq[axis][p]) {
previousNotchCenterFreq[axis][p] = getCenterFreq(axis, p);
Expand Down
22 changes: 22 additions & 0 deletions src/main/interface/msp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1194,20 +1194,37 @@ 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);
//MSP 1.51 removes SmartDTermSmoothing and WitchCraft
//MSP 1.51 adds and refactors dynamic_filter
#ifdef USE_GYRO_DATA_ANALYSE
sbufWriteU8(dst, gyroConfig()->dyn_notch_count); //dynamic_gyro_notch_count
sbufWriteU16(dst, gyroConfig()->dyn_notch_q);
sbufWriteU16(dst, gyroConfig()->dyn_notch_min_hz);
sbufWriteU16(dst, gyroConfig()->dyn_notch_max_hz); //dynamic_gyro_notch_max_hz
#else
sbufWriteU8(dst, 0);
sbufWriteU16(dst, 0);
sbufWriteU16(dst, 0);
sbufWriteU16(dst, 0);
#endif
//end MSP 1.51 add/refactor dynamic filter
//MSP 1.51
sbufWriteU16(dst, gyroConfig()->gyro_ABG_alpha);
Expand All @@ -1219,8 +1236,13 @@ bool mspProcessOutCommand(uint8_t cmdMSP, sbuf_t *dst) {
sbufWriteU8(dst, currentPidProfile->dterm_ABG_half_life);
//end MSP 1.51
//MSP 1.51 dynamic dTerm notch
#ifdef USE_GYRO_DATA_ANALYSE
sbufWriteU8(dst, currentPidProfile->dtermDynNotch); //dterm_dyn_notch_enable
sbufWriteU16(dst, currentPidProfile->dterm_dyn_notch_q); //dterm_dyn_notch_q
#else
sbufWriteU8(dst, 0);
sbufWriteU16(dst, 0);
#endif
//end MSP 1.51 dynamic dTerm notch
break;
/*#ifndef USE_GYRO_IMUF9001
Expand Down
12 changes: 11 additions & 1 deletion src/main/interface/settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ static const char * const lookupTableRcInterpolation[] = {
static const char * const lookupTableRcInterpolationChannels[] = {
"RP", "RPY", "RPYT", "T", "RPT",
};

static const char * const lookupTableFilterType[] = {
"PT1", "BIQUAD", "PT2", "PT3", "PT4",
};
Expand Down Expand Up @@ -393,6 +394,10 @@ static const char *const lookupTableMixerImplType[] = {
"LEGACY", "SMOOTH", "2PASS"
};

static const char *const lookupTableDynNotchAxisType[] = {
"RP", "RPY"
};

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

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

#undef LOOKUP_TABLE_ENTRY
Expand All @@ -503,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 Expand Up @@ -553,6 +561,7 @@ const clivalue_t valueTable[] = {
{ "gyro_to_use", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_GYRO }, PG_GYRO_CONFIG, offsetof(gyroConfig_t, gyro_to_use) },
#endif
#if defined(USE_GYRO_DATA_ANALYSE)
{ "dynamic_gyro_notch_axis", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_DYN_NOTCH_AXIS_TYPE }, PG_GYRO_CONFIG, offsetof(gyroConfig_t, dyn_notch_axis) },
{ "dynamic_gyro_notch_q", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 1, 1000 }, PG_GYRO_CONFIG, offsetof(gyroConfig_t, dyn_notch_q) },
{ "dynamic_gyro_notch_count", VAR_UINT8 | MASTER_VALUE, .config.minmax = { 1, 5 }, PG_GYRO_CONFIG, offsetof(gyroConfig_t, dyn_notch_count) },
{ "dynamic_gyro_notch_min_hz", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 30, 1000 }, PG_GYRO_CONFIG, offsetof(gyroConfig_t, dyn_notch_min_hz) },
Expand Down Expand Up @@ -863,9 +872,10 @@ const clivalue_t valueTable[] = {
{ "runaway_takeoff_deactivate_throttle_percent", VAR_UINT8 | MASTER_VALUE, .config.minmax = { 0, 100 }, PG_PID_CONFIG, offsetof(pidConfig_t, runaway_takeoff_deactivate_throttle) }, // minimum throttle percentage during deactivation phase
#endif
// PG_PID_PROFILE
#ifdef USE_GYRO_DATA_ANALYSE
{ "dterm_dyn_notch_enable", VAR_UINT8 | PROFILE_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_PID_PROFILE, offsetof(pidProfile_t, dtermDynNotch) },
{ "dterm_dyn_notch_q", VAR_UINT16 | PROFILE_VALUE, .config.minmax = { 1, 1000 }, PG_PID_PROFILE, offsetof(pidProfile_t, dterm_dyn_notch_q) },

#endif
{ "dterm_abg_alpha", VAR_UINT16 | PROFILE_VALUE, .config.minmax = { 0, 1000 }, PG_PID_PROFILE, offsetof(pidProfile_t, dterm_ABG_alpha) },
{ "dterm_abg_boost", VAR_UINT16 | PROFILE_VALUE, .config.minmax = { 0, 2000 }, PG_PID_PROFILE, offsetof(pidProfile_t, dterm_ABG_boost) },
{ "dterm_abg_half_life", VAR_UINT8 | PROFILE_VALUE, .config.minmax = { 0, 250 }, PG_PID_PROFILE, offsetof(pidProfile_t, dterm_ABG_half_life) },
Expand Down
Loading

0 comments on commit f870088

Please sign in to comment.