Skip to content

Commit

Permalink
Reset d_min to 0 if >= D gain for a given axis
Browse files Browse the repository at this point in the history
Eliminates the dual-mode disabled logic for d_min for consistency. Previously d_min would logically be disabled if set to 0, or if >= the related D gain. This produces an inconsistent behavior with the Configurator in that it applies validation and will reset d_min to 0 in this case - causing an unexpected settings change just by saving on the PID Tuning tab.

This change aligns the validation in the firmware and Configurator.
  • Loading branch information
etracer65 committed May 4, 2019
1 parent de1c1d5 commit 6e72d5b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/main/fc/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,13 @@ static void validateAndFixConfig(void)
if (pidProfilesMutable(i)->auto_profile_cell_count > MAX_AUTO_DETECT_CELL_COUNT || pidProfilesMutable(i)->auto_profile_cell_count < AUTO_PROFILE_CELL_COUNT_CHANGE) {
pidProfilesMutable(i)->auto_profile_cell_count = AUTO_PROFILE_CELL_COUNT_STAY;
}

// If the d_min value for any axis is >= the D gain then reset d_min to 0 for consistent Configurator behavior
for (unsigned axis = 0; axis <= FD_YAW; axis++) {
if (pidProfilesMutable(i)->d_min[axis] >= pidProfilesMutable(i)->pid[axis].D) {
pidProfilesMutable(i)->d_min[axis] = 0;
}
}
}

if (motorConfig()->dev.motorPwmProtocol == PWM_TYPE_BRUSHED) {
Expand Down

0 comments on commit 6e72d5b

Please sign in to comment.