mirror of
https://github.com/armel/uv-k1-k5v3-firmware-custom.git
synced 2026-10-02 03:15:37 +00:00
Add ACTIONS lock scope to SetLck
This commit is contained in:
1 parent
676f26be34
commit
b44df132d0
9 files changed
+31
-18
No files matched your search
+1
-1
@@ -472,7 +472,7 @@ static void ACTION_Scan_FM(bool bRestart)
|
||||
static void ACTION_AlarmOr1750(const bool b1750)
|
||||
{
|
||||
|
||||
if(gEeprom.KEY_LOCK && gEeprom.KEY_LOCK_PTT)
|
||||
if(gEeprom.KEY_LOCK && (gSetting_set_lck & SET_LCK_PTT))
|
||||
return;
|
||||
|
||||
#if defined(ENABLE_ALARM)
|
||||
|
||||
+8
-3
@@ -2308,7 +2308,7 @@ static void ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
#ifdef ENABLE_FEAT_F4HWN // Disable PTT if KEY_LOCK
|
||||
bool lck_condition = (gEeprom.KEY_LOCK || lowBatPopup) && gCurrentFunction != FUNCTION_TRANSMIT;
|
||||
|
||||
if(!gSetting_set_lck)
|
||||
if((gSetting_set_lck & SET_LCK_PTT) == 0)
|
||||
lck_condition = lck_condition && Key != KEY_PTT;
|
||||
|
||||
if (lck_condition)
|
||||
@@ -2325,6 +2325,12 @@ static void ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
return;
|
||||
}
|
||||
|
||||
// The ACTIONS restriction only applies when the keypad is actually
|
||||
// locked: this block is also entered for the low battery popup, where
|
||||
// action keys must keep working as before
|
||||
const bool passActionKey = ((gSetting_set_lck & SET_LCK_ACTIONS) == 0 || !gEeprom.KEY_LOCK) &&
|
||||
(Key == KEY_SIDE1 || Key == KEY_SIDE2 || (Key == KEY_MENU && bKeyHeld));
|
||||
|
||||
if (Key == KEY_F) { // function/key-lock key
|
||||
if (!bKeyPressed)
|
||||
return;
|
||||
@@ -2339,8 +2345,7 @@ static void ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
// KEY_MENU has a special treatment here, because we want to pass hold event to ACTION_Handle
|
||||
// but we don't want it to complain when initial press happens
|
||||
// we want to react on realese instead
|
||||
else if (Key != KEY_SIDE1 && Key != KEY_SIDE2 && // pass side buttons
|
||||
!(Key == KEY_MENU && bKeyHeld)) // pass KEY_MENU held
|
||||
else if (!passActionKey)
|
||||
{
|
||||
if ((!bKeyPressed || bKeyHeld || (Key == KEY_MENU && bKeyPressed)) && // prevent released or held, prevent KEY_MENU pressed
|
||||
!(Key == KEY_MENU && !bKeyPressed)) // pass KEY_MENU released
|
||||
|
||||
+1
-1
@@ -426,7 +426,7 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax)
|
||||
#endif
|
||||
case MENU_SET_LCK:
|
||||
//*pMin = 0;
|
||||
*pMax = ARRAY_SIZE(gSubMenu_SET_LCK) - 1;
|
||||
*pMax = SET_LCK_LEN - 1;
|
||||
break;
|
||||
case MENU_SET_MET:
|
||||
case MENU_SET_GUI:
|
||||
|
||||
+1
-1
@@ -127,7 +127,7 @@ enum BacklightOnRxTx_t gSetting_backlight_on_tx_rx;
|
||||
uint8_t gSetting_set_ctr = 10;
|
||||
bool gSetting_set_inv = false;
|
||||
uint8_t gSetting_set_eot = 0;
|
||||
bool gSetting_set_lck = false;
|
||||
uint8_t gSetting_set_lck = SET_LCK_KEYS;
|
||||
bool gSetting_set_met = 0;
|
||||
bool gSetting_set_gui = 0;
|
||||
#ifdef ENABLE_FEAT_F4HWN_AUDIO
|
||||
|
||||
+14
-1
@@ -181,6 +181,19 @@ extern enum BacklightOnRxTx_t gSetting_backlight_on_tx_rx;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN
|
||||
// Keypad lock scope. Values are BOTH a bitmask (ACTIONS/PTT bits tested
|
||||
// individually) AND a contiguous 0..3 menu index: the order must stay
|
||||
// aligned with gSubMenu_SET_LCK[] and any new entry must keep the range
|
||||
// contiguous so that SET_LCK_LEN remains valid as menu bound and EEPROM
|
||||
// range check.
|
||||
enum SET_LCK_t {
|
||||
SET_LCK_KEYS = 0u,
|
||||
SET_LCK_ACTIONS = 1u,
|
||||
SET_LCK_PTT = 2u,
|
||||
SET_LCK_ACTIONS_PTT = SET_LCK_ACTIONS | SET_LCK_PTT,
|
||||
SET_LCK_LEN
|
||||
};
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN_LOGO_SAV
|
||||
enum SET_SAV_t {
|
||||
SET_SAV_OFF,
|
||||
@@ -197,7 +210,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 uint8_t gSetting_set_lck;
|
||||
extern bool gSetting_set_met;
|
||||
extern bool gSetting_set_gui;
|
||||
#ifdef ENABLE_FEAT_F4HWN_AUDIO
|
||||
|
||||
+2
-8
@@ -477,7 +477,6 @@ gEeprom.FreqChannel[1] = IS_FREQ_CHANNEL(Data16[5]) ? Data16[5] : (FREQ_CHANNE
|
||||
int tmp = ((Data[5] & 0xF0) >> 4);
|
||||
|
||||
gSetting_set_inv = (((tmp >> 0) & 0x01) < 2) ? ((tmp >> 0) & 0x01): 0;
|
||||
gSetting_set_lck = (((tmp >> 1) & 0x01) < 2) ? ((tmp >> 1) & 0x01): 0;
|
||||
gSetting_set_met = (((tmp >> 2) & 0x01) < 2) ? ((tmp >> 2) & 0x01): 0;
|
||||
gSetting_set_gui = (((tmp >> 3) & 0x01) < 2) ? ((tmp >> 3) & 0x01): 0;
|
||||
gSetting_set_ctr = (((Data[5] & 0x0F)) > 00 && ((Data[5] & 0x0F)) < 16) ? ((Data[5] & 0x0F)) : 10;
|
||||
@@ -492,7 +491,7 @@ gEeprom.FreqChannel[1] = IS_FREQ_CHANNEL(Data16[5]) ? Data16[5] : (FREQ_CHANNE
|
||||
#else
|
||||
gSetting_set_inv = 0;
|
||||
#endif
|
||||
gSetting_set_lck = (tmp >> 1) & 0x01;
|
||||
gSetting_set_lck = (Data[2] < SET_LCK_LEN) ? Data[2] : SET_LCK_KEYS;
|
||||
gSetting_set_met = (tmp >> 2) & 0x01;
|
||||
gSetting_set_gui = (tmp >> 3) & 0x01;
|
||||
|
||||
@@ -510,7 +509,6 @@ gEeprom.FreqChannel[1] = IS_FREQ_CHANNEL(Data16[5]) ? Data16[5] : (FREQ_CHANNE
|
||||
|
||||
// And set special session settings for actions
|
||||
gSetting_set_ptt_session = gSetting_set_ptt;
|
||||
gEeprom.KEY_LOCK_PTT = gSetting_set_lck;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1119,8 +1117,6 @@ void SETTINGS_SaveSettings(void)
|
||||
|
||||
if(gSetting_set_inv == 1)
|
||||
tmp = tmp | (1 << 0);
|
||||
if (gSetting_set_lck == 1)
|
||||
tmp = tmp | (1 << 1);
|
||||
if (gSetting_set_met == 1)
|
||||
tmp = tmp | (1 << 2);
|
||||
if (gSetting_set_gui == 1)
|
||||
@@ -1134,10 +1130,10 @@ void SETTINGS_SaveSettings(void)
|
||||
#endif
|
||||
|
||||
tmp = (gSetting_set_inv << 0) |
|
||||
(gSetting_set_lck << 1) |
|
||||
(gSetting_set_met << 2) |
|
||||
(gSetting_set_gui << 3);
|
||||
|
||||
State[2] = gSetting_set_lck;
|
||||
State[5] = ((tmp << 4) | (gSetting_set_ctr & 0x0F));
|
||||
State[6] = ((gSetting_set_tot << 4) | (gSetting_set_eot & 0x0F));
|
||||
uint8_t set_ptt_scn_sav = gSetting_set_ptt & 0x01;
|
||||
@@ -1151,8 +1147,6 @@ void SETTINGS_SaveSettings(void)
|
||||
|
||||
State[7] = ((gSetting_set_pwr << 4) | set_ptt_scn_sav);
|
||||
|
||||
gEeprom.KEY_LOCK_PTT = gSetting_set_lck;
|
||||
|
||||
PY25Q16_WriteBuffer(0x00A158, SecBuf, 8, false);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -199,7 +199,6 @@ typedef struct {
|
||||
uint8_t TX_TIMEOUT_TIMER;
|
||||
bool KEY_LOCK;
|
||||
#ifdef ENABLE_FEAT_F4HWN
|
||||
bool KEY_LOCK_PTT;
|
||||
bool SET_NAV;
|
||||
#endif
|
||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
||||
|
||||
+3
-1
@@ -421,7 +421,9 @@ const char* const gSubMenu_SCRAMBLER[] =
|
||||
const char* const gSubMenu_SET_LCK[] =
|
||||
{
|
||||
"KEYS",
|
||||
"KEYS+PTT"
|
||||
"KEYS\nACTIONS",
|
||||
"KEYS\nPTT",
|
||||
"KEYS\nACTIONS\nPTT"
|
||||
};
|
||||
|
||||
const char* const gSubMenu_SET_MET[] =
|
||||
|
||||
+1
-1
@@ -195,7 +195,7 @@ extern const char* const gSubMenu_D_RSP[4];
|
||||
extern const char* const gSubMenu_SET_PWR[7];
|
||||
extern const char* const gSubMenu_SET_PTT[2];
|
||||
extern const char* const gSubMenu_SET_TOT[4];
|
||||
extern const char* const gSubMenu_SET_LCK[2];
|
||||
extern const char* const gSubMenu_SET_LCK[];
|
||||
extern const char* const gSubMenu_SET_MET[2];
|
||||
#ifdef ENABLE_FEAT_F4HWN_SCAN_FASTER
|
||||
extern const char* const gSubMenu_SET_SCN[2];
|
||||
|
||||
Reference in new issue
Block a user