Skip to content

Commit

Permalink
Merge pull request #9730 from etracer65/fix_arming_disable_rpmfilter_…
Browse files Browse the repository at this point in the history
…bitbang
  • Loading branch information
mikeller committed Apr 25, 2020
1 parent 43b7fc6 commit 283bda8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/main/drivers/motor.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ void motorWriteAll(float *values)
#endif
}

int motorCount(void)
int motorDeviceCount(void)
{
return motorDevice->count;
}
Expand Down
2 changes: 2 additions & 0 deletions src/main/drivers/motor.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ uint16_t motorConvertToExternal(float motorValue);

struct motorDevConfig_s; // XXX Shouldn't be needed once pwm_output* is really cleaned up.
void motorDevInit(const struct motorDevConfig_s *motorConfig, uint16_t idlePulse, uint8_t motorCount);

int motorDeviceCount(void);
bool isMotorProtocolDshot(void);

void motorDisable(void);
Expand Down
13 changes: 9 additions & 4 deletions src/main/drivers/pwm_output_dshot_shared.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 283bda8

Please sign in to comment.