0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-04-28 22:31:25 +03:00

Added compile option ENABLE_BACKLIGHT_ON_RX - will make this a menu option soon

This commit is contained in:
OneOfEleven 2023-10-03 13:02:43 +01:00
parent 9d5d36cc1f
commit ac05207ef0
5 changed files with 35 additions and 39 deletions

View File

@ -30,6 +30,7 @@ ENABLE_AM_FIX := 1
ENABLE_AM_FIX_SHOW_DATA := 1 ENABLE_AM_FIX_SHOW_DATA := 1
ENABLE_SQUELCH_MORE_SENSITIVE := 1 ENABLE_SQUELCH_MORE_SENSITIVE := 1
ENABLE_FASTER_CHANNEL_SCAN := 0 ENABLE_FASTER_CHANNEL_SCAN := 0
ENABLE_BACKLIGHT_ON_RX := 0
ENABLE_RSSI_BAR := 1 ENABLE_RSSI_BAR := 1
ENABLE_AUDIO_BAR := 1 ENABLE_AUDIO_BAR := 1
#ENABLE_COPY_CHAN_TO_VFO := 1 #ENABLE_COPY_CHAN_TO_VFO := 1
@ -255,6 +256,9 @@ endif
ifeq ($(ENABLE_FASTER_CHANNEL_SCAN),1) ifeq ($(ENABLE_FASTER_CHANNEL_SCAN),1)
CFLAGS += -DENABLE_FASTER_CHANNEL_SCAN CFLAGS += -DENABLE_FASTER_CHANNEL_SCAN
endif endif
ifeq ($(ENABLE_BACKLIGHT_ON_RX),1)
CFLAGS += -DENABLE_BACKLIGHT_ON_RX
endif
ifeq ($(ENABLE_RSSI_BAR),1) ifeq ($(ENABLE_RSSI_BAR),1)
CFLAGS += -DENABLE_RSSI_BAR CFLAGS += -DENABLE_RSSI_BAR
endif endif

View File

@ -53,6 +53,7 @@ ENABLE_AM_FIX := 1 dynamically adjust the front end gains
ENABLE_AM_FIX_SHOW_DATA := 1 show debug data for the AM fix (still tweaking it) ENABLE_AM_FIX_SHOW_DATA := 1 show debug data for the AM fix (still tweaking it)
ENABLE_SQUELCH_MORE_SENSITIVE := 1 make squelch levels a little bit more sensitive - I plan to let user adjust the values themselves ENABLE_SQUELCH_MORE_SENSITIVE := 1 make squelch levels a little bit more sensitive - I plan to let user adjust the values themselves
ENABLE_FASTER_CHANNEL_SCAN := 0 increases the channel scan speed, but the squelch is also made more twitchy ENABLE_FASTER_CHANNEL_SCAN := 0 increases the channel scan speed, but the squelch is also made more twitchy
ENABLE_BACKLIGHT_ON_RX := 0 turn the backlight on when the squelch opens
ENABLE_RSSI_BAR := 1 enable a dBm/Sn RSSI bar graph level inplace of the little antenna symbols ENABLE_RSSI_BAR := 1 enable a dBm/Sn RSSI bar graph level inplace of the little antenna symbols
ENABLE_AUDIO_BAR := 0 experimental, display an audo bar level when TX'ing ENABLE_AUDIO_BAR := 0 experimental, display an audo bar level when TX'ing
#ENABLE_COPY_CHAN_TO_VFO := 1 not yet implemented - copy the current channel into the VFO #ENABLE_COPY_CHAN_TO_VFO := 1 not yet implemented - copy the current channel into the VFO

View File

@ -468,6 +468,9 @@ static void APP_HandleFunction(void)
void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix) void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix)
{ {
const unsigned int chan = gEeprom.RX_CHANNEL;
// const unsigned int chan = gRxVfo->CHANNEL_SAVE;
if (gSetting_KILLED) if (gSetting_KILLED)
return; return;
@ -476,19 +479,16 @@ void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix)
BK1080_Init(0, false); BK1080_Init(0, false);
#endif #endif
#ifdef ENABLE_AM_FIX
if (gEeprom.VfoInfo[gEeprom.RX_CHANNEL].AM_mode && reset_am_fix)
AM_fix_reset(gEeprom.RX_CHANNEL); // TODO: only reset it when moving channel/frequency
#endif
// clear the other vfo's rssi level (to hide the antenna symbol) // clear the other vfo's rssi level (to hide the antenna symbol)
gVFO_RSSI_bar_level[gEeprom.RX_CHANNEL == 0] = 0; gVFO_RSSI_bar_level[(chan + 1) & 1u] = 0;
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH); GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
gEnableSpeaker = true; gEnableSpeaker = true;
BACKLIGHT_TurnOn(); #ifdef ENABLE_BACKLIGHT_ON_RX
BACKLIGHT_TurnOn();
#endif
if (gScanState != SCAN_OFF) if (gScanState != SCAN_OFF)
{ {
@ -516,19 +516,21 @@ void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix)
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
if (IS_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE) && gIsNoaaMode) if (IS_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE) && gIsNoaaMode)
{ {
gRxVfo->CHANNEL_SAVE = gNoaaChannel + NOAA_CHANNEL_FIRST; gRxVfo->CHANNEL_SAVE = gNoaaChannel + NOAA_CHANNEL_FIRST;
gRxVfo->pRX->Frequency = NoaaFrequencyTable[gNoaaChannel]; gRxVfo->pRX->Frequency = NoaaFrequencyTable[gNoaaChannel];
gRxVfo->pTX->Frequency = NoaaFrequencyTable[gNoaaChannel]; gRxVfo->pTX->Frequency = NoaaFrequencyTable[gNoaaChannel];
gEeprom.ScreenChannel[gEeprom.RX_CHANNEL] = gRxVfo->CHANNEL_SAVE; gEeprom.ScreenChannel[chan] = gRxVfo->CHANNEL_SAVE;
gNOAA_Countdown_10ms = 500; // 5 sec gNOAA_Countdown_10ms = 500; // 5 sec
gScheduleNOAA = false; gScheduleNOAA = false;
} }
#endif #endif
if (gCssScanMode != CSS_SCAN_MODE_OFF) if (gCssScanMode != CSS_SCAN_MODE_OFF)
gCssScanMode = CSS_SCAN_MODE_FOUND; gCssScanMode = CSS_SCAN_MODE_FOUND;
if (gScanState == SCAN_OFF && gCssScanMode == CSS_SCAN_MODE_OFF && gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) if (gScanState == SCAN_OFF &&
gCssScanMode == CSS_SCAN_MODE_OFF &&
gEeprom.DUAL_WATCH != DUAL_WATCH_OFF)
{ // not scanning, dual watch is enabled { // not scanning, dual watch is enabled
gDualWatchCountdown_10ms = dual_watch_count_after_2_10ms; gDualWatchCountdown_10ms = dual_watch_count_after_2_10ms;
@ -541,9 +543,8 @@ void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix)
gUpdateStatus = true; gUpdateStatus = true;
} }
// ****************************************** { // RF RX front end gain
{
// original setting // original setting
uint16_t lna_short = orig_lna_short; uint16_t lna_short = orig_lna_short;
uint16_t lna = orig_lna; uint16_t lna = orig_lna;
@ -551,29 +552,22 @@ void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix)
uint16_t pga = orig_pga; uint16_t pga = orig_pga;
#ifdef ENABLE_AM_FIX #ifdef ENABLE_AM_FIX
if (gRxVfo->AM_mode && gSetting_AM_fix)
{ // AM RX mode
// TODO: if (reset_am_fix)
AM_fix_reset(chan); // TODO: only reset it when moving channel/frequency
AM_fix_10ms(chan);
// if (gRxVfo->AM_mode) }
// { // AM RX else
// if (gEeprom.VfoInfo[gEeprom.RX_CHANNEL].AM_mode && gSetting_AM_fix) { // FM RX mode
// {
// AM_fix_10ms(gEeprom.RX_CHANNEL);
// }
// }
// else
BK4819_WriteRegister(BK4819_REG_13, (lna_short << 8) | (lna << 5) | (mixer << 3) | (pga << 0)); BK4819_WriteRegister(BK4819_REG_13, (lna_short << 8) | (lna << 5) | (mixer << 3) | (pga << 0));
}
#else #else
// apply the front end gain settings
BK4819_WriteRegister(BK4819_REG_13, (lna_short << 8) | (lna << 5) | (mixer << 3) | (pga << 0)); BK4819_WriteRegister(BK4819_REG_13, (lna_short << 8) | (lna << 5) | (mixer << 3) | (pga << 0));
#endif #endif
} }
// ****************************************** // AF gain - original QS values
// AF gain - original
BK4819_WriteRegister(BK4819_REG_48, BK4819_WriteRegister(BK4819_REG_48,
(11u << 12) | // ??? .. 0 to 15, doesn't seem to make any difference (11u << 12) | // ??? .. 0 to 15, doesn't seem to make any difference
( 0u << 10) | // AF Rx Gain-1 ( 0u << 10) | // AF Rx Gain-1
@ -593,14 +587,11 @@ void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix)
if (Function == FUNCTION_MONITOR) if (Function == FUNCTION_MONITOR)
#endif #endif
{ // squelch is disabled { // squelch is disabled
if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
GUI_SelectNextDisplay(DISPLAY_MAIN); GUI_SelectNextDisplay(DISPLAY_MAIN);
return;
} }
else
gUpdateDisplay = true; gUpdateDisplay = true;
} }
uint32_t APP_SetFrequencyByStep(VFO_Info_t *pInfo, int8_t Step) uint32_t APP_SetFrequencyByStep(VFO_Info_t *pInfo, int8_t Step)

Binary file not shown.

Binary file not shown.