0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-06-19 06:39:49 +03:00

Menu update + PTT-ID fix

This commit is contained in:
OneOfEleven
2023-10-01 21:50:05 +01:00
parent 8caff25b7c
commit 86d2dade7a
7 changed files with 91 additions and 43 deletions

View File

@ -154,8 +154,8 @@ bool center_line_is_free = true;
if (rssi_dBm >= (s9_dBm + 6))
{ // S9+XXdB, 1dB increment
const char *fmt[] = {"%-4d +%u ", "%-4d +%u "};
const unsigned int dB = rssi_dBm - s9_dBm;
const char *fmt[] = {"%-4d +%u ", "%-4d +%2u "};
const unsigned int dB = ((rssi_dBm - s9_dBm) <= 99) ? rssi_dBm - s9_dBm : 99;
sprintf(s, (dB < 10) ? fmt[0] : fmt[1], rssi_dBm, dB);
}
else

View File

@ -91,11 +91,11 @@ const t_menu_item MenuList[] =
{"ANI-ID", VOICE_ID_ANI_CODE, MENU_ANI_ID },
{"UPCODE", VOICE_ID_INVALID, MENU_UPCODE },
{"DWCODE", VOICE_ID_INVALID, MENU_DWCODE },
{"PTT-ID", VOICE_ID_INVALID, MENU_PTT_ID },
{"D-ST", VOICE_ID_INVALID, MENU_D_ST },
{"D-RSP", VOICE_ID_INVALID, MENU_D_RSP },
{"D-HOLD", VOICE_ID_INVALID, MENU_D_HOLD },
{"D-PRE", VOICE_ID_INVALID, MENU_D_PRE },
{"PTT-ID", VOICE_ID_INVALID, MENU_PTT_ID },
{"D-DCD", VOICE_ID_INVALID, MENU_D_DCD },
{"D-LIST", VOICE_ID_INVALID, MENU_D_LIST },
{"D-LIVE", VOICE_ID_INVALID, MENU_D_LIVE_DEC }, // live DTMF decoder
@ -168,7 +168,6 @@ const char gSubMenu_SAVE[5][4] =
const char gSubMenu_TOT[11][7] =
{
"OFF",
"30 sec",
"1 min",
"2 min",
@ -178,21 +177,22 @@ const char gSubMenu_TOT[11][7] =
"6 min",
"7 min",
"8 min",
"9 min"
"9 min",
"15 min"
};
const char gSubMenu_CHAN[3][7] =
const char gSubMenu_CHAN[3][10] =
{
"OFF",
"CHAN A",
"CHAN B"
"UPPER\nVFO",
"LOWER\nVFO"
};
const char gSubMenu_XB[3][7] =
const char gSubMenu_XB[3][10] =
{
"SAME",
"CHAN A",
"CHAN B"
"MAIN\nVFO",
"UPPER\nVFO",
"LOWER\nVFO"
};
#ifdef ENABLE_VOICE
@ -204,19 +204,19 @@ const char gSubMenu_XB[3][7] =
};
#endif
const char gSubMenu_SC_REV[3][3] =
const char gSubMenu_SC_REV[3][13] =
{
"TO",
"CO",
"SE"
"TIME\nOPER",
"CARRIER\nOPER",
"SEARCH\nOPER"
};
const char gSubMenu_MDF[4][8] =
const char gSubMenu_MDF[4][15] =
{
"FREQ",
"CHAN",
"CHANNEL\nNUMBER",
"NAME",
"NAM+FRE"
"NAME\n+\nFREQ"
};
#ifdef ENABLE_ALARM
@ -235,19 +235,19 @@ const char gSubMenu_D_RSP[4][6] =
"BOTH"
};
const char gSubMenu_PTT_ID[4][5] =
const char gSubMenu_PTT_ID[4][7] =
{
"OFF",
"BOT",
"EOT",
"KEY UP",
"KEY DN",
"BOTH"
};
const char gSubMenu_PONMSG[4][5] =
const char gSubMenu_PONMSG[4][8] =
{
"FULL",
"MSG",
"VOL",
"MESSAGE",
"VOLTAGE",
"NONE"
};
@ -420,7 +420,8 @@ void UI_DisplayMenu(void)
{ // current menu item
strcpy(String, MenuList[menu_index].name);
// strcat(String, ":");
UI_PrintStringSmall(String, 0, 0, 0);
UI_PrintString(String, 0, 0, 0, 8);
// UI_PrintStringSmall(String, 0, 0, 0);
}
}
#endif
@ -775,8 +776,52 @@ void UI_DisplayMenu(void)
}
if (!already_printed)
UI_PrintString(String, menu_item_x1, menu_item_x2, 2, 8);
{
unsigned int y;
unsigned int k = 0;
unsigned int lines = 1;
unsigned int len = strlen(String);
bool small = false;
if (len > 0)
{
// count number of lines
for (i = 0; i < len; i++)
{
if (String[i] == '\n' && i < (len - 1))
{
lines++;
String[i] = 0;
}
}
if (lines > 3)
{ // use small text
small = true;
if (lines > 7)
lines = 7;
}
// move the 1st line up
if (small)
y = 3 - ((lines + 0) / 2);
else
y = 2 - ((lines + 0) / 2);
for (i = 0; i < len && lines > 0; lines--)
{
if (small)
UI_PrintStringSmall(String + k, menu_item_x1, menu_item_x2, y);
else
UI_PrintString(String + k, menu_item_x1, menu_item_x2, y, 8);
while (i < len && String[i] >= 32)
i++;
k = ++i;
y += small ? 1 : 2;
}
}
}
if (gMenuCursor == MENU_SLIST1 || gMenuCursor == MENU_SLIST2)
{
i = (gMenuCursor == MENU_SLIST1) ? 0 : 1;

View File

@ -79,11 +79,11 @@ enum
MENU_ANI_ID,
MENU_UPCODE,
MENU_DWCODE,
MENU_PTT_ID,
MENU_D_ST,
MENU_D_RSP,
MENU_D_HOLD,
MENU_D_PRE,
MENU_PTT_ID,
MENU_D_DCD,
MENU_D_LIST,
MENU_D_LIVE_DEC,
@ -124,19 +124,19 @@ 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_TOT[11][7];
extern const char gSubMenu_CHAN[3][7];
extern const char gSubMenu_XB[3][7];
extern const char gSubMenu_CHAN[3][10];
extern const char gSubMenu_XB[3][10];
#ifdef ENABLE_VOICE
extern const char gSubMenu_VOICE[3][4];
#endif
extern const char gSubMenu_SC_REV[3][3];
extern const char gSubMenu_MDF[4][8];
extern const char gSubMenu_SC_REV[3][13];
extern const char gSubMenu_MDF[4][15];
#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_PTT_ID[4][7];
extern const char gSubMenu_PONMSG[4][8];
extern const char gSubMenu_ROGER[3][6];
extern const char gSubMenu_RESET[2][4];
extern const char gSubMenu_F_LOCK[6][4];