From 5b3fd2d08f76c4ab6bba75766c5d3d6a9c436232 Mon Sep 17 00:00:00 2001 From: Bruce Luckcuck Date: Wed, 22 Apr 2020 18:18:10 -0400 Subject: [PATCH] Disable dynmaic idle if RPM filter is not enabled The addition of previous checks of bidirectional DSHOT being enabled were not sufficient. Additionally RPM filter must also be active (harmonics > 0) for dynamic idle to determine the minimum motor RPM and function correctly. --- src/main/config/config.c | 8 ++++++++ src/main/flight/mixer.c | 6 +----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/main/config/config.c b/src/main/config/config.c index ac17fab056..6d8e5563d5 100644 --- a/src/main/config/config.c +++ b/src/main/config/config.c @@ -522,6 +522,14 @@ static void validateAndFixConfig(void) && motorConfig()->dev.useDshotTelemetry) { motorConfigMutable()->dev.useDshotTelemetry = false; } + +#if defined(USE_DYN_IDLE) + if (!isRpmFilterEnabled()) { + for (unsigned i = 0; i < PID_PROFILE_COUNT; i++) { + pidProfilesMutable(i)->idle_min_rpm = 0; + } + } +#endif // USE_DYN_IDLE #endif // USE_DSHOT_TELEMETRY #endif // USE_DSHOT diff --git a/src/main/flight/mixer.c b/src/main/flight/mixer.c index b8c9ad78bf..77d467afde 100644 --- a/src/main/flight/mixer.c +++ b/src/main/flight/mixer.c @@ -355,11 +355,7 @@ void initEscEndpoints(void) void mixerInitProfile(void) { #ifdef USE_DYN_IDLE - if (motorConfig()->dev.useDshotTelemetry) { - idleMinMotorRps = currentPidProfile->idle_min_rpm * 100.0f / 60.0f; - } else { - idleMinMotorRps = 0; - } + idleMinMotorRps = currentPidProfile->idle_min_rpm * 100.0f / 60.0f; idleMaxIncrease = currentPidProfile->idle_max_increase * 0.001f; idleP = currentPidProfile->idle_p * 0.0001f; #endif