1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-25 01:05:27 +03:00

Rename 'display_name' to 'pilot_name'; rename 'name' to 'craft_name'; Add the 'MSP2_GET_TEXT' and 'MSP2_SET_TEXT' MSP commands

- add the 'MSP2_GET_TEXT' and 'MSP2_SET_TEXT' MSP2 commands

  - Support getting/setting the 'MSP2TEXT_PILOT_DISPLAY_NAME' config prop ('pilotConfigMutable()->displayName')

- rename 'display_name' to 'pilot_name'

  - Add the new 'OSD_PILOT_NAME' OSD element in place of the
  'OSD_DISPLAY_NAME' one (as they are semantically identical)
  - Add the 'osd_pilot_name_pos' cli prop in place of 'osd_display_name_pos'

- rename 'pilotConfigMutable()'s 'name' to 'craftName'

  - remove the legacy 'GET_NAME' / 'SET_NAME' MSP commands
  - replace the 'name' CLI prop for 'craft_name'
  - add the 'MSP2TEXT_CRAFT_NAME' constant for 'MSP2_GET_TEXT' and 'MSP2_SET_TEXT'
This commit is contained in:
Krasiyan Nedelchev 2022-02-07 00:08:57 +01:00
parent aafcd26fb5
commit e7df32f020
12 changed files with 99 additions and 49 deletions

View file

@ -797,10 +797,10 @@ static void toUpperCase(char* dest, const char* src, unsigned int maxSrcLength)
static void osdBackgroundCraftName(osdElementParms_t *element)
{
if (strlen(pilotConfig()->name) == 0) {
if (strlen(pilotConfig()->craftName) == 0) {
strcpy(element->buff, "CRAFT_NAME");
} else {
toUpperCase(element->buff, pilotConfig()->name, MAX_NAME_LENGTH);
toUpperCase(element->buff, pilotConfig()->craftName, MAX_NAME_LENGTH);
}
}
@ -874,12 +874,12 @@ static void osdElementDisarmed(osdElementParms_t *element)
}
}
static void osdBackgroundDisplayName(osdElementParms_t *element)
static void osdBackgroundPilotName(osdElementParms_t *element)
{
if (strlen(pilotConfig()->displayName) == 0) {
strcpy(element->buff, "DISPLAY_NAME");
if (strlen(pilotConfig()->pilotName) == 0) {
strcpy(element->buff, "PILOT_NAME");
} else {
toUpperCase(element->buff, pilotConfig()->displayName, MAX_NAME_LENGTH);
toUpperCase(element->buff, pilotConfig()->pilotName, MAX_NAME_LENGTH);
}
}
@ -1525,7 +1525,7 @@ static void osdElementWarnings(osdElementParms_t *element)
}
#endif // USE_RX_LINK_QUALITY_INFO
}
strncpy(pilotConfigMutable()->name, element->buff, MAX_NAME_LENGTH - 1);
strncpy(pilotConfigMutable()->craftName, element->buff, MAX_NAME_LENGTH - 1);
}
#endif // USE_CRAFTNAME_MSGS
}
@ -1579,7 +1579,7 @@ static const uint8_t osdElementDisplayOrder[] = {
#ifdef USE_ACC
OSD_FLIP_ARROW,
#endif
OSD_DISPLAY_NAME,
OSD_PILOT_NAME,
#ifdef USE_RTC_TIME
OSD_RTC_DATETIME,
#endif
@ -1711,7 +1711,7 @@ const osdElementDrawFn osdElementDrawFunction[OSD_ITEM_COUNT] = {
[OSD_STICK_OVERLAY_LEFT] = osdElementStickOverlay,
[OSD_STICK_OVERLAY_RIGHT] = osdElementStickOverlay,
#endif
[OSD_DISPLAY_NAME] = NULL, // only has background
[OSD_PILOT_NAME] = NULL, // only has background
#if defined(USE_DSHOT_TELEMETRY) || defined(USE_ESC_SENSOR)
[OSD_ESC_RPM_FREQ] = osdElementEscRpmFreq,
#endif
@ -1746,7 +1746,7 @@ const osdElementDrawFn osdElementBackgroundFunction[OSD_ITEM_COUNT] = {
[OSD_STICK_OVERLAY_LEFT] = osdBackgroundStickOverlay,
[OSD_STICK_OVERLAY_RIGHT] = osdBackgroundStickOverlay,
#endif
[OSD_DISPLAY_NAME] = osdBackgroundDisplayName,
[OSD_PILOT_NAME] = osdBackgroundPilotName,
};
static void osdAddActiveElement(osd_items_e element)