Add SetInv menu

This commit is contained in:
Armel FAUVEAU
2024-02-06 05:00:55 +01:00
parent c2d5fc18b5
commit 89d308293f
7 changed files with 33 additions and 7 deletions

View File

@@ -249,11 +249,10 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax)
case MENU_350EN:
#ifndef ENABLE_FEAT_F4HWN
case MENU_SCREN:
#endif
*pMin = 0;
*pMax = ARRAY_SIZE(gSubMenu_OFF_ON) - 1;
break;
#endif
case MENU_AM:
*pMin = 0;
*pMax = ARRAY_SIZE(gModulationStr) - 1;
@@ -384,6 +383,10 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax)
*pMin = 0;
*pMax = 20;
break;
case MENU_SET_INV:
*pMin = 0;
*pMax = ARRAY_SIZE(gSubMenu_OFF_ON) - 1;
break;
#endif
default:
@@ -848,6 +851,9 @@ void MENU_AcceptSetting(void)
case MENU_SET_CTR:
gSetting_set_ctr = gSubMenuSelection;
break;
case MENU_SET_INV:
gSetting_set_inv = gSubMenuSelection;
break;
#endif
}
@@ -1232,6 +1238,9 @@ void MENU_ShowCurrentSetting(void)
case MENU_SET_CTR:
gSubMenuSelection = gSetting_set_ctr;
break;
case MENU_SET_INV:
gSubMenuSelection = gSetting_set_inv;
break;
#endif
default:

View File

@@ -157,7 +157,9 @@ void ST7565_Init(void)
for(uint8_t i = 0; i < 8; i++)
{
#ifdef ENABLE_FEAT_F4HWN
if(i == 7)
if(i == 3)
ST7565_WriteByte(ST7565_CMD_INVERSE_DISPLAY | gSetting_set_inv);
else if(i == 7)
ST7565_WriteByte(20 + gSetting_set_ctr);
else
ST7565_WriteByte(cmds[i]);
@@ -192,7 +194,9 @@ void ST7565_Init(void)
for(uint8_t i = 0; i < 8; i++)
{
if(i == 7)
if(i == 3)
ST7565_WriteByte(ST7565_CMD_INVERSE_DISPLAY | gSetting_set_inv);
else if(i == 7)
ST7565_WriteByte(20 + gSetting_set_ctr);
else
ST7565_WriteByte(cmds[i]);

1
misc.c
View File

@@ -100,6 +100,7 @@ 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_inv = false;
bool gSetting_set_ptt_session;
uint8_t gSetting_set_dual_watch_session;
uint8_t gSetting_set_cross_band_RX_TX_session;

1
misc.h
View File

@@ -161,6 +161,7 @@ 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_inv;
extern bool gSetting_set_ptt_session;
extern uint8_t gSetting_set_dual_watch_session;
extern uint8_t gSetting_set_cross_band_RX_TX_session;

View File

@@ -284,7 +284,10 @@ void SETTINGS_InitEEPROM(void)
gSetting_set_low = (Data[7] < 5) ? Data[7] : 0;
gSetting_set_ptt = (Data[6] < 2) ? Data[6] : 0;
gSetting_set_tot = (Data[5] < 4) ? Data[5] : 0;
gSetting_set_ctr = (Data[4] < 21) ? Data[4] : 11;
uint8_t inv = (Data[4] & 0xF0) >> 4;
uint8_t ctr = (Data[4] & 0x0F);
gSetting_set_inv = (inv < 2) ? inv : 0;
gSetting_set_ctr = (ctr < 21) ? ctr : 11;
// And set special session settings for actions
gSetting_set_ptt_session = gSetting_set_ptt;
@@ -609,7 +612,8 @@ void SETTINGS_SaveSettings(void)
#ifdef ENABLE_FEAT_F4HWN
memset(State, 0xFF, sizeof(State));
State[4] = gSetting_set_ctr;
State[4] = ((gSetting_set_inv << 4) | (gSetting_set_ctr & 0x0F));
State[5] = gSetting_set_tot;
State[6] = gSetting_set_ptt;
State[7] = gSetting_set_low;

View File

@@ -130,6 +130,7 @@ const t_menu_item MenuList[] =
{"SetPtt", VOICE_ID_INVALID, MENU_SET_PTT },
{"SetTot", VOICE_ID_INVALID, MENU_SET_TOT },
{"SetCtr", VOICE_ID_INVALID, MENU_SET_CTR },
{"SetInv", VOICE_ID_INVALID, MENU_SET_INV },
#endif
// hidden menu items from here on
// enabled if pressing both the PTT and upper side button at power-on
@@ -683,9 +684,9 @@ void UI_DisplayMenu(void)
case MENU_350EN:
#ifndef ENABLE_FEAT_F4HWN
case MENU_SCREN:
#endif
strcpy(String, gSubMenu_OFF_ON[gSubMenuSelection]);
break;
#endif
case MENU_MEM_CH:
case MENU_1_CALL:
@@ -911,6 +912,11 @@ void UI_DisplayMenu(void)
gSetting_set_ctr = gSubMenuSelection;
ST7565_Contrast();
break;
case MENU_SET_INV:
strcpy(String, gSubMenu_OFF_ON[gSubMenuSelection]);
ST7565_Contrast();
break;
#endif
}

View File

@@ -126,6 +126,7 @@ enum
MENU_SET_PTT,
MENU_SET_TOT,
MENU_SET_CTR,
MENU_SET_INV,
#endif
MENU_BATCAL, // battery voltage calibration
MENU_F1SHRT,