1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-23 16:25:31 +03:00

Fix ARMING_DISABLED_RPMFILTER when DSHOT bitbang is enabled

The function that checks for each motor having valid telemetry broke with the implementation of bitbang. Effectively the motor count was zero and this caused the logic to fall through with a false-positive. The check relied on a local motor count that was set when the PWM dshot was initialized. When bitbang is active this initialization no longer runs and the motor count was defaulting to zero. This was missed in the bitbang implementation.

Fixed to get the motor count from a common source initialized by both timer and bitbang dshot.

Also changed the logic to prevent a false-positive fallthrough if the motor count is zero (shouldn't happen).
This commit is contained in:
Bruce Luckcuck 2020-04-23 19:50:35 -04:00
parent bf9cc615c5
commit 62adae7374
3 changed files with 11 additions and 5 deletions

View file

@ -46,6 +46,7 @@
#include "drivers/dshot.h"
#include "drivers/dshot_dpwm.h"
#include "drivers/dshot_command.h"
#include "drivers/motor.h"
#include "pwm_output_dshot_shared.h"
@ -264,12 +265,16 @@ bool isDshotMotorTelemetryActive(uint8_t motorIndex)
bool isDshotTelemetryActive(void)
{
for (unsigned i = 0; i < dshotPwmDevice.count; i++) {
if (!isDshotMotorTelemetryActive(i)) {
return false;
const unsigned motorCount = motorDeviceCount();
if (motorCount) {
for (unsigned i = 0; i < motorCount; i++) {
if (!isDshotMotorTelemetryActive(i)) {
return false;
}
}
return true;
}
return true;
return false;
}
#ifdef USE_DSHOT_TELEMETRY_STATS