Keyboard lock is possible even if Rescue Ops is enabled
This commit is contained in:
117
app/generic.c
117
app/generic.c
@@ -39,61 +39,78 @@
|
||||
|
||||
void GENERIC_Key_F(bool bKeyPressed, bool bKeyHeld)
|
||||
{
|
||||
if (gInputBoxIndex > 0) {
|
||||
if (!bKeyHeld && bKeyPressed) // short pressed
|
||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||
return;
|
||||
}
|
||||
|
||||
if (bKeyHeld || !bKeyPressed) { // held or released
|
||||
if (bKeyHeld || bKeyPressed) { // held or pressed (cannot be held and not pressed I guess, so it checks only if HELD?)
|
||||
if (!bKeyHeld) // won't ever pass
|
||||
return;
|
||||
|
||||
if (!bKeyPressed) // won't ever pass
|
||||
return;
|
||||
|
||||
COMMON_KeypadLockToggle();
|
||||
}
|
||||
else { // released
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if ((gFmRadioMode || gScreenToDisplay != DISPLAY_MAIN) && gScreenToDisplay != DISPLAY_FM)
|
||||
return;
|
||||
#else
|
||||
if (gScreenToDisplay != DISPLAY_MAIN)
|
||||
return;
|
||||
#endif
|
||||
|
||||
gWasFKeyPressed = !gWasFKeyPressed; // toggle F function
|
||||
|
||||
if (gWasFKeyPressed)
|
||||
gKeyInputCountdown = key_input_timeout_500ms;
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
if (!gWasFKeyPressed)
|
||||
gAnotherVoiceID = VOICE_ID_CANCEL;
|
||||
#endif
|
||||
gUpdateStatus = true;
|
||||
}
|
||||
}
|
||||
else { // short pressed
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (gScreenToDisplay != DISPLAY_FM)
|
||||
#endif
|
||||
#ifdef ENABLE_F4HWN_FEAT_MENU_LOCK
|
||||
if(gEeprom.MENU_LOCK == true)
|
||||
{
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
if (bKeyHeld || !bKeyPressed) { // held or released
|
||||
if (bKeyHeld || bKeyPressed) { // held or pressed (cannot be held and not pressed I guess, so it checks only if HELD?)
|
||||
if (!bKeyHeld) // won't ever pass
|
||||
return;
|
||||
|
||||
if (!bKeyPressed) // won't ever pass
|
||||
return;
|
||||
|
||||
COMMON_KeypadLockToggle();
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (gInputBoxIndex > 0) {
|
||||
if (!bKeyHeld && bKeyPressed) // short pressed
|
||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (gFM_ScanState == FM_SCAN_OFF) { // not scanning
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
return;
|
||||
if (bKeyHeld || !bKeyPressed) { // held or released
|
||||
if (bKeyHeld || bKeyPressed) { // held or pressed (cannot be held and not pressed I guess, so it checks only if HELD?)
|
||||
if (!bKeyHeld) // won't ever pass
|
||||
return;
|
||||
|
||||
if (!bKeyPressed) // won't ever pass
|
||||
return;
|
||||
|
||||
COMMON_KeypadLockToggle();
|
||||
}
|
||||
else { // released
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if ((gFmRadioMode || gScreenToDisplay != DISPLAY_MAIN) && gScreenToDisplay != DISPLAY_FM)
|
||||
return;
|
||||
#else
|
||||
if (gScreenToDisplay != DISPLAY_MAIN)
|
||||
return;
|
||||
#endif
|
||||
|
||||
gWasFKeyPressed = !gWasFKeyPressed; // toggle F function
|
||||
|
||||
if (gWasFKeyPressed)
|
||||
gKeyInputCountdown = key_input_timeout_500ms;
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
if (!gWasFKeyPressed)
|
||||
gAnotherVoiceID = VOICE_ID_CANCEL;
|
||||
#endif
|
||||
gUpdateStatus = true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
gBeepToPlay = BEEP_440HZ_500MS;
|
||||
gPttWasReleased = true;
|
||||
}
|
||||
else { // short pressed
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (gScreenToDisplay != DISPLAY_FM)
|
||||
#endif
|
||||
{
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (gFM_ScanState == FM_SCAN_OFF) { // not scanning
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
gBeepToPlay = BEEP_440HZ_500MS;
|
||||
gPttWasReleased = true;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void GENERIC_Key_PTT(bool bKeyPressed)
|
||||
|
@@ -948,13 +948,7 @@ void MAIN_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
MAIN_Key_STAR(bKeyPressed, bKeyHeld);
|
||||
break;
|
||||
case KEY_F:
|
||||
#ifndef ENABLE_FEAT_F4HWN_MENU_LOCK
|
||||
GENERIC_Key_F(bKeyPressed, bKeyHeld);
|
||||
#else
|
||||
if(gEeprom.MENU_LOCK == false) {
|
||||
GENERIC_Key_F(bKeyPressed, bKeyHeld);
|
||||
}
|
||||
#endif
|
||||
GENERIC_Key_F(bKeyPressed, bKeyHeld);
|
||||
break;
|
||||
case KEY_PTT:
|
||||
GENERIC_Key_PTT(bKeyPressed);
|
||||
|
Reference in New Issue
Block a user