Skip to content

Commit

Permalink
3 items on main menu
Browse files Browse the repository at this point in the history
Adjust main menu to show 3 items instead of 2.  This removes the static title and fixes the active menu entry in the center.
  • Loading branch information
xawen committed Nov 13, 2023
1 parent e65e6cb commit 85df658
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 26 deletions.
30 changes: 12 additions & 18 deletions app/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ uint8_t gSettingsCount = sizeof(Menu) / sizeof(Menu[0]);

static void DrawMenu(uint8_t Index)
{
UI_DrawString(24, 72, Menu[(Index + gSettingsCount - 1) % gSettingsCount], 14);
Int2Ascii(((Index + gSettingsCount - 1) % gSettingsCount) + 1, 2);
UI_DrawString(140, 72, gShortString, 2);
UI_DrawString(24, 48, Menu[Index], 14);
Int2Ascii(Index + 1, 2);
UI_DrawString(140, 48, gShortString, 2);
Expand All @@ -156,8 +159,11 @@ static void EnableTextEditor(void)

static void DrawSettingName(uint8_t Index)
{
gColorForeground = COLOR_BLUE;
UI_DrawString(24, 72, Menu[Index], 14);
Int2Ascii((Index + 1), 2);
UI_DrawString(140, 72, gShortString, 2);
gColorForeground = COLOR_FOREGROUND;
UI_DrawString(24, 76, Menu[Index], 14);
}

static void DrawNewSetting(void)
Expand All @@ -171,7 +177,7 @@ static void DrawNewSetting(void)
}
gInputBoxWriteIndex = 0;
INPUTBOX_Pad(0, 10);
UI_DrawString(136, 76, " ", 2);
UI_DrawSettingArrow(0);
if (Index && Index <= gSettingsCount) {
gMenuIndex = Index - 1;
MENU_Redraw(false);
Expand Down Expand Up @@ -963,10 +969,8 @@ void MENU_Redraw(bool bClear)
gInputBoxWriteIndex = 0;
if (bClear) {
DISPLAY_Fill(0, 159, 1, 81, COLOR_BACKGROUND);
DISPLAY_DrawRectangle0(0, 56, 160, 1, gSettings.BorderColor);
}
gColorForeground = COLOR_FOREGROUND;
UI_DrawStringMenuSettings();
UI_DrawSettingArrow(0);
DrawMenu(gMenuIndex);
MENU_PlayAudio(gMenuIndex);
Expand Down Expand Up @@ -1015,23 +1019,13 @@ void MENU_KeyHandler(uint8_t Key)

void MENU_Next(uint8_t Key)
{
UI_DrawSettingArrow(0);
if (Key == KEY_UP) {
if (gSettingIndex) {
gSettingIndex = 0;
UI_DrawSettingArrow(0);
} else {
gMenuIndex = (gMenuIndex + gSettingsCount - 1) % gSettingsCount;
DrawMenu(gMenuIndex);
}
gMenuIndex = (gMenuIndex + gSettingsCount - 1) % gSettingsCount;
} else {
if (gSettingIndex) {
gMenuIndex = (gMenuIndex + 1) % gSettingsCount;
DrawMenu(gMenuIndex);
} else {
gSettingIndex = 1;
UI_DrawSettingArrow(1);
}
gMenuIndex = (gMenuIndex + 1) % gSettingsCount;
}
DrawMenu(gMenuIndex);
}

void MENU_SettingKeyHandler(uint8_t Key)
Expand Down
7 changes: 1 addition & 6 deletions ui/helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -836,12 +836,7 @@ void UI_DrawMenuPosition(const char *pString)
gString[i] = '0' + pString[i];
}
}
UI_DrawString(136, 76, gString, 2);
}

void UI_DrawStringMenuSettings(void)
{
UI_DrawString(24, 76, "Menu Settings ", 16);
UI_DrawString(1, 48, gString, 2);
}

void UI_DrawStringSwitchType(void)
Expand Down
1 change: 0 additions & 1 deletion ui/helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ void UI_DrawFrequencyEx(const char *String, uint8_t Vfo, bool bFlag);
void UI_DrawBootVoltage(uint8_t X, uint8_t Y);
void UI_DrawDecimal(const char *pInput);
void UI_DrawMenuPosition(const char *pString);
void UI_DrawStringMenuSettings(void);
void UI_DrawStringSwitchType(void);
void UI_DrawRadar(void);
void UI_DrawGolay(void);
Expand Down
2 changes: 1 addition & 1 deletion ui/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ void UI_DrawSettingArrow(uint8_t Selection)
Bitmap[5] = 0x0080;

DISPLAY_Fill(8, 16, 8, 23, COLOR_BACKGROUND);
DISPLAY_Fill(8, 16, 32, 47, COLOR_BACKGROUND);
DISPLAY_Fill(1, 16, 32, 47, COLOR_BACKGROUND);

for (i = 0; i < 6; i++) {
uint16_t Pixel = Bitmap[i];
Expand Down

0 comments on commit 85df658

Please sign in to comment.