0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-04-28 22:31:25 +03:00

Hold down keys 0-9 to bypass F-key beep fix

This commit is contained in:
OneOfEleven 2023-09-14 20:15:35 +01:00
parent 67ef7c5ef1
commit 89d313c7aa
4 changed files with 31 additions and 16 deletions

View File

@ -37,7 +37,7 @@
// #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) // #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
//#endif //#endif
static void processFKeyFunction(const KEY_Code_t Key) static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
{ {
uint8_t Band; uint8_t Band;
uint8_t Vfo = gEeprom.TX_CHANNEL; uint8_t Vfo = gEeprom.TX_CHANNEL;
@ -73,8 +73,11 @@ static void processFKeyFunction(const KEY_Code_t Key)
gEeprom.FreqChannel[Vfo] = FREQ_CHANNEL_FIRST + Band; gEeprom.FreqChannel[Vfo] = FREQ_CHANNEL_FIRST + Band;
gRequestSaveVFO = true; gRequestSaveVFO = true;
gVfoConfigureMode = VFO_CONFIGURE_RELOAD; gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
gRequestDisplayScreen = DISPLAY_MAIN; gRequestDisplayScreen = DISPLAY_MAIN;
if (beep)
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
break; break;
case KEY_2: case KEY_2:
@ -95,7 +98,10 @@ static void processFKeyFunction(const KEY_Code_t Key)
gRequestSaveSettings = 1; gRequestSaveSettings = 1;
gFlagReconfigureVfos = true; gFlagReconfigureVfos = true;
gRequestDisplayScreen = DISPLAY_MAIN; gRequestDisplayScreen = DISPLAY_MAIN;
if (beep)
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL; gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
break; break;
case KEY_3: case KEY_3:
@ -133,17 +139,22 @@ static void processFKeyFunction(const KEY_Code_t Key)
} }
} }
if (beep)
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL; gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
break; break;
case KEY_4: case KEY_4:
gWasFKeyPressed = false; gWasFKeyPressed = false;
gUpdateStatus = true; gUpdateStatus = true;
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
gFlagStartScan = true; gFlagStartScan = true;
gScanSingleFrequency = false; gScanSingleFrequency = false;
gBackupCROSS_BAND_RX_TX = gEeprom.CROSS_BAND_RX_TX; gBackupCROSS_BAND_RX_TX = gEeprom.CROSS_BAND_RX_TX;
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF; gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF;
if (beep)
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
break; break;
case KEY_5: case KEY_5:
@ -200,13 +211,16 @@ static void processFKeyFunction(const KEY_Code_t Key)
break; break;
} }
if (beep)
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL; gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
break; break;
default: default:
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
gUpdateStatus = true; gUpdateStatus = true;
gWasFKeyPressed = false; gWasFKeyPressed = false;
if (beep)
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
break; break;
} }
} }
@ -229,7 +243,7 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
} }
gWasFKeyPressed = false; gWasFKeyPressed = false;
gUpdateStatus = true; gUpdateStatus = true;
processFKeyFunction(Key); processFKeyFunction(Key, false);
} }
} }
#endif #endif
@ -237,14 +251,15 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
return; return;
} }
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL; if (bKeyPressed)
{ // key is pressed
// if (!bKeyPressed) gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL; // beep when key is pressed
if (bKeyPressed) // wait till the key is released return; // don't use the key till it's released
return; }
if (!gWasFKeyPressed) if (!gWasFKeyPressed)
{ { // F-key wasn't pressed
uint8_t Vfo = gEeprom.TX_CHANNEL; uint8_t Vfo = gEeprom.TX_CHANNEL;
INPUTBOX_Append(Key); INPUTBOX_Append(Key);
@ -374,7 +389,7 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
gWasFKeyPressed = false; gWasFKeyPressed = false;
gUpdateStatus = true; gUpdateStatus = true;
processFKeyFunction(Key); processFKeyFunction(Key, true);
} }
static void MAIN_Key_EXIT(bool bKeyPressed, bool bKeyHeld) static void MAIN_Key_EXIT(bool bKeyPressed, bool bKeyHeld)

BIN
firmware

Binary file not shown.

Binary file not shown.

Binary file not shown.