0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-04-29 14:51:26 +03:00

AM update + scan list fix - hopefully

This commit is contained in:
OneOfEleven 2023-09-22 16:10:28 +01:00
parent 7a58dbc0cb
commit 6d41adf265
7 changed files with 95 additions and 48 deletions

View File

@ -275,6 +275,7 @@ void BK4819_SetAGC(uint8_t Value)
// PGA ........ -3dB // PGA ........ -3dB
// //
BK4819_WriteRegister(BK4819_REG_13, (3u << 8) | (2u << 5) | (3u << 3) | (6u << 0)); // 000000 11 101 11 110 BK4819_WriteRegister(BK4819_REG_13, (3u << 8) | (2u << 5) | (3u << 3) | (6u << 0)); // 000000 11 101 11 110
BK4819_WriteRegister(BK4819_REG_12, 0x037B); // 000000 11 011 11 011 BK4819_WriteRegister(BK4819_REG_12, 0x037B); // 000000 11 011 11 011
BK4819_WriteRegister(BK4819_REG_11, 0x027B); // 000000 10 011 11 011 BK4819_WriteRegister(BK4819_REG_11, 0x027B); // 000000 10 011 11 011
BK4819_WriteRegister(BK4819_REG_10, 0x007A); // 000000 00 011 11 010 BK4819_WriteRegister(BK4819_REG_10, 0x007A); // 000000 00 011 11 010
@ -328,6 +329,7 @@ void BK4819_SetAGC(uint8_t Value)
// PGA ........ -3dB // PGA ........ -3dB
// //
BK4819_WriteRegister(BK4819_REG_13, (3u << 8) | (2u << 5) | (3u << 3) | (6u << 0)); // 000000 11 101 11 110 BK4819_WriteRegister(BK4819_REG_13, (3u << 8) | (2u << 5) | (3u << 3) | (6u << 0)); // 000000 11 101 11 110
BK4819_WriteRegister(BK4819_REG_12, 0x037C); // 000000 11 011 11 100 BK4819_WriteRegister(BK4819_REG_12, 0x037C); // 000000 11 011 11 100
BK4819_WriteRegister(BK4819_REG_11, 0x027B); // 000000 10 011 11 011 BK4819_WriteRegister(BK4819_REG_11, 0x027B); // 000000 10 011 11 011
BK4819_WriteRegister(BK4819_REG_10, 0x007A); // 000000 00 011 11 010 BK4819_WriteRegister(BK4819_REG_10, 0x007A); // 000000 00 011 11 010
@ -513,7 +515,7 @@ void BK4819_EnableVox(uint16_t VoxEnableThreshold, uint16_t VoxDisableThreshold)
BK4819_WriteRegister(BK4819_REG_31, REG_31_Value | (1u << 2)); // VOX Enable BK4819_WriteRegister(BK4819_REG_31, REG_31_Value | (1u << 2)); // VOX Enable
} }
void BK4819_SetFilterBandwidth(BK4819_FilterBandwidth_t Bandwidth) void BK4819_SetFilterBandwidth(BK4819_FilterBandwidth_t Bandwidth, const bool weak_no_different)
{ {
// REG_43 <14:12> 4 RF filter bandwidth // REG_43 <14:12> 4 RF filter bandwidth
// 0 = 1.7 kHz // 0 = 1.7 kHz
@ -557,6 +559,20 @@ void BK4819_SetFilterBandwidth(BK4819_FilterBandwidth_t Bandwidth)
// 1 = 6dB // 1 = 6dB
// //
if (Bandwidth == BK4819_FILTER_BW_WIDE) if (Bandwidth == BK4819_FILTER_BW_WIDE)
{
if (weak_no_different)
{
BK4819_WriteRegister(BK4819_REG_43,
(0u << 15) | // 0
(3u << 12) | // 3 RF filter bandwidth
(3u << 9) | // 0 RF filter bandwidth when signal is weak
(0u << 6) | // 0 AFTxLPF2 filter Band Width
(2u << 4) | // 2 BW Mode Selection
(1u << 3) | // 1
(0u << 2) | // 0 Gain after FM Demodulation
(0u << 0)); // 0
}
else
{ {
BK4819_WriteRegister(BK4819_REG_43, BK4819_WriteRegister(BK4819_REG_43,
(0u << 15) | // 0 (0u << 15) | // 0
@ -568,8 +584,23 @@ void BK4819_SetFilterBandwidth(BK4819_FilterBandwidth_t Bandwidth)
(0u << 2) | // 0 Gain after FM Demodulation (0u << 2) | // 0 Gain after FM Demodulation
(0u << 0)); // 0 (0u << 0)); // 0
} }
}
else else
if (Bandwidth == BK4819_FILTER_BW_NARROW) if (Bandwidth == BK4819_FILTER_BW_NARROW)
{
if (weak_no_different)
{
BK4819_WriteRegister(BK4819_REG_43, // 0x4048); // 0 100 000 001 00 1 0 00
(0u << 15) | // 0
(3u << 12) | // 4 RF filter bandwidth
(3u << 9) | // 0 RF filter bandwidth when signal is weak
(1u << 6) | // 1 AFTxLPF2 filter Band Width
(0u << 4) | // 0 BW Mode Selection
(1u << 3) | // 1
(0u << 2) | // 0 Gain after FM Demodulation
(0u << 0)); // 0
}
else
{ {
BK4819_WriteRegister(BK4819_REG_43, // 0x4048); // 0 100 000 001 00 1 0 00 BK4819_WriteRegister(BK4819_REG_43, // 0x4048); // 0 100 000 001 00 1 0 00
(0u << 15) | // 0 (0u << 15) | // 0
@ -580,21 +611,24 @@ void BK4819_SetFilterBandwidth(BK4819_FilterBandwidth_t Bandwidth)
(1u << 3) | // 1 (1u << 3) | // 1
(0u << 2) | // 0 Gain after FM Demodulation (0u << 2) | // 0 Gain after FM Demodulation
(0u << 0)); // 0 (0u << 0)); // 0
/* }
// https://github.com/fagci/uv-k5-firmware-fagci-mod
//BK4819_WriteRegister(BK4819_REG_43, // 0x790C); // 0 111 100 100 00 1 1 00 squelch
(0u << 15) | // 0
(7u << 12) | // 7 RF filter bandwidth
(4u << 9) | // 4 RF filter bandwidth when signal is weak
(4u << 6) | // 4 AFTxLPF2 filter Band Width
(0u << 4) | // 0 BW Mode Selection
(1u << 3) | // 1
(1u << 2) | // 1 Gain after FM Demodulation
(0u << 0)); // 0
*/
} }
else else
if (Bandwidth == BK4819_FILTER_BW_NARROWER) if (Bandwidth == BK4819_FILTER_BW_NARROWER)
{
if (weak_no_different)
{
BK4819_WriteRegister(BK4819_REG_43, // 0 100 000 001 01 1 0 00
(0u << 15) | // 0
(4u << 12) | // 4 RF filter bandwidth
(4u << 9) | // 0 RF filter bandwidth when signal is weak
(1u << 6) | // 1 AFTxLPF2 filter Band Width
(1u << 4) | // 1 BW Mode Selection
(1u << 3) | // 1
(0u << 2) | // 0 Gain after FM Demodulation
(0u << 0)); // 0
}
else
{ {
BK4819_WriteRegister(BK4819_REG_43, // 0 100 000 001 01 1 0 00 BK4819_WriteRegister(BK4819_REG_43, // 0 100 000 001 01 1 0 00
(0u << 15) | // 0 (0u << 15) | // 0
@ -606,6 +640,7 @@ void BK4819_SetFilterBandwidth(BK4819_FilterBandwidth_t Bandwidth)
(0u << 2) | // 0 Gain after FM Demodulation (0u << 2) | // 0 Gain after FM Demodulation
(0u << 0)); // 0 (0u << 0)); // 0
} }
}
} }
void BK4819_SetupPowerAmplifier(uint16_t Bias, uint32_t Frequency) void BK4819_SetupPowerAmplifier(uint16_t Bias, uint32_t Frequency)

View File

@ -78,7 +78,7 @@ void BK4819_SetCDCSSCodeWord(uint32_t CodeWord);
void BK4819_SetCTCSSFrequency(uint32_t BaudRate); void BK4819_SetCTCSSFrequency(uint32_t BaudRate);
void BK4819_SetTailDetection(const uint32_t freq_10Hz); void BK4819_SetTailDetection(const uint32_t freq_10Hz);
void BK4819_EnableVox(uint16_t Vox1Threshold, uint16_t Vox0Threshold); void BK4819_EnableVox(uint16_t Vox1Threshold, uint16_t Vox0Threshold);
void BK4819_SetFilterBandwidth(BK4819_FilterBandwidth_t Bandwidth); void BK4819_SetFilterBandwidth(BK4819_FilterBandwidth_t Bandwidth, const bool weak_no_different);
void BK4819_SetupPowerAmplifier(uint16_t Bias, uint32_t Frequency); void BK4819_SetupPowerAmplifier(uint16_t Bias, uint32_t Frequency);
void BK4819_SetFrequency(uint32_t Frequency); void BK4819_SetFrequency(uint32_t Frequency);
void BK4819_SetupSquelch( void BK4819_SetupSquelch(

BIN
firmware

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -565,7 +565,7 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
Bandwidth = BK4819_FILTER_BW_WIDE; Bandwidth = BK4819_FILTER_BW_WIDE;
case BK4819_FILTER_BW_WIDE: case BK4819_FILTER_BW_WIDE:
case BK4819_FILTER_BW_NARROW: case BK4819_FILTER_BW_NARROW:
BK4819_SetFilterBandwidth(Bandwidth); BK4819_SetFilterBandwidth(Bandwidth, gRxVfo->IsAM);
break; break;
} }
@ -809,7 +809,7 @@ void RADIO_SetTxParameters(void)
Bandwidth = BK4819_FILTER_BW_WIDE; Bandwidth = BK4819_FILTER_BW_WIDE;
case BK4819_FILTER_BW_WIDE: case BK4819_FILTER_BW_WIDE:
case BK4819_FILTER_BW_NARROW: case BK4819_FILTER_BW_NARROW:
BK4819_SetFilterBandwidth(Bandwidth); BK4819_SetFilterBandwidth(Bandwidth, gCurrentVfo->IsAM);
break; break;
} }

View File

@ -676,31 +676,43 @@ void UI_DisplayMenu(void)
// if (gSubMenuSelection == 0xFF || !gEeprom.SCAN_LIST_ENABLED[i]) // if (gSubMenuSelection == 0xFF || !gEeprom.SCAN_LIST_ENABLED[i])
if (gSubMenuSelection < 0 || !gEeprom.SCAN_LIST_ENABLED[i]) if (gSubMenuSelection < 0 || !gEeprom.SCAN_LIST_ENABLED[i])
{ {
// channel number
UI_PrintString(String, menu_item_x1, menu_item_x2, 0, 8); UI_PrintString(String, menu_item_x1, menu_item_x2, 0, 8);
// channel name
BOARD_fetchChannelName(String, gSubMenuSelection);
if (String[0] == 0)
strcpy(String, "--");
UI_PrintString(String, menu_item_x1, menu_item_x2, 2, 8);
} }
else else
{ {
// channel number
UI_PrintString(String, menu_item_x1, menu_item_x2, 0, 8); UI_PrintString(String, menu_item_x1, menu_item_x2, 0, 8);
// channel name
BOARD_fetchChannelName(String, gSubMenuSelection);
if (String[0] == 0)
strcpy(String, "--");
UI_PrintStringSmall(String, menu_item_x1, menu_item_x2, 2);
if (IS_MR_CHANNEL(gEeprom.SCANLIST_PRIORITY_CH1[i])) if (IS_MR_CHANNEL(gEeprom.SCANLIST_PRIORITY_CH1[i]))
{ {
sprintf(String, "PRI1:%u", gEeprom.SCANLIST_PRIORITY_CH1[i] + 1); sprintf(String, "PRI1:%u", gEeprom.SCANLIST_PRIORITY_CH1[i] + 1);
UI_PrintString(String, menu_item_x1, menu_item_x2, 2, 8); UI_PrintString(String, menu_item_x1, menu_item_x2, 3, 8);
} }
if (IS_MR_CHANNEL(gEeprom.SCANLIST_PRIORITY_CH2[i])) if (IS_MR_CHANNEL(gEeprom.SCANLIST_PRIORITY_CH2[i]))
{ {
sprintf(String, "PRI2:%u", gEeprom.SCANLIST_PRIORITY_CH2[i] + 1); sprintf(String, "PRI2:%u", gEeprom.SCANLIST_PRIORITY_CH2[i] + 1);
UI_PrintString(String, menu_item_x1, menu_item_x2, 4, 8); UI_PrintString(String, menu_item_x1, menu_item_x2, 5, 8);
} }
} }
} }
if (gMenuCursor == MENU_MEM_CH || if (gMenuCursor == MENU_MEM_CH ||
gMenuCursor == MENU_DEL_CH || gMenuCursor == MENU_DEL_CH ||
gMenuCursor == MENU_1_CALL || gMenuCursor == MENU_1_CALL)
gMenuCursor == MENU_SLIST1 ||
gMenuCursor == MENU_SLIST2)
{ // display the channel name { // display the channel name
char s[11]; char s[11];
BOARD_fetchChannelName(s, gSubMenuSelection); BOARD_fetchChannelName(s, gSubMenuSelection);