0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-04-28 22:31:25 +03:00

Fix menu and backlight time out

This commit is contained in:
OneOfEleven 2023-09-15 17:45:07 +01:00
parent 605fcf5217
commit 43b9c0944a
8 changed files with 172 additions and 104 deletions

View File

@ -1448,6 +1448,10 @@ void APP_TimeSlice500ms(void)
if (--gKeypadLocked == 0)
gUpdateDisplay = true;
if (gKeyInputCountdown > 0)
if (--gKeyInputCountdown == 0)
cancelUserInputModes();
// Skipped authentic device check
#ifdef ENABLE_FMRADIO
@ -1468,10 +1472,6 @@ void APP_TimeSlice500ms(void)
gBatteryCheckCounter++;
if (gKeyInputCountdown > 0)
if (--gKeyInputCountdown == 0)
cancelUserInputModes();
// Skipped authentic device check
if (gCurrentFunction != FUNCTION_TRANSMIT)
@ -1495,7 +1495,7 @@ void APP_TimeSlice500ms(void)
#ifdef ENABLE_FMRADIO
if ((gFM_ScanState == FM_SCAN_OFF || gAskToSave) && gCssScanMode == CSS_SCAN_MODE_OFF)
#else
if (gAskToSave && gCssScanMode == CSS_SCAN_MODE_OFF)
if (gCssScanMode == CSS_SCAN_MODE_OFF)
#endif
{
if (gBacklightCountdown > 0)

View File

@ -142,77 +142,110 @@ int MENU_GetLimits(uint8_t Cursor, uint8_t *pMin, uint8_t *pMax)
break;
case MENU_ABR:
case MENU_F_LOCK:
*pMin = 0;
*pMax = 5;
break;
case MENU_MDF:
#ifdef ENABLE_CHAN_NAME_FREQ
case MENU_F_LOCK:
*pMin = 0;
*pMax = 3;
*pMax = ARRAY_SIZE(gSubMenu_F_LOCK) - 1;
break;
case MENU_MDF:
*pMin = 0;
*pMax = ARRAY_SIZE(gSubMenu_MDF) - 1;
break;
case MENU_TXP:
*pMin = 0;
*pMax = ARRAY_SIZE(gSubMenu_TXP) - 1;
break;
case MENU_SFT_D:
*pMin = 0;
*pMax = ARRAY_SIZE(gSubMenu_SFT_D) - 1;
break;
case MENU_TDR:
case MENU_XB:
*pMin = 0;
*pMax = ARRAY_SIZE(gSubMenu_CHAN) - 1;
break;
#ifdef ENABLE_VOICE
case MENU_VOICE:
*pMin = 0;
*pMax = ARRAY_SIZE(gSubMenu_VOICE) - 1;
break;
#endif
// Fallthrough
case MENU_TXP:
case MENU_SFT_D:
case MENU_TDR:
case MENU_XB:
#ifdef ENABLE_VOICE
case MENU_VOICE:
#endif
case MENU_SC_REV:
*pMin = 0;
*pMax = ARRAY_SIZE(gSubMenu_SC_REV) - 1;
break;
case MENU_ROGER:
*pMin = 0;
*pMax = 2;
*pMax = ARRAY_SIZE(gSubMenu_ROGER) - 1;
break;
case MENU_PONMSG:
*pMin = 0;
*pMax = 3;
*pMax = ARRAY_SIZE(gSubMenu_PONMSG) - 1;
break;
case MENU_R_DCS:
case MENU_T_DCS:
*pMin = 0;
*pMax = 208;
//*pMax = (ARRAY_SIZE(DCS_Options) * 2);
break;
case MENU_R_CTCS:
case MENU_T_CTCS:
*pMin = 0;
*pMax = 50;
*pMax = ARRAY_SIZE(CTCSS_Options) - 1;
break;
case MENU_W_N:
*pMin = 0;
*pMax = ARRAY_SIZE(gSubMenu_W_N) - 1;
break;
#ifdef ENABLE_ALARM
case MENU_AL_MOD:
*pMin = 0;
*pMax = ARRAY_SIZE(gSubMenu_AL_MOD) - 1;
break;
#endif
case MENU_RESET:
*pMin = 0;
*pMax = ARRAY_SIZE(gSubMenu_RESET) - 1;
break;
#ifdef ENABLE_COMPANDER
case MENU_COMPAND:
#endif
case MENU_W_N:
case MENU_BCL:
case MENU_BEEP:
case MENU_AUTOLK:
case MENU_S_ADD1:
case MENU_S_ADD2:
case MENU_STE:
#ifdef ENABLE_ALARM
case MENU_AL_MOD:
#endif
case MENU_D_ST:
case MENU_D_DCD:
case MENU_AM:
#ifdef ENABLE_NOAA
case MENU_NOAA_S:
#endif
case MENU_RESET:
case MENU_350TX:
case MENU_200TX:
case MENU_500TX:
case MENU_350EN:
case MENU_SCREN:
*pMin = 0;
*pMax = 1;
*pMax = ARRAY_SIZE(gSubMenu_OFF_ON) - 1;
break;
case MENU_SCR:
@ -233,6 +266,10 @@ int MENU_GetLimits(uint8_t Cursor, uint8_t *pMin, uint8_t *pMax)
break;
case MENU_SAVE:
*pMin = 0;
*pMax = ARRAY_SIZE(gSubMenu_SAVE) - 1;
break;
case MENU_MIC:
*pMin = 0;
*pMax = 4;
@ -244,9 +281,13 @@ int MENU_GetLimits(uint8_t Cursor, uint8_t *pMin, uint8_t *pMax)
break;
case MENU_D_RSP:
*pMin = 0;
*pMax = ARRAY_SIZE(gSubMenu_D_RSP) - 1;
break;
case MENU_PTT_ID:
*pMin = 0;
*pMax = 3;
*pMax = ARRAY_SIZE(gSubMenu_PTT_ID) - 1;
break;
case MENU_D_HOLD:

BIN
firmware

Binary file not shown.

Binary file not shown.

Binary file not shown.

2
misc.c
View File

@ -26,7 +26,7 @@ const uint16_t key_debounce = 2; // 20ms
const uint8_t g_scan_delay = 21; // 210ms
const uint8_t g_menu_timeout = 2 * 30; // 30 seconds
const uint8_t g_menu_timeout = 2 * 15; // 15 seconds
const uint16_t gMax_bat_v = 843; // 8.43V
const uint16_t gMin_bat_v = 660; // 6.6V

152
ui/menu.c
View File

@ -38,71 +38,71 @@
const char MenuList[][7] =
{
"SQL",
"Step",
"Tx-Pwr", // was "TXP"
"RxDCS", // was "R_DCS"
"RxCTCS", // was "R_CTCS"
"TxDCS", // was "T_DCS"
"TxCTCS", // was "T_CTCS"
"TxDir", // was "SFT_D"
"TxOffs", // was "OFFSET"
"STEP",
"TXPWR", // was "TXP"
"RXDCS", // was "R_DCS"
"RXCTCS", // was "R_CTCS"
"TXDCS", // was "T_DCS"
"TXCTCS", // was "T_CTCS"
"TXDIR", // was "SFT_D"
"TXOFFS", // was "OFFSET"
"W/N",
"Scram", // was "SCR"
"BusyCL", // was "BCL"
"MemSav", // was "MEM-CH"
"BatSav", // was "SAVE"
"SCRAM", // was "SCR"
"BUSYCL", // was "BCL"
"MEMSAV", // was "MEM-CH"
"BATSAV", // was "SAVE"
"VOX",
"BackLt", // was "ABR"
"DualRx", // was "TDR"
"TxVFO", // was "WX"
"Beep",
"TxTOut", // was "TOT"
"BACKLT", // was "ABR"
"DUALRX", // was "TDR"
"TXVFO", // was "WX"
"BEEP",
"TXTOUT", // was "TOT"
#ifdef ENABLE_VOICE
"Voice",
"VOICE",
#endif
"SC-Rev",
"ChDisp", // was "MDF"
"KeyLoc", // was "AUTOLk"
"S-Add1",
"S-Add2",
"SC-REV",
"CHDISP", // was "MDF"
"KEYLOC", // was "AUTOLk"
"S-ADD1",
"S-ADD2",
"STE",
"RP-STE",
"Mic",
"MIC",
#ifdef ENABLE_COMPANDER
"Compnd",
"COMPND",
#endif
"1-Call",
"S-List",
"SList1",
"SList2",
"1-CALL",
"SLIST",
"SLIST1",
"SLIST2",
#ifdef ENABLE_ALARM
"AL-Mod",
"AL-MOD",
#endif
"ANI-ID",
"UpCode",
"DwCode",
"UPCODE",
"DWCODE",
"D-ST",
"D-RSP",
"D-Hold",
"D-Pre",
"D-HOLD",
"D-PRE",
"PTT-ID",
"D-DCD",
"D-List",
"POnMsg",
"Roger",
"BatVol", // was "VOL"
"Mode", // was "AM"
"D-LIST",
"PONMSG",
"ROGER",
"BATVOL", // was "VOL"
"MODE", // was "AM"
#ifdef ENABLE_NOAA
"NOAA_S",
"NOAA-S",
#endif
"MemDel", // was "Del-CH"
"Reset",
"MEMDEL", // was "Del-CH"
"RESET",
// normally hidden menu items from here on.
// enabled if pressing PTT and side button below PTT at power-on.
"350-TX", // was "350TX"
"F-Lock",
"F-LOCK",
"200-TX", // was "200TX"
"500-TX", // was "500TX"
"350-EN", // was "350EN"
@ -111,73 +111,73 @@ const char MenuList[][7] =
"" // end of list
};
static const char gSubMenu_TXP[3][5] =
const char gSubMenu_TXP[3][5] =
{
"LOW",
"MID",
"HIGH",
"HIGH"
};
static const char gSubMenu_SFT_D[3][4] =
const char gSubMenu_SFT_D[3][4] =
{
"OFF",
"+",
"-",
"-"
};
static const char gSubMenu_W_N[2][7] =
const char gSubMenu_W_N[2][7] =
{
"WIDE",
"NARROW",
"NARROW"
};
static const char gSubMenu_OFF_ON[2][4] =
const char gSubMenu_OFF_ON[2][4] =
{
"OFF",
"ON",
"ON"
};
static const char gSubMenu_SAVE[5][4] =
const char gSubMenu_SAVE[5][4] =
{
"OFF",
"1:1",
"1:2",
"1:3",
"1:4",
"1:4"
};
static const char gSubMenu_CHAN[3][7] =
const char gSubMenu_CHAN[3][7] =
{
"OFF",
"CHAN_A",
"CHAN_B",
"CHAN_B"
};
#ifdef ENABLE_VOICE
static const char gSubMenu_VOICE[3][4] =
const char gSubMenu_VOICE[3][4] =
{
"OFF",
"CHI",
"ENG",
"ENG"
};
#endif
static const char gSubMenu_SC_REV[3][3] =
const char gSubMenu_SC_REV[3][3] =
{
"TO",
"CO",
"SE",
"SE"
};
#ifndef ENABLE_CHAN_NAME_FREQ
static const char gSubMenu_MDF[3][5] =
const char gSubMenu_MDF[3][5] =
{
"FREQ",
"CHAN",
"NAME"
};
#else
static const char gSubMenu_MDF[4][8] =
const char gSubMenu_MDF[4][8] =
{
"FREQ",
"CHAN",
@ -187,30 +187,30 @@ static const char gSubMenu_SC_REV[3][3] =
#endif
#ifdef ENABLE_ALARM
static const char gSubMenu_AL_MOD[2][5] =
const char gSubMenu_AL_MOD[2][5] =
{
"SITE",
"TONE",
"TONE"
};
#endif
static const char gSubMenu_D_RSP[4][6] =
const char gSubMenu_D_RSP[4][6] =
{
"NULL",
"RING",
"REPLY",
"BOTH",
"BOTH"
};
static const char gSubMenu_PTT_ID[4][5] =
const char gSubMenu_PTT_ID[4][5] =
{
"OFF",
"BOT",
"EOT",
"BOTH",
"BOTH"
};
static const char gSubMenu_PONMSG[4][5] =
const char gSubMenu_PONMSG[4][5] =
{
"FULL",
"MSG",
@ -218,27 +218,27 @@ static const char gSubMenu_PONMSG[4][5] =
"NONE"
};
static const char gSubMenu_ROGER[3][6] =
const char gSubMenu_ROGER[3][6] =
{
"OFF",
"ROGER",
"MDC",
"MDC"
};
static const char gSubMenu_RESET[2][4] =
const char gSubMenu_RESET[2][4] =
{
"VFO",
"ALL",
"ALL"
};
static const char gSubMenu_F_LOCK[6][4] =
const char gSubMenu_F_LOCK[6][4] =
{
"OFF",
"FCC",
"CE",
"GB",
"430",
"438",
"438"
};
bool gIsInSubMenu;
@ -283,7 +283,7 @@ void UI_DisplayMenu(void)
NUMBER_ToDigits(1 + gMenuCursor, String);
UI_DisplaySmallDigits(2, String + 6, 33, 6, false);
#else
sprintf(String, "%2u/%u", 1u + gMenuCursor, gMenuListCount);
sprintf(String, "%2u.%u", 1u + gMenuCursor, gMenuListCount);
UI_PrintStringSmall(String, 8, 0, 6);
#endif
@ -536,11 +536,13 @@ void UI_DisplayMenu(void)
if (gMenuCursor == MENU_AM)
{ // the radio doesn't really do AM
UI_PrintString(String, 50, 127, 1, 8);
#if 0
if (gSubMenuSelection > 0)
{
UI_PrintString("not", 50, 127, 3, 8);
UI_PrintString("really", 50, 127, 5, 8);
}
#endif
}
else
if (gMenuCursor == MENU_VOL)

View File

@ -92,6 +92,31 @@ enum
extern const char MenuList[][7];
extern const char gSubMenu_TXP[3][5];
extern const char gSubMenu_SFT_D[3][4];
extern const char gSubMenu_W_N[2][7];
extern const char gSubMenu_OFF_ON[2][4];
extern const char gSubMenu_SAVE[5][4];
extern const char gSubMenu_CHAN[3][7];
#ifdef ENABLE_VOICE
extern const char gSubMenu_VOICE[3][4];
#endif
extern const char gSubMenu_SC_REV[3][3];
#ifndef ENABLE_CHAN_NAME_FREQ
extern const char gSubMenu_MDF[3][5];
#else
extern const char gSubMenu_MDF[4][8];
#endif
#ifdef ENABLE_ALARM
extern const char gSubMenu_AL_MOD[2][5];
#endif
extern const char gSubMenu_D_RSP[4][6];
extern const char gSubMenu_PTT_ID[4][5];
extern const char gSubMenu_PONMSG[4][5];
extern const char gSubMenu_ROGER[3][6];
extern const char gSubMenu_RESET[2][4];
extern const char gSubMenu_F_LOCK[6][4];
extern bool gIsInSubMenu;
extern uint8_t gMenuCursor;