diff --git a/App/app/fm.c b/App/app/fm.c index 6614f41b..0842ba7b 100644 --- a/App/app/fm.c +++ b/App/app/fm.c @@ -40,7 +40,6 @@ volatile int8_t gFM_ScanState; bool gFM_AutoScan; uint8_t gFM_ChannelPosition; bool gFM_FoundFrequency; -bool gFM_AutoScan; uint16_t gFM_RestoreCountdown_10ms; @@ -167,6 +166,12 @@ void FM_Tune(uint16_t Frequency, int8_t Step, bool bFlag) BK1080_SetFrequency(gEeprom.FM_FrequencyPlaying, gEeprom.FM_Band/*, gEeprom.FM_Space*/); } +void FM_AudioPathOn(void) { + BACKLIGHT_TurnOn(); + AUDIO_AudioPathOn(); + gEnableSpeaker = true; +} + void FM_PlayAndUpdate(void) { gFM_ScanState = FM_SCAN_OFF; @@ -184,9 +189,7 @@ void FM_PlayAndUpdate(void) gScheduleFM = false; gAskToSave = false; - AUDIO_AudioPathOn(); - - gEnableSpeaker = true; + FM_AudioPathOn(); } int FM_CheckFrequencyLock(uint16_t Frequency, uint16_t LowerLimit) @@ -391,8 +394,14 @@ static void Key_FUNC(KEY_Code_t Key, uint8_t state) static void Key_EXIT(uint8_t state) { - if (state != BUTTON_EVENT_SHORT) - return; + if (gInputBoxIndex) { + if (state != BUTTON_EVENT_SHORT) + return; + } + else { + if (state != BUTTON_EVENT_PRESSED) + return; + } gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL; @@ -603,8 +612,7 @@ void FM_Play(void) if (!gEeprom.FM_IsMrMode) gEeprom.FM_SelectedFrequency = gEeprom.FM_FrequencyPlaying; - AUDIO_AudioPathOn(); - gEnableSpeaker = true; + FM_AudioPathOn(); GUI_SelectNextDisplay(DISPLAY_FM); return; @@ -639,9 +647,8 @@ void FM_Start(void) // Disable UHF LNA, enable VHF LNA BK4819_PickRXFilterPathBasedOnFrequency(10320000); // 103.2 MHz < 280 MHz - AUDIO_AudioPathOn(); + FM_AudioPathOn(); - gEnableSpeaker = true; gUpdateStatus = true; #ifdef ENABLE_FEAT_F4HWN_RESUME_STATE diff --git a/App/app/generic.c b/App/app/generic.c index 4c5a42c5..de42899d 100644 --- a/App/app/generic.c +++ b/App/app/generic.c @@ -91,7 +91,7 @@ void GENERIC_Key_F(bool bKeyPressed, bool bKeyHeld) return; } #endif - gBeepToPlay = BEEP_440HZ_500MS; + gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL; gPttWasReleased = true; } } diff --git a/App/app/main.c b/App/app/main.c index d55e1ace..507df65d 100644 --- a/App/app/main.c +++ b/App/app/main.c @@ -941,12 +941,12 @@ static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction) uint16_t Channel = gEeprom.ScreenChannel[gEeprom.TX_VFO]; - if (bKeyHeld || !bKeyPressed) { // key held or released - if (gInputBoxIndex > 0) { - gInputBoxIndex = 0; - gHasVfoBackup = false; - } + if (gInputBoxIndex > 0) { + gInputBoxIndex = 0; + gHasVfoBackup = false; + } + if (bKeyHeld || !bKeyPressed) { // key held or released if (!bKeyPressed) { if (!bKeyHeld || IS_FREQ_CHANNEL(Channel)) return; diff --git a/App/app/uart.c b/App/app/uart.c index 0bd99605..8f7d592b 100644 --- a/App/app/uart.c +++ b/App/app/uart.c @@ -347,9 +347,9 @@ static void CMD_0514(uint32_t Port, const uint8_t *pBuffer) #endif gSerialConfigCountDown_500ms = 12; // 6 sec - - // turn the LCD backlight off - BACKLIGHT_TurnOff(); + + if (gEeprom.BACKLIGHT_TIME < 61) // backlight is set to be always on + BACKLIGHT_TurnOff(); // turn the LCD backlight off SendVersion(Port); } @@ -593,8 +593,8 @@ static void CMD_052F(uint32_t Port, const uint8_t *pBuffer) } #endif - // turn the LCD backlight off - BACKLIGHT_TurnOff(); + if (gEeprom.BACKLIGHT_TIME < 61) // backlight is set to be always on + BACKLIGHT_TurnOff(); // turn the LCD backlight off SendVersion(Port); } diff --git a/App/audio.c b/App/audio.c index f2c2f23c..2a61b6d3 100644 --- a/App/audio.c +++ b/App/audio.c @@ -48,7 +48,6 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep) if (Beep != BEEP_880HZ_60MS_DOUBLE_BEEP && Beep != BEEP_500HZ_60MS_DOUBLE_BEEP && - Beep != BEEP_440HZ_500MS && #ifdef ENABLE_DTMF_CALLING Beep != BEEP_880HZ_200MS && Beep != BEEP_880HZ_500MS && @@ -95,9 +94,6 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep) case BEEP_500HZ_60MS_DOUBLE_BEEP: ToneFrequency = 500; break; - case BEEP_440HZ_500MS: - ToneFrequency = 440; - break; case BEEP_880HZ_60MS_DOUBLE_BEEP: #ifndef ENABLE_FEAT_F4HWN case BEEP_880HZ_200MS: @@ -118,10 +114,12 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep) #endif } +#ifdef ENABLE_FEAT_F4HWN if(Beep == BEEP_400HZ_30MS || Beep == BEEP_500HZ_30MS || Beep == BEEP_600HZ_30MS) { BK4819_WriteRegister(BK4819_REG_70, BK4819_REG_70_ENABLE_TONE1 | ((1 & 0x7f) << BK4819_REG_70_SHIFT_TONE1_TUNING_GAIN)); } +#endif BK4819_PlayTone(ToneFrequency, true); @@ -153,7 +151,6 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep) Duration = 30; break; #endif - case BEEP_440HZ_500MS: #ifndef ENABLE_FEAT_F4HWN case BEEP_880HZ_200MS: BK4819_ExitTxMute(); diff --git a/App/audio.h b/App/audio.h index 64ec8f5e..210fd956 100644 --- a/App/audio.h +++ b/App/audio.h @@ -27,7 +27,6 @@ enum BEEP_Type_t BEEP_NONE = 0, BEEP_1KHZ_60MS_OPTIONAL, BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL, - BEEP_440HZ_500MS, #ifdef ENABLE_DTMF_CALLING BEEP_880HZ_200MS, BEEP_880HZ_500MS, diff --git a/App/ui/inputbox.c b/App/ui/inputbox.c index 2a13a6d4..ee570426 100644 --- a/App/ui/inputbox.c +++ b/App/ui/inputbox.c @@ -41,4 +41,18 @@ const char* INPUTBOX_GetAscii() inputBoxAscii[i] = (c==10)? '-' : '0' + c; } return inputBoxAscii; +} + +const char* INPUTBOX_GetAsciiAlignRight() { + int targetPos = 7; + + if (gInputBoxIndex == 1) + memset(inputBoxAscii, '-', sizeof(inputBoxAscii)); + + for (int i = 7; i >= 0; i--) { + if (gInputBox[i] != 10) { + inputBoxAscii[targetPos--] = '0' + gInputBox[i]; + } + } + return inputBoxAscii; } \ No newline at end of file diff --git a/App/ui/inputbox.h b/App/ui/inputbox.h index eb450cae..546a7577 100644 --- a/App/ui/inputbox.h +++ b/App/ui/inputbox.h @@ -25,7 +25,9 @@ extern char gInputBox[8]; extern uint8_t gInputBoxIndex; void INPUTBOX_Append(const KEY_Code_t Digit); + const char* INPUTBOX_GetAscii(); +const char* INPUTBOX_GetAsciiAlignRight(); #endif diff --git a/App/ui/main.c b/App/ui/main.c index 3a379771..0d7dcda1 100644 --- a/App/ui/main.c +++ b/App/ui/main.c @@ -948,7 +948,7 @@ void UI_DisplayMain(void) if (!inputting || gScanStateDir != SCAN_OFF) sprintf(String, "%04u", gEeprom.ScreenChannel[vfo_num] + 1); else - sprintf(String, "%.4s", INPUTBOX_GetAscii()); // show the input text + sprintf(String, "%.4s", INPUTBOX_GetAsciiAlignRight() + 4); // show the input text //if (gSetting_set_gui) { UI_PrintStringSmallNormalInverse(String, x, 0, line + 1); diff --git a/App/ui/status.c b/App/ui/status.c index ec53fe20..ca146871 100644 --- a/App/ui/status.c +++ b/App/ui/status.c @@ -155,42 +155,47 @@ void UI_DisplayStatus() if(!SCANNER_IsScanning()) { #ifdef ENABLE_FEAT_F4HWN_RX_TX_TIMER - if(gCurrentFunction == FUNCTION_TRANSMIT && gSetting_set_tmr == true) - { - convertTime(line, 0); - } - else if(FUNCTION_IsRx() && gSetting_set_tmr == true) - { - convertTime(line, 1); + bool isTransmit = gCurrentFunction == FUNCTION_TRANSMIT; + if (gSetting_set_tmr && (isTransmit || FUNCTION_IsRx())) { + convertTime(line, !isTransmit); } else #endif { if(!gAirCopyBootMode) { + const void *src = NULL; // Pointer to the font/bitmap to copy + size_t sSize = 0; // Size of the font/bitmap + uint8_t sOff = 2; // Offset relative to the reference position + #ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS - if(gEeprom.MENU_LOCK == true) { - memcpy(line + x + 2, gFontRO, sizeof(gFontRO)); - } - else + if (gEeprom.MENU_LOCK) { + src = gFontRO; + sSize = sizeof(gFontRO); + } else + #endif { - #endif - uint8_t dw = (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2; - if(dw == 1 || dw == 3) { // DWR - dual watch + respond - if(gDualWatchActive) - memcpy(line + x + (dw==1?0:2), gFontDWR, sizeof(gFontDWR) - (dw==1?0:5)); - else - memcpy(line + x + 3, gFontHold, sizeof(gFontHold)); + uint8_t xb = (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF); + + if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) { + if (gDualWatchActive) { // DWR - dual watch + respond + src = gFontDWR; + sOff = xb ? 2 : 0; + sSize = sizeof(gFontDWR) - (xb ? 5 : 0); + } else { + src = gFontHold; + sOff = 3; + sSize = sizeof(gFontHold); + } + } else { + src = xb ? gFontXB : gFontMO; // XB - crossband + sSize = xb ? sizeof(gFontXB) : sizeof(gFontMO); // MO - main only } - else if(dw == 2) { // XB - crossband - memcpy(line + x + 2, gFontXB, sizeof(gFontXB)); - } - else - { - memcpy(line + x + 2, gFontMO, sizeof(gFontMO)); - } - #ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS } - #endif + + // Perform the memcpy if a source was selected + if (src) { + memcpy(line + x + sOff, src, sSize); + } } } }