mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-12 19:10:32 +03:00
add FORCE option to dshot_edt, remove dshot_edt_always_decode
This commit is contained in:
parent
f9966d1eee
commit
3ce7f7a1e0
6 changed files with 23 additions and 8 deletions
|
@ -223,6 +223,12 @@ const char * const lookupTableOffOn[] = {
|
|||
"OFF", "ON"
|
||||
};
|
||||
|
||||
#ifdef USE_DSHOT_TELEMETRY
|
||||
static const char * const lookupTableDshotEdt[] = {
|
||||
"OFF", "ON", "FORCE"
|
||||
};
|
||||
#endif
|
||||
|
||||
static const char * const lookupTableCrashRecovery[] = {
|
||||
"OFF", "ON" ,"BEEP", "DISARM"
|
||||
};
|
||||
|
@ -643,6 +649,9 @@ const lookupTableEntry_t lookupTables[] = {
|
|||
#endif
|
||||
LOOKUP_TABLE_ENTRY(debugModeNames),
|
||||
LOOKUP_TABLE_ENTRY(lookupTablePwmProtocol),
|
||||
#ifdef USE_DSHOT_TELEMETRY
|
||||
LOOKUP_TABLE_ENTRY(lookupTableDshotEdt),
|
||||
#endif
|
||||
LOOKUP_TABLE_ENTRY(lookupTableLowpassType),
|
||||
LOOKUP_TABLE_ENTRY(lookupTableDtermLowpassType),
|
||||
LOOKUP_TABLE_ENTRY(lookupTableFailsafe),
|
||||
|
@ -955,8 +964,7 @@ const clivalue_t valueTable[] = {
|
|||
#endif
|
||||
#ifdef USE_DSHOT_TELEMETRY
|
||||
{ PARAM_NAME_DSHOT_BIDIR, VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_MOTOR_CONFIG, offsetof(motorConfig_t, dev.useDshotTelemetry) },
|
||||
{ "dshot_edt", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_MOTOR_CONFIG, offsetof(motorConfig_t, dev.useDshotEdt) },
|
||||
{ "dshot_edt_always_decode", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_MOTOR_CONFIG, offsetof(motorConfig_t, dev.useDshotEdtAlwaysDecode) },
|
||||
{ "dshot_edt", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_DSHOT_EDT }, PG_MOTOR_CONFIG, offsetof(motorConfig_t, dev.useDshotEdt) },
|
||||
#endif
|
||||
#ifdef USE_DSHOT_BITBANG
|
||||
{ "dshot_bitbang", VAR_UINT8 | HARDWARE_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON_AUTO }, PG_MOTOR_CONFIG, offsetof(motorConfig_t, dev.useDshotBitbang) },
|
||||
|
|
|
@ -64,6 +64,9 @@ typedef enum {
|
|||
#endif
|
||||
TABLE_DEBUG,
|
||||
TABLE_MOTOR_PWM_PROTOCOL,
|
||||
#ifdef USE_DSHOT_TELEMETRY
|
||||
TABLE_DSHOT_EDT,
|
||||
#endif
|
||||
TABLE_GYRO_LPF_TYPE,
|
||||
TABLE_DTERM_LPF_TYPE,
|
||||
TABLE_FAILSAFE,
|
||||
|
|
|
@ -181,7 +181,7 @@ void initDshotTelemetry(const timeUs_t looptimeUs)
|
|||
|
||||
// erpmToHz is used by bidir dshot and ESC telemetry
|
||||
erpmToHz = ERPM_PER_LSB / SECONDS_PER_MINUTE / (motorConfig()->motorPoleCount / 2.0f);
|
||||
edtAlwaysDecode = motorConfig()->dev.useDshotEdtAlwaysDecode;
|
||||
edtAlwaysDecode = (motorConfig()->dev.useDshotEdt == DSHOT_EDT_FORCE);
|
||||
|
||||
#ifdef USE_RPM_FILTER
|
||||
if (motorConfig()->dev.useDshotTelemetry) {
|
||||
|
|
|
@ -47,8 +47,8 @@
|
|||
#define DEFAULT_DSHOT_TELEMETRY DSHOT_TELEMETRY_OFF
|
||||
#endif
|
||||
|
||||
#if !defined(DEFAULT_DSHOT_EDT_ALWAYS_DECODE)
|
||||
#define DEFAULT_DSHOT_EDT_ALWAYS_DECODE false
|
||||
#if !defined(DEFAULT_DSHOT_EDT)
|
||||
#define DEFAULT_DSHOT_EDT DSHOT_EDT_OFF
|
||||
#endif
|
||||
|
||||
PG_REGISTER_WITH_RESET_FN(motorConfig_t, motorConfig, PG_MOTOR_CONFIG, 4);
|
||||
|
@ -116,7 +116,7 @@ void pgResetFn_motorConfig(motorConfig_t *motorConfig)
|
|||
|
||||
#ifdef USE_DSHOT_TELEMETRY
|
||||
motorConfig->dev.useDshotTelemetry = DEFAULT_DSHOT_TELEMETRY;
|
||||
motorConfig->dev.useDshotEdtAlwaysDecode = DEFAULT_DSHOT_EDT_ALWAYS_DECODE;
|
||||
motorConfig->dev.useDshotEdt = DEFAULT_DSHOT_EDT;
|
||||
#endif
|
||||
|
||||
#ifdef USE_DSHOT_BITBANG
|
||||
|
|
|
@ -57,6 +57,12 @@ typedef enum {
|
|||
DSHOT_TELEMETRY_ON,
|
||||
} dshotTelemetry_e;
|
||||
|
||||
typedef enum {
|
||||
DSHOT_EDT_OFF = 0,
|
||||
DSHOT_EDT_ON = 1,
|
||||
DSHOT_EDT_FORCE = 2,
|
||||
} dshotEdt_e;
|
||||
|
||||
typedef struct motorDevConfig_s {
|
||||
uint16_t motorPwmRate; // The update rate of motor outputs (50-498Hz)
|
||||
uint8_t motorProtocol; // Pwm Protocol
|
||||
|
@ -65,7 +71,6 @@ typedef struct motorDevConfig_s {
|
|||
uint8_t useBurstDshot;
|
||||
uint8_t useDshotTelemetry;
|
||||
uint8_t useDshotEdt;
|
||||
uint8_t useDshotEdtAlwaysDecode;
|
||||
ioTag_t ioTags[MAX_SUPPORTED_MOTORS];
|
||||
uint8_t motorTransportProtocol;
|
||||
uint8_t useDshotBitbang;
|
||||
|
|
|
@ -43,7 +43,6 @@ PG_RESET_TEMPLATE(motorConfig_t, motorConfig,
|
|||
.useBurstDshot = 0,
|
||||
.useDshotTelemetry = 0,
|
||||
.useDshotEdt = 0,
|
||||
.useDshotEdtAlwaysDecode = 0,
|
||||
.ioTags = {IO_TAG_NONE, IO_TAG_NONE, IO_TAG_NONE, IO_TAG_NONE},
|
||||
.motorTransportProtocol = 0,
|
||||
.useDshotBitbang = 0,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue