Do some stuff
All checks were successful
Build Firmware / build (push) Successful in 3m32s

This commit is contained in:
2025-03-04 16:46:02 +01:00
parent fabf38f1bc
commit 72558f93f3
34 changed files with 937 additions and 1248 deletions

229
ui/menu.c
View File

@@ -54,7 +54,6 @@ const t_menu_item MenuList[] =
{"COMP", MENU_COMPAND},
{"Mod", MENU_AM}, // was "AM"
#ifdef ENABLE_FEAT_F4HWN
{"TXLck", MENU_TX_LOCK},
#endif
{"ScAdd1", MENU_S_ADD1},
{"ScAdd2", MENU_S_ADD2},
@@ -131,15 +130,12 @@ const t_menu_item MenuList[] =
{"RxMode", MENU_TDR},
{"Sql", MENU_SQL},
#ifdef ENABLE_FEAT_F4HWN
{"SPwr", MENU_SET_PWR},
{"SPTT", MENU_SET_PTT},
{"STOT", MENU_SET_TOT},
{"SEOT", MENU_SET_EOT},
{"SCtr", MENU_SET_CTR},
{"SInv", MENU_SET_INV},
{"SLck", MENU_SET_LCK},
//{"SMet", MENU_SET_MET},
//{"SGUI", MENU_SET_GUI},
{"STmr", MENU_SET_TMR},
#ifdef ENABLE_FEAT_F4HWN_SLEEP
{"SOff", MENU_SET_OFF},
@@ -160,13 +156,6 @@ const t_menu_item MenuList[] =
// hidden menu items from here on
// enabled if pressing both the PTT and upper side button at power-on
{"F Lock", MENU_F_LOCK},
#ifndef ENABLE_FEAT_F4HWN
{"Tx 200", MENU_200TX }, // was "200TX"
{"Tx 350", MENU_350TX }, // was "350TX"
{"Tx 500", MENU_500TX }, // was "500TX"
{"350 En", MENU_350EN }, // was "350EN"
#endif
//{"ScraEn", MENU_SCREN }, // was "SCREN"
#ifdef ENABLE_F_CAL_MENU
{"FrCali", MENU_F_CALI}, // reference xtal calibration
#endif
@@ -177,18 +166,15 @@ const t_menu_item MenuList[] =
{"", 0xff} // end of list - DO NOT delete or move this this
};
const uint8_t FIRST_HIDDEN_MENU_ITEM = MENU_F_LOCK;
const char gSubMenu_TXP[][6] =
const char gSubMenu_TXP[][5] =
{
"USR",
"L1",
"L2",
"L3",
"L4",
"L5",
"M",
"H"
"<.02",
".125",
".25",
".5",
"1",
"2",
"5"
};
const char gSubMenu_SFT_D[][4] =
@@ -333,32 +319,7 @@ const char gSubMenu_BATTYP[][9] =
"35"
};
const char gSubMenu_SCRAMBLER[][7] =
{
"OFF",
"26K",
"27K",
"28K",
"29K",
"30K",
"31K",
"32K",
"33K",
"34K",
"35K"
};
#ifdef ENABLE_FEAT_F4HWN
const char gSubMenu_SET_PWR[][6] =
{
"<.02",
".125",
".25",
".5",
"1",
"2",
"5"
};
const char gSubMenu_SET_PTT[][8] =
{
@@ -374,12 +335,6 @@ const char gSubMenu_SET_TOT[][7] = // Use by SET_EOT too
"ALL"
};
const char gSubMenu_SET_LCK[][9] =
{
"KEY",
"KEY+PTT"
};
#ifdef ENABLE_FEAT_F4HWN_NARROWER
const char gSubMenu_SET_NFM[][9] =
{
@@ -500,7 +455,7 @@ void UI_DisplayMenu(void) {
for (i = 0; i < 3; i++)
if (gMenuCursor > 0 || i > 0)
if ((gMenuListCount - 1) != gMenuCursor || i != 2)
UI_PrintString(MenuList[gMenuCursor + i - 1].name, 0, 0, i * 2, 8);
UI_PrintString(MenuList[gMenuCursor + i - 1].name, 0, 0, i * 2 /*, 8 */);
// invert the current menu list item pixels
for (i = 0; i < (8 * menu_list_width); i++)
@@ -525,14 +480,17 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
#else
{ // new menu layout .. experimental & unfinished
const int menu_index = gMenuCursor; // current selected menu item
i = 1;
i = 0;
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)
UI_PrintStringSmallNormal(MenuList[(gMenuListCount + k) % gMenuListCount].name, 0, 0,
i); // wrap-around
else if (k >= (int) gMenuListCount)
UI_PrintStringSmallNormal(MenuList[k % gMenuListCount].name, 0, 0, i); // wrap-around
else
UI_PrintStringSmallNormal(MenuList[k].name, 0, 0, i);
i++;
}
@@ -546,10 +504,13 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
while (i < 5) { // trailing menu item - small text
const int k = menu_index + i - 2;
if (k >= 0 && k < (int) gMenuListCount)
UI_PrintStringSmallNormal(MenuList[k].name, 0, 0, i);
if (k < 0)
UI_PrintStringSmallNormal(MenuList[(gMenuListCount + k) % gMenuListCount].name, 0, 0,
i); // wrap-around
else if (k >= (int) gMenuListCount)
UI_PrintStringSmallNormal(MenuList[gMenuListCount - k].name, 0, 0, i); // wrap-a-round
UI_PrintStringSmallNormal(MenuList[k % gMenuListCount].name, 0, 0, i); // wrap-around
else
UI_PrintStringSmallNormal(MenuList[k].name, 0, 0, i);
i++;
}
@@ -560,7 +521,7 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
#endif
} else if (menu_index >= 0 && menu_index < (int) gMenuListCount) { // current menu item
// strcat(String, ":");
UI_PrintString(MenuList[menu_index].name, 0, 0, 0, 8);
UI_PrintString(MenuList[menu_index].name, 0, 0, 0 /*, 8 */);
// UI_PrintStringSmallNormal(String, 0, 0, 0);
}
@@ -615,11 +576,7 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
}
case MENU_TXP:
if (gSubMenuSelection == 0) {
strcpy(String, gSubMenu_TXP[gSubMenuSelection]);
} else {
sprintf(String, "%s\n%sW", gSubMenu_TXP[gSubMenuSelection], gSubMenu_SET_PWR[gSubMenuSelection - 1]);
}
sprintf(String, "%sW", gSubMenu_TXP[gSubMenuSelection]);
break;
case MENU_R_DCS:
@@ -649,14 +606,14 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
case MENU_OFFSET:
if (!gIsInSubMenu || gInputBoxIndex == 0) {
sprintf(String, "%3d.%05u", gSubMenuSelection / 100000, abs(gSubMenuSelection) % 100000);
UI_PrintString(String, menu_item_x1, menu_item_x2, 1, 8);
UI_PrintString(String, menu_item_x1, menu_item_x2, 1 /*, 8 */);
} else {
const char *ascii = INPUTBOX_GetAscii();
sprintf(String, "%.3s.%.3s ", ascii, ascii + 3);
UI_PrintString(String, menu_item_x1, menu_item_x2, 1, 8);
UI_PrintString(String, menu_item_x1, menu_item_x2, 1 /*, 8 */);
}
UI_PrintString("MHz", menu_item_x1, menu_item_x2, 3, 8);
UI_PrintString("MHz", menu_item_x1, menu_item_x2, 3 /*, 8 */);
already_printed = true;
break;
@@ -666,11 +623,13 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
break;
case MENU_SCR:
strcpy(String, gSubMenu_SCRAMBLER[gSubMenuSelection]);
if (gSubMenuSelection > 0)
if (gSubMenuSelection > 0) {
sprintf(String, "%d00", gSubMenuSelection + 25);
BK4819_EnableScramble(gSubMenuSelection - 1);
else
} else {
strcpy(String, "OFF");
BK4819_DisableScramble();
}
break;
case MENU_VOX:
@@ -757,13 +716,6 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
#ifdef ENABLE_NOAA
case MENU_NOAA_S:
#endif
#ifndef ENABLE_FEAT_F4HWN
case MENU_350TX:
case MENU_200TX:
case MENU_500TX:
#endif
case MENU_350EN:
//case MENU_SCREN:
#ifdef ENABLE_FEAT_F4HWN
case MENU_SET_TMR:
#endif
@@ -776,16 +728,16 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
const bool valid = RADIO_CheckValidChannel(gSubMenuSelection, false, 0);
UI_GenerateChannelStringEx(String, valid, gSubMenuSelection);
UI_PrintString(String, menu_item_x1, menu_item_x2, 0, 8);
UI_PrintString(String, menu_item_x1, menu_item_x2, 0 /*, 8 */);
if (valid && !gAskForConfirmation) { // show the frequency so that the user knows the channels frequency
const uint32_t frequency = SETTINGS_FetchChannelFrequency(gSubMenuSelection);
sprintf(String, "%u.%05u", frequency / 100000, frequency % 100000);
UI_PrintString(String, menu_item_x1, menu_item_x2, 4, 8);
UI_PrintString(String, menu_item_x1, menu_item_x2, 4 /*, 8 */);
}
SETTINGS_FetchChannelName(String, gSubMenuSelection);
UI_PrintString(String[0] ? String : "--", menu_item_x1, menu_item_x2, 2, 8);
UI_PrintString(String[0] ? String : "--", menu_item_x1, menu_item_x2, 2 /*, 8 */);
already_printed = true;
break;
}
@@ -794,7 +746,7 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
const bool valid = RADIO_CheckValidChannel(gSubMenuSelection, false, 0);
UI_GenerateChannelStringEx(String, valid, gSubMenuSelection);
UI_PrintString(String, menu_item_x1, menu_item_x2, 0, 8);
UI_PrintString(String, menu_item_x1, menu_item_x2, 0 /*, 8 */);
if (valid) {
const uint32_t frequency = SETTINGS_FetchChannelFrequency(gSubMenuSelection);
@@ -805,18 +757,18 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
if (edit_index < 0) { // show the channel name
SETTINGS_FetchChannelName(String, gSubMenuSelection);
char *pPrintStr = String[0] ? String : "--";
UI_PrintString(pPrintStr, menu_item_x1, menu_item_x2, 2, 8);
UI_PrintString(pPrintStr, menu_item_x1, menu_item_x2, 2 /*, 8 */);
} else { // show the channel name being edited
//UI_PrintString(edit, menu_item_x1, 0, 2, 8);
UI_PrintString(edit, menu_item_x1, menu_item_x2, 2, 8);
//UI_PrintString(edit, menu_item_x1, 0, 2 /*, 8 */);
UI_PrintString(edit, menu_item_x1, menu_item_x2, 2 /*, 8 */);
if (edit_index < 10)
//UI_PrintString("^", menu_item_x1 + (8 * edit_index), 0, 4, 8); // show the cursor
UI_PrintString("^", menu_item_x1 - 1 + (8 * edit_index), 0, 4, 8); // show the cursor
//UI_PrintString("^", menu_item_x1 + (8 * edit_index), 0, 4 /*, 8 */); // show the cursor
UI_PrintString("^", menu_item_x1 - 1 + (8 * edit_index), 0, 4 /*, 8 */); // show the cursor
}
if (!gAskForConfirmation) { // show the frequency so that the user knows the channels frequency
sprintf(String, "%u.%05u", frequency / 100000, frequency % 100000);
UI_PrintString(String, menu_item_x1, menu_item_x2, 4 + (gIsInSubMenu && edit_index >= 0), 8);
UI_PrintString(String, menu_item_x1, menu_item_x2, 4 + (gIsInSubMenu && edit_index >= 0) /*, 8 */);
}
}
@@ -958,17 +910,17 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
break;
#ifdef ENABLE_F_CAL_MENU
case MENU_F_CALI: {
const uint32_t value = 22656 + gSubMenuSelection;
const uint32_t xtal_Hz = (0x4f0000u + value) * 5;
case MENU_F_CALI: {
const uint32_t value = 22656 + gSubMenuSelection;
const uint32_t xtal_Hz = (0x4f0000u + value) * 5;
writeXtalFreqCal(gSubMenuSelection, false);
writeXtalFreqCal(gSubMenuSelection, false);
sprintf(String, "%d\n%u.%06u\nMHz",
gSubMenuSelection,
xtal_Hz / 1000000, xtal_Hz % 1000000);
}
break;
sprintf(String, "%d\n%u.%06u\nMHz",
gSubMenuSelection,
xtal_Hz / 1000000, xtal_Hz % 1000000);
}
break;
#endif
case MENU_BATCAL: {
@@ -1006,10 +958,6 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
#endif
#ifdef ENABLE_FEAT_F4HWN
case MENU_SET_PWR:
sprintf(String, "%s\n%sW", gSubMenu_TXP[gSubMenuSelection + 1], gSubMenu_SET_PWR[gSubMenuSelection]);
break;
case MENU_SET_PTT:
strcpy(String, gSubMenu_SET_PTT[gSubMenuSelection]);
break;
@@ -1038,23 +986,6 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
#endif
break;
case MENU_TX_LOCK:
if (TX_freq_check(gEeprom.VfoInfo[gEeprom.TX_VFO].pRX->Frequency) == 0) {
strcpy(String, "Inside\nF Lock\nPlan");
} else {
strcpy(String, gSubMenu_OFF_ON[gSubMenuSelection]);
}
break;
case MENU_SET_LCK:
strcpy(String, gSubMenu_SET_LCK[gSubMenuSelection]);
break;
//case MENU_SET_MET:
//case MENU_SET_GUI:
strcpy(String, gSubMenu_SET_MET[gSubMenuSelection]); // Same as SET_MET
break;
#ifdef ENABLE_FEAT_F4HWN_NARROWER
case MENU_SET_NFM:
strcpy(String, gSubMenu_SET_NFM[gSubMenuSelection]);
@@ -1062,25 +993,25 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
#endif
#ifdef ENABLE_FEAT_F4HWN_VOL
case MENU_SET_VOL:
if (gSubMenuSelection == 0) {
strcpy(String, gSubMenu_OFF_ON[0]);
} else if (gSubMenuSelection < 64) {
sprintf(String, "%02u", gSubMenuSelection);
case MENU_SET_VOL:
if (gSubMenuSelection == 0) {
strcpy(String, gSubMenu_OFF_ON[0]);
} else if (gSubMenuSelection < 64) {
sprintf(String, "%02u", gSubMenuSelection);
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
//ST7565_Gauge(4, 1, 63, gSubMenuSelection);
gaugeLine = 4;
gaugeMin = 1;
gaugeMax = 63;
//ST7565_Gauge(4, 1, 63, gSubMenuSelection);
gaugeLine = 4;
gaugeMin = 1;
gaugeMax = 63;
#endif
}
gEeprom.VOLUME_GAIN = gSubMenuSelection;
BK4819_WriteRegister(BK4819_REG_48,
(11u << 12) | // ??? .. 0 ~ 15, doesn't seem to make any difference
(0u << 10) | // AF Rx Gain-1
(gEeprom.VOLUME_GAIN << 4) | // AF Rx Gain-2
(gEeprom.DAC_GAIN << 0)); // AF DAC Gain (after Gain-1 and Gain-2)
break;
}
gEeprom.VOLUME_GAIN = gSubMenuSelection;
BK4819_WriteRegister(BK4819_REG_48,
(11u << 12) | // ??? .. 0 ~ 15, doesn't seem to make any difference
(0u << 10) | // AF Rx Gain-1
(gEeprom.VOLUME_GAIN << 4) | // AF Rx Gain-2
(gEeprom.DAC_GAIN << 0)); // AF DAC Gain (after Gain-1 and Gain-2)
break;
#endif
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
@@ -1092,11 +1023,11 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
}
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
if (gaugeLine != 0) {
ST7565_Gauge(gaugeLine, gaugeMin, gaugeMax, gSubMenuSelection);
}
#endif
//#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
// if (gaugeLine != 0) {
// ST7565_Gauge(gaugeLine, gaugeMin, gaugeMax, gSubMenuSelection);
// }
//#endif
if (!already_printed) { // we now do multi-line text in a single string
@@ -1135,7 +1066,7 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
if (small)
UI_PrintStringSmallNormal(String + i, menu_item_x1, menu_item_x2, y);
else
UI_PrintString(String + i, menu_item_x1, menu_item_x2, y, 8);
UI_PrintString(String + i, menu_item_x1, menu_item_x2, y /*, 8 */);
// look for start of next line
while (i < len && String[i] >= 32)
@@ -1164,21 +1095,21 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
}
// channel number
UI_PrintString(pPrintStr, menu_item_x1, menu_item_x2, 0, 8);
UI_PrintString(pPrintStr, menu_item_x1, menu_item_x2, 0 /*, 8 */);
SETTINGS_FetchChannelName(String, gSubMenuSelection);
pPrintStr = String[0] ? String : "--";
// channel name and scan-list
if (gSubMenuSelection < 0 || !gEeprom.SCAN_LIST_ENABLED[i]) {
UI_PrintString(pPrintStr, menu_item_x1, menu_item_x2, 2, 8);
UI_PrintString(pPrintStr, menu_item_x1, menu_item_x2, 2 /*, 8 */);
} else {
/*
UI_PrintStringSmallNormal(pPrintStr, menu_item_x1, menu_item_x2, 2);
if (IS_MR_CHANNEL(gEeprom.SCANLIST_PRIORITY_CH1[i])) {
sprintf(String, "PRI%d:%u", 1, gEeprom.SCANLIST_PRIORITY_CH1[i] + 1);
UI_PrintString(String, menu_item_x1, menu_item_x2, 3, 8);
UI_PrintString(String, menu_item_x1, menu_item_x2, 3 , 8);
}
if (IS_MR_CHANNEL(gEeprom.SCANLIST_PRIORITY_CH2[i])) {
@@ -1194,7 +1125,7 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
if (IS_MR_CHANNEL(channel)) {
sprintf(String, "PRI%d:%u", pri, channel + 1);
UI_PrintString(String, menu_item_x1, menu_item_x2, pri * 2 + 1, 8);
UI_PrintString(String, menu_item_x1, menu_item_x2, pri * 2 + 1 /*, 8 */);
}
}
@@ -1202,14 +1133,14 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
}
if ((UI_MENU_GetCurrentMenuId() == MENU_R_CTCS || UI_MENU_GetCurrentMenuId() == MENU_R_DCS) && gCssBackgroundScan)
UI_PrintString("SCAN", menu_item_x1, menu_item_x2, 4, 8);
UI_PrintString("SCAN", menu_item_x1, menu_item_x2, 4 /*, 8 */);
#ifdef ENABLE_DTMF_CALLING
if (UI_MENU_GetCurrentMenuId() == MENU_D_LIST && gIsDtmfContactValid) {
Contact[11] = 0;
memcpy(&gDTMF_ID, Contact + 8, 4);
sprintf(String, "ID:%4s", gDTMF_ID);
UI_PrintString(String, menu_item_x1, menu_item_x2, 4, 8);
UI_PrintString(String, menu_item_x1, menu_item_x2, 4 /*, 8 */);
}
#endif
@@ -1230,7 +1161,7 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
UI_MENU_GetCurrentMenuId() == MENU_MEM_NAME ||
UI_MENU_GetCurrentMenuId() == MENU_DEL_CH) && gAskForConfirmation) { // display confirmation
char *pPrintStr = (gAskForConfirmation == 1) ? "SURE?" : "WAIT!";
UI_PrintString(pPrintStr, menu_item_x1, menu_item_x2, 5, 8);
UI_PrintString(pPrintStr, menu_item_x1, menu_item_x2, 5 /*, 8 */);
}
ST7565_BlitFullScreen();