1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-12 19:10:32 +03:00

Remove unnecessary enum for dshot_edt_always_decode option

This commit is contained in:
kedeng 2025-07-11 19:12:14 +08:00
parent b5b3de1cb1
commit f9966d1eee
3 changed files with 3 additions and 9 deletions

View file

@ -150,7 +150,7 @@ FAST_DATA_ZERO_INIT static float minMotorFrequencyHz;
FAST_DATA_ZERO_INIT static float erpmToHz;
FAST_DATA_ZERO_INIT static float dshotRpmAverage;
FAST_DATA_ZERO_INIT static float dshotRpm[MAX_SUPPORTED_MOTORS];
FAST_DATA_ZERO_INIT static dshotEdtAlwaysDecode_e edtAlwaysDecode;
FAST_DATA_ZERO_INIT static bool edtAlwaysDecode;
// Lookup table for extended telemetry type decoding
// Only contains extended telemetry types, eRPM is handled by conditional logic
@ -215,8 +215,7 @@ static uint32_t dshot_decode_eRPM_telemetry_value(uint16_t value)
static void dshot_decode_telemetry_value(uint8_t motorIndex, uint32_t *pDecoded, dshotTelemetryType_t *pType)
{
uint16_t value = dshotTelemetryState.motorState[motorIndex].rawValue;
bool isEdtEnabled = (dshotTelemetryState.motorState[motorIndex].telemetryTypes & DSHOT_EXTENDED_TELEMETRY_MASK) != 0;
isEdtEnabled = isEdtEnabled || (edtAlwaysDecode == DSHOT_EDT_ALWAYS_DECODE_ON);
bool isEdtEnabled = edtAlwaysDecode || (dshotTelemetryState.motorState[motorIndex].telemetryTypes & DSHOT_EXTENDED_TELEMETRY_MASK) != 0;
// https://github.com/bird-sanctuary/extended-dshot-telemetry
// Extract telemetry type field and check for eRPM conditions in one operation

View file

@ -48,7 +48,7 @@
#endif
#if !defined(DEFAULT_DSHOT_EDT_ALWAYS_DECODE)
#define DEFAULT_DSHOT_EDT_ALWAYS_DECODE DSHOT_EDT_ALWAYS_DECODE_OFF
#define DEFAULT_DSHOT_EDT_ALWAYS_DECODE false
#endif
PG_REGISTER_WITH_RESET_FN(motorConfig_t, motorConfig, PG_MOTOR_CONFIG, 4);

View file

@ -57,11 +57,6 @@ typedef enum {
DSHOT_TELEMETRY_ON,
} dshotTelemetry_e;
typedef enum {
DSHOT_EDT_ALWAYS_DECODE_OFF,
DSHOT_EDT_ALWAYS_DECODE_ON,
} dshotEdtAlwaysDecode_e;
typedef struct motorDevConfig_s {
uint16_t motorPwmRate; // The update rate of motor outputs (50-498Hz)
uint8_t motorProtocol; // Pwm Protocol