Skip to content

Commit

Permalink
Fix Dshot telemetry (betaflight#13140)
Browse files Browse the repository at this point in the history
* Fix Dshot telemetry

* Revert check per review
  • Loading branch information
haslinghuis authored Nov 23, 2023
1 parent 89607c6 commit cafe727
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 13 deletions.
11 changes: 5 additions & 6 deletions src/main/fc/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -360,13 +360,12 @@ void updateArmingStatus(void)
}
#endif

#ifdef USE_RPM_FILTER
// USE_RPM_FILTER will only be defined if USE_DSHOT and USE_DSHOT_TELEMETRY are defined
// If the RPM filter is enabled and any motor isn't providing telemetry, then disable arming
if (isRpmFilterEnabled() && !isDshotTelemetryActive()) {
setArmingDisabled(ARMING_DISABLED_RPMFILTER);
#ifdef USE_DSHOT_TELEMETRY
// If Dshot Telemetry is enabled and any motor isn't providing telemetry, then disable arming
if (motorConfig()->dev.useDshotTelemetry && !isDshotTelemetryActive()) {
setArmingDisabled(ARMING_DISABLED_DSHOT_TELEM);
} else {
unsetArmingDisabled(ARMING_DISABLED_RPMFILTER);
unsetArmingDisabled(ARMING_DISABLED_DSHOT_TELEM);
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/main/fc/runtime_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const char *armingDisableFlagNames[]= {
"PARALYZE",
"GPS",
"RESCUE_SW",
"RPMFILTER",
"DSHOT_TELEM",
"REBOOT_REQD",
"DSHOT_BBANG",
"NO_ACC_CAL",
Expand Down
2 changes: 1 addition & 1 deletion src/main/fc/runtime_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ typedef enum {
ARMING_DISABLED_PARALYZE = (1 << 17),
ARMING_DISABLED_GPS = (1 << 18),
ARMING_DISABLED_RESC = (1 << 19),
ARMING_DISABLED_RPMFILTER = (1 << 20),
ARMING_DISABLED_DSHOT_TELEM = (1 << 20),
ARMING_DISABLED_REBOOT_REQUIRED = (1 << 21),
ARMING_DISABLED_DSHOT_BITBANG = (1 << 22),
ARMING_DISABLED_ACC_CALIBRATION = (1 << 23),
Expand Down
2 changes: 1 addition & 1 deletion src/main/osd/osd_warnings.c
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ void renderOsdWarning(char *warningText, bool *blinking, uint8_t *displayAttr)

// Add esc warnings
if (ARMING_FLAG(ARMED) && osdConfig()->esc_rpm_alarm != ESC_RPM_ALARM_OFF
&& (dshotTelemetryState.motorState[k].telemetryTypes & (1 << DSHOT_TELEMETRY_TYPE_eRPM)) != 0
&& isDshotMotorTelemetryActive(k)
&& (dshotTelemetryState.motorState[k].telemetryData[DSHOT_TELEMETRY_TYPE_eRPM] * 100 * 2 / motorConfig()->motorPoleCount) <= osdConfig()->esc_rpm_alarm) {
warningText[dshotEscErrorLength++] = 'R';
}
Expand Down
5 changes: 1 addition & 4 deletions src/main/target/common_post.h
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,7 @@
#ifndef USE_DSHOT_TELEMETRY
#undef USE_RPM_FILTER
#undef USE_DSHOT_TELEMETRY_STATS
#undef USE_DYN_IDLE
#endif

#if !defined(USE_BOARD_INFO)
Expand Down Expand Up @@ -568,10 +569,6 @@ extern uint8_t __config_end;
#define RAM_CODE __attribute__((section(".ram_code")))
#endif

#if !defined(USE_RPM_FILTER)
#undef USE_DYN_IDLE
#endif

#ifndef USE_ITERM_RELAX
#undef USE_ABSOLUTE_CONTROL
#endif
Expand Down

0 comments on commit cafe727

Please sign in to comment.