Skip to content

Commit

Permalink
Set default PID DENOM
Browse files Browse the repository at this point in the history
  • Loading branch information
haslinghuis committed Jun 13, 2023
1 parent 7d1007e commit c3f9174
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
6 changes: 6 additions & 0 deletions src/main/config/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,12 @@ void validateAndFixGyroConfig(void)
}
#endif

#if defined(USE_GYRO_DENOM_CHECK) && (defined(USE_ACCGYRO_BMI160) || defined(USE_ACCGYRO_BMI270))
if (gyro.gyroSensor1.gyroDev.gyroHardware == GYRO_BMI160 || gyro.gyroSensor1.gyroDev.gyroHardware == GYRO_BMI270) {
pidConfigMutable()->pid_process_denom = 1;
}
#endif

switch (motorConfig()->dev.motorPwmProtocol) {
case PWM_TYPE_STANDARD:
motorUpdateRestriction = 1.0f / BRUSHLESS_MOTORS_PWM_RATE;
Expand Down
4 changes: 1 addition & 3 deletions src/main/flight/pid.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,11 @@ pt1Filter_t throttleLpf;

PG_REGISTER_WITH_RESET_TEMPLATE(pidConfig_t, pidConfig, PG_PID_CONFIG, 3);

#if !defined(DEFAULT_PID_PROCESS_DENOM)
#if defined(STM32F411xE)
#if !defined(DEFAULT_PID_PROCESS_DENOM) && defined(USE_GYRO_DENOM_CHECK)
#define DEFAULT_PID_PROCESS_DENOM 2
#else
#define DEFAULT_PID_PROCESS_DENOM 1
#endif
#endif

#ifdef USE_RUNAWAY_TAKEOFF
PG_RESET_TEMPLATE(pidConfig_t, pidConfig,
Expand Down
2 changes: 2 additions & 0 deletions src/main/target/STM32F405/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,6 @@

#define USE_EXTI

#define USE_GYRO_DENOM_CHECK

#define FLASH_PAGE_SIZE ((uint32_t)0x4000) // 16K sectors
2 changes: 2 additions & 0 deletions src/main/target/STM32F411/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,6 @@

#define USE_EXTI

#define USE_GYRO_DENOM_CHECK

#define FLASH_PAGE_SIZE ((uint32_t)0x4000) // 16K sectors

0 comments on commit c3f9174

Please sign in to comment.