More changes from review & rebase
Simplified disable logic to only use the feature() check in the gyro loop. Changed 2000hz loop time constant to a define.
This commit is contained in:
parent
25c6b038d9
commit
382ad2ad8f
|
@ -60,7 +60,6 @@
|
|||
#include "sensors/acceleration.h"
|
||||
#include "sensors/battery.h"
|
||||
#include "sensors/gyro.h"
|
||||
#include "sensors/gyroanalyse.h"
|
||||
|
||||
#ifndef USE_OSD_SLAVE
|
||||
pidProfile_t *currentPidProfile;
|
||||
|
@ -70,6 +69,8 @@ pidProfile_t *currentPidProfile;
|
|||
#define RX_SPI_DEFAULT_PROTOCOL 0
|
||||
#endif
|
||||
|
||||
#define DYNAMIC_FILTER_MAX_SUPPORTED_LOOP_TIME HZ_TO_INTERVAL_US(2000)
|
||||
|
||||
PG_REGISTER_WITH_RESET_TEMPLATE(pilotConfig_t, pilotConfig, PG_PILOT_CONFIG, 0);
|
||||
|
||||
PG_RESET_TEMPLATE(pilotConfig_t, pilotConfig,
|
||||
|
@ -413,7 +414,7 @@ void validateAndFixGyroConfig(void)
|
|||
{
|
||||
#ifdef USE_GYRO_DATA_ANALYSE
|
||||
// Disable dynamic filter if gyro loop is less than 2KHz
|
||||
if (!dynamicFilterAllowed()) {
|
||||
if (gyro.targetLooptime > DYNAMIC_FILTER_MAX_SUPPORTED_LOOP_TIME) {
|
||||
featureClear(FEATURE_DYNAMIC_FILTER);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -743,7 +743,7 @@ static void gyroInitFilterNotch2(gyroSensor_t *gyroSensor, uint16_t notchHz, uin
|
|||
#ifdef USE_GYRO_DATA_ANALYSE
|
||||
static bool isDynamicFilterActive(void)
|
||||
{
|
||||
return feature(FEATURE_DYNAMIC_FILTER) && dynamicFilterAllowed();
|
||||
return feature(FEATURE_DYNAMIC_FILTER);
|
||||
}
|
||||
|
||||
static void gyroInitFilterDynamicNotch(gyroSensor_t *gyroSensor)
|
||||
|
|
|
@ -303,8 +303,4 @@ static FAST_CODE_NOINLINE void gyroDataAnalyseUpdate(gyroAnalyseState_t *state,
|
|||
|
||||
state->updateStep = (state->updateStep + 1) % STEP_COUNT;
|
||||
}
|
||||
|
||||
bool dynamicFilterAllowed(void) {
|
||||
return (gyro.targetLooptime <= HZ_TO_INTERVAL_US(2000));
|
||||
}
|
||||
#endif // USE_GYRO_DATA_ANALYSE
|
||||
|
|
|
@ -61,4 +61,3 @@ void gyroDataAnalyseInit(void);
|
|||
void gyroDataAnalyseStateInit(gyroAnalyseState_t *gyroAnalyse, uint32_t targetLooptime);
|
||||
void gyroDataAnalysePush(gyroAnalyseState_t *gyroAnalyse, int axis, float sample);
|
||||
void gyroDataAnalyse(gyroAnalyseState_t *gyroAnalyse, biquadFilter_t *notchFilterDyn);
|
||||
bool dynamicFilterAllowed(void);
|
||||
|
|
Loading…
Reference in New Issue