SetVol debug

This commit is contained in:
Armel FAUVEAU
2024-10-31 18:07:29 +01:00
parent ee6f71a4c5
commit 443c3d8eb9
6 changed files with 58 additions and 4 deletions

View File

@@ -48,6 +48,7 @@ ENABLE_FEAT_F4HWN_CHARGING_C ?= 1
ENABLE_FEAT_F4HWN_SLEEP ?= 1
ENABLE_FEAT_F4HWN_RESTORE_SCAN ?= 1
ENABLE_FEAT_F4HWN_NARROWER ?= 1
ENABLE_FEAT_F4HWN_VOL ?= 0
ENABLE_FEAT_F4HWN_RESET_CHANNEL ?= 0
ENABLE_FEAT_F4HWN_PMR ?= 0
ENABLE_FEAT_F4HWN_GMRS_FRS_MURS ?= 0
@@ -431,6 +432,9 @@ endif
ifeq ($(ENABLE_FEAT_F4HWN_NARROWER),1)
CFLAGS += -DENABLE_FEAT_F4HWN_NARROWER
endif
ifeq ($(ENABLE_FEAT_F4HWN_VOL),1)
CFLAGS += -DENABLE_FEAT_F4HWN_VOL
endif
ifeq ($(ENABLE_FEAT_F4HWN_RESET_CHANNEL),1)
CFLAGS += -DENABLE_FEAT_F4HWN_RESET_CHANNEL
endif

View File

@@ -424,6 +424,12 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax)
*pMax = ARRAY_SIZE(gSubMenu_SET_NFM) - 1;
break;
#endif
#ifdef ENABLE_FEAT_F4HWN_VOL
case MENU_SET_VOL:
//*pMin = 0;
*pMax = 63;
break;
#endif
#endif
default:
@@ -930,6 +936,11 @@ void MENU_AcceptSetting(void)
RADIO_SetupRegisters(true);
break;
#endif
#ifdef ENABLE_FEAT_F4HWN_VOL
case MENU_SET_VOL:
gEeprom.VOLUME_GAIN = gSubMenuSelection;
break;
#endif
case MENU_SET_TMR:
gSetting_set_tmr = gSubMenuSelection;
break;
@@ -1369,6 +1380,11 @@ void MENU_ShowCurrentSetting(void)
gSubMenuSelection = gSetting_set_nfm;
break;
#endif
#ifdef ENABLE_FEAT_F4HWN_VOL
case MENU_SET_VOL:
gSubMenuSelection = gEeprom.VOLUME_GAIN;
break;
#endif
case MENU_SET_TMR:
gSubMenuSelection = gSetting_set_tmr;
break;

View File

@@ -795,6 +795,10 @@ void SETTINGS_SaveSettings(void)
EEPROM_WriteBuffer(0x1FF0, State);
#endif
#ifdef ENABLE_FEAT_F4HWN_VOL
SETTINGS_WriteCurrentVol();
#endif
}
void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO, uint8_t Mode)
@@ -997,3 +1001,13 @@ State[1] = 0
EEPROM_WriteBuffer(0x0E78, State);
}
#endif
#ifdef ENABLE_FEAT_F4HWN_VOL
void SETTINGS_WriteCurrentVol(void)
{
uint8_t State[8];
EEPROM_ReadBuffer(0x1F88, State, sizeof(State));
State[6] = gEeprom.VOLUME_GAIN;
EEPROM_WriteBuffer(0x1F88, State);
}
#endif

View File

@@ -308,5 +308,7 @@ void SETTINGS_WriteBuildOptions(void);
#ifdef ENABLE_FEAT_F4HWN_RESTORE_SCAN
void SETTINGS_WriteCurrentState(void);
#endif
#ifdef ENABLE_FEAT_F4HWN_VOL
void SETTINGS_WriteCurrentVol(void);
#endif
#endif

View File

@@ -150,9 +150,12 @@ const t_menu_item MenuList[] =
#ifdef ENABLE_FEAT_F4HWN_SLEEP
{"SetOff", MENU_SET_OFF },
#endif
#ifdef ENABLE_FEAT_F4HWN_NARROWER
{"SetNFM", MENU_SET_NFM },
#endif
#ifdef ENABLE_FEAT_F4HWN_NARROWER
{"SetNFM", MENU_SET_NFM },
#endif
#ifdef ENABLE_FEAT_F4HWN_VOL
{"SetVol", MENU_SET_VOL },
#endif
#endif
// hidden menu items from here on
// enabled if pressing both the PTT and upper side button at power-on
@@ -1046,6 +1049,18 @@ void UI_DisplayMenu(void)
strcpy(String, gSubMenu_SET_NFM[gSubMenuSelection]);
break;
#endif
#ifdef ENABLE_FEAT_F4HWN_VOL
case MENU_SET_VOL:
sprintf(String, gSubMenuSelection == 0 ? "OFF" : "%02u", gSubMenuSelection);
gEeprom.VOLUME_GAIN = gSubMenuSelection;
BK4819_WriteRegister(BK4819_REG_48,
(11u << 12) | // ??? .. 0 ~ 15, doesn't seem to make any difference
( 0u << 10) | // AF Rx Gain-1
(gEeprom.VOLUME_GAIN << 4) | // AF Rx Gain-2
(gEeprom.DAC_GAIN << 0)); // AF DAC Gain (after Gain-1 and Gain-2)
break;
#endif
#endif
}

View File

@@ -144,6 +144,9 @@ enum
#ifdef ENABLE_FEAT_F4HWN_NARROWER
MENU_SET_NFM,
#endif
#ifdef ENABLE_FEAT_F4HWN_VOL
MENU_SET_VOL,
#endif
#endif
MENU_BATCAL, // battery voltage calibration
MENU_F1SHRT,