Skip to content

Commit

Permalink
Show stopped motors in Motor Diagnostic OSD element
Browse files Browse the repository at this point in the history
When motor is stopped and not spinning properly, show letter S instead
of expected esc output.

This is useful after crash recovery or during turtle mode.
  • Loading branch information
Igor Shpakov committed Sep 22, 2020
1 parent de35df8 commit 17706e3
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/main/osd/osd_elements.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@
#define FULL_CIRCLE 360
#define EFFICIENCY_MINIMUM_SPEED_CM_S 100

#define MOTOR_STOPPED_THRESHOLD_RPM 1000

#ifdef USE_OSD_STICK_OVERLAY
typedef struct radioControls_s {
uint8_t left_vertical;
Expand Down Expand Up @@ -1051,6 +1053,12 @@ static void osdElementMotorDiagnostics(osdElementParms_t *element)
for (; i < getMotorCount(); i++) {
if (motorsRunning) {
element->buff[i] = 0x88 - scaleRange(motor[i], getMotorOutputLow(), getMotorOutputHigh(), 0, 8);
#if defined(USE_ESC_SENSOR) || defined(USE_DSHOT_TELEMETRY)
if (getEscRpm(i) < MOTOR_STOPPED_THRESHOLD_RPM) {
// Motor is not spinning properly. Mark as Stopped
element->buff[i] = 'S';
}
#endif
} else {
element->buff[i] = 0x88;
}
Expand Down

0 comments on commit 17706e3

Please sign in to comment.