mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-15 20:35:33 +03:00
commit
ef79a36fd7
5 changed files with 46 additions and 2 deletions
|
@ -1253,6 +1253,10 @@ const clivalue_t valueTable[] = {
|
|||
{ "osd_pid_profile_name_pos", VAR_UINT16 | MASTER_VALUE, .config.minmaxUnsigned = { 0, OSD_POSCFG_MAX }, PG_OSD_CONFIG, offsetof(osdConfig_t, item_pos[OSD_PID_PROFILE_NAME]) },
|
||||
#endif
|
||||
|
||||
#ifdef USE_OSD_PROFILES
|
||||
{ "osd_profile_name_pos", VAR_UINT16 | MASTER_VALUE, .config.minmaxUnsigned = { 0, OSD_POSCFG_MAX }, PG_OSD_CONFIG, offsetof(osdConfig_t, item_pos[OSD_PROFILE_NAME]) },
|
||||
#endif
|
||||
|
||||
// OSD stats enabled flags are stored as bitmapped values inside a 32bit parameter
|
||||
// It is recommended to keep the settings order the same as the enumeration. This way the settings are displayed in the cli in the same order making it easier on the users
|
||||
{ "osd_stat_rtc_date_time", VAR_UINT32 | MASTER_VALUE | MODE_BITSET, .config.bitpos = OSD_STAT_RTC_DATE_TIME, PG_OSD_CONFIG, offsetof(osdConfig_t, enabled_stats)},
|
||||
|
@ -1288,6 +1292,9 @@ const clivalue_t valueTable[] = {
|
|||
|
||||
#ifdef USE_OSD_PROFILES
|
||||
{ "osd_profile", VAR_UINT8 | MASTER_VALUE, .config.minmaxUnsigned = { 1, OSD_PROFILE_COUNT }, PG_OSD_CONFIG, offsetof(osdConfig_t, osdProfileIndex) },
|
||||
{ "osd_profile_1_name", VAR_UINT8 | MASTER_VALUE | MODE_STRING, .config.string = { 1, OSD_PROFILE_NAME_LENGTH, STRING_FLAGS_NONE }, PG_OSD_CONFIG, offsetof(osdConfig_t, profile[0]) },
|
||||
{ "osd_profile_2_name", VAR_UINT8 | MASTER_VALUE | MODE_STRING, .config.string = { 1, OSD_PROFILE_NAME_LENGTH, STRING_FLAGS_NONE }, PG_OSD_CONFIG, offsetof(osdConfig_t, profile[1]) },
|
||||
{ "osd_profile_3_name", VAR_UINT8 | MASTER_VALUE | MODE_STRING, .config.string = { 1, OSD_PROFILE_NAME_LENGTH, STRING_FLAGS_NONE }, PG_OSD_CONFIG, offsetof(osdConfig_t, profile[2]) },
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
|
@ -120,6 +120,9 @@ const OSD_Entry menuOsdActiveElemsEntries[] =
|
|||
#ifdef USE_PROFILE_NAMES
|
||||
{"PID PROFILE NAME", OME_VISIBLE, NULL, &osdConfig_item_pos[OSD_PID_PROFILE_NAME], DYNAMIC},
|
||||
{"RATE PROFILE NAME", OME_VISIBLE, NULL, &osdConfig_item_pos[OSD_RATE_PROFILE_NAME], DYNAMIC},
|
||||
#endif
|
||||
#ifdef USE_OSD_PROFILES
|
||||
{"OSD PROFILE NAME", OME_VISIBLE, NULL, &osdConfig_item_pos[OSD_PROFILE_NAME], DYNAMIC},
|
||||
#endif
|
||||
{"DEBUG", OME_VISIBLE, NULL, &osdConfig_item_pos[OSD_DEBUG], DYNAMIC},
|
||||
{"WARNINGS", OME_VISIBLE, NULL, &osdConfig_item_pos[OSD_WARNINGS], DYNAMIC},
|
||||
|
|
|
@ -128,7 +128,7 @@ static uint8_t osdStatsRowCount = 0;
|
|||
escSensorData_t *osdEscDataCombined;
|
||||
#endif
|
||||
|
||||
PG_REGISTER_WITH_RESET_FN(osdConfig_t, osdConfig, PG_OSD_CONFIG, 5);
|
||||
PG_REGISTER_WITH_RESET_FN(osdConfig_t, osdConfig, PG_OSD_CONFIG, 6);
|
||||
|
||||
void osdStatSetState(uint8_t statIndex, bool enabled)
|
||||
{
|
||||
|
@ -265,6 +265,9 @@ void pgResetFn_osdConfig(osdConfig_t *osdConfig)
|
|||
|
||||
osdConfig->osdProfileIndex = 1;
|
||||
osdConfig->ahInvert = false;
|
||||
for (int i=0; i < OSD_PROFILE_COUNT; i++) {
|
||||
osdConfig->profile[i][0] = '\0';
|
||||
}
|
||||
osdConfig->rssi_dbm_alarm = 60;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,8 @@ extern const char * const osdTimerSourceNames[OSD_NUM_TIMER_TYPES];
|
|||
|
||||
#define OSD_ELEMENT_BUFFER_LENGTH 32
|
||||
|
||||
#define OSD_PROFILE_NAME_LENGTH 16
|
||||
|
||||
#ifdef USE_OSD_PROFILES
|
||||
#define OSD_PROFILE_COUNT 3
|
||||
#else
|
||||
|
@ -128,6 +130,7 @@ typedef enum {
|
|||
OSD_ESC_RPM_FREQ,
|
||||
OSD_RATE_PROFILE_NAME,
|
||||
OSD_PID_PROFILE_NAME,
|
||||
OSD_PROFILE_NAME,
|
||||
OSD_RSSI_DBM_VALUE,
|
||||
OSD_ITEM_COUNT // MUST BE LAST
|
||||
} osd_items_e;
|
||||
|
@ -252,6 +255,7 @@ typedef struct osdConfig_s {
|
|||
uint8_t ahInvert; // invert the artificial horizon
|
||||
uint8_t osdProfileIndex;
|
||||
uint8_t overlay_radio_mode;
|
||||
char profile[OSD_PROFILE_COUNT][OSD_PROFILE_NAME_LENGTH + 1];
|
||||
uint16_t link_quality_alarm;
|
||||
uint8_t rssi_dbm_alarm;
|
||||
} osdConfig_t;
|
||||
|
|
|
@ -690,6 +690,27 @@ static void osdElementPidProfileName(osdElementParms_t *element)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef USE_OSD_PROFILES
|
||||
static void osdElementOsdProfileName(osdElementParms_t *element)
|
||||
{
|
||||
uint8_t profileIndex = getCurrentOsdProfileIndex();
|
||||
|
||||
if (strlen(osdConfig()->profile[profileIndex - 1]) == 0) {
|
||||
tfp_sprintf(element->buff, "OSD_%u", profileIndex);
|
||||
} else {
|
||||
unsigned i;
|
||||
for (i = 0; i < OSD_PROFILE_NAME_LENGTH; i++) {
|
||||
if (osdConfig()->profile[profileIndex - 1][i]) {
|
||||
element->buff[i] = toupper((unsigned char)osdConfig()->profile[profileIndex - 1][i]);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
element->buff[i] = '\0';
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef USE_ESC_SENSOR
|
||||
static void osdElementEscTemperature(osdElementParms_t *element)
|
||||
{
|
||||
|
@ -1401,6 +1422,10 @@ static const uint8_t osdElementDisplayOrder[] = {
|
|||
OSD_RATE_PROFILE_NAME,
|
||||
OSD_PID_PROFILE_NAME,
|
||||
#endif
|
||||
#ifdef USE_OSD_PROFILES
|
||||
OSD_PROFILE_NAME,
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
// Define the mapping between the OSD element id and the function to draw it
|
||||
|
@ -1500,10 +1525,12 @@ const osdElementDrawFn osdElementDrawFunction[OSD_ITEM_COUNT] = {
|
|||
[OSD_RATE_PROFILE_NAME] = osdElementRateProfileName,
|
||||
[OSD_PID_PROFILE_NAME] = osdElementPidProfileName,
|
||||
#endif
|
||||
#ifdef USE_OSD_PROFILES
|
||||
[OSD_PROFILE_NAME] = osdElementOsdProfileName,
|
||||
#endif
|
||||
#ifdef USE_RX_RSSI_DBM
|
||||
[OSD_RSSI_DBM_VALUE] = osdElementRssiDbm,
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
static void osdAddActiveElement(osd_items_e element)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue