From 5400728a5f7e7e2846a7c768e0f61693fc85cc15 Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Mon, 28 Oct 2024 05:39:43 +0100 Subject: [PATCH] Add RESET_CHANNEL option --- Makefile | 4 ++++ compile-with-docker-all.sh | 1 + settings.c | 22 +++++++++++++--------- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 54ef5ac..99785b3 100644 --- a/Makefile +++ b/Makefile @@ -47,6 +47,7 @@ ENABLE_FEAT_F4HWN_RX_TX_TIMER ?= 1 ENABLE_FEAT_F4HWN_CHARGING_C ?= 1 ENABLE_FEAT_F4HWN_SLEEP ?= 1 ENABLE_FEAT_F4HWN_RESTORE_SCAN ?= 1 +ENABLE_FEAT_F4HWN_RESET_CHANNEL ?= 0 ENABLE_FEAT_F4HWN_PMR ?= 0 ENABLE_FEAT_F4HWN_GMRS_FRS_MURS ?= 0 ENABLE_FEAT_F4HWN_CA ?= 1 @@ -426,6 +427,9 @@ endif ifeq ($(ENABLE_FEAT_F4HWN_RESTORE_SCAN),1) CFLAGS += -DENABLE_FEAT_F4HWN_RESTORE_SCAN endif +ifeq ($(ENABLE_FEAT_F4HWN_RESET_CHANNEL),1) + CFLAGS += -DENABLE_FEAT_F4HWN_RESET_CHANNEL +endif ifeq ($(ENABLE_FEAT_F4HWN_PMR),1) CFLAGS += -DENABLE_FEAT_F4HWN_PMR endif diff --git a/compile-with-docker-all.sh b/compile-with-docker-all.sh index a92c9dd..d596abb 100755 --- a/compile-with-docker-all.sh +++ b/compile-with-docker-all.sh @@ -24,6 +24,7 @@ ENABLE_VOX=0 \ ENABLE_AIRCOPY=0 \ ENABLE_AUDIO_BAR=0 \ ENABLE_FEAT_F4HWN_SPECTRUM=0 \ +ENABLE_FEAT_F4HWN_SLEEP=1 \ ENABLE_NOAA=0 \ ENABLE_FEAT_F4HWN_RESTORE_SCAN=0 \ TARGET=f4hwn.voxless \ diff --git a/settings.c b/settings.c index 42be85b..c0d6489 100644 --- a/settings.c +++ b/settings.c @@ -27,6 +27,7 @@ #include "settings.h" #include "ui/menu.h" +#ifdef ENABLE_FEAT_F4HWN_RESET_CHANNEL static const uint32_t gDefaultFrequencyTable[] = { 14500000, // @@ -35,6 +36,7 @@ static const uint32_t gDefaultFrequencyTable[] = 43320000, // 43350000 // }; +#endif EEPROM_Config_t gEeprom = { 0 }; @@ -499,15 +501,17 @@ void SETTINGS_FactoryReset(bool bIsAll) { RADIO_InitInfo(gRxVfo, FREQ_CHANNEL_FIRST + BAND6_400MHz, 43350000); - // set the first few memory channels - for (i = 0; i < ARRAY_SIZE(gDefaultFrequencyTable); i++) - { - const uint32_t Frequency = gDefaultFrequencyTable[i]; - gRxVfo->freq_config_RX.Frequency = Frequency; - gRxVfo->freq_config_TX.Frequency = Frequency; - gRxVfo->Band = FREQUENCY_GetBand(Frequency); - SETTINGS_SaveChannel(MR_CHANNEL_FIRST + i, 0, gRxVfo, 2); - } + #ifdef ENABLE_FEAT_F4HWN_RESET_CHANNEL + // set the first few memory channels + for (i = 0; i < ARRAY_SIZE(gDefaultFrequencyTable); i++) + { + const uint32_t Frequency = gDefaultFrequencyTable[i]; + gRxVfo->freq_config_RX.Frequency = Frequency; + gRxVfo->freq_config_TX.Frequency = Frequency; + gRxVfo->Band = FREQUENCY_GetBand(Frequency); + SETTINGS_SaveChannel(MR_CHANNEL_FIRST + i, 0, gRxVfo, 2); + } + #endif #ifdef ENABLE_FEAT_F4HWN EEPROM_WriteBuffer(0x1FF0, Template);