Keyboard lock is possible even if Rescue Ops is enabled

This commit is contained in:
Armel FAUVEAU
2024-11-19 16:32:15 +01:00
parent 8555c19c22
commit 6eef189048
3 changed files with 75 additions and 66 deletions

View File

@@ -39,6 +39,22 @@
void GENERIC_Key_F(bool bKeyPressed, bool bKeyHeld) void GENERIC_Key_F(bool bKeyPressed, bool bKeyHeld)
{ {
#ifdef ENABLE_F4HWN_FEAT_MENU_LOCK
if(gEeprom.MENU_LOCK == true)
{
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 (gInputBoxIndex > 0) {
if (!bKeyHeld && bKeyPressed) // short pressed if (!bKeyHeld && bKeyPressed) // short pressed
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL; gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
@@ -94,6 +110,7 @@ void GENERIC_Key_F(bool bKeyPressed, bool bKeyHeld)
gBeepToPlay = BEEP_440HZ_500MS; gBeepToPlay = BEEP_440HZ_500MS;
gPttWasReleased = true; gPttWasReleased = true;
} }
#endif
} }
void GENERIC_Key_PTT(bool bKeyPressed) void GENERIC_Key_PTT(bool bKeyPressed)

View File

@@ -948,13 +948,7 @@ void MAIN_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
MAIN_Key_STAR(bKeyPressed, bKeyHeld); MAIN_Key_STAR(bKeyPressed, bKeyHeld);
break; break;
case KEY_F: case KEY_F:
#ifndef ENABLE_FEAT_F4HWN_MENU_LOCK
GENERIC_Key_F(bKeyPressed, bKeyHeld); GENERIC_Key_F(bKeyPressed, bKeyHeld);
#else
if(gEeprom.MENU_LOCK == false) {
GENERIC_Key_F(bKeyPressed, bKeyHeld);
}
#endif
break; break;
case KEY_PTT: case KEY_PTT:
GENERIC_Key_PTT(bKeyPressed); GENERIC_Key_PTT(bKeyPressed);

View File

@@ -213,15 +213,13 @@ void UI_DisplayStatus()
memcpy(line + x + 1, gFontKeyLock, sizeof(gFontKeyLock)); memcpy(line + x + 1, gFontKeyLock, sizeof(gFontKeyLock));
} }
else if (gWasFKeyPressed) { else if (gWasFKeyPressed) {
#ifdef ENABLE_FEAT_F4HWN_MENU_LOCK
if(gEeprom.MENU_LOCK == false) {
memcpy(line + x + 1, gFontF, sizeof(gFontF)); memcpy(line + x + 1, gFontF, sizeof(gFontF));
/*
UI_PrintStringSmallBufferNormal("F", line + x + 1);
for (uint8_t i = 71; i < 79; i++)
{
gStatusLine[i] ^= 0x7F;
} }
*/ #else
memcpy(line + x + 1, gFontF, sizeof(gFontF));
#endif
} }
else if (gBackLight) else if (gBackLight)
{ {