1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-15 04:15:44 +03:00

Revise pid_process_denom default logic - 2nd try

Now with the motor protocol defaulting to DISABLED we can reimplement this.

Remove dependence on gyro type and base on MCU type.

The previous logic was based on expecting an 8K sampling gyro and would set an inappropriate loop time for other gyro types.

Change the logic to be based on the capabilities of the MCU which is more appropriate. We set the pid_process_denom default to the maximum recommended value for a given MCU.

The `pid_process_denom` will be defaulted as follows (assuming a 8khz gyro) based on MCU type:

MCU	`pid_process_denom`
F1:	8 (1khz)
F3:	4 (2khz)
F411:	2 (4khz)
Others:	1 (8khz)

Of course the final PID loop rate will be based on the native sample rate of the gyro.
This commit is contained in:
Bruce Luckcuck 2020-04-11 20:23:43 -04:00
parent 2101326a1d
commit fb034c22e7

View file

@ -96,8 +96,12 @@ PG_REGISTER_WITH_RESET_TEMPLATE(pidConfig_t, pidConfig, PG_PID_CONFIG, 2);
#if defined(STM32F1) #if defined(STM32F1)
#define PID_PROCESS_DENOM_DEFAULT 8 #define PID_PROCESS_DENOM_DEFAULT 8
#else #elif defined(STM32F3)
#define PID_PROCESS_DENOM_DEFAULT 4 #define PID_PROCESS_DENOM_DEFAULT 4
#elif defined(STM32F411xE)
#define PID_PROCESS_DENOM_DEFAULT 2
#else
#define PID_PROCESS_DENOM_DEFAULT 1
#endif #endif
#if defined(USE_D_MIN) #if defined(USE_D_MIN)