Menu style build option ENABLE_CUSTOM_MENU_LAYOUT

This commit is contained in:
Krzysiek Egzmont
2023-12-25 01:59:18 +01:00
parent 36ecde86e9
commit f35ce8d789
4 changed files with 48 additions and 32 deletions

View File

@@ -25,6 +25,7 @@ ENABLE_FLASHLIGHT ?= 1
# ---- CUSTOM MODS ----
ENABLE_BIG_FREQ ?= 1
ENABLE_SMALL_BOLD ?= 1
ENABLE_CUSTOM_MENU_LAYOUT ?= 1
ENABLE_KEEP_MEM_NAME ?= 1
ENABLE_WIDE_RX ?= 1
ENABLE_TX_WHEN_AM ?= 0
@@ -373,6 +374,9 @@ endif
ifeq ($(ENABLE_UART_RW_BK_REGS),1)
CFLAGS += -DENABLE_UART_RW_BK_REGS
endif
ifeq ($(ENABLE_CUSTOM_MENU_LAYOUT),1)
CFLAGS += -DENABLE_CUSTOM_MENU_LAYOUT
endif
LDFLAGS =
LDFLAGS += -z noexecstack -mcpu=cortex-m0 -nostartfiles -Wl,-T,firmware.ld -Wl,--gc-sections

View File

@@ -312,3 +312,16 @@ const uint8_t BITMAP_compand[6] =
0b01000010,
0b00100100
};
#ifndef ENABLE_CUSTOM_MENU_LAYOUT
const uint8_t BITMAP_CurrentIndicator[8] = {
0xFF,
0xFF,
0x7E,
0x7E,
0x3C,
0x3C,
0x18,
0x18
};
#endif

View File

@@ -43,4 +43,9 @@ extern const uint8_t BITMAP_ScanList1[6];
extern const uint8_t BITMAP_ScanList2[6];
extern const uint8_t BITMAP_compand[6];
#ifndef ENABLE_CUSTOM_MENU_LAYOUT
extern const uint8_t BITMAP_CurrentIndicator[8];
#endif
#endif

View File

@@ -404,9 +404,8 @@ void UI_DisplayMenu(void)
UI_DisplayClear();
#if 0
#ifndef ENABLE_CUSTOM_MENU_LAYOUT
// original menu layout
for (i = 0; i < 3; i++)
if (gMenuCursor > 0 || i > 0)
if ((gMenuListCount - 1) != gMenuCursor || i != 2)
@@ -434,19 +433,16 @@ void UI_DisplayMenu(void)
#else
{ // new menu layout .. experimental & unfinished
const int menu_index = gMenuCursor; // current selected menu item
i = 1;
if (!gIsInSubMenu)
{
if (!gIsInSubMenu) {
while (i < 2)
{ // leading menu items - small text
const int k = menu_index + i - 2;
if (k < 0)
UI_PrintStringSmallNormal(MenuList[gMenuListCount + k].name, 0, 0, i); // wrap-a-round
else
if (k >= 0 && k < (int)gMenuListCount)
else if (k >= 0 && k < (int)gMenuListCount)
UI_PrintStringSmallNormal(MenuList[k].name, 0, 0, i);
i++;
}
@@ -461,8 +457,7 @@ void UI_DisplayMenu(void)
const int k = menu_index + i - 2;
if (k >= 0 && k < (int)gMenuListCount)
UI_PrintStringSmallNormal(MenuList[k].name, 0, 0, 1 + i);
else
if (k >= (int)gMenuListCount)
else if (k >= (int)gMenuListCount)
UI_PrintStringSmallNormal(MenuList[gMenuListCount - k].name, 0, 0, 1 + i); // wrap-a-round
i++;
}
@@ -471,8 +466,7 @@ void UI_DisplayMenu(void)
sprintf(String, "%2u.%u", 1 + gMenuCursor, gMenuListCount);
UI_PrintStringSmallNormal(String, 2, 0, 6);
}
else
if (menu_index >= 0 && menu_index < (int)gMenuListCount)
else if (menu_index >= 0 && menu_index < (int)gMenuListCount)
{ // current menu item
// strcat(String, ":");
UI_PrintString(MenuList[menu_index].name, 0, 0, 0, 8);