Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix dynamic idle safety issues #9719

Merged
merged 1 commit into from Apr 20, 2020

Conversation

etracer65
Copy link
Member

@etracer65 etracer65 commented Apr 18, 2020

Fixes #9713

Fixes a problem with dynamic idle not checking for bidirectional DSHOT being enabled. So the code would run but have no RPM data available leading to elevated motor idle.

Fixes a problem with dynamic idle not resetting accumulated static variables that continue to be used when dynamic idle is switched off via a PID profile change. Depending on the state of the variables this could cause excessive motor idle speed. In some cases enough to cause the quad to spontaneously take off on arming or be unable to descend in flight.

Fixes a problem with dynamic idle inappropriately modifying the static motorOutputLow that is set based on the chosen motor protocol. Downstream code that relies on this value to determine the actual motor output range was adversely affected.

@@ -657,7 +664,7 @@ static void calculateThrottleAndCurrentMotorEndpoints(timeUs_t currentTimeUs)
#endif

currentThrottleInputRange = rcCommandThrottleRange;
motorRangeMin = motorOutputLow + motorRangeMinIncrease * (motorOutputHigh - motorOutputLow);
motorRangeMin = dynIdleMotorOutputLow + motorRangeMinIncrease * (motorOutputHigh - dynIdleMotorOutputLow);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naming of this seems to be a bit confusing - this is applied even when dynamic idle is not enabled - maybe rather appliedMotorOutputLow?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, updated.

Fixes a problem with dynamic idle not checking for bidirectional DSHOT being enabled. So the code would run but have no RPM data available leading to elevated motor idle.

Fixes a problem with dynamic idle not resetting accumulated static variables that continue to be used when dynamic idle is switched off via a PID profile change. Depending on the state of the variables this could cause excessive motor idle speed. In some cases enough to cause the quad to spontaneously take off on arming or be unable to descend in flight.

Fixes a problem with dynamic idle inappropriately modifying the static `motorOutputLow` that is set based on the chosen motor protocol. Downstream code that relies on this value to determine the acutal motor output range was adversely affected.
@mikeller mikeller merged commit 10bac1f into betaflight:master Apr 20, 2020
mikeller added a commit that referenced this pull request Apr 20, 2020
@etracer65 etracer65 deleted the dyn_idle_change_profile_fix branch June 2, 2020 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Switching pid profiles with/without dynamic idle and/or ff_interpolate_sp changes the idle throttle
2 participants