diff --git a/app/action.c b/app/action.c index dfba68e..9e3b09e 100644 --- a/app/action.c +++ b/app/action.c @@ -458,7 +458,7 @@ void ACTION_Main(void) static uint8_t b; - if(gEeprom.DUAL_WATCH == 0 && gEeprom.CROSS_BAND_RX_TX == 0 && cycle != 1) + if(gSetting_set_dual_watch_session == 0 && gSetting_set_cross_band_RX_TX_session == 0 && cycle != 1) { return; } @@ -466,11 +466,11 @@ void ACTION_Main(void) { if(cycle == 0) { - a = gEeprom.DUAL_WATCH; - b = gEeprom.CROSS_BAND_RX_TX; + a = gSetting_set_dual_watch_session; + b = gSetting_set_cross_band_RX_TX_session; - gEeprom.DUAL_WATCH = 0; - gEeprom.CROSS_BAND_RX_TX = 0; + gSetting_set_dual_watch_session = 0; + gSetting_set_cross_band_RX_TX_session = 0; gFlagReconfigureVfos = true; gUpdateStatus = true; @@ -479,8 +479,8 @@ void ACTION_Main(void) } else { - gEeprom.DUAL_WATCH = a; - gEeprom.CROSS_BAND_RX_TX = b; + gSetting_set_dual_watch_session = a; + gSetting_set_cross_band_RX_TX_session = b; gFlagReconfigureVfos = true; gUpdateStatus = true; @@ -492,8 +492,7 @@ void ACTION_Main(void) void ACTION_Ptt(void) { - gSetting_set_ptt = (gSetting_set_ptt == 0) ? 1: 0; - + gSetting_set_ptt_session = (gSetting_set_ptt_session == 0) ? 1: 0; } void ACTION_Wn(void) diff --git a/app/app.c b/app/app.c index 9e6b22b..797c562 100644 --- a/app/app.c +++ b/app/app.c @@ -1066,7 +1066,7 @@ static void CheckKeys(void) // -------------------- PTT ------------------------ #ifdef ENABLE_FEAT_F4HWN - if (gSetting_set_ptt == 1) + if (gSetting_set_ptt_session == true) { if (!GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) && !SerialConfigInProgress() && gPttOnePushCounter == 0) { // PTT pressed diff --git a/app/menu.c b/app/menu.c index b75da6c..fe2d7fb 100644 --- a/app/menu.c +++ b/app/menu.c @@ -247,10 +247,12 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax) case MENU_200TX: case MENU_500TX: case MENU_350EN: +#ifndef ENABLE_FEAT_F4HWN case MENU_SCREN: *pMin = 0; *pMax = ARRAY_SIZE(gSubMenu_OFF_ON) - 1; break; +#endif case MENU_AM: *pMin = 0; @@ -563,6 +565,11 @@ void MENU_AcceptSetting(void) case MENU_TDR: gEeprom.DUAL_WATCH = (gEeprom.TX_VFO + 1) * (gSubMenuSelection & 1); gEeprom.CROSS_BAND_RX_TX = (gEeprom.TX_VFO + 1) * ((gSubMenuSelection & 2) > 0); +#ifdef ENABLE_FEAT_F4HWN + // Special for actions + gSetting_set_dual_watch_session = gEeprom.DUAL_WATCH; + gSetting_set_cross_band_RX_TX_session = gEeprom.CROSS_BAND_RX_TX; +#endif gFlagReconfigureVfos = true; gUpdateStatus = true; @@ -777,10 +784,12 @@ void MENU_AcceptSetting(void) gFlagResetVfos = true; break; +#ifndef ENABLE_FEAT_F4HWN case MENU_SCREN: gSetting_ScrambleEnable = gSubMenuSelection; gFlagReconfigureVfos = true; break; +#endif #ifdef ENABLE_F_CAL_MENU case MENU_F_CALI: @@ -827,6 +836,7 @@ void MENU_AcceptSetting(void) break; case MENU_SET_PTT: gSetting_set_ptt = gSubMenuSelection; + gSetting_set_ptt_session = gSetting_set_ptt; // Special for action break; case MENU_SET_TOT: gSetting_set_tot = gSubMenuSelection; @@ -987,7 +997,11 @@ void MENU_ShowCurrentSetting(void) break; case MENU_TDR: +#ifdef ENABLE_FEAT_F4HWN + gSubMenuSelection = (gSetting_set_dual_watch_session != DUAL_WATCH_OFF) + (gSetting_set_cross_band_RX_TX_session != CROSS_BAND_OFF) * 2; +#else gSubMenuSelection = (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2; +#endif break; case MENU_BEEP: @@ -1157,9 +1171,11 @@ void MENU_ShowCurrentSetting(void) gSubMenuSelection = gSetting_350EN; break; +#ifndef ENABLE_FEAT_F4HWN case MENU_SCREN: gSubMenuSelection = gSetting_ScrambleEnable; break; +#endif #ifdef ENABLE_F_CAL_MENU case MENU_F_CALI: @@ -1204,7 +1220,7 @@ void MENU_ShowCurrentSetting(void) gSubMenuSelection = gSetting_set_low; break; case MENU_SET_PTT: - gSubMenuSelection = gSetting_set_ptt; + gSubMenuSelection = gSetting_set_ptt_session; break; case MENU_SET_TOT: gSubMenuSelection = gSetting_set_tot; diff --git a/misc.c b/misc.c index 56d65cc..c81338b 100644 --- a/misc.c +++ b/misc.c @@ -100,6 +100,9 @@ enum BacklightOnRxTx_t gSetting_backlight_on_tx_rx; bool gSetting_set_ptt; uint8_t gSetting_set_tot; uint8_t gSetting_set_ctr = 11; + bool gSetting_set_ptt_session; + uint8_t gSetting_set_dual_watch_session; + uint8_t gSetting_set_cross_band_RX_TX_session; #endif #ifdef ENABLE_AUDIO_BAR diff --git a/misc.h b/misc.h index 3445317..2b55605 100644 --- a/misc.h +++ b/misc.h @@ -161,6 +161,9 @@ extern enum BacklightOnRxTx_t gSetting_backlight_on_tx_rx; extern bool gSetting_set_ptt; extern uint8_t gSetting_set_tot; extern uint8_t gSetting_set_ctr; + extern bool gSetting_set_ptt_session; + extern uint8_t gSetting_set_dual_watch_session; + extern uint8_t gSetting_set_cross_band_RX_TX_session; #endif #ifdef ENABLE_AUDIO_BAR diff --git a/settings.c b/settings.c index 2ce18f2..0572591 100644 --- a/settings.c +++ b/settings.c @@ -286,6 +286,10 @@ void SETTINGS_InitEEPROM(void) gSetting_set_tot = (Data[5] < 4) ? Data[5] : 0; gSetting_set_ctr = (Data[4] < 21) ? Data[4] : 11; + // And set special session settings for actions + gSetting_set_ptt_session = gSetting_set_ptt; + gSetting_set_dual_watch_session = gEeprom.DUAL_WATCH; + gSetting_set_cross_band_RX_TX_session = gEeprom.CROSS_BAND_RX_TX; #endif } diff --git a/ui/main.c b/ui/main.c index 36b65b0..cfce189 100644 --- a/ui/main.c +++ b/ui/main.c @@ -159,7 +159,7 @@ void UI_DisplayAudioBar(void) #ifdef ENABLE_FEAT_F4HWN unsigned int line; - if ((gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2 == 0) + if ((gSetting_set_dual_watch_session != DUAL_WATCH_OFF) + (gSetting_set_cross_band_RX_TX_session != CROSS_BAND_OFF) * 2 == 0) { line = 5; } @@ -228,7 +228,7 @@ void DisplayRSSIBar(const bool now) }; unsigned int line; - if ((gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2 == 0) + if ((gSetting_set_dual_watch_session != DUAL_WATCH_OFF) + (gSetting_set_cross_band_RX_TX_session != CROSS_BAND_OFF) * 2 == 0) { line = 5; } @@ -472,7 +472,7 @@ void UI_DisplayMain(void) const unsigned int line0 = 0; // text screen line const unsigned int line1 = 4; unsigned int line; - if ((gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2 == 0) + if ((gSetting_set_dual_watch_session != DUAL_WATCH_OFF) + (gSetting_set_cross_band_RX_TX_session != CROSS_BAND_OFF) * 2 == 0) { line = 0; } @@ -495,7 +495,7 @@ void UI_DisplayMain(void) #endif #ifdef ENABLE_FEAT_F4HWN - if ((gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2 == 0) + if ((gSetting_set_dual_watch_session != DUAL_WATCH_OFF) + (gSetting_set_cross_band_RX_TX_session != CROSS_BAND_OFF) * 2 == 0) { if (activeTxVFO != vfo_num) { @@ -505,7 +505,7 @@ void UI_DisplayMain(void) #endif #ifdef ENABLE_FEAT_F4HWN - if (activeTxVFO != vfo_num || ((gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2 == 0)) + if (activeTxVFO != vfo_num || ((gSetting_set_dual_watch_session != DUAL_WATCH_OFF) + (gSetting_set_cross_band_RX_TX_session != CROSS_BAND_OFF) * 2 == 0)) #else if (activeTxVFO != vfo_num) // this is not active TX VFO #endif @@ -562,7 +562,7 @@ void UI_DisplayMain(void) } #ifdef ENABLE_FEAT_F4HWN - if ((gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2 == 0) + if ((gSetting_set_dual_watch_session != DUAL_WATCH_OFF) + (gSetting_set_cross_band_RX_TX_session != CROSS_BAND_OFF) * 2 == 0) { UI_PrintString(pPrintStr, 2, 0, 5, 8); isMainOnlyInputDTMF = true; @@ -767,7 +767,7 @@ void UI_DisplayMain(void) } else { #ifdef ENABLE_FEAT_F4HWN - if ((gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2 == 0) + if ((gSetting_set_dual_watch_session != DUAL_WATCH_OFF) + (gSetting_set_cross_band_RX_TX_session != CROSS_BAND_OFF) * 2 == 0) { UI_PrintString(String, 32, 0, line, 8); } @@ -786,7 +786,7 @@ void UI_DisplayMain(void) #endif #ifdef ENABLE_FEAT_F4HWN - if ((gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2 == 0) + if ((gSetting_set_dual_watch_session != DUAL_WATCH_OFF) + (gSetting_set_cross_band_RX_TX_session != CROSS_BAND_OFF) * 2 == 0) { sprintf(String, "%3u.%05u", frequency / 100000, frequency % 100000); if(frequency < _1GHz_in_KHz) { @@ -989,7 +989,7 @@ void UI_DisplayMain(void) sprintf(String, "DTMF %s", gDTMF_RX_live + idx); #ifdef ENABLE_FEAT_F4HWN - if ((gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2 == 0) + if ((gSetting_set_dual_watch_session != DUAL_WATCH_OFF) + (gSetting_set_cross_band_RX_TX_session != CROSS_BAND_OFF) * 2 == 0) { UI_PrintStringSmallNormal(String, 2, 0, 5); } diff --git a/ui/menu.c b/ui/menu.c index e75ab6b..1efea11 100644 --- a/ui/menu.c +++ b/ui/menu.c @@ -138,7 +138,9 @@ const t_menu_item MenuList[] = {"Tx 350", VOICE_ID_INVALID, MENU_350TX }, // was "350TX" {"Tx 500", VOICE_ID_INVALID, MENU_500TX }, // was "500TX" {"350 En", VOICE_ID_INVALID, MENU_350EN }, // was "350EN" +#ifndef ENABLE_FEAT_F4HWN {"ScraEn", VOICE_ID_INVALID, MENU_SCREN }, // was "SCREN" +#endif #ifdef ENABLE_F_CAL_MENU {"FrCali", VOICE_ID_INVALID, MENU_F_CALI }, // reference xtal calibration #endif @@ -679,9 +681,11 @@ void UI_DisplayMenu(void) case MENU_200TX: case MENU_500TX: case MENU_350EN: +#ifndef ENABLE_FEAT_F4HWN case MENU_SCREN: strcpy(String, gSubMenu_OFF_ON[gSubMenuSelection]); break; +#endif case MENU_MEM_CH: case MENU_1_CALL: diff --git a/ui/menu.h b/ui/menu.h index 33a4bbc..e1d373e 100644 --- a/ui/menu.h +++ b/ui/menu.h @@ -115,7 +115,9 @@ enum MENU_350TX, MENU_500TX, MENU_350EN, +#ifndef ENABLE_FEAT_F4HWN MENU_SCREN, +#endif #ifdef ENABLE_F_CAL_MENU MENU_F_CALI, // reference xtal calibration #endif @@ -174,7 +176,7 @@ extern const char gSubMenu_BAT_TXT[3][8]; extern const char gSubMenu_BATTYP[2][9]; #ifndef ENABLE_FEAT_F4HWN -extern const char gSubMenu_SCRAMBLER[11][7]; + extern const char gSubMenu_SCRAMBLER[11][7]; #endif typedef struct {char* name; uint8_t id;} t_sidefunction; diff --git a/ui/status.c b/ui/status.c index 178952b..f52fed4 100644 --- a/ui/status.c +++ b/ui/status.c @@ -131,7 +131,7 @@ void UI_DisplayStatus() #ifdef ENABLE_FEAT_F4HWN // PTT indicator - if (gSetting_set_ptt) { + if (gSetting_set_ptt_session) { memcpy(line + x, BITMAP_PTT_ONE_PUSH, sizeof(BITMAP_PTT_ONE_PUSH)); x1 = x + sizeof(BITMAP_PTT_ONE_PUSH) + 1; }