1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-24 00:35:39 +03:00

Increase Number of Available Dynamic Notches to 7 (#13750)

This commit is contained in:
Brian White 2024-07-28 16:10:36 -04:00 committed by GitHub
parent 5e40ec857d
commit 1fb73b36f4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 7 additions and 6 deletions

View file

@ -19,11 +19,11 @@
*/ */
/* original work by Rav /* original work by Rav
* *
* 2018_07 updated by ctzsnooze to post filter, wider Q, different peak detection * 2018_07 updated by ctzsnooze to post filter, wider Q, different peak detection
* coding assistance and advice from DieHertz, Rav, eTracer * coding assistance and advice from DieHertz, Rav, eTracer
* test pilots icr4sh, UAV Tech, Flint723 * test pilots icr4sh, UAV Tech, Flint723
* *
* 2021_02 updated by KarateBrot: switched FFT with SDFT, multiple notches per axis * 2021_02 updated by KarateBrot: switched FFT with SDFT, multiple notches per axis
* test pilots: Sugar K, bizmar * test pilots: Sugar K, bizmar
*/ */
@ -375,8 +375,9 @@ static FAST_CODE_NOINLINE void dynNotchProcess(void)
} }
if (state.axis == gyro.gyroDebugAxis) { if (state.axis == gyro.gyroDebugAxis) {
for (int p = 0; p < dynNotch.count && p < 3; p++) { for (int p = 0; p < dynNotch.count && p < DYN_NOTCH_COUNT_MAX; p++) {
DEBUG_SET(DEBUG_FFT_FREQ, p, lrintf(dynNotch.centerFreq[state.axis][p])); // debug channel 0 is reserved for pre DN gyro
DEBUG_SET(DEBUG_FFT_FREQ, p + 1, lrintf(dynNotch.centerFreq[state.axis][p]));
} }
DEBUG_SET(DEBUG_DYN_LPF, 1, lrintf(dynNotch.centerFreq[state.axis][0])); DEBUG_SET(DEBUG_DYN_LPF, 1, lrintf(dynNotch.centerFreq[state.axis][0]));
} }

View file

@ -26,7 +26,7 @@
#include "pg/dyn_notch.h" #include "pg/dyn_notch.h"
#define DYN_NOTCH_COUNT_MAX 5 #define DYN_NOTCH_COUNT_MAX 7
void dynNotchInit(const dynNotchConfig_t *config, const timeUs_t targetLooptimeUs); void dynNotchInit(const dynNotchConfig_t *config, const timeUs_t targetLooptimeUs);
void dynNotchPush(const int axis, const float sample); void dynNotchPush(const int axis, const float sample);

View file

@ -68,7 +68,7 @@ static FAST_CODE void GYRO_FILTER_FUNCTION_NAME(void)
if (isDynNotchActive()) { if (isDynNotchActive()) {
if (axis == gyro.gyroDebugAxis) { if (axis == gyro.gyroDebugAxis) {
GYRO_FILTER_DEBUG_SET(DEBUG_FFT, 0, lrintf(gyroADCf)); GYRO_FILTER_DEBUG_SET(DEBUG_FFT, 0, lrintf(gyroADCf));
GYRO_FILTER_DEBUG_SET(DEBUG_FFT_FREQ, 3, lrintf(gyroADCf)); GYRO_FILTER_DEBUG_SET(DEBUG_FFT_FREQ, 0, lrintf(gyroADCf));
GYRO_FILTER_DEBUG_SET(DEBUG_DYN_LPF, 0, lrintf(gyroADCf)); GYRO_FILTER_DEBUG_SET(DEBUG_DYN_LPF, 0, lrintf(gyroADCf));
} }