Add SetKey for RescueOps

This commit is contained in:
Armel FAUVEAU
2024-11-13 06:17:32 +01:00
parent cd5caff593
commit 397561e0e1
7 changed files with 55 additions and 8 deletions

View File

@@ -432,6 +432,12 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax)
*pMax = 63; *pMax = 63;
break; break;
#endif #endif
#ifdef ENABLE_FEAT_F4HWN_MENU_LOCK
case MENU_SET_KEY:
//*pMin = 0;
*pMax = 4;
break;
#endif
#endif #endif
default: default:
@@ -945,6 +951,11 @@ void MENU_AcceptSetting(void)
gEeprom.VOLUME_GAIN = gSubMenuSelection; gEeprom.VOLUME_GAIN = gSubMenuSelection;
break; break;
#endif #endif
#ifdef ENABLE_FEAT_F4HWN_MENU_LOCK
case MENU_SET_KEY:
gEeprom.SET_KEY = gSubMenuSelection;
break;
#endif
case MENU_SET_TMR: case MENU_SET_TMR:
gSetting_set_tmr = gSubMenuSelection; gSetting_set_tmr = gSubMenuSelection;
break; break;
@@ -1391,6 +1402,11 @@ void MENU_ShowCurrentSetting(void)
gSubMenuSelection = gEeprom.VOLUME_GAIN; gSubMenuSelection = gEeprom.VOLUME_GAIN;
break; break;
#endif #endif
#ifdef ENABLE_FEAT_F4HWN_MENU_LOCK
case MENU_SET_KEY:
gSubMenuSelection = gEeprom.SET_KEY;
break;
#endif
case MENU_SET_TMR: case MENU_SET_TMR:
gSubMenuSelection = gSetting_set_tmr; gSubMenuSelection = gSetting_set_tmr;
break; break;

View File

@@ -45,9 +45,9 @@ BOOT_Mode_t BOOT_GetMode(void)
} }
#ifdef ENABLE_FEAT_F4HWN_MENU_LOCK #ifdef ENABLE_FEAT_F4HWN_MENU_LOCK
if (Keys[0] == KEY_MENU) if (Keys[0] == (10 + gEeprom.SET_KEY))
{ {
return BOOT_MODE_MENU_LOCK; // Menu pressed return BOOT_MODE_MENU_LOCK; // Secret KEY pressed
} }
#endif #endif

13
main.c
View File

@@ -164,11 +164,14 @@ void Main(void)
#ifndef ENABLE_VOX #ifndef ENABLE_VOX
gMenuCursor = 65; // move to hidden section, fix me if change... !!! Remove VOX and Mic Bar gMenuCursor = 65; // move to hidden section, fix me if change... !!! Remove VOX and Mic Bar
#else #else
#ifdef ENABLE_FEAT_F4HWN_SLEEP gMenuCursor = 68; // move to hidden section, fix me if change... !!!
gMenuCursor = 68; // move to hidden section, fix me if change... !!! #endif
#else
gMenuCursor = 67; // move to hidden section, fix me if change... !!! #ifdef ENABLE_NOAA
#endif gMenuCursor += 1; // move to hidden section, fix me if change... !!!
#endif
#ifdef ENABLE_FEAT_F4HWN_MENU_LOCK
gMenuCursor += 1; // move to hidden section, fix me if change... !!!
#endif #endif
gSubMenuSelection = gSetting_F_LOCK; gSubMenuSelection = gSetting_F_LOCK;
#endif #endif

View File

@@ -54,6 +54,7 @@ void SETTINGS_InitEEPROM(void)
#ifdef ENABLE_FEAT_F4HWN_MENU_LOCK #ifdef ENABLE_FEAT_F4HWN_MENU_LOCK
gEeprom.KEY_LOCK = (Data[4] & 0x01) != 0; gEeprom.KEY_LOCK = (Data[4] & 0x01) != 0;
gEeprom.MENU_LOCK = (Data[4] & 0x02) != 0; gEeprom.MENU_LOCK = (Data[4] & 0x02) != 0;
gEeprom.SET_KEY = (Data[4] >> 2) & 0x0F;
#else #else
gEeprom.KEY_LOCK = (Data[4] < 2) ? Data[4] : false; gEeprom.KEY_LOCK = (Data[4] < 2) ? Data[4] : false;
#endif #endif
@@ -597,7 +598,7 @@ void SETTINGS_SaveSettings(void)
#endif #endif
#ifdef ENABLE_FEAT_F4HWN_MENU_LOCK #ifdef ENABLE_FEAT_F4HWN_MENU_LOCK
State[4] = (gEeprom.KEY_LOCK ? 0x01 : 0) | (gEeprom.MENU_LOCK ? 0x02 :0); State[4] = (gEeprom.KEY_LOCK ? 0x01 : 0) | (gEeprom.MENU_LOCK ? 0x02 :0) | ((gEeprom.SET_KEY & 0x0F) << 2);
#else #else
State[4] = gEeprom.KEY_LOCK; State[4] = gEeprom.KEY_LOCK;
#endif #endif

View File

@@ -188,6 +188,7 @@ typedef struct {
#endif #endif
#ifdef ENABLE_FEAT_F4HWN_MENU_LOCK #ifdef ENABLE_FEAT_F4HWN_MENU_LOCK
bool MENU_LOCK; bool MENU_LOCK;
uint8_t SET_KEY;
#endif #endif
bool VOX_SWITCH; bool VOX_SWITCH;
uint8_t VOX_LEVEL; uint8_t VOX_LEVEL;

View File

@@ -158,6 +158,9 @@ const t_menu_item MenuList[] =
#ifdef ENABLE_FEAT_F4HWN_VOL #ifdef ENABLE_FEAT_F4HWN_VOL
{"SetVol", MENU_SET_VOL }, {"SetVol", MENU_SET_VOL },
#endif #endif
#ifdef ENABLE_FEAT_F4HWN_MENU_LOCK
{"SetKey", MENU_SET_KEY },
#endif
#endif #endif
// hidden menu items from here on // hidden menu items from here on
// enabled if pressing both the PTT and upper side button at power-on // enabled if pressing both the PTT and upper side button at power-on
@@ -397,6 +400,17 @@ const char gSubMenu_SCRAMBLER[][7] =
"NARROWER" "NARROWER"
}; };
#endif #endif
#ifdef ENABLE_FEAT_F4HWN_MENU_LOCK
const char gSubMenu_SET_KEY[][9] =
{
"KEY_MENU",
"KEY_UP",
"KEY_DOWN",
"KEY_EXIT",
"KEY_STAR"
};
#endif
#endif #endif
const t_sidefunction gSubMenu_SIDEFUNCTIONS[] = const t_sidefunction gSubMenu_SIDEFUNCTIONS[] =
@@ -1065,6 +1079,12 @@ void UI_DisplayMenu(void)
(gEeprom.DAC_GAIN << 0)); // AF DAC Gain (after Gain-1 and Gain-2) (gEeprom.DAC_GAIN << 0)); // AF DAC Gain (after Gain-1 and Gain-2)
break; break;
#endif #endif
#ifdef ENABLE_FEAT_F4HWN_MENU_LOCK
case MENU_SET_KEY:
strcpy(String, gSubMenu_SET_KEY[gSubMenuSelection]);
break;
#endif
#endif #endif
} }

View File

@@ -147,6 +147,9 @@ enum
#ifdef ENABLE_FEAT_F4HWN_VOL #ifdef ENABLE_FEAT_F4HWN_VOL
MENU_SET_VOL, MENU_SET_VOL,
#endif #endif
#ifdef ENABLE_FEAT_F4HWN_MENU_LOCK
MENU_SET_KEY,
#endif
#endif #endif
MENU_BATCAL, // battery voltage calibration MENU_BATCAL, // battery voltage calibration
MENU_F1SHRT, MENU_F1SHRT,
@@ -187,6 +190,9 @@ extern const char gSubMenu_D_RSP[4][11];
#ifdef ENABLE_FEAT_F4HWN_NARROWER #ifdef ENABLE_FEAT_F4HWN_NARROWER
extern const char gSubMenu_SET_NFM[2][9]; extern const char gSubMenu_SET_NFM[2][9];
#endif #endif
#ifdef ENABLE_FEAT_F4HWN_MENU_LOCK
extern const char gSubMenu_SET_KEY[][9];
#endif
#endif #endif
extern const char* const gSubMenu_PTT_ID[5]; extern const char* const gSubMenu_PTT_ID[5];