Add SetTot menu

This commit is contained in:
Armel FAUVEAU
2024-02-01 06:16:02 +01:00
parent c9b8476733
commit 103a23926d
8 changed files with 64 additions and 20 deletions

View File

@@ -380,7 +380,7 @@ ifeq ($(ENABLE_CUSTOM_MENU_LAYOUT),1)
endif
ifeq ($(ENABLE_FEAT_F4HWN),1)
CFLAGS += -DENABLE_FEAT_F4HWN
FEAT_STRING ?= "F4HWN v1.5"
FEAT_STRING ?= "F4HWN v1.6"
CFLAGS += -DFEAT_STRING=\"$(FEAT_STRING)\" -DALERT_TOT=10
endif

View File

@@ -828,33 +828,43 @@ void APP_Update(void)
#ifdef ENABLE_FEAT_F4HWN
if (gCurrentFunction == FUNCTION_TRANSMIT && (gTxTimeoutReachedAlert || SerialConfigInProgress()))
{
if (gEeprom.BACKLIGHT_TIME == 0) {
if (gBlinkCounter == 0)
{
GPIO_FlipBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
}
else if(gBlinkCounter == 250)
{
GPIO_FlipBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
}
}
else
if(gSetting_set_tot >= 2)
{
if (gBlinkCounter == 0)
{
BACKLIGHT_TurnOn();
if (gEeprom.BACKLIGHT_TIME == 0) {
if (gBlinkCounter == 0)
{
GPIO_FlipBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
}
else if(gBlinkCounter == 250)
{
GPIO_FlipBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
}
}
else if(gBlinkCounter == 15000)
else
{
BACKLIGHT_TurnOff();
if (gBlinkCounter == 0)
{
BACKLIGHT_TurnOn();
}
else if(gBlinkCounter == 15000)
{
BACKLIGHT_TurnOff();
}
}
}
gBlinkCounter++;
if(gBlinkCounter > 30000)
if(gBlinkCounter > 74000)
{
gBlinkCounter = 0;
if(gSetting_set_tot == 1 || gSetting_set_tot == 3)
{
BK4819_DisableScramble();
BK4819_PlaySingleTone(gTxTimeoutToneAlert, 30, 1, true);
gTxTimeoutToneAlert += 100;
}
}
}
#endif
@@ -865,6 +875,7 @@ void APP_Update(void)
#ifdef ENABLE_FEAT_F4HWN
gTxTimeoutReachedAlert = false;
gTxTimeoutToneAlert = 800;
#endif
APP_EndTransmission();

View File

@@ -372,6 +372,10 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax)
*pMin = 0;
*pMax = ARRAY_SIZE(gSubMenu_SET_PTT) - 1;
break;
case MENU_SET_TOT:
*pMin = 0;
*pMax = ARRAY_SIZE(gSubMenu_SET_TOT) - 1;
break;
#endif
default:
@@ -817,6 +821,10 @@ void MENU_AcceptSetting(void)
gSetting_set_ptt = gSubMenuSelection;
gRequestSaveChannel = 1;
break;
case MENU_SET_TOT:
gSetting_set_tot = gSubMenuSelection;
gRequestSaveChannel = 1;
break;
#endif
}
@@ -1187,6 +1195,9 @@ void MENU_ShowCurrentSetting(void)
case MENU_SET_PTT:
gSubMenuSelection = gSetting_set_ptt;
break;
case MENU_SET_TOT:
gSubMenuSelection = gSetting_set_tot;
break;
#endif
default:

2
misc.c
View File

@@ -98,6 +98,7 @@ enum BacklightOnRxTx_t gSetting_backlight_on_tx_rx;
#ifdef ENABLE_FEAT_F4HWN
uint8_t gSetting_set_low;
bool gSetting_set_ptt;
uint8_t gSetting_set_tot;
#endif
#ifdef ENABLE_AUDIO_BAR
@@ -140,6 +141,7 @@ volatile bool gTxTimeoutReached;
#ifdef ENABLE_FEAT_F4HWN
volatile uint16_t gTxTimerCountdownAlert_500ms;
volatile bool gTxTimeoutReachedAlert;
volatile uint16_t gTxTimeoutToneAlert = 800;
#endif
volatile uint16_t gTailNoteEliminationCountdown_10ms;

6
misc.h
View File

@@ -157,8 +157,9 @@ extern enum BacklightOnRxTx_t gSetting_backlight_on_tx_rx;
#endif
#ifdef ENABLE_FEAT_F4HWN
extern uint8_t gSetting_set_low;
extern bool gSetting_set_ptt;
extern uint8_t gSetting_set_low;
extern bool gSetting_set_ptt;
extern uint8_t gSetting_set_tot;
#endif
#ifdef ENABLE_AUDIO_BAR
@@ -213,6 +214,7 @@ extern volatile bool gTxTimeoutReached;
#ifdef ENABLE_FEAT_F4HWN
extern volatile uint16_t gTxTimerCountdownAlert_500ms;
extern volatile bool gTxTimeoutReachedAlert;
extern volatile uint16_t gTxTimeoutToneAlert;
#endif
extern volatile uint16_t gTailNoteEliminationCountdown_10ms;

View File

@@ -283,6 +283,8 @@ void SETTINGS_InitEEPROM(void)
EEPROM_ReadBuffer(0x1FF0, Data, 8);
gSetting_set_low = (Data[7] < 5) ? Data[7] : 0;
gSetting_set_ptt = (Data[6] < 2) ? Data[6] : 0;
gSetting_set_tot = (Data[5] < 4) ? Data[5] : 0;
#endif
}
@@ -602,6 +604,7 @@ void SETTINGS_SaveSettings(void)
#ifdef ENABLE_FEAT_F4HWN
memset(State, 0xFF, sizeof(State));
State[5] = gSetting_set_tot;
State[6] = gSetting_set_ptt;
State[7] = gSetting_set_low;
EEPROM_WriteBuffer(0x1FF0, State);

View File

@@ -126,6 +126,7 @@ const t_menu_item MenuList[] =
#ifdef ENABLE_FEAT_F4HWN
{"SetLow", VOICE_ID_INVALID, MENU_SET_LOW },
{"SetPtt", VOICE_ID_INVALID, MENU_SET_PTT },
{"SetTot", VOICE_ID_INVALID, MENU_SET_TOT },
#endif
// hidden menu items from here on
// enabled if pressing both the PTT and upper side button at power-on
@@ -352,6 +353,14 @@ const char gSubMenu_SCRAMBLER[][7] =
"Classic",
"OnePush"
};
const char gSubMenu_SET_TOT[][7] =
{
"Off",
"Sound",
"Visual",
"All"
};
#endif
const t_sidefunction gSubMenu_SIDEFUNCTIONS[] =
@@ -880,6 +889,10 @@ void UI_DisplayMenu(void)
case MENU_SET_PTT:
strcpy(String, gSubMenu_SET_PTT[gSubMenuSelection]);
break;
case MENU_SET_TOT:
strcpy(String, gSubMenu_SET_TOT[gSubMenuSelection]);
break;
#endif
}

View File

@@ -120,6 +120,7 @@ enum
#ifdef ENABLE_FEAT_F4HWN
MENU_SET_LOW,
MENU_SET_PTT,
MENU_SET_TOT,
#endif
MENU_BATCAL, // battery voltage calibration
MENU_F1SHRT,
@@ -156,6 +157,7 @@ extern const char gSubMenu_D_RSP[4][11];
#ifdef ENABLE_FEAT_F4HWN
extern const char gSubMenu_SET_LOW[5][7];
extern const char gSubMenu_SET_PTT[2][8];
extern const char gSubMenu_SET_TOT[4][7];
#endif
extern const char* const gSubMenu_PTT_ID[5];