mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-21 07:15:18 +03:00
Improve dterm filter accuracy // magic number
This commit is contained in:
parent
4543778ad1
commit
138ade7939
3 changed files with 7 additions and 5 deletions
|
@ -72,9 +72,9 @@ pidControllerFuncPtr pid_controller = pidLegacy; // which pid controller are we
|
|||
pidControllerFuncPtr pid_controller = pidBetaflight; // which pid controller are we using
|
||||
#endif
|
||||
|
||||
void setTargetPidLooptime(uint8_t pidProcessDenom)
|
||||
void setTargetPidLooptime(uint32_t pidLooptime)
|
||||
{
|
||||
targetPidLooptime = gyro.targetLooptime * pidProcessDenom;
|
||||
targetPidLooptime = pidLooptime;
|
||||
}
|
||||
|
||||
void pidResetErrorGyroState(void)
|
||||
|
|
|
@ -133,5 +133,5 @@ extern uint8_t PIDweight[3];
|
|||
void pidSetController(pidControllerType_e type);
|
||||
void pidResetErrorGyroState(void);
|
||||
void pidStabilisationState(pidStabilisationState_e pidControllerState);
|
||||
void setTargetPidLooptime(uint8_t pidProcessDenom);
|
||||
void setTargetPidLooptime(uint32_t pidLooptime);
|
||||
|
||||
|
|
|
@ -109,6 +109,8 @@
|
|||
#include "config/config_profile.h"
|
||||
#include "config/config_master.h"
|
||||
|
||||
#define LOOPTIME_SUSPEND_TIME 5 // Prevent too long busy wait times
|
||||
|
||||
#ifdef USE_HARDWARE_REVISION_DETECTION
|
||||
#include "hardware_revision.h"
|
||||
#endif
|
||||
|
@ -600,7 +602,7 @@ void init(void)
|
|||
masterConfig.gyro_sync_denom = 1;
|
||||
}
|
||||
|
||||
setTargetPidLooptime(masterConfig.pid_process_denom); // Initialize pid looptime
|
||||
setTargetPidLooptime((gyro.targetLooptime + LOOPTIME_SUSPEND_TIME) * masterConfig.pid_process_denom); // Initialize pid looptime
|
||||
|
||||
|
||||
#ifdef BLACKBOX
|
||||
|
@ -678,7 +680,7 @@ void main_init(void)
|
|||
|
||||
/* Setup scheduler */
|
||||
schedulerInit();
|
||||
rescheduleTask(TASK_GYROPID, gyro.targetLooptime + 5); // Add a littlebit of extra time to reduce busy wait
|
||||
rescheduleTask(TASK_GYROPID, gyro.targetLooptime + LOOPTIME_SUSPEND_TIME); // Add a littlebit of extra time to reduce busy wait
|
||||
setTaskEnabled(TASK_GYROPID, true);
|
||||
|
||||
if (sensors(SENSOR_ACC)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue