diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 71a2cdf..0f288e3 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -22,11 +22,8 @@ - - - - - + + diff --git a/app/menu.c b/app/menu.c index 87007ef..787d587 100644 --- a/app/menu.c +++ b/app/menu.c @@ -1437,8 +1437,45 @@ static void MENU_Key_MENU(const bool bKeyPressed, const bool bKeyHeld) return; } +#ifdef ENABLE_MDC1200 + if (UI_MENU_GetCurrentMenuId() == MENU_MDC_ID) + { + if (edit_index < 0) + { + edit_index = 0; + while (edit_index < 4) + edit[edit_index++] = '_'; + edit_index = 0; // 'edit_index' is going to be used as the cursor position + // make a copy so we can test for change when exiting the menu item + memmove(edit_original, edit, sizeof(edit_original)); + return; + } + else + if (edit_index >= 0 && edit_index < 4) + { // editing the channel name characters - if (UI_MENU_GetCurrentMenuId() == MENU_MEM_NAME) + if (++edit_index < 4) + return; // next char + + // exit + if (memcmp(edit_original, edit, sizeof(edit_original)) == 0) + { // no change - drop it + gFlagAcceptSetting = false; + gIsInSubMenu = false; + gAskForConfirmation = 0; + } + else + { + gFlagAcceptSetting = false; + gAskForConfirmation = 0; + } + } + } + + +else +#endif + if (UI_MENU_GetCurrentMenuId() == MENU_MEM_NAME) { if (edit_index < 0) { // enter channel name edit mode diff --git a/ui/menu.c b/ui/menu.c index 4edf861..2df1d25 100644 --- a/ui/menu.c +++ b/ui/menu.c @@ -676,7 +676,27 @@ void UI_DisplayMenu(void) { already_printed = true; break; } +#ifdef ENABLE_MDC1200 +// case MENU_MDC_ID: +// /// char mdc_id_str[4]; +// sprintf(String, "%04X", gEeprom.MDC1200_ID); // %04X确保输出是4个字符长度的十六进制数 +// // strcpy(String, id); +// break; + case MENU_MDC_ID: + { + if (!gIsInSubMenu||edit_index<0) { // show the channel name + sprintf(String, "%04X", gEeprom.MDC1200_ID); // %04X确保输出是4个字符长度的十六进制数 + UI_PrintStringSmall(String, menu_item_x1, menu_item_x2, 3);//4 + } else { // show the channel name being edited + UI_PrintStringSmall(edit, menu_item_x1, 0, 3); + if (edit_index < 4) + UI_PrintStringSmall("^", menu_item_x1 + (8 * edit_index), 0, 4); // show the cursor + } + already_printed = true; + break; + } +#endif case MENU_MEM_NAME: { const bool valid = RADIO_CheckValidChannel(gSubMenuSelection, false, 1); @@ -804,13 +824,7 @@ void UI_DisplayMenu(void) { strcpy(String, gEeprom.ANI_DTMF_ID); break; #endif -#ifdef ENABLE_MDC1200 - case MENU_MDC_ID: - /// char mdc_id_str[4]; - sprintf(String, "%04X", gEeprom.MDC1200_ID); // %04X确保输出是4个字符长度的十六进制数 - // strcpy(String, id); - break; -#endif + case MENU_UPCODE: strcpy(String, gEeprom.DTMF_UP_CODE); break;