mirror of
https://github.com/armel/uv-k1-k5v3-firmware-custom.git
synced 2026-10-02 03:15:37 +00:00
Add menu categories with All fallback
This commit is contained in:
1 parent
e4408fcb55
commit
a3c72bdd93
9 files changed
+368
-20
No files matched your search
@@ -227,11 +227,16 @@ endif()
|
|||||||
enable_feature(ENABLE_FEAT_F4HWN_QRCODE)
|
enable_feature(ENABLE_FEAT_F4HWN_QRCODE)
|
||||||
enable_feature(ENABLE_FEAT_F4HWN_LOGO)
|
enable_feature(ENABLE_FEAT_F4HWN_LOGO)
|
||||||
enable_feature(ENABLE_FEAT_F4HWN_LOGO_SAV)
|
enable_feature(ENABLE_FEAT_F4HWN_LOGO_SAV)
|
||||||
|
enable_feature(ENABLE_FEAT_F4HWN_MENU_CAT)
|
||||||
|
|
||||||
if(ENABLE_FEAT_F4HWN_LOGO_SAV AND NOT ENABLE_FEAT_F4HWN_LOGO)
|
if(ENABLE_FEAT_F4HWN_LOGO_SAV AND NOT ENABLE_FEAT_F4HWN_LOGO)
|
||||||
message(FATAL_ERROR "ENABLE_FEAT_F4HWN_LOGO_SAV requires ENABLE_FEAT_F4HWN_LOGO.")
|
message(FATAL_ERROR "ENABLE_FEAT_F4HWN_LOGO_SAV requires ENABLE_FEAT_F4HWN_LOGO.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(ENABLE_FEAT_F4HWN_MENU_CAT AND NOT ENABLE_FEAT_F4HWN)
|
||||||
|
message(FATAL_ERROR "ENABLE_FEAT_F4HWN_MENU_CAT requires ENABLE_FEAT_F4HWN.")
|
||||||
|
endif()
|
||||||
|
|
||||||
# ---- DEBUGGING ----
|
# ---- DEBUGGING ----
|
||||||
|
|
||||||
enable_feature(ENABLE_AGC_SHOW_DATA)
|
enable_feature(ENABLE_AGC_SHOW_DATA)
|
||||||
|
|||||||
+4
-1
@@ -2605,7 +2605,10 @@ Skip:
|
|||||||
gFlagRefreshSetting = false;
|
gFlagRefreshSetting = false;
|
||||||
gMenuCountdown = menu_timeout_500ms;
|
gMenuCountdown = menu_timeout_500ms;
|
||||||
|
|
||||||
MENU_ShowCurrentSetting();
|
#ifdef ENABLE_FEAT_F4HWN_MENU_CAT
|
||||||
|
if (gMenuLevel != MENU_LEVEL_CAT)
|
||||||
|
#endif
|
||||||
|
MENU_ShowCurrentSetting();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gFlagPrepareTX) {
|
if (gFlagPrepareTX) {
|
||||||
|
|||||||
@@ -45,6 +45,7 @@
|
|||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "ui/inputbox.h"
|
#include "ui/inputbox.h"
|
||||||
#include "ui/main.h"
|
#include "ui/main.h"
|
||||||
|
#include "ui/menu.h"
|
||||||
#include "ui/ui.h"
|
#include "ui/ui.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
@@ -835,6 +836,11 @@ static void MAIN_Key_MENU(bool bKeyPressed, bool bKeyHeld)
|
|||||||
|
|
||||||
gFlagRefreshSetting = true;
|
gFlagRefreshSetting = true;
|
||||||
gRequestDisplayScreen = DISPLAY_MENU;
|
gRequestDisplayScreen = DISPLAY_MENU;
|
||||||
|
#ifdef ENABLE_FEAT_F4HWN_MENU_CAT
|
||||||
|
gMenuLevel = MENU_LEVEL_CAT;
|
||||||
|
UI_MENU_BuildCategoryScreen();
|
||||||
|
gMenuCursor = (gMenuCatCursor < gMenuListCount) ? gMenuCatCursor : 0;
|
||||||
|
#endif
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
gAnotherVoiceID = VOICE_ID_MENU;
|
gAnotherVoiceID = VOICE_ID_MENU;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+74
-3
@@ -85,10 +85,10 @@ void MENU_StartCssScan(void)
|
|||||||
void MENU_CssScanFound(void)
|
void MENU_CssScanFound(void)
|
||||||
{
|
{
|
||||||
if(gScanCssResultType == CODE_TYPE_DIGITAL || gScanCssResultType == CODE_TYPE_REVERSE_DIGITAL) {
|
if(gScanCssResultType == CODE_TYPE_DIGITAL || gScanCssResultType == CODE_TYPE_REVERSE_DIGITAL) {
|
||||||
gMenuCursor = UI_MENU_GetMenuIdx(MENU_R_DCS);
|
gMenuCursor = UI_MENU_GetViewPos(MENU_R_DCS);
|
||||||
}
|
}
|
||||||
else if(gScanCssResultType == CODE_TYPE_CONTINUOUS_TONE) {
|
else if(gScanCssResultType == CODE_TYPE_CONTINUOUS_TONE) {
|
||||||
gMenuCursor = UI_MENU_GetMenuIdx(MENU_R_CTCS);
|
gMenuCursor = UI_MENU_GetViewPos(MENU_R_CTCS);
|
||||||
}
|
}
|
||||||
|
|
||||||
MENU_ShowCurrentSetting();
|
MENU_ShowCurrentSetting();
|
||||||
@@ -1607,6 +1607,36 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
|
|
||||||
gRequestDisplayScreen = DISPLAY_MENU;
|
gRequestDisplayScreen = DISPLAY_MENU;
|
||||||
|
|
||||||
|
#ifdef ENABLE_FEAT_F4HWN_MENU_CAT
|
||||||
|
if (gMenuLevel == MENU_LEVEL_CAT)
|
||||||
|
{ // saut-par-numero global : depuis l'ecran categories, entre dans All a l'item N
|
||||||
|
const uint8_t allCount = UI_MENU_CategoryItemCount(CAT_ALL);
|
||||||
|
uint16_t value;
|
||||||
|
|
||||||
|
if (gInputBoxIndex >= 2) {
|
||||||
|
gInputBoxIndex = 0;
|
||||||
|
value = (gInputBox[0] * 10) + gInputBox[1];
|
||||||
|
} else {
|
||||||
|
value = gInputBox[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (value > 0 && value <= allCount)
|
||||||
|
{
|
||||||
|
gMenuCategory = CAT_ALL;
|
||||||
|
gMenuCatCursor = gMenuListCount - 1; // All = derniere entree de gCatOrder
|
||||||
|
UI_MENU_BuildView();
|
||||||
|
gMenuLevel = MENU_LEVEL_ITEMS;
|
||||||
|
gMenuCursor = value - 1;
|
||||||
|
gFlagRefreshSetting = true;
|
||||||
|
}
|
||||||
|
else if (gInputBoxIndex == 0)
|
||||||
|
{
|
||||||
|
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!gIsInSubMenu)
|
if (!gIsInSubMenu)
|
||||||
{
|
{
|
||||||
switch (gInputBoxIndex)
|
switch (gInputBoxIndex)
|
||||||
@@ -1821,6 +1851,22 @@ Skip:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ENABLE_FEAT_F4HWN_MENU_CAT
|
||||||
|
if (gMenuLevel == MENU_LEVEL_ITEMS)
|
||||||
|
{ // remonter aux categories au lieu de quitter le menu
|
||||||
|
gCatLastPos[gMenuCategory] = gMenuCursor; // memorise la position dans la categorie
|
||||||
|
gMenuLevel = MENU_LEVEL_CAT;
|
||||||
|
UI_MENU_BuildCategoryScreen();
|
||||||
|
gMenuCursor = gMenuCatCursor;
|
||||||
|
gRequestDisplayScreen = DISPLAY_MENU;
|
||||||
|
#ifdef ENABLE_VOICE
|
||||||
|
gAnotherVoiceID = VOICE_ID_CANCEL;
|
||||||
|
#endif
|
||||||
|
gPttWasReleased = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
gAnotherVoiceID = VOICE_ID_CANCEL;
|
gAnotherVoiceID = VOICE_ID_CANCEL;
|
||||||
#endif
|
#endif
|
||||||
@@ -1854,13 +1900,28 @@ static void MENU_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
|
|||||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||||
gRequestDisplayScreen = DISPLAY_MENU;
|
gRequestDisplayScreen = DISPLAY_MENU;
|
||||||
|
|
||||||
|
#ifdef ENABLE_FEAT_F4HWN_MENU_CAT
|
||||||
|
if (gMenuLevel == MENU_LEVEL_CAT)
|
||||||
|
{ // niveau categories : MENU descend dans la categorie choisie
|
||||||
|
gMenuCatCursor = gMenuCursor;
|
||||||
|
gMenuCategory = gCatOrder[gMenuCursor];
|
||||||
|
|
||||||
|
UI_MENU_BuildView();
|
||||||
|
gMenuLevel = MENU_LEVEL_ITEMS;
|
||||||
|
gMenuCursor = (gCatLastPos[gMenuCategory] < gMenuListCount) ? gCatLastPos[gMenuCategory] : 0;
|
||||||
|
gIsInSubMenu = false;
|
||||||
|
gFlagRefreshSetting = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!gIsInSubMenu)
|
if (!gIsInSubMenu)
|
||||||
{
|
{
|
||||||
const int m = UI_MENU_GetCurrentMenuId();
|
const int m = UI_MENU_GetCurrentMenuId();
|
||||||
|
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
if (m != MENU_SCR)
|
if (m != MENU_SCR)
|
||||||
gAnotherVoiceID = MenuList[gMenuCursor].voice_id;
|
gAnotherVoiceID = MenuList[gMenuIndices[gMenuCursor]].voice_id;
|
||||||
#endif
|
#endif
|
||||||
if (m == MENU_UPCODE
|
if (m == MENU_UPCODE
|
||||||
|| m == MENU_DWCODE
|
|| m == MENU_DWCODE
|
||||||
@@ -2060,6 +2121,16 @@ static void MENU_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
|||||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ENABLE_FEAT_F4HWN_MENU_CAT
|
||||||
|
if (gMenuLevel == MENU_LEVEL_CAT)
|
||||||
|
{ // niveau categories : deplacement simple du curseur
|
||||||
|
gMenuCursor = NUMBER_AddWithWraparound(gMenuCursor, -Direction, 0, gMenuListCount - 1);
|
||||||
|
gFlagRefreshSetting = true; // rearme le timeout menu (ShowCurrentSetting saute au niveau CAT)
|
||||||
|
gRequestDisplayScreen = DISPLAY_MENU;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!gEeprom.SET_NAV && gIsInSubMenu) {
|
if (!gEeprom.SET_NAV && gIsInSubMenu) {
|
||||||
Direction = -Direction;
|
Direction = -Direction;
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-8
@@ -164,19 +164,17 @@ void Main(void)
|
|||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
gEeprom.KEY_LOCK = 0;
|
gEeprom.KEY_LOCK = 0;
|
||||||
SETTINGS_SaveSettings();
|
SETTINGS_SaveSettings();
|
||||||
|
#ifdef ENABLE_FEAT_F4HWN_MENU_CAT
|
||||||
|
gMenuLevel = MENU_LEVEL_ITEMS;
|
||||||
|
gMenuCategory = CAT_ALL;
|
||||||
|
#endif
|
||||||
gMenuCursor = UI_MENU_GetMenuIdx(FIRST_HIDDEN_MENU_ITEM);
|
gMenuCursor = UI_MENU_GetMenuIdx(FIRST_HIDDEN_MENU_ITEM);
|
||||||
gSubMenuSelection = gSetting_F_LOCK;
|
gSubMenuSelection = gSetting_F_LOCK;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// count the number of menu items
|
// build the current menu view (Etape 1: vue = All, identite)
|
||||||
gMenuListCount = 0;
|
UI_MENU_BuildView();
|
||||||
while (MenuList[gMenuListCount].name[0] != '\0') {
|
|
||||||
if(!gF_LOCK && MenuList[gMenuListCount].menu_id == FIRST_HIDDEN_MENU_ITEM)
|
|
||||||
break;
|
|
||||||
|
|
||||||
gMenuListCount++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// wait for user to release all butts before moving on
|
// wait for user to release all butts before moving on
|
||||||
if (GPIO_IsPttPressed() ||
|
if (GPIO_IsPttPressed() ||
|
||||||
|
|||||||
+237
-8
@@ -535,9 +535,15 @@ const uint8_t gSubMenu_SIDEFUNCTIONS_size = ARRAY_SIZE(gSubMenu_SIDEFUNCTIONS);
|
|||||||
|
|
||||||
bool gIsInSubMenu;
|
bool gIsInSubMenu;
|
||||||
uint8_t gMenuCursor;
|
uint8_t gMenuCursor;
|
||||||
|
uint8_t gMenuIndices[ARRAY_SIZE(MenuList)]; // Etape 1: table position affichee -> index MenuList (vue courante)
|
||||||
|
|
||||||
int UI_MENU_GetCurrentMenuId() {
|
int UI_MENU_GetCurrentMenuId() {
|
||||||
if(gMenuCursor < ARRAY_SIZE(MenuList))
|
#ifdef ENABLE_FEAT_F4HWN_MENU_CAT
|
||||||
return MenuList[gMenuCursor].menu_id;
|
if (gMenuLevel == MENU_LEVEL_CAT)
|
||||||
|
return 0xFF; // pas d'item courant au niveau categories
|
||||||
|
#endif
|
||||||
|
if(gMenuCursor < gMenuListCount)
|
||||||
|
return MenuList[gMenuIndices[gMenuCursor]].menu_id;
|
||||||
|
|
||||||
return MenuList[ARRAY_SIZE(MenuList)-1].menu_id;
|
return MenuList[ARRAY_SIZE(MenuList)-1].menu_id;
|
||||||
}
|
}
|
||||||
@@ -550,6 +556,221 @@ uint8_t UI_MENU_GetMenuIdx(uint8_t id)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Position dans la vue courante (gMenuIndices) du menu_id, ou gMenuCursor si absent.
|
||||||
|
// En vue All (identite) equivaut a UI_MENU_GetMenuIdx ; en vue categorie, donne la
|
||||||
|
// position filtree correcte.
|
||||||
|
uint8_t UI_MENU_GetViewPos(uint8_t id)
|
||||||
|
{
|
||||||
|
for (uint8_t i = 0; i < gMenuListCount; i++)
|
||||||
|
if (MenuList[gMenuIndices[i]].menu_id == id)
|
||||||
|
return i;
|
||||||
|
return gMenuCursor;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef ENABLE_FEAT_F4HWN_MENU_CAT
|
||||||
|
// --- Etape 2a : donnee du classement par categorie (cible Fusion) ---
|
||||||
|
// Chaque liste = les menu_id d'une categorie, DANS l'ordre d'affichage voulu
|
||||||
|
// (ex. SetPwr colle a Power). CAT_ALL n'a pas de liste : il reprend MenuList
|
||||||
|
// tel quel, donc ordre et numeros d'origine preserves.
|
||||||
|
const char *const CategoryNames[CAT_COUNT] = {
|
||||||
|
[CAT_CHANNELS] = "Channels",
|
||||||
|
[CAT_SCAN] = "Scan",
|
||||||
|
[CAT_KEYS] = "Keys",
|
||||||
|
[CAT_POWER] = "Power",
|
||||||
|
[CAT_DISPLAY] = "Display",
|
||||||
|
[CAT_TIMERS] = "Timers",
|
||||||
|
[CAT_AUDIO] = "Audio",
|
||||||
|
[CAT_RADIO] = "Radio",
|
||||||
|
[CAT_DTMF] = "DTMF",
|
||||||
|
[CAT_SERVICE] = "Service",
|
||||||
|
[CAT_ALL] = "All",
|
||||||
|
};
|
||||||
|
|
||||||
|
// Les menu_id de sous-features optionnelles sont gardes exactement comme dans
|
||||||
|
// l'enum (menu.h) : sur un preset qui ne les compile pas, ils ne sont pas
|
||||||
|
// references (sinon build KO, ex. preset Custom). Les autres MENU_SET_* sont
|
||||||
|
// sous ENABLE_FEAT_F4HWN, garanti par la dependance CMake (App/CMakeLists.txt).
|
||||||
|
static const uint8_t CatChannels[] = {
|
||||||
|
MENU_STEP, MENU_TXP, MENU_SET_PWR, MENU_R_DCS, MENU_R_CTCS, MENU_T_DCS,
|
||||||
|
MENU_T_CTCS, MENU_SFT_D, MENU_OFFSET, MENU_W_N,
|
||||||
|
#ifdef ENABLE_FEAT_F4HWN_NARROWER
|
||||||
|
MENU_SET_NFM,
|
||||||
|
#endif
|
||||||
|
MENU_BCL, MENU_COMPAND, MENU_AM, MENU_TX_LOCK, MENU_PTT_ID, MENU_LIST_CH,
|
||||||
|
MENU_MEM_CH, MENU_DEL_CH, MENU_MEM_NAME,
|
||||||
|
};
|
||||||
|
static const uint8_t CatScan[] = {
|
||||||
|
MENU_S_LIST, MENU_S_PRI, MENU_S_PRI_CH_1, MENU_S_PRI_CH_2, MENU_SC_REV,
|
||||||
|
#ifdef ENABLE_FEAT_F4HWN_SCAN_FASTER
|
||||||
|
MENU_SET_SCN,
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
static const uint8_t CatKeys[] = {
|
||||||
|
MENU_F1SHRT, MENU_F1LONG, MENU_F2SHRT, MENU_F2LONG, MENU_MLONG, MENU_AUTOLK, MENU_SET_LCK,
|
||||||
|
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
||||||
|
MENU_SET_KEY,
|
||||||
|
#endif
|
||||||
|
MENU_SET_PTT, MENU_1_CALL,
|
||||||
|
};
|
||||||
|
static const uint8_t CatPower[] = {
|
||||||
|
MENU_SAVE, MENU_BAT_TXT,
|
||||||
|
#ifdef ENABLE_FEAT_F4HWN_SLEEP
|
||||||
|
MENU_SET_OFF,
|
||||||
|
#endif
|
||||||
|
#ifdef ENABLE_FEAT_F4HWN_LOGO_SAV
|
||||||
|
MENU_SET_SAV,
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
static const uint8_t CatDisplay[] = { MENU_MDF, MENU_PONMSG, MENU_ABR, MENU_ABR_MIN, MENU_ABR_MAX, MENU_ABR_ON_TX_RX, MENU_SET_CTR, MENU_SET_INV, MENU_SET_MET, MENU_SET_GUI, MENU_VOL };
|
||||||
|
static const uint8_t CatTimers[] = { MENU_TOT, MENU_SET_TOT, MENU_SET_EOT, MENU_SET_TMR };
|
||||||
|
static const uint8_t CatAudio[] = {
|
||||||
|
MENU_MIC, MENU_MIC_BAR, MENU_BEEP,
|
||||||
|
#ifdef ENABLE_FEAT_F4HWN_VOL
|
||||||
|
MENU_SET_VOL,
|
||||||
|
#endif
|
||||||
|
#ifdef ENABLE_FEAT_F4HWN_AUDIO
|
||||||
|
MENU_SET_AUD,
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
static const uint8_t CatRadio[] = { MENU_SQL, MENU_STE, MENU_RP_STE, MENU_ROGER, MENU_VOX, MENU_TDR };
|
||||||
|
static const uint8_t CatDtmf[] = { MENU_UPCODE, MENU_DWCODE, MENU_D_ST, MENU_D_PRE, MENU_D_LIVE_DEC };
|
||||||
|
static const uint8_t CatService[] = { MENU_F_LOCK, MENU_350EN, MENU_BATCAL, MENU_BATTYP, MENU_SET_NAV, MENU_RESET };
|
||||||
|
|
||||||
|
typedef struct { const uint8_t *ids; uint8_t len; } cat_list_t;
|
||||||
|
|
||||||
|
static const cat_list_t CategoryLists[CAT_COUNT] = {
|
||||||
|
[CAT_CHANNELS] = { CatChannels, ARRAY_SIZE(CatChannels) },
|
||||||
|
[CAT_SCAN] = { CatScan, ARRAY_SIZE(CatScan) },
|
||||||
|
[CAT_KEYS] = { CatKeys, ARRAY_SIZE(CatKeys) },
|
||||||
|
[CAT_POWER] = { CatPower, ARRAY_SIZE(CatPower) },
|
||||||
|
[CAT_DISPLAY] = { CatDisplay, ARRAY_SIZE(CatDisplay) },
|
||||||
|
[CAT_TIMERS] = { CatTimers, ARRAY_SIZE(CatTimers) },
|
||||||
|
[CAT_AUDIO] = { CatAudio, ARRAY_SIZE(CatAudio) },
|
||||||
|
[CAT_RADIO] = { CatRadio, ARRAY_SIZE(CatRadio) },
|
||||||
|
[CAT_DTMF] = { CatDtmf, ARRAY_SIZE(CatDtmf) },
|
||||||
|
[CAT_SERVICE] = { CatService, ARRAY_SIZE(CatService) },
|
||||||
|
[CAT_ALL] = { NULL, 0 },
|
||||||
|
};
|
||||||
|
|
||||||
|
uint8_t gMenuCategory = CAT_ALL;
|
||||||
|
|
||||||
|
// Index de 'id' dans MenuList, ou 0xFF si absent (item non compile).
|
||||||
|
static uint8_t menu_find_idx(uint8_t id)
|
||||||
|
{
|
||||||
|
for (uint8_t i = 0; MenuList[i].name[0] != '\0'; i++)
|
||||||
|
if (MenuList[i].menu_id == id)
|
||||||
|
return i;
|
||||||
|
return 0xFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t gMenuLevel = MENU_LEVEL_CAT;
|
||||||
|
uint8_t gCatOrder[CAT_COUNT];
|
||||||
|
uint8_t gMenuCatCursor = 0;
|
||||||
|
uint8_t gCatLastPos[CAT_COUNT]; // derniere position du curseur item, par categorie
|
||||||
|
|
||||||
|
// Nombre d'items presents (compiles) dans une categorie.
|
||||||
|
uint8_t UI_MENU_CategoryItemCount(uint8_t cat)
|
||||||
|
{
|
||||||
|
uint8_t n = 0;
|
||||||
|
|
||||||
|
if (cat == CAT_ALL)
|
||||||
|
{
|
||||||
|
for (uint8_t i = 0; MenuList[i].name[0] != '\0'; i++)
|
||||||
|
{
|
||||||
|
if (!gF_LOCK && MenuList[i].menu_id == FIRST_HIDDEN_MENU_ITEM)
|
||||||
|
break;
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
|
const cat_list_t *cl = &CategoryLists[cat];
|
||||||
|
for (uint8_t k = 0; k < cl->len; k++)
|
||||||
|
if (menu_find_idx(cl->ids[k]) != 0xFF)
|
||||||
|
n++;
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Construit l'ecran niveau categories : gCatOrder = categories visibles,
|
||||||
|
// gMenuListCount = leur nombre. Service n'apparait que si gF_LOCK.
|
||||||
|
void UI_MENU_BuildCategoryScreen(void)
|
||||||
|
{
|
||||||
|
gMenuListCount = 0;
|
||||||
|
for (uint8_t c = 0; c < CAT_COUNT; c++)
|
||||||
|
{
|
||||||
|
if (c == CAT_SERVICE && !gF_LOCK)
|
||||||
|
continue;
|
||||||
|
gCatOrder[gMenuListCount++] = c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Rendu de l'ecran des categories (niveau 1).
|
||||||
|
static void UI_MENU_DrawCategories(void)
|
||||||
|
{
|
||||||
|
char str[16];
|
||||||
|
const unsigned int sep = 64; // separateur decale a droite : noms longs (ex. "Channels")
|
||||||
|
const unsigned int x1 = sep + 2;
|
||||||
|
const unsigned int x2 = LCD_WIDTH - 1;
|
||||||
|
|
||||||
|
UI_DisplayClear();
|
||||||
|
|
||||||
|
UI_DrawLineBuffer(gFrameBuffer, sep, 0, sep, 55, 1);
|
||||||
|
for (uint8_t i = 0; i < sep; i += 2)
|
||||||
|
gFrameBuffer[5][i] = 0x40;
|
||||||
|
|
||||||
|
const int count = gMenuListCount;
|
||||||
|
const int cur = gMenuCursor;
|
||||||
|
|
||||||
|
int prev = cur - 1; if (prev < 0) prev = count - 1;
|
||||||
|
int next = cur + 1; if (next >= count) next = 0;
|
||||||
|
|
||||||
|
if (count > 1)
|
||||||
|
UI_PrintStringSmallNormal(CategoryNames[gCatOrder[prev]], 0, 0, 1);
|
||||||
|
UI_PrintString(CategoryNames[gCatOrder[cur]], 0, 0, 2, 8);
|
||||||
|
if (count > 1)
|
||||||
|
UI_PrintStringSmallNormal(CategoryNames[gCatOrder[next]], 0, 0, 4);
|
||||||
|
|
||||||
|
sprintf(str, "%02u/%02u", 1 + cur, count);
|
||||||
|
UI_PrintStringSmallNormal(str, 6, 0, 6);
|
||||||
|
|
||||||
|
sprintf(str, "%u", UI_MENU_CategoryItemCount(gCatOrder[cur]));
|
||||||
|
UI_PrintString(str, x1, x2, 1, 8);
|
||||||
|
UI_PrintStringSmallNormal("items", x1, x2, 5);
|
||||||
|
|
||||||
|
ST7565_BlitFullScreen();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Construit la "vue" courante = table position affichee -> index MenuList.
|
||||||
|
// Unique endroit qui fixe gMenuListCount + gMenuIndices.
|
||||||
|
// CAT_ALL (defaut) = liste plate, identite -> ordre/numeros d'origine preserves.
|
||||||
|
void UI_MENU_BuildView(void)
|
||||||
|
{
|
||||||
|
gMenuListCount = 0;
|
||||||
|
|
||||||
|
#ifdef ENABLE_FEAT_F4HWN_MENU_CAT
|
||||||
|
if (gMenuCategory != CAT_ALL)
|
||||||
|
{
|
||||||
|
const cat_list_t *cl = &CategoryLists[gMenuCategory];
|
||||||
|
for (uint8_t k = 0; k < cl->len; k++)
|
||||||
|
{
|
||||||
|
uint8_t idx = menu_find_idx(cl->ids[k]);
|
||||||
|
if (idx != 0xFF)
|
||||||
|
gMenuIndices[gMenuListCount++] = idx;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
for (uint8_t i = 0; MenuList[i].name[0] != '\0'; i++)
|
||||||
|
{
|
||||||
|
if (!gF_LOCK && MenuList[i].menu_id == FIRST_HIDDEN_MENU_ITEM)
|
||||||
|
break;
|
||||||
|
|
||||||
|
gMenuIndices[gMenuListCount++] = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int32_t gSubMenuSelection;
|
int32_t gSubMenuSelection;
|
||||||
|
|
||||||
// edit box
|
// edit box
|
||||||
@@ -624,6 +845,14 @@ void UI_DisplayMenu(void)
|
|||||||
char String[64]; // bigger cuz we can now do multi-line in one string (use '\n' char)
|
char String[64]; // bigger cuz we can now do multi-line in one string (use '\n' char)
|
||||||
char top_right_badge[16];
|
char top_right_badge[16];
|
||||||
|
|
||||||
|
#ifdef ENABLE_FEAT_F4HWN_MENU_CAT
|
||||||
|
if (gMenuLevel == MENU_LEVEL_CAT)
|
||||||
|
{
|
||||||
|
UI_MENU_DrawCategories();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
const int m = UI_MENU_GetCurrentMenuId();
|
const int m = UI_MENU_GetCurrentMenuId();
|
||||||
|
|
||||||
#ifdef ENABLE_DTMF_CALLING
|
#ifdef ENABLE_DTMF_CALLING
|
||||||
@@ -647,7 +876,7 @@ void UI_DisplayMenu(void)
|
|||||||
for (i = 0; i < 3; i++)
|
for (i = 0; i < 3; i++)
|
||||||
if (gMenuCursor > 0 || i > 0)
|
if (gMenuCursor > 0 || i > 0)
|
||||||
if ((gMenuListCount - 1) != gMenuCursor || i != 2)
|
if ((gMenuListCount - 1) != gMenuCursor || i != 2)
|
||||||
UI_PrintString(MenuList[gMenuCursor + i - 1].name, 0, 0, i * 2, 8);
|
UI_PrintString(MenuList[gMenuIndices[gMenuCursor + i - 1]].name, 0, 0, i * 2, 8);
|
||||||
|
|
||||||
// invert the current menu list item pixels
|
// invert the current menu list item pixels
|
||||||
for (i = 0; i < (8 * menu_list_width); i++)
|
for (i = 0; i < (8 * menu_list_width); i++)
|
||||||
@@ -683,17 +912,17 @@ void UI_DisplayMenu(void)
|
|||||||
if (prev_index < 0) {
|
if (prev_index < 0) {
|
||||||
prev_index = menu_count - 1;
|
prev_index = menu_count - 1;
|
||||||
}
|
}
|
||||||
UI_PrintStringSmallNormal(MenuList[prev_index].name, 0, 0, 1);
|
UI_PrintStringSmallNormal(MenuList[gMenuIndices[prev_index]].name, 0, 0, 1);
|
||||||
|
|
||||||
// current menu item - keep big n fat
|
// current menu item - keep big n fat
|
||||||
UI_PrintString(MenuList[menu_index].name, 0, 0, 2, 8);
|
UI_PrintString(MenuList[gMenuIndices[menu_index]].name, 0, 0, 2, 8);
|
||||||
|
|
||||||
// trailing menu item - small text
|
// trailing menu item - small text
|
||||||
int next_index = menu_index + 1;
|
int next_index = menu_index + 1;
|
||||||
if (next_index >= menu_count) {
|
if (next_index >= menu_count) {
|
||||||
next_index = 0;
|
next_index = 0;
|
||||||
}
|
}
|
||||||
UI_PrintStringSmallNormal(MenuList[next_index].name, 0, 0, 4);
|
UI_PrintStringSmallNormal(MenuList[gMenuIndices[next_index]].name, 0, 0, 4);
|
||||||
|
|
||||||
|
|
||||||
// draw the menu index number/count
|
// draw the menu index number/count
|
||||||
@@ -706,12 +935,12 @@ void UI_DisplayMenu(void)
|
|||||||
{
|
{
|
||||||
// current menu item
|
// current menu item
|
||||||
// strcat(String, ":");
|
// strcat(String, ":");
|
||||||
UI_PrintString(MenuList[menu_index].name, 0, 0, 0, 8);
|
UI_PrintString(MenuList[gMenuIndices[menu_index]].name, 0, 0, 0, 8);
|
||||||
// UI_PrintStringSmallNormal(String, 0, 0, 0);
|
// UI_PrintStringSmallNormal(String, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
sprintf(String, "%02u/%u", 1 + menu_index, menu_count);
|
sprintf(String, "%02u/%02u", 1 + menu_index, menu_count);
|
||||||
UI_PrintStringSmallNormal(String, 6, 0, 6);
|
UI_PrintStringSmallNormal(String, 6, 0, 6);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -169,6 +169,37 @@ enum
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef ENABLE_FEAT_F4HWN_MENU_CAT
|
||||||
|
// Categories (niveau 1) — l'ordre = ordre d'affichage de l'ecran des categories.
|
||||||
|
enum {
|
||||||
|
CAT_CHANNELS = 0,
|
||||||
|
CAT_SCAN,
|
||||||
|
CAT_KEYS,
|
||||||
|
CAT_POWER,
|
||||||
|
CAT_DISPLAY,
|
||||||
|
CAT_TIMERS,
|
||||||
|
CAT_AUDIO,
|
||||||
|
CAT_RADIO,
|
||||||
|
CAT_DTMF,
|
||||||
|
CAT_SERVICE, // menu cache : n'apparait que si gF_LOCK
|
||||||
|
CAT_ALL, // liste plate complete, ordre et numeros d'origine
|
||||||
|
CAT_COUNT
|
||||||
|
};
|
||||||
|
|
||||||
|
#define MENU_LEVEL_CAT 0
|
||||||
|
#define MENU_LEVEL_ITEMS 1
|
||||||
|
|
||||||
|
extern const char *const CategoryNames[];
|
||||||
|
extern uint8_t gMenuCategory;
|
||||||
|
extern uint8_t gMenuLevel;
|
||||||
|
extern uint8_t gCatOrder[];
|
||||||
|
extern uint8_t gMenuCatCursor;
|
||||||
|
extern uint8_t gCatLastPos[];
|
||||||
|
|
||||||
|
void UI_MENU_BuildCategoryScreen(void);
|
||||||
|
uint8_t UI_MENU_CategoryItemCount(uint8_t cat);
|
||||||
|
#endif
|
||||||
|
|
||||||
extern const uint8_t FIRST_HIDDEN_MENU_ITEM;
|
extern const uint8_t FIRST_HIDDEN_MENU_ITEM;
|
||||||
extern const t_menu_item MenuList[];
|
extern const t_menu_item MenuList[];
|
||||||
|
|
||||||
@@ -249,6 +280,7 @@ extern const t_sidefunction gSubMenu_SIDEFUNCTIONS[];
|
|||||||
extern bool gIsInSubMenu;
|
extern bool gIsInSubMenu;
|
||||||
|
|
||||||
extern uint8_t gMenuCursor;
|
extern uint8_t gMenuCursor;
|
||||||
|
extern uint8_t gMenuIndices[];
|
||||||
|
|
||||||
extern int32_t gSubMenuSelection;
|
extern int32_t gSubMenuSelection;
|
||||||
|
|
||||||
@@ -260,5 +292,7 @@ extern bool edit_is_uppercase;
|
|||||||
void UI_DisplayMenu(void);
|
void UI_DisplayMenu(void);
|
||||||
int UI_MENU_GetCurrentMenuId();
|
int UI_MENU_GetCurrentMenuId();
|
||||||
uint8_t UI_MENU_GetMenuIdx(uint8_t id);
|
uint8_t UI_MENU_GetMenuIdx(uint8_t id);
|
||||||
|
uint8_t UI_MENU_GetViewPos(uint8_t id);
|
||||||
|
void UI_MENU_BuildView(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -79,6 +79,7 @@
|
|||||||
"ENABLE_FEAT_F4HWN_RXTX_LOG_K5VIEWER": false,
|
"ENABLE_FEAT_F4HWN_RXTX_LOG_K5VIEWER": false,
|
||||||
"ENABLE_FEAT_F4HWN_LOGO": false,
|
"ENABLE_FEAT_F4HWN_LOGO": false,
|
||||||
"ENABLE_FEAT_F4HWN_LOGO_SAV": false,
|
"ENABLE_FEAT_F4HWN_LOGO_SAV": false,
|
||||||
|
"ENABLE_FEAT_F4HWN_MENU_CAT": false,
|
||||||
"ENABLE_AGC_SHOW_DATA": false,
|
"ENABLE_AGC_SHOW_DATA": false,
|
||||||
"ENABLE_UART_RW_BK_REGS": false,
|
"ENABLE_UART_RW_BK_REGS": false,
|
||||||
"ENABLE_SWD": false,
|
"ENABLE_SWD": false,
|
||||||
@@ -216,6 +217,7 @@
|
|||||||
"ENABLE_FEAT_F4HWN_MEM": true,
|
"ENABLE_FEAT_F4HWN_MEM": true,
|
||||||
"ENABLE_FEAT_F4HWN_LOGO": true,
|
"ENABLE_FEAT_F4HWN_LOGO": true,
|
||||||
"ENABLE_FEAT_F4HWN_LOGO_SAV": true,
|
"ENABLE_FEAT_F4HWN_LOGO_SAV": true,
|
||||||
|
"ENABLE_FEAT_F4HWN_MENU_CAT": true,
|
||||||
"ENABLE_SWD": true,
|
"ENABLE_SWD": true,
|
||||||
"EDITION_STRING": "Fusion",
|
"EDITION_STRING": "Fusion",
|
||||||
"TARGET": "f4hwn.fusion"
|
"TARGET": "f4hwn.fusion"
|
||||||
|
|||||||
Binary file not shown.
Reference in new issue
Block a user