Updated/Fix menu channel edit name

This commit is contained in:
OneOfEleven 2023-09-20 11:58:47 +01:00
parent a3aa3da2db
commit e3c4f1d28c
4 changed files with 80 additions and 23 deletions

View File

@ -1097,7 +1097,7 @@ void MENU_ShowCurrentSetting(void)
}
}
static void MENU_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
{
uint8_t Offset;
int32_t Min;
@ -1109,6 +1109,28 @@ static void MENU_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
if (gMenuCursor == MENU_MEM_NAME && edit_index >= 0)
{ // currently editing the channel name
if (edit_index < 10)
{
if (Key >= KEY_0 && Key <= KEY_9)
{
edit[edit_index] = '0' + Key - KEY_0;
if (++edit_index >= 10)
{ // exit edit
gFlagAcceptSetting = false;
gAskForConfirmation = 1;
}
gRequestDisplayScreen = DISPLAY_MENU;
}
}
return;
}
INPUTBOX_Append(Key);
gRequestDisplayScreen = DISPLAY_MENU;
@ -1339,7 +1361,7 @@ static void MENU_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
// exit
if (memcmp(edit_original, edit, sizeof(edit_original)) == 0)
{ // no change
{ // no change - drop it
gFlagAcceptSetting = false;
gIsInSubMenu = false;
gAskForConfirmation = 0;
@ -1423,6 +1445,25 @@ static void MENU_Key_STAR(const bool bKeyPressed, const bool bKeyHeld)
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
if (gMenuCursor == MENU_MEM_NAME && edit_index >= 0)
{ // currently editing the channel name
if (edit_index < 10)
{
edit[edit_index] = '-';
if (++edit_index >= 10)
{ // exit edit
gFlagAcceptSetting = false;
gAskForConfirmation = 1;
}
gRequestDisplayScreen = DISPLAY_MENU;
}
return;
}
RADIO_SelectVfos();
#ifdef ENABLE_NOAA
@ -1618,7 +1659,7 @@ void MENU_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
case KEY_7:
case KEY_8:
case KEY_9:
MENU_Key_DIGITS(Key, bKeyPressed, bKeyHeld);
MENU_Key_0_to_9(Key, bKeyPressed, bKeyHeld);
break;
case KEY_MENU:
MENU_Key_MENU(bKeyPressed, bKeyHeld);
@ -1636,6 +1677,22 @@ void MENU_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
MENU_Key_STAR(bKeyPressed, bKeyHeld);
break;
case KEY_F:
if (gMenuCursor == MENU_MEM_NAME && edit_index >= 0)
{ // currently editing the channel name
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
if (edit_index < 10)
{
edit[edit_index] = ' ';
if (++edit_index >= 10)
{ // exit edit
gFlagAcceptSetting = false;
gAskForConfirmation = 1;
}
gRequestDisplayScreen = DISPLAY_MENU;
}
break;
}
GENERIC_Key_F(bKeyPressed, bKeyHeld);
break;
case KEY_PTT:

BIN
firmware

Binary file not shown.

Binary file not shown.

Binary file not shown.