Fix F4IRT shortcut bug

This commit is contained in:
Armel FAUVEAU
2024-02-05 23:49:56 +01:00
parent ec87fff311
commit e45c2f5904
10 changed files with 53 additions and 22 deletions

View File

@@ -458,7 +458,7 @@ void ACTION_Main(void)
static uint8_t b; 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; return;
} }
@@ -466,11 +466,11 @@ void ACTION_Main(void)
{ {
if(cycle == 0) if(cycle == 0)
{ {
a = gEeprom.DUAL_WATCH; a = gSetting_set_dual_watch_session;
b = gEeprom.CROSS_BAND_RX_TX; b = gSetting_set_cross_band_RX_TX_session;
gEeprom.DUAL_WATCH = 0; gSetting_set_dual_watch_session = 0;
gEeprom.CROSS_BAND_RX_TX = 0; gSetting_set_cross_band_RX_TX_session = 0;
gFlagReconfigureVfos = true; gFlagReconfigureVfos = true;
gUpdateStatus = true; gUpdateStatus = true;
@@ -479,8 +479,8 @@ void ACTION_Main(void)
} }
else else
{ {
gEeprom.DUAL_WATCH = a; gSetting_set_dual_watch_session = a;
gEeprom.CROSS_BAND_RX_TX = b; gSetting_set_cross_band_RX_TX_session = b;
gFlagReconfigureVfos = true; gFlagReconfigureVfos = true;
gUpdateStatus = true; gUpdateStatus = true;
@@ -492,8 +492,7 @@ void ACTION_Main(void)
void ACTION_Ptt(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) void ACTION_Wn(void)

View File

@@ -1066,7 +1066,7 @@ static void CheckKeys(void)
// -------------------- PTT ------------------------ // -------------------- PTT ------------------------
#ifdef ENABLE_FEAT_F4HWN #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) if (!GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) && !SerialConfigInProgress() && gPttOnePushCounter == 0)
{ // PTT pressed { // PTT pressed

View File

@@ -247,10 +247,12 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax)
case MENU_200TX: case MENU_200TX:
case MENU_500TX: case MENU_500TX:
case MENU_350EN: case MENU_350EN:
#ifndef ENABLE_FEAT_F4HWN
case MENU_SCREN: case MENU_SCREN:
*pMin = 0; *pMin = 0;
*pMax = ARRAY_SIZE(gSubMenu_OFF_ON) - 1; *pMax = ARRAY_SIZE(gSubMenu_OFF_ON) - 1;
break; break;
#endif
case MENU_AM: case MENU_AM:
*pMin = 0; *pMin = 0;
@@ -563,6 +565,11 @@ void MENU_AcceptSetting(void)
case MENU_TDR: case MENU_TDR:
gEeprom.DUAL_WATCH = (gEeprom.TX_VFO + 1) * (gSubMenuSelection & 1); gEeprom.DUAL_WATCH = (gEeprom.TX_VFO + 1) * (gSubMenuSelection & 1);
gEeprom.CROSS_BAND_RX_TX = (gEeprom.TX_VFO + 1) * ((gSubMenuSelection & 2) > 0); 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; gFlagReconfigureVfos = true;
gUpdateStatus = true; gUpdateStatus = true;
@@ -777,10 +784,12 @@ void MENU_AcceptSetting(void)
gFlagResetVfos = true; gFlagResetVfos = true;
break; break;
#ifndef ENABLE_FEAT_F4HWN
case MENU_SCREN: case MENU_SCREN:
gSetting_ScrambleEnable = gSubMenuSelection; gSetting_ScrambleEnable = gSubMenuSelection;
gFlagReconfigureVfos = true; gFlagReconfigureVfos = true;
break; break;
#endif
#ifdef ENABLE_F_CAL_MENU #ifdef ENABLE_F_CAL_MENU
case MENU_F_CALI: case MENU_F_CALI:
@@ -827,6 +836,7 @@ void MENU_AcceptSetting(void)
break; break;
case MENU_SET_PTT: case MENU_SET_PTT:
gSetting_set_ptt = gSubMenuSelection; gSetting_set_ptt = gSubMenuSelection;
gSetting_set_ptt_session = gSetting_set_ptt; // Special for action
break; break;
case MENU_SET_TOT: case MENU_SET_TOT:
gSetting_set_tot = gSubMenuSelection; gSetting_set_tot = gSubMenuSelection;
@@ -987,7 +997,11 @@ void MENU_ShowCurrentSetting(void)
break; break;
case MENU_TDR: 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; gSubMenuSelection = (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2;
#endif
break; break;
case MENU_BEEP: case MENU_BEEP:
@@ -1157,9 +1171,11 @@ void MENU_ShowCurrentSetting(void)
gSubMenuSelection = gSetting_350EN; gSubMenuSelection = gSetting_350EN;
break; break;
#ifndef ENABLE_FEAT_F4HWN
case MENU_SCREN: case MENU_SCREN:
gSubMenuSelection = gSetting_ScrambleEnable; gSubMenuSelection = gSetting_ScrambleEnable;
break; break;
#endif
#ifdef ENABLE_F_CAL_MENU #ifdef ENABLE_F_CAL_MENU
case MENU_F_CALI: case MENU_F_CALI:
@@ -1204,7 +1220,7 @@ void MENU_ShowCurrentSetting(void)
gSubMenuSelection = gSetting_set_low; gSubMenuSelection = gSetting_set_low;
break; break;
case MENU_SET_PTT: case MENU_SET_PTT:
gSubMenuSelection = gSetting_set_ptt; gSubMenuSelection = gSetting_set_ptt_session;
break; break;
case MENU_SET_TOT: case MENU_SET_TOT:
gSubMenuSelection = gSetting_set_tot; gSubMenuSelection = gSetting_set_tot;

3
misc.c
View File

@@ -100,6 +100,9 @@ enum BacklightOnRxTx_t gSetting_backlight_on_tx_rx;
bool gSetting_set_ptt; bool gSetting_set_ptt;
uint8_t gSetting_set_tot; uint8_t gSetting_set_tot;
uint8_t gSetting_set_ctr = 11; 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 #endif
#ifdef ENABLE_AUDIO_BAR #ifdef ENABLE_AUDIO_BAR

3
misc.h
View File

@@ -161,6 +161,9 @@ extern enum BacklightOnRxTx_t gSetting_backlight_on_tx_rx;
extern bool gSetting_set_ptt; extern bool gSetting_set_ptt;
extern uint8_t gSetting_set_tot; extern uint8_t gSetting_set_tot;
extern uint8_t gSetting_set_ctr; 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 #endif
#ifdef ENABLE_AUDIO_BAR #ifdef ENABLE_AUDIO_BAR

View File

@@ -286,6 +286,10 @@ void SETTINGS_InitEEPROM(void)
gSetting_set_tot = (Data[5] < 4) ? Data[5] : 0; gSetting_set_tot = (Data[5] < 4) ? Data[5] : 0;
gSetting_set_ctr = (Data[4] < 21) ? Data[4] : 11; 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 #endif
} }

View File

@@ -159,7 +159,7 @@ void UI_DisplayAudioBar(void)
#ifdef ENABLE_FEAT_F4HWN #ifdef ENABLE_FEAT_F4HWN
unsigned int line; 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; line = 5;
} }
@@ -228,7 +228,7 @@ void DisplayRSSIBar(const bool now)
}; };
unsigned int line; 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; line = 5;
} }
@@ -472,7 +472,7 @@ void UI_DisplayMain(void)
const unsigned int line0 = 0; // text screen line const unsigned int line0 = 0; // text screen line
const unsigned int line1 = 4; const unsigned int line1 = 4;
unsigned int line; 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; line = 0;
} }
@@ -495,7 +495,7 @@ void UI_DisplayMain(void)
#endif #endif
#ifdef ENABLE_FEAT_F4HWN #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) if (activeTxVFO != vfo_num)
{ {
@@ -505,7 +505,7 @@ void UI_DisplayMain(void)
#endif #endif
#ifdef ENABLE_FEAT_F4HWN #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 #else
if (activeTxVFO != vfo_num) // this is not active TX VFO if (activeTxVFO != vfo_num) // this is not active TX VFO
#endif #endif
@@ -562,7 +562,7 @@ void UI_DisplayMain(void)
} }
#ifdef ENABLE_FEAT_F4HWN #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); UI_PrintString(pPrintStr, 2, 0, 5, 8);
isMainOnlyInputDTMF = true; isMainOnlyInputDTMF = true;
@@ -767,7 +767,7 @@ void UI_DisplayMain(void)
} }
else { else {
#ifdef ENABLE_FEAT_F4HWN #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); UI_PrintString(String, 32, 0, line, 8);
} }
@@ -786,7 +786,7 @@ void UI_DisplayMain(void)
#endif #endif
#ifdef ENABLE_FEAT_F4HWN #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); sprintf(String, "%3u.%05u", frequency / 100000, frequency % 100000);
if(frequency < _1GHz_in_KHz) { if(frequency < _1GHz_in_KHz) {
@@ -989,7 +989,7 @@ void UI_DisplayMain(void)
sprintf(String, "DTMF %s", gDTMF_RX_live + idx); sprintf(String, "DTMF %s", gDTMF_RX_live + idx);
#ifdef ENABLE_FEAT_F4HWN #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); UI_PrintStringSmallNormal(String, 2, 0, 5);
} }

View File

@@ -138,7 +138,9 @@ const t_menu_item MenuList[] =
{"Tx 350", VOICE_ID_INVALID, MENU_350TX }, // was "350TX" {"Tx 350", VOICE_ID_INVALID, MENU_350TX }, // was "350TX"
{"Tx 500", VOICE_ID_INVALID, MENU_500TX }, // was "500TX" {"Tx 500", VOICE_ID_INVALID, MENU_500TX }, // was "500TX"
{"350 En", VOICE_ID_INVALID, MENU_350EN }, // was "350EN" {"350 En", VOICE_ID_INVALID, MENU_350EN }, // was "350EN"
#ifndef ENABLE_FEAT_F4HWN
{"ScraEn", VOICE_ID_INVALID, MENU_SCREN }, // was "SCREN" {"ScraEn", VOICE_ID_INVALID, MENU_SCREN }, // was "SCREN"
#endif
#ifdef ENABLE_F_CAL_MENU #ifdef ENABLE_F_CAL_MENU
{"FrCali", VOICE_ID_INVALID, MENU_F_CALI }, // reference xtal calibration {"FrCali", VOICE_ID_INVALID, MENU_F_CALI }, // reference xtal calibration
#endif #endif
@@ -679,9 +681,11 @@ void UI_DisplayMenu(void)
case MENU_200TX: case MENU_200TX:
case MENU_500TX: case MENU_500TX:
case MENU_350EN: case MENU_350EN:
#ifndef ENABLE_FEAT_F4HWN
case MENU_SCREN: case MENU_SCREN:
strcpy(String, gSubMenu_OFF_ON[gSubMenuSelection]); strcpy(String, gSubMenu_OFF_ON[gSubMenuSelection]);
break; break;
#endif
case MENU_MEM_CH: case MENU_MEM_CH:
case MENU_1_CALL: case MENU_1_CALL:

View File

@@ -115,7 +115,9 @@ enum
MENU_350TX, MENU_350TX,
MENU_500TX, MENU_500TX,
MENU_350EN, MENU_350EN,
#ifndef ENABLE_FEAT_F4HWN
MENU_SCREN, MENU_SCREN,
#endif
#ifdef ENABLE_F_CAL_MENU #ifdef ENABLE_F_CAL_MENU
MENU_F_CALI, // reference xtal calibration MENU_F_CALI, // reference xtal calibration
#endif #endif

View File

@@ -131,7 +131,7 @@ void UI_DisplayStatus()
#ifdef ENABLE_FEAT_F4HWN #ifdef ENABLE_FEAT_F4HWN
// PTT indicator // PTT indicator
if (gSetting_set_ptt) { if (gSetting_set_ptt_session) {
memcpy(line + x, BITMAP_PTT_ONE_PUSH, sizeof(BITMAP_PTT_ONE_PUSH)); memcpy(line + x, BITMAP_PTT_ONE_PUSH, sizeof(BITMAP_PTT_ONE_PUSH));
x1 = x + sizeof(BITMAP_PTT_ONE_PUSH) + 1; x1 = x + sizeof(BITMAP_PTT_ONE_PUSH) + 1;
} }