mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-17 13:25:30 +03:00
commit
fd297b6b2c
8 changed files with 62 additions and 8 deletions
|
@ -2296,6 +2296,26 @@ static void cliVtx(char *cmdline)
|
||||||
|
|
||||||
#endif // VTX_CONTROL
|
#endif // VTX_CONTROL
|
||||||
|
|
||||||
|
#ifdef USE_OSD
|
||||||
|
static void printDisplayName(uint8_t dumpMask, const pilotConfig_t *pilotConfig)
|
||||||
|
{
|
||||||
|
const bool equalsDefault = strlen(pilotConfig->displayName) == 0;
|
||||||
|
cliDumpPrintLinef(dumpMask, equalsDefault, "display_name %s", equalsDefault ? emptyName : pilotConfig->displayName);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void cliDisplayName(char *cmdline)
|
||||||
|
{
|
||||||
|
const unsigned int len = strlen(cmdline);
|
||||||
|
if (len > 0) {
|
||||||
|
memset(pilotConfigMutable()->displayName, 0, ARRAYLEN(pilotConfig()->displayName));
|
||||||
|
if (strncmp(cmdline, emptyName, len)) {
|
||||||
|
strncpy(pilotConfigMutable()->displayName, cmdline, MIN(len, MAX_NAME_LENGTH));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
printDisplayName(DUMP_MASTER, pilotConfig());
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void printName(uint8_t dumpMask, const pilotConfig_t *pilotConfig)
|
static void printName(uint8_t dumpMask, const pilotConfig_t *pilotConfig)
|
||||||
{
|
{
|
||||||
const bool equalsDefault = strlen(pilotConfig->name) == 0;
|
const bool equalsDefault = strlen(pilotConfig->name) == 0;
|
||||||
|
@ -4614,6 +4634,11 @@ static void printConfig(char *cmdline, bool doDiff)
|
||||||
cliPrintHashLine("name");
|
cliPrintHashLine("name");
|
||||||
printName(dumpMask, &pilotConfig_Copy);
|
printName(dumpMask, &pilotConfig_Copy);
|
||||||
|
|
||||||
|
#ifdef USE_OSD
|
||||||
|
cliPrintHashLine("display_name");
|
||||||
|
printDisplayName(dumpMask, &pilotConfig_Copy);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef USE_RESOURCE_MGMT
|
#ifdef USE_RESOURCE_MGMT
|
||||||
cliPrintHashLine("resources");
|
cliPrintHashLine("resources");
|
||||||
printResource(dumpMask);
|
printResource(dumpMask);
|
||||||
|
@ -4830,6 +4855,9 @@ const clicmd_t cmdTable[] = {
|
||||||
#endif
|
#endif
|
||||||
CLI_COMMAND_DEF("defaults", "reset to defaults and reboot", "[nosave]", cliDefaults),
|
CLI_COMMAND_DEF("defaults", "reset to defaults and reboot", "[nosave]", cliDefaults),
|
||||||
CLI_COMMAND_DEF("diff", "list configuration changes from default", "[master|profile|rates|all] {defaults}", cliDiff),
|
CLI_COMMAND_DEF("diff", "list configuration changes from default", "[master|profile|rates|all] {defaults}", cliDiff),
|
||||||
|
#ifdef USE_OSD
|
||||||
|
CLI_COMMAND_DEF("display_name", "display name of craft", NULL, cliDisplayName),
|
||||||
|
#endif
|
||||||
#ifdef USE_RESOURCE_MGMT
|
#ifdef USE_RESOURCE_MGMT
|
||||||
CLI_COMMAND_DEF("dma", "list dma utilisation", NULL, cliDma),
|
CLI_COMMAND_DEF("dma", "list dma utilisation", NULL, cliDma),
|
||||||
#ifdef USE_DMA_SPEC
|
#ifdef USE_DMA_SPEC
|
||||||
|
|
|
@ -1168,6 +1168,7 @@ const clivalue_t valueTable[] = {
|
||||||
{ "osd_mah_drawn_pos", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 0, OSD_POSCFG_MAX }, PG_OSD_CONFIG, offsetof(osdConfig_t, item_pos[OSD_MAH_DRAWN]) },
|
{ "osd_mah_drawn_pos", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 0, OSD_POSCFG_MAX }, PG_OSD_CONFIG, offsetof(osdConfig_t, item_pos[OSD_MAH_DRAWN]) },
|
||||||
{ "osd_motor_diag_pos", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 0, OSD_POSCFG_MAX }, PG_OSD_CONFIG, offsetof(osdConfig_t, item_pos[OSD_MOTOR_DIAG]) },
|
{ "osd_motor_diag_pos", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 0, OSD_POSCFG_MAX }, PG_OSD_CONFIG, offsetof(osdConfig_t, item_pos[OSD_MOTOR_DIAG]) },
|
||||||
{ "osd_craft_name_pos", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 0, OSD_POSCFG_MAX }, PG_OSD_CONFIG, offsetof(osdConfig_t, item_pos[OSD_CRAFT_NAME]) },
|
{ "osd_craft_name_pos", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 0, OSD_POSCFG_MAX }, PG_OSD_CONFIG, offsetof(osdConfig_t, item_pos[OSD_CRAFT_NAME]) },
|
||||||
|
{ "osd_display_name_pos", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 0, OSD_POSCFG_MAX }, PG_OSD_CONFIG, offsetof(osdConfig_t, item_pos[OSD_DISPLAY_NAME]) },
|
||||||
{ "osd_gps_speed_pos", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 0, OSD_POSCFG_MAX }, PG_OSD_CONFIG, offsetof(osdConfig_t, item_pos[OSD_GPS_SPEED]) },
|
{ "osd_gps_speed_pos", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 0, OSD_POSCFG_MAX }, PG_OSD_CONFIG, offsetof(osdConfig_t, item_pos[OSD_GPS_SPEED]) },
|
||||||
{ "osd_gps_lon_pos", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 0, OSD_POSCFG_MAX }, PG_OSD_CONFIG, offsetof(osdConfig_t, item_pos[OSD_GPS_LON]) },
|
{ "osd_gps_lon_pos", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 0, OSD_POSCFG_MAX }, PG_OSD_CONFIG, offsetof(osdConfig_t, item_pos[OSD_GPS_LON]) },
|
||||||
{ "osd_gps_lat_pos", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 0, OSD_POSCFG_MAX }, PG_OSD_CONFIG, offsetof(osdConfig_t, item_pos[OSD_GPS_LAT]) },
|
{ "osd_gps_lat_pos", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 0, OSD_POSCFG_MAX }, PG_OSD_CONFIG, offsetof(osdConfig_t, item_pos[OSD_GPS_LAT]) },
|
||||||
|
|
|
@ -132,6 +132,7 @@ OSD_Entry menuOsdActiveElemsEntries[] =
|
||||||
{"STICK OVERLAY LEFT", OME_VISIBLE, NULL, &osdConfig_item_pos[OSD_STICK_OVERLAY_LEFT], DYNAMIC},
|
{"STICK OVERLAY LEFT", OME_VISIBLE, NULL, &osdConfig_item_pos[OSD_STICK_OVERLAY_LEFT], DYNAMIC},
|
||||||
{"STICK OVERLAY RIGHT",OME_VISIBLE, NULL, &osdConfig_item_pos[OSD_STICK_OVERLAY_RIGHT], DYNAMIC},
|
{"STICK OVERLAY RIGHT",OME_VISIBLE, NULL, &osdConfig_item_pos[OSD_STICK_OVERLAY_RIGHT], DYNAMIC},
|
||||||
#endif
|
#endif
|
||||||
|
{"DISPLAY NAME", OME_VISIBLE, NULL, &osdConfig_item_pos[OSD_DISPLAY_NAME], 0},
|
||||||
{"BACK", OME_Back, NULL, NULL, 0},
|
{"BACK", OME_Back, NULL, NULL, 0},
|
||||||
{NULL, OME_END, NULL, NULL, 0}
|
{NULL, OME_END, NULL, NULL, 0}
|
||||||
};
|
};
|
||||||
|
|
|
@ -74,10 +74,11 @@ pidProfile_t *currentPidProfile;
|
||||||
|
|
||||||
#define DYNAMIC_FILTER_MAX_SUPPORTED_LOOP_TIME HZ_TO_INTERVAL_US(2000)
|
#define DYNAMIC_FILTER_MAX_SUPPORTED_LOOP_TIME HZ_TO_INTERVAL_US(2000)
|
||||||
|
|
||||||
PG_REGISTER_WITH_RESET_TEMPLATE(pilotConfig_t, pilotConfig, PG_PILOT_CONFIG, 0);
|
PG_REGISTER_WITH_RESET_TEMPLATE(pilotConfig_t, pilotConfig, PG_PILOT_CONFIG, 1);
|
||||||
|
|
||||||
PG_RESET_TEMPLATE(pilotConfig_t, pilotConfig,
|
PG_RESET_TEMPLATE(pilotConfig_t, pilotConfig,
|
||||||
.name = { 0 }
|
.name = { 0 },
|
||||||
|
.displayName = { 0 },
|
||||||
);
|
);
|
||||||
|
|
||||||
PG_REGISTER_WITH_RESET_TEMPLATE(systemConfig_t, systemConfig, PG_SYSTEM_CONFIG, 2);
|
PG_REGISTER_WITH_RESET_TEMPLATE(systemConfig_t, systemConfig, PG_SYSTEM_CONFIG, 2);
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
|
|
||||||
typedef struct pilotConfig_s {
|
typedef struct pilotConfig_s {
|
||||||
char name[MAX_NAME_LENGTH + 1];
|
char name[MAX_NAME_LENGTH + 1];
|
||||||
|
char displayName[MAX_NAME_LENGTH + 1];
|
||||||
} pilotConfig_t;
|
} pilotConfig_t;
|
||||||
|
|
||||||
PG_DECLARE(pilotConfig_t, pilotConfig);
|
PG_DECLARE(pilotConfig_t, pilotConfig);
|
||||||
|
|
|
@ -247,6 +247,7 @@ static const uint8_t osdElementDisplayOrder[] = {
|
||||||
OSD_ANTI_GRAVITY,
|
OSD_ANTI_GRAVITY,
|
||||||
OSD_MOTOR_DIAG,
|
OSD_MOTOR_DIAG,
|
||||||
OSD_FLIP_ARROW,
|
OSD_FLIP_ARROW,
|
||||||
|
OSD_DISPLAY_NAME,
|
||||||
#ifdef USE_RTC_TIME
|
#ifdef USE_RTC_TIME
|
||||||
OSD_RTC_DATETIME,
|
OSD_RTC_DATETIME,
|
||||||
#endif
|
#endif
|
||||||
|
@ -829,6 +830,26 @@ static bool osdDrawSingleElement(uint8_t item)
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case OSD_DISPLAY_NAME:
|
||||||
|
// This does not strictly support iterative updating if the display name changes at run time. But since the display name is not supposed to be changing this should not matter, and blanking the entire length of the display name string on update will make it impossible to configure elements to be displayed on the right hand side of the display name.
|
||||||
|
//TODO: When iterative updating is implemented, change this so the display name is only printed once whenever the OSD 'flight' screen is entered.
|
||||||
|
|
||||||
|
if (strlen(pilotConfig()->displayName) == 0) {
|
||||||
|
strcpy(buff, "DISPLAY_NAME");
|
||||||
|
} else {
|
||||||
|
unsigned i;
|
||||||
|
for (i = 0; i < MAX_NAME_LENGTH; i++) {
|
||||||
|
if (pilotConfig()->displayName[i]) {
|
||||||
|
buff[i] = toupper((unsigned char)pilotConfig()->displayName[i]);
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
buff[i] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
case OSD_THROTTLE_POS:
|
case OSD_THROTTLE_POS:
|
||||||
buff[0] = SYM_THR;
|
buff[0] = SYM_THR;
|
||||||
buff[1] = SYM_THR1;
|
buff[1] = SYM_THR1;
|
||||||
|
|
|
@ -121,6 +121,7 @@ typedef enum {
|
||||||
OSD_FLIGHT_DIST,
|
OSD_FLIGHT_DIST,
|
||||||
OSD_STICK_OVERLAY_LEFT,
|
OSD_STICK_OVERLAY_LEFT,
|
||||||
OSD_STICK_OVERLAY_RIGHT,
|
OSD_STICK_OVERLAY_RIGHT,
|
||||||
|
OSD_DISPLAY_NAME,
|
||||||
OSD_ITEM_COUNT // MUST BE LAST
|
OSD_ITEM_COUNT // MUST BE LAST
|
||||||
} osd_items_e;
|
} osd_items_e;
|
||||||
|
|
||||||
|
|
|
@ -124,12 +124,6 @@
|
||||||
#undef USE_MSP_OVER_TELEMETRY
|
#undef USE_MSP_OVER_TELEMETRY
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(USE_OSD)
|
|
||||||
#undef USE_RX_LINK_QUALITY_INFO
|
|
||||||
#undef USE_OSD_PROFILES
|
|
||||||
#undef USE_OSD_STICK_OVERLAY
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* If either VTX_CONTROL or VTX_COMMON is undefined then remove common code and device drivers */
|
/* If either VTX_CONTROL or VTX_COMMON is undefined then remove common code and device drivers */
|
||||||
#if !defined(USE_VTX_COMMON) || !defined(USE_VTX_CONTROL)
|
#if !defined(USE_VTX_COMMON) || !defined(USE_VTX_CONTROL)
|
||||||
#undef USE_VTX_COMMON
|
#undef USE_VTX_COMMON
|
||||||
|
@ -187,6 +181,12 @@
|
||||||
#define USE_OSD
|
#define USE_OSD
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !defined(USE_OSD)
|
||||||
|
#undef USE_RX_LINK_QUALITY_INFO
|
||||||
|
#undef USE_OSD_PROFILES
|
||||||
|
#undef USE_OSD_STICK_OVERLAY
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(USE_GPS_RESCUE)
|
#if defined(USE_GPS_RESCUE)
|
||||||
#define USE_GPS
|
#define USE_GPS
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue