mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-17 21:35:44 +03:00
Add OSD message to report motor/esc problem. (#5550)
Signed-off-by: Mark Hale <mark.hale@physics.org>
This commit is contained in:
parent
a7eccffa38
commit
cf6b3639e2
2 changed files with 26 additions and 1 deletions
|
@ -64,6 +64,9 @@
|
||||||
|
|
||||||
#include "flight/altitude.h"
|
#include "flight/altitude.h"
|
||||||
#include "flight/imu.h"
|
#include "flight/imu.h"
|
||||||
|
#ifdef USE_ESC_SENSOR
|
||||||
|
#include "flight/mixer.h"
|
||||||
|
#endif
|
||||||
#include "flight/pid.h"
|
#include "flight/pid.h"
|
||||||
|
|
||||||
#include "io/asyncfatfs/asyncfatfs.h"
|
#include "io/asyncfatfs/asyncfatfs.h"
|
||||||
|
@ -668,6 +671,27 @@ static bool osdDrawSingleElement(uint8_t item)
|
||||||
break;
|
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
|
// Visual beeper
|
||||||
if (enabledWarnings & OSD_WARNING_VISUAL_BEEPER && showVisualBeeper) {
|
if (enabledWarnings & OSD_WARNING_VISUAL_BEEPER && showVisualBeeper) {
|
||||||
osdFormatMessage(buff, OSD_FORMAT_MESSAGE_BUFFER_SIZE, " * * * *");
|
osdFormatMessage(buff, OSD_FORMAT_MESSAGE_BUFFER_SIZE, " * * * *");
|
||||||
|
|
|
@ -137,7 +137,8 @@ typedef enum {
|
||||||
OSD_WARNING_BATTERY_WARNING = (1 << 2),
|
OSD_WARNING_BATTERY_WARNING = (1 << 2),
|
||||||
OSD_WARNING_BATTERY_CRITICAL = (1 << 3),
|
OSD_WARNING_BATTERY_CRITICAL = (1 << 3),
|
||||||
OSD_WARNING_VISUAL_BEEPER = (1 << 4),
|
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;
|
} osdWarningsFlags_e;
|
||||||
|
|
||||||
typedef struct osdConfig_s {
|
typedef struct osdConfig_s {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue