diff --git a/Makefile b/Makefile index 9e878a2..33133a5 100644 --- a/Makefile +++ b/Makefile @@ -35,7 +35,7 @@ ENABLE_RSSI_BAR := 1 ENABLE_AUDIO_BAR := 0 ENABLE_COPY_CHAN_TO_VFO := 1 #ENABLE_SINGLE_VFO_CHAN := 1 -#ENABLE_BAND_SCOPE := 1 +#ENABLE_PANADAPTER := 1 ############################################################# @@ -305,8 +305,8 @@ endif ifeq ($(ENABLE_SINGLE_VFO_CHAN),1) CFLAGS += -DENABLE_SINGLE_VFO_CHAN endif -ifeq ($(ENABLE_BAND_SCOPE),1) - CFLAGS += -DENABLE_BAND_SCOPE +ifeq ($(ENABLE_PANADAPTER),1) + CFLAGS += -DENABLE_PANADAPTER endif LDFLAGS = diff --git a/README.md b/README.md index 36212d0..c3b7a1a 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ ENABLE_REVERSE_BAT_SYMBOL := 1 mirror the battery symbol on the status ENABLE_CODE_SCAN_TIMEOUT := 0 enable/disable 32-sec CTCSS/DCS scan timeout (press exit butt instead of time-out to end scan) ENABLE_AM_FIX := 1 dynamically adjust the front end gains when in AM mode to helo prevent AM demodulator saturation, ignore the on-screen RSSI level (for now) ENABLE_AM_FIX_SHOW_DATA := 1 show debug data for the AM fix (still tweaking it) -ENABLE_SQUELCH_MORE_SENSITIVE := 0 make squelch levels a little bit more sensitive - I plan to let user adjust the values themselves +ENABLE_SQUELCH_MORE_SENSITIVE := 1 make squelch levels a little bit more sensitive - I plan to let user adjust the values themselves ENABLE_FASTER_CHANNEL_SCAN := 0 increases the channel scan speed, but the squelch is also made more twitchy ENABLE_RSSI_BAR := 1 enable a dBm/Sn RSSI bar graph level inplace of the little antenna symbols ENABLE_AUDIO_BAR := 0 experimental, display an audo bar level when TX'ing @@ -75,6 +75,25 @@ ENABLE_COPY_CHAN_TO_VFO := 1 copy current channel into the other VFO * * Long-press '*' .. Start scanning, then toggles the scanning between scanlists 1, 2 or ALL channels +# Edit channel/memory name + +1. Press Menu button +2. Scroll to "CH NAM" (around number 17) +3. Press the Menu button to enter +4. Use up/down keys to choose the desired channel to edit +5. Press the Menu button again to enter edit name mode +6. Use the up/down keys to cycle through the letters etc +7. Press the Menu button again to move to the next character position +8. Repeat steps 6 and/or 7 till you reach the end +9. When it pops up the "Sure?" text, press Menu button to save, or Exit to cancel + +Press the Exit button at any time to cancel the edit and return to the main menu. + +Sounds a lot/complicated but once you done it a couple of times you'll be fine (hopefully). + +When you're editing the name, you can enter digits (0 ~ 9) directly without having to use the up/down +buttons to find them. + # Some changes made from the Quansheng firmware * Various Quansheng firmware bugs fixed diff --git a/app/action.c b/app/action.c index fe07b1d..36b61f6 100644 --- a/app/action.c +++ b/app/action.c @@ -334,10 +334,10 @@ void ACTION_Handle(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) { gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL; - if (gDTMF_InputIndex > 0) + if (gDTMF_InputBox_Index > 0) { - gDTMF_InputBox[--gDTMF_InputIndex] = '-'; - if (gDTMF_InputIndex > 0) + gDTMF_InputBox[--gDTMF_InputBox_Index] = '-'; + if (gDTMF_InputBox_Index > 0) { gPttWasReleased = true; gRequestDisplayScreen = DISPLAY_MAIN; diff --git a/app/app.c b/app/app.c index e1006ab..c72784a 100644 --- a/app/app.c +++ b/app/app.c @@ -1367,27 +1367,20 @@ void APP_CheckKeys(void) return; } + if (gDebounceCounter < key_repeat_delay_10ms) + return; + // key is being held pressed if (gDebounceCounter == key_repeat_delay_10ms) - { // initial delay after pressed - if (Key == KEY_STAR || - Key == KEY_F || - Key == KEY_SIDE2 || - Key == KEY_SIDE1 || - Key == KEY_UP || - Key == KEY_DOWN || - Key == KEY_EXIT || - Key == KEY_MENU || - (Key >= KEY_0 && Key <= KEY_9)) // keys 0-9 can be held down to bypass pressing the F-Key + { // initial key repeat delay after pressed + if (Key != KEY_PTT) { gKeyBeingHeld = true; APP_ProcessKey(Key, true, true); } - return; } - - if (gDebounceCounter > key_repeat_delay_10ms) + else { // key repeat if (Key == KEY_UP || Key == KEY_DOWN) { @@ -1400,7 +1393,6 @@ void APP_CheckKeys(void) return; gDebounceCounter = key_repeat_delay_10ms; - return; } } @@ -1433,34 +1425,23 @@ void APP_TimeSlice10ms(void) if (gCurrentFunction != FUNCTION_POWER_SAVE || !gRxIdleMode) APP_CheckRadioInterrupts(); - if (gCurrentFunction != FUNCTION_TRANSMIT) - { // receiving - if (gUpdateStatus) - UI_DisplayStatus(false); - - if (gUpdateDisplay) - { - gUpdateDisplay = false; - GUI_DisplayScreen(); - } - } - else + if (gCurrentFunction == FUNCTION_TRANSMIT) { // transmitting #ifdef ENABLE_AUDIO_BAR if (gSetting_mic_bar && (gFlashLightBlinkCounter % (150 / 10)) == 0) // once every 150ms UI_DisplayAudioBar(); #endif - - if (gUpdateDisplay) - { - gUpdateDisplay = false; - GUI_DisplayScreen(); - } - - if (gUpdateStatus) - UI_DisplayStatus(false); } + if (gUpdateDisplay) + { + gUpdateDisplay = false; + GUI_DisplayScreen(); + } + + if (gUpdateStatus) + UI_DisplayStatus(false); + // Skipping authentic device checks #ifdef ENABLE_FMRADIO @@ -1699,22 +1680,31 @@ void APP_TimeSlice10ms(void) void cancelUserInputModes(void) { gKeyInputCountdown = 0; - if (gDTMF_InputMode || gInputBoxIndex > 0) + + if (gDTMF_InputMode || gDTMF_InputBox_Index > 0) +// if (gDTMF_InputMode || gInputBoxIndex > 0) { - memset(gDTMF_String, 0, sizeof(gDTMF_String)); - gDTMF_InputMode = false; - gDTMF_InputIndex = 0; + DTMF_clear_input_box(); + gDTMF_PreviousIndex = 0; gInputBoxIndex = 0; - + gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL; gRequestDisplayScreen = DISPLAY_MAIN; + gUpdateDisplay = true; + } - gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL; + if (gWasFKeyPressed) + { + gWasFKeyPressed = false; + gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL; + gUpdateStatus = true; } } // this is called once every 500ms void APP_TimeSlice500ms(void) { + bool exit_menu = false; + // Skipped authentic device check if (gKeypadLocked > 0) @@ -1722,9 +1712,19 @@ void APP_TimeSlice500ms(void) gUpdateDisplay = true; if (gKeyInputCountdown > 0) + { if (--gKeyInputCountdown == 0) + { cancelUserInputModes(); + if (gBeepToPlay != BEEP_NONE) + { + AUDIO_PlayBeep(gBeepToPlay); + gBeepToPlay = BEEP_NONE; + } + } + } + if (gDTMF_RX_live_timeout > 0) { #ifdef ENABLE_RSSI_BAR @@ -1743,15 +1743,14 @@ void APP_TimeSlice500ms(void) } } + if (gMenuCountdown > 0) + if (--gMenuCountdown == 0) + exit_menu = (gScreenToDisplay == DISPLAY_MENU); // exit menu mode + if (gDTMF_RX_timeout > 0) if (--gDTMF_RX_timeout == 0) DTMF_clear_RX(); - if (gSerialConfigCountDown_500ms > 0) - { -// gReducedService = true; // a serial config upload/download is in progress - } - // Skipped authentic device check #ifdef ENABLE_FMRADIO @@ -1763,6 +1762,16 @@ void APP_TimeSlice500ms(void) } #endif + if (gBacklightCountdown > 0 && !gAskToSave && gCssScanMode == CSS_SCAN_MODE_OFF) + if (gScreenToDisplay != DISPLAY_MENU || gMenuCursor != MENU_ABR) // don't turn off backlight if user is in backlight menu option + if (--gBacklightCountdown == 0) + if (gEeprom.BACKLIGHT < (ARRAY_SIZE(gSubMenu_BACKLIGHT) - 1)) + GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); // turn backlight off + + if (gSerialConfigCountDown_500ms > 0) + { + } + if (gReducedService) { BOARD_ADC_GetBatteryInfo(&gBatteryCurrentVoltage, &gBatteryCurrent); @@ -1802,94 +1811,90 @@ void APP_TimeSlice500ms(void) #endif } - if (gCurrentFunction != FUNCTION_TRANSMIT) + #ifdef ENABLE_FMRADIO + if ((gFM_ScanState == FM_SCAN_OFF || gAskToSave) && gCssScanMode == CSS_SCAN_MODE_OFF) + #else + if (gCssScanMode == CSS_SCAN_MODE_OFF) + #endif { - if (gCurrentFunction != FUNCTION_POWER_SAVE) - updateRSSI(gEeprom.RX_VFO); - - #ifdef ENABLE_FMRADIO - if ((gFM_ScanState == FM_SCAN_OFF || gAskToSave) && gCssScanMode == CSS_SCAN_MODE_OFF) + #ifdef ENABLE_AIRCOPY + if (gScanStateDir == SCAN_OFF && gScreenToDisplay != DISPLAY_AIRCOPY && (gScreenToDisplay != DISPLAY_SCANNER || gScanCssState >= SCAN_CSS_STATE_FOUND)) #else - if (gCssScanMode == CSS_SCAN_MODE_OFF) + if (gScanStateDir == SCAN_OFF && (gScreenToDisplay != DISPLAY_SCANNER || gScanCssState >= SCAN_CSS_STATE_FOUND)) #endif { - if (gBacklightCountdown > 0) - if (gScreenToDisplay != DISPLAY_MENU || gMenuCursor != MENU_ABR) // don't turn off backlight if user is in backlight menu option - if (--gBacklightCountdown == 0) - if (gEeprom.BACKLIGHT < (ARRAY_SIZE(gSubMenu_BACKLIGHT) - 1)) - GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); // turn backlight off - - #ifdef ENABLE_AIRCOPY - if (gScanStateDir == SCAN_OFF && gScreenToDisplay != DISPLAY_AIRCOPY && (gScreenToDisplay != DISPLAY_SCANNER || gScanCssState >= SCAN_CSS_STATE_FOUND)) - #else - if (gScanStateDir == SCAN_OFF && (gScreenToDisplay != DISPLAY_SCANNER || gScanCssState >= SCAN_CSS_STATE_FOUND)) - #endif + if (gEeprom.AUTO_KEYPAD_LOCK && gKeyLockCountdown > 0 && !gDTMF_InputMode) { - bool exit_menu = false; + if (--gKeyLockCountdown == 0) + gEeprom.KEY_LOCK = true; // lock the keyboard + gUpdateStatus = true; // lock symbol needs showing + } - if (gEeprom.AUTO_KEYPAD_LOCK && gKeyLockCountdown > 0 && !gDTMF_InputMode) + if (exit_menu) + { + gMenuCountdown = 0; + + if (gEeprom.BACKLIGHT == 0) { - if (--gKeyLockCountdown == 0) - gEeprom.KEY_LOCK = true; // lock the keyboard - - gUpdateStatus = true; // lock symbol needs showing + gBacklightCountdown = 0; + GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); // turn the backlight OFF } - if (gMenuCountdown > 0) - if (--gMenuCountdown == 0) - exit_menu = true; // exit menu mode - - if (exit_menu) + if (gInputBoxIndex > 0 || gDTMF_InputMode) + AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL); +/* + if (gScreenToDisplay == DISPLAY_SCANNER) { - gMenuCountdown = 0; + BK4819_StopScan(); - if (gEeprom.BACKLIGHT == 0 && gScreenToDisplay == DISPLAY_MENU) - { - gBacklightCountdown = 0; - GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); // turn the backlight OFF - } + RADIO_ConfigureChannel(0, VFO_CONFIGURE_RELOAD); + RADIO_ConfigureChannel(1, VFO_CONFIGURE_RELOAD); - if (gInputBoxIndex > 0 || gDTMF_InputMode || gScreenToDisplay == DISPLAY_MENU) - AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL); + RADIO_SetupRegisters(true); + } +*/ + DTMF_clear_input_box(); - if (gScreenToDisplay == DISPLAY_SCANNER) - { - BK4819_StopScan(); + gWasFKeyPressed = false; + gInputBoxIndex = 0; - RADIO_ConfigureChannel(0, VFO_CONFIGURE_RELOAD); - RADIO_ConfigureChannel(1, VFO_CONFIGURE_RELOAD); + gAskToSave = false; + gAskToDelete = false; - RADIO_SetupRegisters(true); - } - - gWasFKeyPressed = false; - gUpdateStatus = true; - gInputBoxIndex = 0; - gDTMF_InputMode = false; - gDTMF_InputIndex = 0; - gAskToSave = false; - gAskToDelete = false; + gUpdateStatus = true; + gUpdateDisplay = true; + { + GUI_DisplayType_t disp = DISPLAY_INVALID; + #ifdef ENABLE_FMRADIO if (gFmRadioMode && - gCurrentFunction != FUNCTION_RECEIVE && + gCurrentFunction != FUNCTION_RECEIVE && gCurrentFunction != FUNCTION_MONITOR && gCurrentFunction != FUNCTION_TRANSMIT) { - GUI_SelectNextDisplay(DISPLAY_FM); + disp = DISPLAY_FM; } - else #endif - #ifndef ENABLE_CODE_SCAN_TIMEOUT - if (gScreenToDisplay != DISPLAY_SCANNER) - #endif - GUI_SelectNextDisplay(DISPLAY_MAIN); + + if (disp == DISPLAY_INVALID) + { + #ifndef ENABLE_CODE_SCAN_TIMEOUT + if (gScreenToDisplay != DISPLAY_SCANNER) + #endif + disp = DISPLAY_MAIN; + } + + if (disp != DISPLAY_INVALID) + GUI_SelectNextDisplay(disp); } } } - } + if (gCurrentFunction != FUNCTION_POWER_SAVE && gCurrentFunction != FUNCTION_TRANSMIT) + updateRSSI(gEeprom.RX_VFO); + #ifdef ENABLE_FMRADIO if (!gPttIsPressed && gFM_ResumeCountdown_500ms > 0) { @@ -1947,7 +1952,7 @@ void APP_TimeSlice500ms(void) //if (gCurrentFunction != FUNCTION_POWER_SAVE) FUNCTION_Select(FUNCTION_POWER_SAVE); - ST7565_Configure_GPIO_B11(); + ST7565_HardwareReset(); if (gEeprom.BACKLIGHT < (ARRAY_SIZE(gSubMenu_BACKLIGHT) - 1)) GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); // turn the backlight off @@ -1985,6 +1990,7 @@ void APP_TimeSlice500ms(void) if (gDTMF_DecodeRingCountdown_500ms > 0) { // make "ring-ring" sound gDTMF_DecodeRingCountdown_500ms--; + AUDIO_PlayBeep(BEEP_880HZ_200MS); } } @@ -2074,6 +2080,9 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) { bool bFlag = false; + if (Key == KEY_INVALID) + return; + const bool backlight_was_on = GPIO_CheckBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); if (Key == KEY_EXIT && !backlight_was_on && gEeprom.BACKLIGHT > 0) @@ -2189,14 +2198,7 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) } } - if (Key != KEY_PTT && - Key != KEY_UP && - Key != KEY_DOWN && - Key != KEY_EXIT && - Key != KEY_SIDE1 && - Key != KEY_SIDE2 && - Key != KEY_STAR && - Key != KEY_MENU) + if ((Key >= KEY_0 && Key <= KEY_9) || Key == KEY_F) { if (gScanStateDir != SCAN_OFF || gCssScanMode != CSS_SCAN_MODE_OFF) { // FREQ/CTCSS/DCS scanning @@ -2231,9 +2233,8 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) } } - if (gWasFKeyPressed && Key > KEY_9 && Key != KEY_F && Key != KEY_STAR) -// if (gWasFKeyPressed && Key > KEY_9 && Key != KEY_F && Key != KEY_STAR && Key != KEY_MENU) - { + if (gWasFKeyPressed && (Key == KEY_PTT || Key == KEY_EXIT || Key == KEY_SIDE1 || Key == KEY_SIDE2)) + { // cancel the F-key gWasFKeyPressed = false; gUpdateStatus = true; } @@ -2247,59 +2248,58 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) if (gAlarmState == ALARM_STATE_OFF) #endif { + char Code; + if (Key == KEY_PTT) { GENERIC_Key_PTT(bKeyPressed); + goto Skip; + } + + if (Key == KEY_SIDE2) + { // transmit 1750Hz tone + Code = 0xFE; } else { - char Code; - - if (Key == KEY_SIDE2) - { // transmit 1750Hz tone - Code = 0xFE; - } - else + Code = DTMF_GetCharacter(Key - KEY_0); + if (Code == 0xFF) + goto Skip; + + // transmit DTMF keys + } + + if (!bKeyPressed || bKeyHeld) + { + if (!bKeyPressed) { - Code = DTMF_GetCharacter(Key - KEY_0); - if (Code == 0xFF) - goto Skip; - - // transmit DTMF keys - } - - if (!bKeyPressed || bKeyHeld) - { - if (!bKeyPressed) - { - GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH); - - gEnableSpeaker = false; - - BK4819_ExitDTMF_TX(false); - - if (gCurrentVfo->SCRAMBLING_TYPE == 0 || !gSetting_ScrambleEnable) - BK4819_DisableScramble(); - else - BK4819_EnableScramble(gCurrentVfo->SCRAMBLING_TYPE - 1); - } - } - else - { - if (gEeprom.DTMF_SIDE_TONE) - { // user will here the DTMF tones in speaker - GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH); - gEnableSpeaker = true; - } - - BK4819_DisableScramble(); - - if (Code == 0xFE) - BK4819_TransmitTone(gEeprom.DTMF_SIDE_TONE, 1750); + GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH); + + gEnableSpeaker = false; + + BK4819_ExitDTMF_TX(false); + + if (gCurrentVfo->SCRAMBLING_TYPE == 0 || !gSetting_ScrambleEnable) + BK4819_DisableScramble(); else - BK4819_PlayDTMFEx(gEeprom.DTMF_SIDE_TONE, Code); + BK4819_EnableScramble(gCurrentVfo->SCRAMBLING_TYPE - 1); } } + else + { + if (gEeprom.DTMF_SIDE_TONE) + { // user will here the DTMF tones in speaker + GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH); + gEnableSpeaker = true; + } + + BK4819_DisableScramble(); + + if (Code == 0xFE) + BK4819_TransmitTone(gEeprom.DTMF_SIDE_TONE, 1750); + else + BK4819_PlayDTMFEx(gEeprom.DTMF_SIDE_TONE, Code); + } } #if defined(ENABLE_ALARM) || defined(ENABLE_TX1750) else @@ -2307,13 +2307,8 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) { ALARM_Off(); - // TODO: fix side key 1750, you have to press it twice to restart the tone :( - if (gEeprom.REPEATER_TAIL_TONE_ELIMINATION == 0) - { - //if (gCurrentFunction != FUNCTION_FOREGROUND) - FUNCTION_Select(FUNCTION_FOREGROUND); - } + FUNCTION_Select(FUNCTION_FOREGROUND); else gRTTECountdown = gEeprom.REPEATER_TAIL_TONE_ELIMINATION * 10; @@ -2332,9 +2327,7 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) { case DISPLAY_MAIN: MAIN_ProcessKeys(Key, bKeyPressed, bKeyHeld); - bKeyHeld = false; // allow the channel setting to be saved - break; #ifdef ENABLE_FMRADIO @@ -2376,10 +2369,8 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL; } else - { - if (Key == KEY_EXIT && bKeyHeld) - cancelUserInputModes(); - } + if (Key == KEY_EXIT && bKeyHeld) + cancelUserInputModes(); Skip: if (gBeepToPlay != BEEP_NONE) diff --git a/app/dtmf.c b/app/dtmf.c index b5135ff..68b23eb 100644 --- a/app/dtmf.c +++ b/app/dtmf.c @@ -36,9 +36,9 @@ char gDTMF_String[15]; char gDTMF_InputBox[15]; -uint8_t gDTMF_InputIndex = 0; -bool gDTMF_InputMode = false; -uint8_t gDTMF_PreviousIndex = 0; +uint8_t gDTMF_InputBox_Index = 0; +bool gDTMF_InputMode = false; +uint8_t gDTMF_PreviousIndex = 0; char gDTMF_RX[17]; uint8_t gDTMF_RX_index = 0; @@ -133,8 +133,26 @@ bool DTMF_FindContact(const char *pContact, char *pResult) char DTMF_GetCharacter(const unsigned int code) { - const char list[] = "0123456789ABCD*#"; - return (code < ARRAY_SIZE(list)) ? list[code] : 0xFF; + switch (code) + { + case KEY_0: return '0'; + case KEY_1: return '1'; + case KEY_2: return '2'; + case KEY_3: return '3'; + case KEY_4: return '4'; + case KEY_5: return '5'; + case KEY_6: return '6'; + case KEY_7: return '7'; + case KEY_8: return '8'; + case KEY_9: return '9'; + case KEY_MENU: return 'A'; + case KEY_UP: return 'B'; + case KEY_DOWN: return 'C'; + case KEY_EXIT: return 'D'; + case KEY_STAR: return '*'; + case KEY_F: return '#'; + default: return 0xff; + } } bool DTMF_CompareMessage(const char *pMsg, const char *pTemplate, const unsigned int size, const bool bCheckGroup) @@ -163,16 +181,23 @@ DTMF_CallMode_t DTMF_CheckGroupCall(const char *pMsg, const unsigned int size) return (i < size) ? DTMF_CALL_MODE_GROUP : DTMF_CALL_MODE_NOT_GROUP; } +void DTMF_clear_input_box(void) +{ + memset(gDTMF_InputBox, 0, sizeof(gDTMF_InputBox)); + gDTMF_InputBox_Index = 0; + gDTMF_InputMode = false; +} + void DTMF_Append(const char code) { - if (gDTMF_InputIndex == 0) + if (gDTMF_InputBox_Index == 0) { - memset(gDTMF_InputBox, '-', sizeof(gDTMF_InputBox)); + memset(gDTMF_InputBox, '-', sizeof(gDTMF_InputBox) - 1); gDTMF_InputBox[sizeof(gDTMF_InputBox) - 1] = 0; } - if (gDTMF_InputIndex < sizeof(gDTMF_InputBox)) - gDTMF_InputBox[gDTMF_InputIndex++] = code; + if (gDTMF_InputBox_Index < (sizeof(gDTMF_InputBox) - 1)) + gDTMF_InputBox[gDTMF_InputBox_Index++] = code; } void DTMF_HandleRequest(void) diff --git a/app/dtmf.h b/app/dtmf.h index 0042ff0..8fc70a0 100644 --- a/app/dtmf.h +++ b/app/dtmf.h @@ -65,7 +65,7 @@ typedef enum DTMF_CallMode_t DTMF_CallMode_t; extern char gDTMF_String[15]; extern char gDTMF_InputBox[15]; -extern uint8_t gDTMF_InputIndex; +extern uint8_t gDTMF_InputBox_Index; extern bool gDTMF_InputMode; extern uint8_t gDTMF_PreviousIndex; @@ -98,6 +98,7 @@ bool DTMF_FindContact(const char *pContact, char *pResult); char DTMF_GetCharacter(const unsigned int code); bool DTMF_CompareMessage(const char *pDTMF, const char *pTemplate, const unsigned int size, const bool bFlag); DTMF_CallMode_t DTMF_CheckGroupCall(const char *pDTMF, const unsigned int size); +void DTMF_clear_input_box(void); void DTMF_Append(const char vode); void DTMF_HandleRequest(void); void DTMF_Reply(void); diff --git a/app/generic.c b/app/generic.c index 82e8f10..0bfa0d8 100644 --- a/app/generic.c +++ b/app/generic.c @@ -59,13 +59,13 @@ void GENERIC_Key_F(bool bKeyPressed, bool bKeyHeld) #endif gCurrentFunction != FUNCTION_TRANSMIT) { // toggle the keyboad lock - + #ifdef ENABLE_VOICE gAnotherVoiceID = gEeprom.KEY_LOCK ? VOICE_ID_UNLOCK : VOICE_ID_LOCK; #endif - + gEeprom.KEY_LOCK = !gEeprom.KEY_LOCK; - + gRequestSaveSettings = true; } } @@ -81,6 +81,9 @@ void GENERIC_Key_F(bool bKeyPressed, bool bKeyHeld) gWasFKeyPressed = !gWasFKeyPressed; + if (gWasFKeyPressed) + gKeyInputCountdown = key_input_timeout_500ms; + #ifdef ENABLE_VOICE if (!gWasFKeyPressed) gAnotherVoiceID = VOICE_ID_CANCEL; @@ -106,6 +109,7 @@ void GENERIC_Key_F(bool bKeyPressed, bool bKeyHeld) #endif gBeepToPlay = BEEP_440HZ_500MS; + gPttWasReleased = true; } } @@ -192,64 +196,61 @@ void GENERIC_Key_PTT(bool bKeyPressed) return; } - gFlagPrepareTX = true; - - if (gDTMF_InputMode) - { - if (gDTMF_InputIndex > 0 || gDTMF_PreviousIndex > 0) - { - if (gDTMF_InputIndex == 0) - gDTMF_InputIndex = gDTMF_PreviousIndex; - - gDTMF_InputBox[gDTMF_InputIndex] = 0; - - #if 0 - // append our DTMF ID to the inputted DTMF code - - // IF the user inputted code is exactly 3 digits long - if (gDTMF_InputIndex == 3) - gDTMF_CallMode = DTMF_CheckGroupCall(gDTMF_InputBox, 3); - else - #else - // append our DTMF ID to the inputted DTMF code - - // IF the user inputted code is exactly 3 digits long and D-DCD is enabled - if (gDTMF_InputIndex == 3 && gTxVfo->DTMF_DECODING_ENABLE > 0) - gDTMF_CallMode = DTMF_CheckGroupCall(gDTMF_InputBox, 3); - else - #endif - gDTMF_CallMode = DTMF_CALL_MODE_DTMF; - - strcpy(gDTMF_String, gDTMF_InputBox); - - gDTMF_PreviousIndex = gDTMF_InputIndex; - gDTMF_ReplyState = DTMF_REPLY_ANI; - gDTMF_State = DTMF_STATE_0; - } - - if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu - gRequestDisplayScreen = DISPLAY_MAIN; - - gDTMF_InputMode = false; - gDTMF_InputIndex = 0; - return; - } - if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu gRequestDisplayScreen = DISPLAY_MAIN; - gFlagPrepareTX = true; - gInputBoxIndex = 0; + if (!gDTMF_InputMode) + { + gFlagPrepareTX = true; + gInputBoxIndex = 0; + return; + } + + gDTMF_InputMode = false; +// gUpdateDisplay = true; + + if (gDTMF_InputBox_Index > 0 || gDTMF_PreviousIndex > 0) + { + if (gDTMF_InputBox_Index == 0) + gDTMF_InputBox_Index = gDTMF_PreviousIndex; + + if (gDTMF_InputBox_Index < sizeof(gDTMF_InputBox)) + gDTMF_InputBox[gDTMF_InputBox_Index] = 0; + + #if 0 + // append our DTMF ID to the inputted DTMF code - + // IF the user inputted code is exactly 3 digits long + if (gDTMF_InputBox_Index == 3) + gDTMF_CallMode = DTMF_CheckGroupCall(gDTMF_InputBox, 3); + else + #else + // append our DTMF ID to the inputted DTMF code - + // IF the user inputted code is exactly 3 digits long and D-DCD is enabled + if (gDTMF_InputBox_Index == 3 && gTxVfo->DTMF_DECODING_ENABLE > 0) + gDTMF_CallMode = DTMF_CheckGroupCall(gDTMF_InputBox, 3); + else + #endif + gDTMF_CallMode = DTMF_CALL_MODE_DTMF; + + strcpy(gDTMF_String, gDTMF_InputBox); + gDTMF_PreviousIndex = gDTMF_InputBox_Index; + DTMF_clear_input_box(); + + gDTMF_ReplyState = DTMF_REPLY_ANI; + gDTMF_State = DTMF_STATE_0; + + gFlagPrepareTX = true; + } return; } - if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu - gRequestDisplayScreen = DISPLAY_MAIN; - gEeprom.CROSS_BAND_RX_TX = gBackupCROSS_BAND_RX_TX; - gUpdateStatus = true; gFlagStopScan = true; gVfoConfigureMode = VFO_CONFIGURE_RELOAD; gFlagResetVfos = true; + + gUpdateStatus = true; } else { diff --git a/app/main.c b/app/main.c index b650338..e8db077 100644 --- a/app/main.c +++ b/app/main.c @@ -529,7 +529,7 @@ static void MAIN_Key_EXIT(bool bKeyPressed, bool bKeyHeld) if (gInputBoxIndex > 0) { // cancel key input mode (channel/frequency entry) gDTMF_InputMode = false; - gDTMF_InputIndex = 0; + gDTMF_InputBox_Index = 0; memset(gDTMF_String, 0, sizeof(gDTMF_String)); gInputBoxIndex = 0; gRequestDisplayScreen = DISPLAY_MAIN; @@ -550,6 +550,8 @@ static void MAIN_Key_MENU(const bool bKeyPressed, const bool bKeyHeld) if (bKeyPressed) { // long press MENU key + gWasFKeyPressed = false; + if (gScreenToDisplay == DISPLAY_MAIN) { if (gInputBoxIndex > 0) @@ -634,77 +636,77 @@ static void MAIN_Key_MENU(const bool bKeyPressed, const bool bKeyHeld) static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld) { - if (gInputBoxIndex) - { + if (gCurrentFunction == FUNCTION_TRANSMIT) + return; + + if (gInputBoxIndex > 0) + { // entering a frequency or DTMF string if (!bKeyHeld && bKeyPressed) gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL; return; } - if (bKeyHeld || !bKeyPressed) - { // long press + if (bKeyHeld && !gWasFKeyPressed) + { // long press .. toggle scanning + if (!bKeyPressed) + return; // released + gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL; + ACTION_Scan(false); + return; + } - if (bKeyHeld || bKeyPressed) - { - if (!bKeyHeld) - return; - - if (!bKeyPressed) - return; - - ACTION_Scan(false); - - return; - } + if (bKeyPressed) + { // just pressed +// gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL; + gBeepToPlay = BEEP_880HZ_40MS_OPTIONAL; + return; + } + + // just released + + if (!gWasFKeyPressed) + { // pressed without the F-key #ifdef ENABLE_NOAA if (gScanStateDir == SCAN_OFF && IS_NOT_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE)) #else if (gScanStateDir == SCAN_OFF) #endif - { - gKeyInputCountdown = key_input_timeout_500ms; + { // start entering a DTMF string + + memmove(gDTMF_InputBox, gDTMF_String, MIN(sizeof(gDTMF_InputBox), sizeof(gDTMF_String) - 1)); + gDTMF_InputBox_Index = 0; gDTMF_InputMode = true; - memmove(gDTMF_InputBox, gDTMF_String, sizeof(gDTMF_InputBox)); - gDTMF_InputIndex = 0; + + gKeyInputCountdown = key_input_timeout_500ms; gRequestDisplayScreen = DISPLAY_MAIN; - return; } } else - { - gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL; - if (!gWasFKeyPressed) - { - gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL; - return; - } - + { // with the F-key gWasFKeyPressed = false; - gUpdateStatus = true; #ifdef ENABLE_NOAA - if (IS_NOT_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE)) - { - gFlagStartScan = true; - gScanSingleFrequency = true; - gBackupCROSS_BAND_RX_TX = gEeprom.CROSS_BAND_RX_TX; - gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF; - } - else + if (IS_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE)) { gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL; - } - #else - gFlagStartScan = true; - gScanSingleFrequency = true; - gBackupCROSS_BAND_RX_TX = gEeprom.CROSS_BAND_RX_TX; - gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF; + return; + } #endif - - gPttWasReleased = true; +/* + // scan the CTCSS/DCS code + gFlagStartScan = true; + gScanSingleFrequency = true; + gBackupCROSS_BAND_RX_TX = gEeprom.CROSS_BAND_RX_TX; + gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF; +*/ + ACTION_Scan(false); } + + gPttWasReleased = true; + + gUpdateStatus = true; } static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction) @@ -712,7 +714,8 @@ static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction) uint8_t Channel = gEeprom.ScreenChannel[gEeprom.TX_VFO]; if (bKeyHeld || !bKeyPressed) - { + { // long press + if (gInputBoxIndex > 0) return; @@ -822,7 +825,7 @@ void MAIN_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) { if (!bKeyHeld) { - const char Character = DTMF_GetCharacter(Key - KEY_0); + const char Character = DTMF_GetCharacter(Key); if (Character != 0xFF) { // add key to DTMF string DTMF_Append(Character); diff --git a/app/menu.c b/app/menu.c index a94b098..fb38396 100644 --- a/app/menu.c +++ b/app/menu.c @@ -674,7 +674,7 @@ void MENU_AcceptSetting(void) { GUI_SelectNextDisplay(DISPLAY_MAIN); gDTMF_InputMode = true; - gDTMF_InputIndex = 3; + gDTMF_InputBox_Index = 3; memmove(gDTMF_InputBox, gDTMF_ID, 4); gRequestDisplayScreen = DISPLAY_INVALID; } diff --git a/driver/keyboard.c b/driver/keyboard.c index c6af554..0003a81 100644 --- a/driver/keyboard.c +++ b/driver/keyboard.c @@ -36,8 +36,8 @@ static const struct { // We are very fortunate. // The key and pin defines fit together in a single u8, making this very efficient struct { - uint8_t key : 5; // Key 23 is highest - uint8_t pin : 3; // Pin 6 is highest + KEY_Code_t key : 5; + uint8_t pin : 3; // Pin 6 is highest } pins[4]; } keyboard[] = { diff --git a/driver/keyboard.h b/driver/keyboard.h index 78c1a4f..5a7d839 100644 --- a/driver/keyboard.h +++ b/driver/keyboard.h @@ -21,28 +21,29 @@ #include #include -typedef enum { - KEY_INVALID = 0, - KEY_0, - KEY_1, - KEY_2, - KEY_3, - KEY_4, - KEY_5, - KEY_6, - KEY_7, - KEY_8, - KEY_9, - KEY_MENU, - KEY_UP, - KEY_DOWN, - KEY_EXIT, - KEY_STAR, - KEY_F, - KEY_PTT, - KEY_SIDE2, - KEY_SIDE1 -} KEY_Code_t; +enum KEY_Code_e { + KEY_0 = 0, // 0 + KEY_1, // 1 + KEY_2, // 2 + KEY_3, // 3 + KEY_4, // 4 + KEY_5, // 5 + KEY_6, // 6 + KEY_7, // 7 + KEY_8, // 8 + KEY_9, // 9 + KEY_MENU, // A + KEY_UP, // B + KEY_DOWN, // C + KEY_EXIT, // D + KEY_STAR, // * + KEY_F, // # + KEY_PTT, // + KEY_SIDE2, // + KEY_SIDE1, // + KEY_INVALID // +}; +typedef enum KEY_Code_e KEY_Code_t; extern KEY_Code_t gKeyReading0; extern KEY_Code_t gKeyReading1; diff --git a/driver/st7565.c b/driver/st7565.c index c2ccd3f..66ee65d 100644 --- a/driver/st7565.c +++ b/driver/st7565.c @@ -146,7 +146,7 @@ void ST7565_Init(const bool full) { SPI0_Init(); - ST7565_Configure_GPIO_B11(); + ST7565_HardwareReset(); SPI_ToggleMasterMode(&SPI0->CR, false); @@ -199,7 +199,7 @@ void ST7565_Init(const bool full) ST7565_FillScreen(0x00); } -void ST7565_Configure_GPIO_B11(void) +void ST7565_HardwareReset(void) { GPIO_SetBit(&GPIOB->DATA, GPIOB_PIN_ST7565_RES); SYSTEM_DelayMs(1); diff --git a/driver/st7565.h b/driver/st7565.h index 5fc2e8d..ac0ffd9 100644 --- a/driver/st7565.h +++ b/driver/st7565.h @@ -31,7 +31,7 @@ void ST7565_BlitFullScreen(void); void ST7565_BlitStatusLine(void); void ST7565_FillScreen(uint8_t Value); void ST7565_Init(const bool full); -void ST7565_Configure_GPIO_B11(void); +void ST7565_HardwareReset(void); void ST7565_SelectColumnAndLine(uint8_t Column, uint8_t Line); void ST7565_WriteByte(uint8_t Value); diff --git a/firmware.bin b/firmware.bin index 01983d5..61f6a77 100644 Binary files a/firmware.bin and b/firmware.bin differ diff --git a/firmware.packed.bin b/firmware.packed.bin index be0723a..b99f36a 100644 Binary files a/firmware.packed.bin and b/firmware.packed.bin differ diff --git a/misc.c b/misc.c index cc25ba9..dc5e6f6 100644 --- a/misc.c +++ b/misc.c @@ -33,8 +33,7 @@ const uint8_t DTMF_RX_timeout_500ms = 10000 / 500; // 10 seconds const uint8_t DTMF_decode_ring_countdown_500ms = 15000 / 500; // 15 seconds .. time we sound the ringing for const uint8_t DTMF_txstop_countdown_500ms = 3000 / 500; // 6 seconds -const uint8_t key_input_timeout_500ms = 8000 / 500; // 8 seconds - +const uint8_t key_input_timeout_500ms = 6000 / 500; // 6 seconds const uint16_t key_repeat_delay_10ms = 400 / 10; // 400ms const uint16_t key_repeat_10ms = 80 / 10; // 80ms .. MUST be less than 'key_repeat_delay' const uint16_t key_debounce_10ms = 20 / 10; // 20ms diff --git a/misc.h b/misc.h index 9a5b0c0..2c0a771 100644 --- a/misc.h +++ b/misc.h @@ -24,6 +24,14 @@ #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) #endif +#ifndef MAX + #define MAX(a, b) ({ __typeof__ (a) _a = (a); __typeof__ (b) _b = (b); _a > _b ? _a : _b; }) +#endif + +#ifndef MIN + #define MIN(a, b) ({ __typeof__ (a) _a = (a); __typeof__ (b) _b = (b); _a < _b ? _a : _b; }) +#endif + #define IS_MR_CHANNEL(x) ((x) >= MR_CHANNEL_FIRST && (x) <= MR_CHANNEL_LAST) #define IS_FREQ_CHANNEL(x) ((x) >= FREQ_CHANNEL_FIRST && (x) <= FREQ_CHANNEL_LAST) #define IS_VALID_CHANNEL(x) ((x) < LAST_CHANNEL) diff --git a/radio.c b/radio.c index 38dd1b5..cc5d9c2 100644 --- a/radio.c +++ b/radio.c @@ -939,6 +939,7 @@ void RADIO_PrepareTX(void) gEeprom.RX_VFO = gEeprom.TX_VFO; gRxVfo = &gEeprom.VfoInfo[gEeprom.TX_VFO]; // gRxVfoIsActive = true; + gRxVfoIsActive = false; } // let the user see that DW is not active @@ -948,47 +949,35 @@ void RADIO_PrepareTX(void) RADIO_SelectCurrentVfo(); - #if defined(ENABLE_ALARM) && defined(ENABLE_TX1750) - if (gAlarmState == ALARM_STATE_OFF || - gAlarmState == ALARM_STATE_TX1750 || - (gAlarmState == ALARM_STATE_ALARM && gEeprom.ALARM_MODE == ALARM_MODE_TONE)) - #elif defined(ENABLE_ALARM) - if (gAlarmState == ALARM_STATE_OFF || - (gAlarmState == ALARM_STATE_ALARM && gEeprom.ALARM_MODE == ALARM_MODE_TONE)) - #elif defined(ENABLE_TX1750) - if (gAlarmState == ALARM_STATE_OFF || - gAlarmState == ALARM_STATE_TX1750) - #endif - { - #ifndef ENABLE_TX_WHEN_AM - if (gCurrentVfo->AM_mode) - { // not allowed to TX if in AM mode - State = VFO_STATE_TX_DISABLE; - } - else - #endif - if (!gSetting_TX_EN || gSerialConfigCountDown_500ms > 0) - { // TX is disabled or config upload/download in progress + #ifndef ENABLE_TX_WHEN_AM + if (gCurrentVfo->AM_mode) + { // not allowed to TX if in AM mode State = VFO_STATE_TX_DISABLE; } else - if (TX_freq_check(gCurrentVfo->pTX->Frequency) == 0) - { // TX frequency is allowed - if (gCurrentVfo->BUSY_CHANNEL_LOCK && gCurrentFunction == FUNCTION_RECEIVE) - State = VFO_STATE_BUSY; // busy RX'ing a station - else - if (gBatteryDisplayLevel == 0) - State = VFO_STATE_BAT_LOW; // charge your battery ! - else - if (gBatteryDisplayLevel >= 6) - State = VFO_STATE_VOLTAGE_HIGH; // over voltage .. this is being a pain - } - else - State = VFO_STATE_TX_DISABLE; // TX frequency not allowed + #endif + if (!gSetting_TX_EN || gSerialConfigCountDown_500ms > 0) + { // TX is disabled or config upload/download in progress + State = VFO_STATE_TX_DISABLE; } + else + if (TX_freq_check(gCurrentVfo->pTX->Frequency) == 0) + { // TX frequency is allowed + if (gCurrentVfo->BUSY_CHANNEL_LOCK && gCurrentFunction == FUNCTION_RECEIVE) + State = VFO_STATE_BUSY; // busy RX'ing a station + else + if (gBatteryDisplayLevel == 0) + State = VFO_STATE_BAT_LOW; // charge your battery ! + else + if (gBatteryDisplayLevel >= 6) + State = VFO_STATE_VOLTAGE_HIGH; // over voltage (no doubt to protect the PA) .. this is being a pain + } + else + State = VFO_STATE_TX_DISABLE; // TX frequency not allowed if (State != VFO_STATE_NORMAL) { // TX not allowed + RADIO_SetVfoState(State); #if defined(ENABLE_ALARM) || defined(ENABLE_TX1750) diff --git a/ui/inputbox.c b/ui/inputbox.c index e352cce..cd6742c 100644 --- a/ui/inputbox.c +++ b/ui/inputbox.c @@ -31,5 +31,6 @@ void INPUTBOX_Append(const KEY_Code_t Digit) if (Digit >= KEY_0 && Digit != KEY_INVALID) gInputBox[gInputBoxIndex++] = (char)(Digit - KEY_0); +// gInputBox[gInputBoxIndex++] = Digit; } diff --git a/ui/main.c b/ui/main.c index c829cf3..35e74a7 100644 --- a/ui/main.c +++ b/ui/main.c @@ -386,10 +386,8 @@ void UI_DisplayMain(void) else { sprintf(String, ">%s", gDTMF_InputBox); - - center_line = CENTER_LINE_IN_USE; } - UI_PrintString(String, 2, 0, vfo_num * 3, 8); + UI_PrintString(String, 2, 0, 0 + (vfo_num * 3), 8); memset(String, 0, sizeof(String)); if (!gDTMF_InputMode) @@ -404,10 +402,6 @@ void UI_DisplayMain(void) if (gDTMF_IsTx) sprintf(String, ">%s", gDTMF_String); } - else - { - center_line = CENTER_LINE_IN_USE; - } UI_PrintString(String, 2, 0, 2 + (vfo_num * 3), 8); center_line = CENTER_LINE_IN_USE; diff --git a/ui/menu.c b/ui/menu.c index 03984b7..d41b849 100644 --- a/ui/menu.c +++ b/ui/menu.c @@ -58,8 +58,8 @@ const t_menu_item MenuList[] = {"SCRAM", VOICE_ID_SCRAMBLER_ON, MENU_SCR }, // was "SCR" {"BUSYCL", VOICE_ID_BUSY_LOCKOUT, MENU_BCL }, // was "BCL" {"CH SAV", VOICE_ID_MEMORY_CHANNEL, MENU_MEM_CH }, // was "MEM-CH" - {"CH DEL", VOICE_ID_DELETE_CHANNEL, MENU_DEL_CH }, // was "DEL-CH" {"CH NAM", VOICE_ID_INVALID, MENU_MEM_NAME }, + {"CH DEL", VOICE_ID_DELETE_CHANNEL, MENU_DEL_CH }, // was "DEL-CH" {"CH DIS", VOICE_ID_INVALID, MENU_MDF }, // was "MDF" {"BATSAV", VOICE_ID_SAVE_MODE, MENU_SAVE }, // was "SAVE" #ifdef ENABLE_VOX @@ -88,7 +88,7 @@ const t_menu_item MenuList[] = {"SLIST1", VOICE_ID_INVALID, MENU_SLIST1 }, {"SLIST2", VOICE_ID_INVALID, MENU_SLIST2 }, #ifdef ENABLE_ALARM - {"AL-MOD", VOICE_ID_INVALID, MENU_AL_MOD }, + {"ALMODE", VOICE_ID_INVALID, MENU_AL_MOD }, #endif {"ANI ID", VOICE_ID_ANI_CODE, MENU_ANI_ID }, {"UPCODE", VOICE_ID_INVALID, MENU_UPCODE }, diff --git a/ui/menu.h b/ui/menu.h index 157b3d2..ddb1e48 100644 --- a/ui/menu.h +++ b/ui/menu.h @@ -28,6 +28,14 @@ typedef struct { uint8_t menu_id; } t_menu_item; +// currently this list MUST be in exactly the same order +// as the other menu list "MenuList[]" in "ui/menu.c", otherwise +// you'll have big problems +// +// I'm going to fix that so that you can reorder the menu items +// anyway you like simply by editing this list only (the other list +// you just leave as is, or any which way, it won't matter) +// enum { MENU_SQL = 0, @@ -45,8 +53,8 @@ enum MENU_SCR, MENU_BCL, MENU_MEM_CH, - MENU_DEL_CH, MENU_MEM_NAME, + MENU_DEL_CH, MENU_MDF, MENU_SAVE, #ifdef ENABLE_VOX diff --git a/ui/ui.c b/ui/ui.c index b370182..0ea903a 100644 --- a/ui/ui.c +++ b/ui/ui.c @@ -77,33 +77,28 @@ void GUI_DisplayScreen(void) void GUI_SelectNextDisplay(GUI_DisplayType_t Display) { - if (Display != DISPLAY_INVALID) + if (Display == DISPLAY_INVALID) + return; + + if (gScreenToDisplay != Display) { - if (gScreenToDisplay != Display) - { - gInputBoxIndex = 0; - gIsInSubMenu = false; - gCssScanMode = CSS_SCAN_MODE_OFF; - gScanStateDir = SCAN_OFF; - #ifdef ENABLE_FMRADIO - gFM_ScanState = FM_SCAN_OFF; - #endif - gAskForConfirmation = 0; - gDTMF_InputMode = false; - gDTMF_InputIndex = 0; - gAskToSave = false; - gAskToDelete = false; + DTMF_clear_input_box(); - if (gWasFKeyPressed) - { - gWasFKeyPressed = false; - gUpdateStatus = true; - } + gInputBoxIndex = 0; + gIsInSubMenu = false; + gCssScanMode = CSS_SCAN_MODE_OFF; + gScanStateDir = SCAN_OFF; + #ifdef ENABLE_FMRADIO + gFM_ScanState = FM_SCAN_OFF; + #endif + gAskForConfirmation = 0; + gAskToSave = false; + gAskToDelete = false; + gWasFKeyPressed = false; - gUpdateStatus = true; - } - - gUpdateDisplay = true; - gScreenToDisplay = Display; + gUpdateStatus = true; } + + gScreenToDisplay = Display; + gUpdateDisplay = true; }