1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-19 14:25:20 +03:00

motor output scale

First draft

Change method to percentage compensation

fast sag filter with fast battery updates

Renaming, moving factors to init where possible

Names changed, display update frequency reverted to 50hz as it was

50Hz ESC Voltage sampling, battery sag lowpass for PID compensation.

increment PG_PID_PROFILE, element added to end of batteryConfig_t

all HZ_TO_INTERVALs set back to 200 to match battery task frequency of 200hz.

Add a flag to control vbat comp

Flag vbat_sag_comp_enabled allows battery compensation to be enabled or
disabled from the CLI. When disabled the battery voltage task is run at
50Hz and the battery compensation code is not run. When enabled the
voltage task is run at 200Hz and the compensation code runs. Constants
for the fast and slow rates are added to tasks.h. The default value for
vbat_sag_compensation is changed to 100 as we no longer need to use it
to disable the feature.

Fixed variable task frequency setting.

Added config validation to disable sag compensation unless ADC is used as the voltage data source.

Added conditionals, fixed naming.

Fixed build.
This commit is contained in:
ctzsnooze 2020-03-08 00:16:02 +11:00 committed by mikeller
parent 9c3d4603b7
commit d63ba914c6
12 changed files with 158 additions and 50 deletions

View file

@ -135,7 +135,7 @@ static FAST_RAM_ZERO_INIT float airmodeThrottleOffsetLimit;
#define LAUNCH_CONTROL_YAW_ITERM_LIMIT 50 // yaw iterm windup limit when launch mode is "FULL" (all axes)
PG_REGISTER_ARRAY_WITH_RESET_FN(pidProfile_t, PID_PROFILE_COUNT, pidProfiles, PG_PID_PROFILE, 14);
PG_REGISTER_ARRAY_WITH_RESET_FN(pidProfile_t, PID_PROFILE_COUNT, pidProfiles, PG_PID_PROFILE, 15);
void resetPidProfile(pidProfile_t *pidProfile)
{
@ -224,6 +224,7 @@ void resetPidProfile(pidProfile_t *pidProfile)
.ff_boost = 15,
.dyn_lpf_curve_expo = 0,
.level_race_mode = false,
.vbat_sag_compensation = 0,
);
#ifndef USE_D_MIN
pidProfile->pid[PID_ROLL].D = 30;