Skip to content

Commit

Permalink
bugfix gating USE_GYRO_DATA_ANALYSE (#917)
Browse files Browse the repository at this point in the history
bugfix gating USE_GYRO_DATA_ANALYSE when  is used
  • Loading branch information
nerdCopter authored Jun 14, 2023
1 parent c9cb676 commit 9c0d704
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main/flight/pid.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,12 +315,14 @@ void pidInitFilters(const pidProfile_t *pidProfile) {
dtermABGapplyFn = (filterApplyFnPtr)alphaBetaGammaApply;
ABGInit(&dtermABG[axis], pidProfile->dterm_ABG_alpha, pidProfile->dterm_ABG_boost, pidProfile->dterm_ABG_half_life, dT);
}

#ifdef USE_GYRO_DATA_ANALYSE
if (isDynamicFilterActive()) {
for (int axis2 = 0; axis2 < gyroConfig()->dyn_notch_count; axis2++) {
biquadFilterInit(&dtermNotch[axis][axis2], 400, targetPidLooptime, gyroConfig()->dyn_notch_q / 100.0f, FILTER_NOTCH);
}
}
#endif

}

#if defined(USE_THROTTLE_BOOST)
Expand Down
2 changes: 2 additions & 0 deletions src/main/sensors/gyro.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,9 @@ bool gyroYawSpinDetected(void);
uint16_t gyroAbsRateDps(int axis);
uint8_t gyroReadRegister(uint8_t whichSensor, uint8_t reg);
float applySmithPredictor(smithPredictor_t *smithPredictor, float gyroFiltered);
#ifdef USE_GYRO_DATA_ANALYSE
bool isDynamicFilterActive(void);
#endif
#ifdef USE_YAW_SPIN_RECOVERY
void initYawSpinRecovery(int maxYawRate);
#endif

0 comments on commit 9c0d704

Please sign in to comment.