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

Dshot erpm telemetry on the signal line

This commit is contained in:
Thorsten Laux 2019-01-03 14:42:52 +01:00
parent 4778ad6c0f
commit 816da6cbf5
14 changed files with 500 additions and 79 deletions

View file

@ -86,6 +86,7 @@
#include "fc/tasks.h"
#include "fc/rc_controls.h"
#include "fc/runtime_config.h"
#include "fc/dispatch.h"
#include "interface/cli.h"
#include "interface/msp.h"
@ -205,6 +206,26 @@ static IO_t busSwitchResetPin = IO_NONE;
}
#endif
#if defined(USE_DSHOT) && defined(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, true);
}
}
dispatchEntry_t activateDshotTelemetryEntry =
{
activateDshotTelemetry, 0, NULL, false
};
#endif
void init(void)
{
#ifdef USE_ITCM_RAM
@ -748,7 +769,14 @@ 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)
dispatchEnable();
dispatchAdd(&activateDshotTelemetryEntry, 5000000);
#endif
fcTasksInit();
systemState |= SYSTEM_STATE_READY;
}