Show stopped motors in Motor Diagnostic OSD element

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.
This commit is contained in:
Igor Shpakov 2020-09-18 22:48:13 +01:00
parent de35df8e07
commit 17706e3b65
1 changed files with 8 additions and 0 deletions

View File

@ -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;
@ -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;
}