diff --git a/app/app.c b/app/app.c index 7a8201d..80943ae 100644 --- a/app/app.c +++ b/app/app.c @@ -1756,7 +1756,14 @@ static void ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) bool lowBatPopup = gLowBattery && !gLowBatteryConfirmed && gScreenToDisplay == DISPLAY_MAIN; #ifdef ENABLE_FEAT_F4HWN // Disable PTT if KEY_LOCK - if ((gEeprom.KEY_LOCK || lowBatPopup) && gCurrentFunction != FUNCTION_TRANSMIT) + bool lck_condition = false; + + if(gSetting_set_lck) + lck_condition = (gEeprom.KEY_LOCK || lowBatPopup) && gCurrentFunction != FUNCTION_TRANSMIT; + else + lck_condition = (gEeprom.KEY_LOCK || lowBatPopup) && gCurrentFunction != FUNCTION_TRANSMIT && Key != KEY_PTT; + + if (lck_condition) #else if ((gEeprom.KEY_LOCK || lowBatPopup) && gCurrentFunction != FUNCTION_TRANSMIT && Key != KEY_PTT) #endif diff --git a/app/menu.c b/app/menu.c index 844392d..2d3d05a 100644 --- a/app/menu.c +++ b/app/menu.c @@ -388,6 +388,10 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax) *pMin = 0; *pMax = ARRAY_SIZE(gSubMenu_OFF_ON) - 1; break; + case MENU_SET_LCK: + *pMin = 0; + *pMax = ARRAY_SIZE(gSubMenu_SET_LCK) - 1; + break; #endif default: @@ -852,6 +856,9 @@ void MENU_AcceptSetting(void) case MENU_SET_INV: gSetting_set_inv = gSubMenuSelection; break; + case MENU_SET_LCK: + gSetting_set_lck = gSubMenuSelection; + break; #endif } @@ -1238,6 +1245,9 @@ void MENU_ShowCurrentSetting(void) case MENU_SET_INV: gSubMenuSelection = gSetting_set_inv; break; + case MENU_SET_LCK: + gSubMenuSelection = gSetting_set_lck; + break; #endif default: diff --git a/misc.c b/misc.c index 0f4cf85..f858a86 100644 --- a/misc.c +++ b/misc.c @@ -102,6 +102,7 @@ enum BacklightOnRxTx_t gSetting_backlight_on_tx_rx; uint8_t gSetting_set_ctr = 11; bool gSetting_set_inv = false; uint8_t gSetting_set_eot = 0; + bool gSetting_set_lck = false; bool gSetting_set_ptt_session; #endif diff --git a/misc.h b/misc.h index fc048b5..e069a13 100644 --- a/misc.h +++ b/misc.h @@ -163,6 +163,7 @@ extern enum BacklightOnRxTx_t gSetting_backlight_on_tx_rx; extern uint8_t gSetting_set_ctr; extern bool gSetting_set_inv; extern uint8_t gSetting_set_eot; + extern bool gSetting_set_lck; extern bool gSetting_set_ptt_session; #endif diff --git a/settings.c b/settings.c index 4feea52..d529daa 100644 --- a/settings.c +++ b/settings.c @@ -296,6 +296,8 @@ void SETTINGS_InitEEPROM(void) gSetting_set_inv = (((Data[5] & 0xF0) >> 4) < 2) ? ((Data[5] & 0xF0) >> 4) : 0; gSetting_set_ctr = (((Data[5] & 0x0F)) < 16) ? ((Data[5] & 0x0F)) : 5; + gSetting_set_lck = (Data[4] < 2) ? (Data[4]) : 0; + // And set special session settings for actions gSetting_set_ptt_session = gSetting_set_ptt; #endif @@ -624,6 +626,7 @@ void SETTINGS_SaveSettings(void) #ifdef ENABLE_FEAT_F4HWN memset(State, 0xFF, sizeof(State)); + State[4] = gSetting_set_lck; State[5] = ((gSetting_set_inv << 4) | (gSetting_set_ctr & 0x0F)); State[6] = ((gSetting_set_tot << 4) | (gSetting_set_eot & 0x0F)); State[7] = ((gSetting_set_low << 4) | (gSetting_set_ptt & 0x0F)); diff --git a/ui/main.c b/ui/main.c index 0ad11a7..ebb6d0b 100644 --- a/ui/main.c +++ b/ui/main.c @@ -518,6 +518,7 @@ void UI_DisplayMain(void) return; } +#ifndef ENABLE_FEAT_F4HWN if (gEeprom.KEY_LOCK && gKeypadLocked > 0) { // tell user how to unlock the keyboard UI_PrintString("Long press #", 0, LCD_WIDTH, 1, 8); @@ -525,6 +526,15 @@ void UI_DisplayMain(void) ST7565_BlitFullScreen(); return; } +#else + if (gEeprom.KEY_LOCK && gKeypadLocked > 0) + { // tell user how to unlock the keyboard + BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, true); + SYSTEM_DelayMs(50); + BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, false); + SYSTEM_DelayMs(50); + } +#endif unsigned int activeTxVFO = gRxVfoIsActive ? gEeprom.RX_VFO : gEeprom.TX_VFO; diff --git a/ui/menu.c b/ui/menu.c index ea39dfa..0cde85c 100644 --- a/ui/menu.c +++ b/ui/menu.c @@ -132,6 +132,7 @@ const t_menu_item MenuList[] = {"SetEot", VOICE_ID_INVALID, MENU_SET_EOT }, {"SetCtr", VOICE_ID_INVALID, MENU_SET_CTR }, {"SetInv", VOICE_ID_INVALID, MENU_SET_INV }, + {"SetLck", VOICE_ID_INVALID, MENU_SET_LCK }, #endif // hidden menu items from here on // enabled if pressing both the PTT and upper side button at power-on @@ -370,6 +371,12 @@ const char gSubMenu_SCRAMBLER[][7] = "VISUAL", "ALL" }; + + const char gSubMenu_SET_LCK[][9] = + { + "KEYS", + "KEYS+PTT" + }; #endif const t_sidefunction gSubMenu_SIDEFUNCTIONS[] = @@ -922,6 +929,10 @@ void UI_DisplayMenu(void) strcpy(String, gSubMenu_OFF_ON[gSubMenuSelection]); ST7565_ContrastAndInv(); break; + + case MENU_SET_LCK: + strcpy(String, gSubMenu_SET_LCK[gSubMenuSelection]); + break; #endif } diff --git a/ui/menu.h b/ui/menu.h index 915bfe9..48142bb 100644 --- a/ui/menu.h +++ b/ui/menu.h @@ -128,6 +128,7 @@ enum MENU_SET_EOT, MENU_SET_CTR, MENU_SET_INV, + MENU_SET_LCK, #endif MENU_BATCAL, // battery voltage calibration MENU_F1SHRT, @@ -165,6 +166,7 @@ extern const char gSubMenu_D_RSP[4][11]; extern const char gSubMenu_SET_LOW[5][7]; extern const char gSubMenu_SET_PTT[2][8]; extern const char gSubMenu_SET_TOT[4][7]; + extern const char gSubMenu_SET_LCK[2][9]; #endif extern const char* const gSubMenu_PTT_ID[5];