1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-19 06:15:16 +03:00

Periodically try to activate DSHOT telemetry if enabled but not working

If DSHOT telemetry is enabled but one or more ESC's are not supplying valid telemetry packets, then send the DSHOT command to enable telemetry once a second while disarmed until all ESC's are supplying telemetry.

Addresses the issue of the flight controller booting without the ESC's powered. In this case the initial command at boot to enable bidirectional telemetry will be missed by the ESC since they're not powered. If the battery is subsequently plugged in the ESC's will default to bidirectional telemetry disabled.

This change will detect that ESC's are not supplying telemetry and attempt to preiodically enable them.
This commit is contained in:
Bruce Luckcuck 2019-03-16 14:05:30 -04:00
parent 7c6d36167c
commit 81c226e769
6 changed files with 24 additions and 23 deletions

View file

@ -209,15 +209,12 @@ static IO_t busSwitchResetPin = IO_NONE;
}
#endif
#if defined(USE_DSHOT) && defined(USE_DSHOT_TELEMETRY)
#ifdef USE_DSHOT_TELEMETRY
void activateDshotTelemetry(struct dispatchEntry_s* self)
{
UNUSED(self);
if (!ARMING_FLAG(ARMED))
{
pwmWriteDshotCommand(
255, getMotorCount(), motorConfig()->dev.useDshotTelemetry ?
DSHOT_CMD_SIGNAL_LINE_CONTINUOUS_ERPM_TELEMETRY : DSHOT_CMD_SIGNAL_LINE_TELEMETRY_DISABLE, false);
if (!ARMING_FLAG(ARMED) && !isDshotTelemetryActive()) {
pwmWriteDshotCommand(ALL_MOTORS, getMotorCount(), DSHOT_CMD_SIGNAL_LINE_CONTINUOUS_ERPM_TELEMETRY, false);
dispatchAdd(self, 1e6); // check again in 1 second
}
}
@ -811,8 +808,7 @@ void init(void)
setArmingDisabled(ARMING_DISABLED_BOOT_GRACE_TIME);
// TODO: potentially delete when feature is stable. Activation when arming is enough for flight.
#if defined(USE_DSHOT) && defined(USE_DSHOT_TELEMETRY)
#ifdef USE_DSHOT_TELEMETRY
if (motorConfig()->dev.useDshotTelemetry) {
dispatchEnable();
dispatchAdd(&activateDshotTelemetryEntry, 5000000);