From 103a23926d95ba4078305b2c07fd7c52d0b5fca8 Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Thu, 1 Feb 2024 06:16:02 +0100 Subject: [PATCH] Add SetTot menu --- Makefile | 2 +- app/app.c | 45 ++++++++++++++++++++++++++++----------------- app/menu.c | 11 +++++++++++ misc.c | 2 ++ misc.h | 6 ++++-- settings.c | 3 +++ ui/menu.c | 13 +++++++++++++ ui/menu.h | 2 ++ 8 files changed, 64 insertions(+), 20 deletions(-) diff --git a/Makefile b/Makefile index 6f550ab..4584ac1 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/app/app.c b/app/app.c index 1df8b04..06a023d 100644 --- a/app/app.c +++ b/app/app.c @@ -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(); diff --git a/app/menu.c b/app/menu.c index a400c2c..ac68359 100644 --- a/app/menu.c +++ b/app/menu.c @@ -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: diff --git a/misc.c b/misc.c index e6f04dc..6e6797e 100644 --- a/misc.c +++ b/misc.c @@ -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; diff --git a/misc.h b/misc.h index 8da1731..d02cbd6 100644 --- a/misc.h +++ b/misc.h @@ -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; diff --git a/settings.c b/settings.c index 3b81e40..c83c780 100644 --- a/settings.c +++ b/settings.c @@ -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); diff --git a/ui/menu.c b/ui/menu.c index cc695fe..c238699 100644 --- a/ui/menu.c +++ b/ui/menu.c @@ -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 } diff --git a/ui/menu.h b/ui/menu.h index 93e052c..0d6fef3 100644 --- a/ui/menu.h +++ b/ui/menu.h @@ -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];