Optional string for OME_Label
OME_Label now has an optional string (data). Profile number is now displayed PID menu using this facility.
This commit is contained in:
parent
b7342b98e2
commit
7861603c96
|
@ -333,8 +333,14 @@ static int cmsDrawMenuEntry(displayPort_t *pDisplay, OSD_Entry *p, uint8_t row)
|
||||||
CLR_PRINTVALUE(p);
|
CLR_PRINTVALUE(p);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case OME_OSD_Exit:
|
|
||||||
case OME_Label:
|
case OME_Label:
|
||||||
|
if (IS_PRINTVALUE(p) && p->data) {
|
||||||
|
// A label with optional string, immediately following text
|
||||||
|
cnt = displayWrite(pDisplay, LEFT_MENU_COLUMN + 2 + strlen(p->text), row, p->data);
|
||||||
|
CLR_PRINTVALUE(p);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case OME_OSD_Exit:
|
||||||
case OME_END:
|
case OME_END:
|
||||||
case OME_Back:
|
case OME_Back:
|
||||||
break;
|
break;
|
||||||
|
@ -417,7 +423,9 @@ static void cmsDrawMenu(displayPort_t *pDisplay)
|
||||||
// Print text labels
|
// Print text labels
|
||||||
for (i = 0, p = pageTop; i < MAX_MENU_ITEMS(pDisplay) && p->type != OME_END; i++, p++) {
|
for (i = 0, p = pageTop; i < MAX_MENU_ITEMS(pDisplay) && p->type != OME_END; i++, p++) {
|
||||||
if (IS_PRINTLABEL(p)) {
|
if (IS_PRINTLABEL(p)) {
|
||||||
room -= displayWrite(pDisplay, LEFT_MENU_COLUMN + 2, i + top, p->text);
|
uint8_t coloff = LEFT_MENU_COLUMN;
|
||||||
|
coloff += (p->type == OME_Label) ? 1 : 2;
|
||||||
|
room -= displayWrite(pDisplay, coloff, i + top, p->text);
|
||||||
CLR_PRINTLABEL(p);
|
CLR_PRINTLABEL(p);
|
||||||
if (room < 30)
|
if (room < 30)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -52,12 +52,14 @@
|
||||||
//
|
//
|
||||||
static uint8_t tmpProfileIndex;
|
static uint8_t tmpProfileIndex;
|
||||||
static uint8_t profileIndex;
|
static uint8_t profileIndex;
|
||||||
|
static char profileIndexString[] = " PROF n";
|
||||||
static uint8_t tempPid[4][3];
|
static uint8_t tempPid[4][3];
|
||||||
|
|
||||||
static long cmsx_menuImu_onEnter(void)
|
static long cmsx_menuImu_onEnter(void)
|
||||||
{
|
{
|
||||||
profileIndex = masterConfig.current_profile_index;
|
profileIndex = masterConfig.current_profile_index;
|
||||||
tmpProfileIndex = profileIndex + 1;
|
tmpProfileIndex = profileIndex + 1;
|
||||||
|
profileIndexString[6] = '0' + tmpProfileIndex;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -86,6 +88,15 @@ static long cmsx_PidRead(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static long cmsx_PidOnEnter(void)
|
||||||
|
{
|
||||||
|
profileIndexString[6] = '0' + tmpProfileIndex;
|
||||||
|
cmsx_PidRead();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static long cmsx_PidWriteback(OSD_Entry *self)
|
static long cmsx_PidWriteback(OSD_Entry *self)
|
||||||
{
|
{
|
||||||
UNUSED(self);
|
UNUSED(self);
|
||||||
|
@ -105,7 +116,7 @@ static long cmsx_PidWriteback(OSD_Entry *self)
|
||||||
|
|
||||||
static OSD_Entry cmsx_menuPidEntries[] =
|
static OSD_Entry cmsx_menuPidEntries[] =
|
||||||
{
|
{
|
||||||
{ "-- PID --", OME_Label, NULL, NULL, 0},
|
{ "-- PID --", OME_Label, NULL, profileIndexString, 0},
|
||||||
|
|
||||||
{ "ROLL P", OME_UINT8, NULL, &(OSD_UINT8_t){ &tempPid[PIDROLL][0], 0, 200, 1 }, 0 },
|
{ "ROLL P", OME_UINT8, NULL, &(OSD_UINT8_t){ &tempPid[PIDROLL][0], 0, 200, 1 }, 0 },
|
||||||
{ "ROLL I", OME_UINT8, NULL, &(OSD_UINT8_t){ &tempPid[PIDROLL][1], 0, 200, 1 }, 0 },
|
{ "ROLL I", OME_UINT8, NULL, &(OSD_UINT8_t){ &tempPid[PIDROLL][1], 0, 200, 1 }, 0 },
|
||||||
|
@ -126,7 +137,7 @@ static OSD_Entry cmsx_menuPidEntries[] =
|
||||||
static CMS_Menu cmsx_menuPid = {
|
static CMS_Menu cmsx_menuPid = {
|
||||||
"XPID",
|
"XPID",
|
||||||
OME_MENU,
|
OME_MENU,
|
||||||
cmsx_PidRead,
|
cmsx_PidOnEnter,
|
||||||
cmsx_PidWriteback,
|
cmsx_PidWriteback,
|
||||||
NULL,
|
NULL,
|
||||||
cmsx_menuPidEntries,
|
cmsx_menuPidEntries,
|
||||||
|
|
Loading…
Reference in New Issue