mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-17 21:35:44 +03:00
Merge pull request #3415 from DanNixon/osd_show_arming_disable_reason
Add most common reason for not arming to OSD
This commit is contained in:
commit
31c639b13f
6 changed files with 30 additions and 18 deletions
|
@ -190,13 +190,6 @@ static const char * const *sensorHardwareNames[] = {
|
||||||
};
|
};
|
||||||
#endif // USE_SENSOR_NAMES
|
#endif // USE_SENSOR_NAMES
|
||||||
|
|
||||||
#ifndef MINIMAL_CLI
|
|
||||||
static const char *armingDisableFlagNames[] = {
|
|
||||||
"NOGYRO", "FAILSAFE", "BOXFAILSAFE", "THROTTLE",
|
|
||||||
"ANGLE", "LOAD", "CALIB", "CLI", "CMS", "OSD", "BST"
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void cliPrint(const char *str)
|
static void cliPrint(const char *str)
|
||||||
{
|
{
|
||||||
while (*str) {
|
while (*str) {
|
||||||
|
|
|
@ -29,6 +29,13 @@ uint16_t flightModeFlags = 0;
|
||||||
|
|
||||||
static uint32_t enabledSensors = 0;
|
static uint32_t enabledSensors = 0;
|
||||||
|
|
||||||
|
#if defined(OSD) || !defined(MINIMAL_CLI)
|
||||||
|
const char *armingDisableFlagNames[]= {
|
||||||
|
"NOGYRO", "FAILSAFE", "BOXFAILSAFE", "THROTTLE",
|
||||||
|
"ANGLE", "LOAD", "CALIB", "CLI", "CMS", "OSD", "BST"
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
static armingDisableFlags_e armingDisableFlags = 0;
|
static armingDisableFlags_e armingDisableFlags = 0;
|
||||||
|
|
||||||
void setArmingDisabled(armingDisableFlags_e flag)
|
void setArmingDisabled(armingDisableFlags_e flag)
|
||||||
|
|
|
@ -47,6 +47,11 @@ typedef enum {
|
||||||
ARMING_DISABLED_BST = (1 << 10),
|
ARMING_DISABLED_BST = (1 << 10),
|
||||||
} armingDisableFlags_e;
|
} armingDisableFlags_e;
|
||||||
|
|
||||||
|
#define NUM_ARMING_DISABLE_FLAGS 11
|
||||||
|
#if defined(OSD) || !defined(MINIMAL_CLI)
|
||||||
|
extern const char *armingDisableFlagNames[NUM_ARMING_DISABLE_FLAGS];
|
||||||
|
#endif
|
||||||
|
|
||||||
void setArmingDisabled(armingDisableFlags_e flag);
|
void setArmingDisabled(armingDisableFlags_e flag);
|
||||||
void unsetArmingDisabled(armingDisableFlags_e flag);
|
void unsetArmingDisabled(armingDisableFlags_e flag);
|
||||||
bool isArmingDisabled(void);
|
bool isArmingDisabled(void);
|
||||||
|
|
|
@ -128,7 +128,6 @@ static uint8_t armState;
|
||||||
|
|
||||||
static displayPort_t *osdDisplayPort;
|
static displayPort_t *osdDisplayPort;
|
||||||
|
|
||||||
|
|
||||||
#define AH_MAX_PITCH 200 // Specify maximum AHI pitch value displayed. Default 200 = 20.0 degrees
|
#define AH_MAX_PITCH 200 // Specify maximum AHI pitch value displayed. Default 200 = 20.0 degrees
|
||||||
#define AH_MAX_ROLL 400 // Specify maximum AHI roll value displayed. Default 400 = 40.0 degrees
|
#define AH_MAX_ROLL 400 // Specify maximum AHI roll value displayed. Default 400 = 40.0 degrees
|
||||||
#define AH_SIDEBAR_WIDTH_POS 7
|
#define AH_SIDEBAR_WIDTH_POS 7
|
||||||
|
@ -520,6 +519,19 @@ static void osdDrawSingleElement(uint8_t item)
|
||||||
}
|
}
|
||||||
|
|
||||||
case OSD_WARNINGS:
|
case OSD_WARNINGS:
|
||||||
|
/* Show common reason for arming being disabled */
|
||||||
|
if (IS_RC_MODE_ACTIVE(BOXARM) && isArmingDisabled()) {
|
||||||
|
const armingDisableFlags_e flags = getArmingDisableFlags();
|
||||||
|
for (int i = 0; i < NUM_ARMING_DISABLE_FLAGS; i++) {
|
||||||
|
if (flags & (1 << i)) {
|
||||||
|
tfp_sprintf(buff, "%s", armingDisableFlagNames[i]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Show battery state warning */
|
||||||
switch(getBatteryState()) {
|
switch(getBatteryState()) {
|
||||||
case BATTERY_WARNING:
|
case BATTERY_WARNING:
|
||||||
tfp_sprintf(buff, "LOW BATTERY");
|
tfp_sprintf(buff, "LOW BATTERY");
|
||||||
|
@ -530,6 +542,7 @@ static void osdDrawSingleElement(uint8_t item)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
/* Show visual beeper if battery is OK */
|
||||||
if (showVisualBeeper) {
|
if (showVisualBeeper) {
|
||||||
tfp_sprintf(buff, " * * * *");
|
tfp_sprintf(buff, " * * * *");
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -113,7 +113,8 @@ osd_unittest_SRC := \
|
||||||
$(USER_DIR)/common/typeconversion.c \
|
$(USER_DIR)/common/typeconversion.c \
|
||||||
$(USER_DIR)/drivers/display.c \
|
$(USER_DIR)/drivers/display.c \
|
||||||
$(USER_DIR)/common/maths.c \
|
$(USER_DIR)/common/maths.c \
|
||||||
$(USER_DIR)/common/printf.c
|
$(USER_DIR)/common/printf.c \
|
||||||
|
$(USER_DIR)/fc/runtime_config.c
|
||||||
|
|
||||||
osd_unittest_DEFINES := \
|
osd_unittest_DEFINES := \
|
||||||
OSD
|
OSD
|
||||||
|
|
|
@ -48,9 +48,6 @@ extern "C" {
|
||||||
|
|
||||||
void osdRefresh(timeUs_t currentTimeUs);
|
void osdRefresh(timeUs_t currentTimeUs);
|
||||||
|
|
||||||
uint8_t stateFlags;
|
|
||||||
uint8_t armingFlags;
|
|
||||||
uint16_t flightModeFlags;
|
|
||||||
uint16_t rssi;
|
uint16_t rssi;
|
||||||
attitudeEulerAngles_t attitude;
|
attitudeEulerAngles_t attitude;
|
||||||
pidProfile_t *currentPidProfile;
|
pidProfile_t *currentPidProfile;
|
||||||
|
@ -498,9 +495,8 @@ TEST(OsdTest, TestElementRssi)
|
||||||
|
|
||||||
// STUBS
|
// STUBS
|
||||||
extern "C" {
|
extern "C" {
|
||||||
bool sensors(uint32_t mask) {
|
void beeperConfirmationBeeps(uint8_t beepCount) {
|
||||||
UNUSED(mask);
|
UNUSED(beepCount);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IS_RC_MODE_ACTIVE(boxId_e boxId) {
|
bool IS_RC_MODE_ACTIVE(boxId_e boxId) {
|
||||||
|
@ -574,7 +570,4 @@ extern "C" {
|
||||||
UNUSED(pDisplay);
|
UNUSED(pDisplay);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setArmingDisabled(armingDisableFlags_e flag) { UNUSED(flag); }
|
|
||||||
void unsetArmingDisabled(armingDisableFlags_e flag) { UNUSED(flag); }
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue