From 259cf446bfcc40831701ceb56d9f48ba8a0ba599 Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Tue, 26 Mar 2024 04:45:00 +0100 Subject: [PATCH] Add exclude memory channel --- app/main.c | 6 ++---- app/menu.c | 8 ++++---- misc.c | 1 - misc.h | 1 - settings.c | 6 +++--- settings.h | 2 +- 6 files changed, 10 insertions(+), 14 deletions(-) diff --git a/app/main.c b/app/main.c index e7d84e1..fc07cb5 100644 --- a/app/main.c +++ b/app/main.c @@ -65,7 +65,7 @@ static void toggle_chan_scanlist(void) gTxVfo->SCANLIST1_PARTICIPATION = !gTxVfo->SCANLIST1_PARTICIPATION; } - SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true); + SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true, false); gVfoConfigureMode = VFO_CONFIGURE; gFlagResetVfos = true; @@ -547,9 +547,7 @@ static void MAIN_Key_MENU(const bool bKeyPressed, const bool bKeyHeld) gTxVfo->SCANLIST1_PARTICIPATION = 0; gTxVfo->SCANLIST2_PARTICIPATION = 0; - gWriteChannel = false; - SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true); - gWriteChannel = true; + SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true, true); gVfoConfigureMode = VFO_CONFIGURE; gFlagResetVfos = true; diff --git a/app/menu.c b/app/menu.c index c1f0641..4c45a18 100644 --- a/app/menu.c +++ b/app/menu.c @@ -616,14 +616,14 @@ void MENU_AcceptSetting(void) case MENU_S_ADD1: gTxVfo->SCANLIST1_PARTICIPATION = gSubMenuSelection; - SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true); + SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true, true); gVfoConfigureMode = VFO_CONFIGURE; gFlagResetVfos = true; return; case MENU_S_ADD2: gTxVfo->SCANLIST2_PARTICIPATION = gSubMenuSelection; - SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true); + SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true, true); gVfoConfigureMode = VFO_CONFIGURE; gFlagResetVfos = true; return; @@ -650,7 +650,7 @@ void MENU_AcceptSetting(void) case MENU_COMPAND: gTxVfo->Compander = gSubMenuSelection; - SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true); + SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true, true); gVfoConfigureMode = VFO_CONFIGURE; gFlagResetVfos = true; // gRequestSaveChannel = 1; @@ -756,7 +756,7 @@ void MENU_AcceptSetting(void) #endif case MENU_DEL_CH: - SETTINGS_UpdateChannel(gSubMenuSelection, NULL, false); + SETTINGS_UpdateChannel(gSubMenuSelection, NULL, false, true); gVfoConfigureMode = VFO_CONFIGURE_RELOAD; gFlagResetVfos = true; return; diff --git a/misc.c b/misc.c index 42e904e..c6fc797 100644 --- a/misc.c +++ b/misc.c @@ -116,7 +116,6 @@ enum BacklightOnRxTx_t gSetting_backlight_on_tx_rx; bool gSetting_set_gui = 0; bool gSetting_set_ptt_session; uint8_t gDebug; - bool gWriteChannel = true; #endif #ifdef ENABLE_AUDIO_BAR diff --git a/misc.h b/misc.h index 28595b4..2d72357 100644 --- a/misc.h +++ b/misc.h @@ -350,7 +350,6 @@ extern volatile uint8_t boot_counter_10ms; extern uint8_t gPttOnePushCounter; extern uint32_t gBlinkCounter; extern uint8_t gDebug; - extern bool gWriteChannel; #endif int32_t NUMBER_AddWithWraparound(int32_t Base, int32_t Add, int32_t LowerLimit, int32_t UpperLimit); diff --git a/settings.c b/settings.c index 04301b3..b0fa696 100644 --- a/settings.c +++ b/settings.c @@ -714,7 +714,7 @@ void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO, #endif EEPROM_WriteBuffer(OffsetVFO + 8, State._8); - SETTINGS_UpdateChannel(Channel, pVFO, true); + SETTINGS_UpdateChannel(Channel, pVFO, true, true); if (IS_MR_CHANNEL(Channel)) { #ifndef ENABLE_KEEP_MEM_NAME @@ -749,7 +749,7 @@ void SETTINGS_SaveChannelName(uint8_t channel, const char * name) EEPROM_WriteBuffer(0x0F58 + offset, buf + 8); } -void SETTINGS_UpdateChannel(uint8_t channel, const VFO_Info_t *pVFO, bool keep) +void SETTINGS_UpdateChannel(uint8_t channel, const VFO_Info_t *pVFO, bool keep, bool save) { #ifdef ENABLE_NOAA if (!IS_NOAA_CHANNEL(channel)) @@ -778,7 +778,7 @@ void SETTINGS_UpdateChannel(uint8_t channel, const VFO_Info_t *pVFO, bool keep) state[channel & 7u] = att.__val; #ifdef ENABLE_FEAT_F4HWN - if(gWriteChannel) + if(save) { EEPROM_WriteBuffer(offset, state); } diff --git a/settings.h b/settings.h index 6ae4e87..447c9eb 100644 --- a/settings.h +++ b/settings.h @@ -282,7 +282,7 @@ void SETTINGS_SaveSettings(void); void SETTINGS_SaveChannelName(uint8_t channel, const char * name); void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO, uint8_t Mode); void SETTINGS_SaveBatteryCalibration(const uint16_t * batteryCalibration); -void SETTINGS_UpdateChannel(uint8_t channel, const VFO_Info_t *pVFO, bool keep); +void SETTINGS_UpdateChannel(uint8_t channel, const VFO_Info_t *pVFO, bool keep, bool save); void SETTINGS_WriteBuildOptions(void); #endif