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

View File

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

162
ui/menu.c
View File

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

View File

@ -92,6 +92,31 @@ enum
extern const char MenuList[][7]; 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 bool gIsInSubMenu;
extern uint8_t gMenuCursor; extern uint8_t gMenuCursor;