mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-24 16:55:36 +03:00
Filter Cleanup CF coding style// Remove Old pt1 for acc etc // F1 slower acc update
This commit is contained in:
parent
e15ee54513
commit
a105af1225
11 changed files with 52 additions and 64 deletions
|
@ -121,8 +121,6 @@ extern uint32_t currentTime;
|
|||
extern uint8_t PIDweight[3];
|
||||
|
||||
static bool isRXDataNew;
|
||||
static filterStatePt1_t filteredCycleTimeState;
|
||||
uint16_t filteredCycleTime;
|
||||
|
||||
typedef void (*pidControllerFuncPtr)(pidProfile_t *pidProfile, controlRateConfig_t *controlRateConfig,
|
||||
uint16_t max_angle_inclination, rollAndPitchTrims_t *angleTrim, rxConfig_t *rxConfig); // pid controller function prototype
|
||||
|
@ -179,10 +177,21 @@ void filterRc(void){
|
|||
static int16_t deltaRC[4] = { 0, 0, 0, 0 };
|
||||
static int16_t factor, rcInterpolationFactor;
|
||||
uint16_t rxRefreshRate;
|
||||
static biquad_t filteredCycleTimeState;
|
||||
static bool filterIsSet;
|
||||
uint16_t filteredCycleTime;
|
||||
|
||||
// Set RC refresh rate for sampling and channels to filter
|
||||
initRxRefreshRate(&rxRefreshRate);
|
||||
|
||||
/* Initialize cycletime filter */
|
||||
if (!filterIsSet) {
|
||||
BiQuadNewLpf(1, &filteredCycleTimeState, 0);
|
||||
filterIsSet = true;
|
||||
}
|
||||
|
||||
filteredCycleTime = applyBiQuadFilter((float) cycleTime, &filteredCycleTimeState);
|
||||
|
||||
rcInterpolationFactor = rxRefreshRate / filteredCycleTime + 1;
|
||||
|
||||
if (isRXDataNew) {
|
||||
|
@ -657,13 +666,6 @@ void taskMainPidLoop(void)
|
|||
cycleTime = getTaskDeltaTime(TASK_SELF);
|
||||
dT = (float)targetLooptime * 0.000001f;
|
||||
|
||||
// Calculate average cycle time and average jitter
|
||||
filteredCycleTime = filterApplyPt1(cycleTime, &filteredCycleTimeState, 1, dT);
|
||||
|
||||
#if defined JITTER_DEBUG
|
||||
debug[JITTER_DEBUG] = cycleTime - filteredCycleTime;
|
||||
#endif
|
||||
|
||||
imuUpdateGyroAndAttitude();
|
||||
|
||||
annexCode();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue