Add OSD message to report motor/esc problem. (#5550)

Signed-off-by: Mark Hale <mark.hale@physics.org>
This commit is contained in:
pulquero 2018-03-30 14:09:33 +01:00 committed by Michael Keller
parent a7eccffa38
commit cf6b3639e2
2 changed files with 26 additions and 1 deletions

View File

@ -64,6 +64,9 @@
#include "flight/altitude.h"
#include "flight/imu.h"
#ifdef USE_ESC_SENSOR
#include "flight/mixer.h"
#endif
#include "flight/pid.h"
#include "io/asyncfatfs/asyncfatfs.h"
@ -668,6 +671,27 @@ static bool osdDrawSingleElement(uint8_t item)
break;
}
#ifdef USE_ESC_SENSOR
// Show warning if we lose motor output
if (enabledWarnings & OSD_WARNING_ESC_FAIL && ARMING_FLAG(ARMED)) {
char escErrMsg[OSD_FORMAT_MESSAGE_BUFFER_SIZE];
// center justify message
int pos = 0;
while (pos < 4 - getMotorCount()/2) {
escErrMsg[pos++] = ' ';
}
strcpy(escErrMsg + pos, "ESC");
pos += strlen("ESC");
for (int i = 0; i < getMotorCount(); i++) {
escSensorData_t *escDatai = getEscSensorData(i);
escErrMsg[pos++] = escDatai->rpm == 0 ? '0' + i + 1 : ' ';
}
escErrMsg[pos] = '\0';
osdFormatMessage(buff, OSD_FORMAT_MESSAGE_BUFFER_SIZE, escErrMsg);
break;
}
#endif
// Visual beeper
if (enabledWarnings & OSD_WARNING_VISUAL_BEEPER && showVisualBeeper) {
osdFormatMessage(buff, OSD_FORMAT_MESSAGE_BUFFER_SIZE, " * * * *");

View File

@ -137,7 +137,8 @@ typedef enum {
OSD_WARNING_BATTERY_WARNING = (1 << 2),
OSD_WARNING_BATTERY_CRITICAL = (1 << 3),
OSD_WARNING_VISUAL_BEEPER = (1 << 4),
OSD_WARNING_CRASH_FLIP = (1 << 5)
OSD_WARNING_CRASH_FLIP = (1 << 5),
OSD_WARNING_ESC_FAIL = (1 << 6)
} osdWarningsFlags_e;
typedef struct osdConfig_s {