Add SetTmr

This commit is contained in:
Armel FAUVEAU
2024-08-15 04:34:00 +02:00
parent 75480cac10
commit e008313170
8 changed files with 53 additions and 5 deletions

View File

@@ -254,6 +254,9 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax)
case MENU_350EN:
#ifndef ENABLE_FEAT_F4HWN
case MENU_SCREN:
#endif
#ifdef ENABLE_FEAT_F4HWN
case MENU_SET_TMR:
#endif
//*pMin = 0;
*pMax = ARRAY_SIZE(gSubMenu_OFF_ON) - 1;
@@ -895,10 +898,13 @@ void MENU_AcceptSetting(void)
case MENU_SET_GUI:
gSetting_set_gui = gSubMenuSelection;
break;
case MENU_SET_TMR:
gSetting_set_tmr = gSubMenuSelection;
break;
case MENU_TX_LOCK:
gTxVfo->TX_LOCK = gSubMenuSelection;
gRequestSaveChannel = 1;
return;
return;
#endif
}
@@ -1316,6 +1322,9 @@ void MENU_ShowCurrentSetting(void)
case MENU_SET_GUI:
gSubMenuSelection = gSetting_set_gui;
break;
case MENU_SET_TMR:
gSubMenuSelection = gSetting_set_tmr;
break;
case MENU_TX_LOCK:
gSubMenuSelection = gTxVfo->TX_LOCK;
break;

4
main.c
View File

@@ -129,9 +129,9 @@ void Main(void)
gEeprom.KEY_LOCK = 0;
SETTINGS_SaveSettings();
#ifndef ENABLE_VOX
gMenuCursor = 63; // move to hidden section, fix me if change... !!! Remove VOX and Mic Bar
gMenuCursor = 64; // move to hidden section, fix me if change... !!! Remove VOX and Mic Bar
#else
gMenuCursor = 65; // move to hidden section, fix me if change... !!!
gMenuCursor = 66; // move to hidden section, fix me if change... !!!
#endif
gSubMenuSelection = gSetting_F_LOCK;
#endif

1
misc.c
View File

@@ -114,6 +114,7 @@ enum BacklightOnRxTx_t gSetting_backlight_on_tx_rx;
bool gSetting_set_lck = false;
bool gSetting_set_met = 0;
bool gSetting_set_gui = 0;
bool gSetting_set_tmr = 0;
bool gSetting_set_ptt_session;
uint8_t gDebug;
uint8_t gDW = 0;

1
misc.h
View File

@@ -166,6 +166,7 @@ extern enum BacklightOnRxTx_t gSetting_backlight_on_tx_rx;
extern bool gSetting_set_lck;
extern bool gSetting_set_met;
extern bool gSetting_set_gui;
extern bool gSetting_set_tmr;
extern bool gSetting_set_ptt_session;
extern uint8_t gDebug;
extern uint8_t gDW;

View File

@@ -324,6 +324,7 @@ void SETTINGS_InitEEPROM(void)
gSetting_set_tot = (((Data[6] & 0xF0) >> 4) < 4) ? ((Data[6] & 0xF0) >> 4) : 0;
gSetting_set_eot = (((Data[6] & 0x0F)) < 4) ? ((Data[6] & 0x0F)) : 0;
/*
int tmp = ((Data[5] & 0xF0) >> 4);
gSetting_set_inv = (((tmp >> 0) & 0x01) < 2) ? ((tmp >> 0) & 0x01): 0;
@@ -332,6 +333,21 @@ void SETTINGS_InitEEPROM(void)
gSetting_set_gui = (((tmp >> 3) & 0x01) < 2) ? ((tmp >> 3) & 0x01): 0;
gSetting_set_ctr = (((Data[5] & 0x0F)) > 00 && ((Data[5] & 0x0F)) < 16) ? ((Data[5] & 0x0F)) : 10;
gSetting_set_tmr = ((Data[4] & 1) < 2) ? (Data[4] & 1): 0;
*/
int tmp = (Data[5] & 0xF0) >> 4;
gSetting_set_inv = (tmp >> 0) & 0x01;
gSetting_set_lck = (tmp >> 1) & 0x01;
gSetting_set_met = (tmp >> 2) & 0x01;
gSetting_set_gui = (tmp >> 3) & 0x01;
int ctr_value = Data[5] & 0x0F;
gSetting_set_ctr = (ctr_value > 0 && ctr_value < 16) ? ctr_value : 10;
gSetting_set_tmr = Data[4] & 1;
// And set special session settings for actions
gSetting_set_ptt_session = gSetting_set_ptt;
gEeprom.KEY_LOCK_PTT = gSetting_set_lck;
@@ -700,6 +716,14 @@ void SETTINGS_SaveSettings(void)
#ifdef ENABLE_FEAT_F4HWN
memset(State, 0xFF, sizeof(State));
/*
tmp = 0;
if(gSetting_set_tmr == 1)
tmp = tmp | (1 << 0);
State[4] = tmp;
tmp = 0;
if(gSetting_set_inv == 1)
@@ -710,6 +734,14 @@ void SETTINGS_SaveSettings(void)
tmp = tmp | (1 << 2);
if (gSetting_set_gui == 1)
tmp = tmp | (1 << 3);
*/
State[4] = gSetting_set_tmr ? (1 << 0) : 0;
tmp = (gSetting_set_inv << 0) |
(gSetting_set_lck << 1) |
(gSetting_set_met << 2) |
(gSetting_set_gui << 3);
State[5] = ((tmp << 4) | (gSetting_set_ctr & 0x0F));
State[6] = ((gSetting_set_tot << 4) | (gSetting_set_eot & 0x0F));

View File

@@ -146,6 +146,7 @@ const t_menu_item MenuList[] =
{"SetLck", MENU_SET_LCK },
{"SetMet", MENU_SET_MET },
{"SetGui", MENU_SET_GUI },
{"SetTmr", MENU_SET_TMR },
#endif
// hidden menu items from here on
// enabled if pressing both the PTT and upper side button at power-on
@@ -737,6 +738,9 @@ void UI_DisplayMenu(void)
case MENU_350EN:
#ifndef ENABLE_FEAT_F4HWN
case MENU_SCREN:
#endif
#ifdef ENABLE_FEAT_F4HWN
case MENU_SET_TMR:
#endif
strcpy(String, gSubMenu_OFF_ON[gSubMenuSelection]);
break;

View File

@@ -135,6 +135,7 @@ enum
MENU_SET_LCK,
MENU_SET_MET,
MENU_SET_GUI,
MENU_SET_TMR,
#endif
MENU_BATCAL, // battery voltage calibration
MENU_F1SHRT,

View File

@@ -143,11 +143,11 @@ void UI_DisplayStatus()
if(!SCANNER_IsScanning()) {
#ifdef ENABLE_FEAT_F4HWN_RX_TX_TIMER
if(gCurrentFunction == FUNCTION_TRANSMIT)
if(gCurrentFunction == FUNCTION_TRANSMIT && gSetting_set_tmr == true)
{
convertTime(line, 0);
}
else if(FUNCTION_IsRx())
else if(FUNCTION_IsRx() && gSetting_set_tmr == true)
{
convertTime(line, 1);
}