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

Fix 630MHz limit when user tries to go into 630-840MHz range

This commit is contained in:
OneOfEleven 2023-09-28 09:28:36 +01:00
parent c4dc8954e8
commit f55a2b6a6d
7 changed files with 23 additions and 11 deletions

View File

@ -56,8 +56,8 @@ void ACTION_Power(void)
if (++gTxVfo->OUTPUT_POWER > OUTPUT_POWER_HIGH)
gTxVfo->OUTPUT_POWER = OUTPUT_POWER_LOW;
//gRequestSaveChannel = 1;
gRequestSaveChannel = 2;
gRequestSaveChannel = 1;
//gRequestSaveChannel = 2; // auto save the channel
#ifdef ENABLE_VOICE
gAnotherVoiceID = VOICE_ID_POWER;

View File

@ -344,6 +344,7 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
NUMBER_Get(gInputBox, &Frequency);
// clamp the frequency entered to some valid value
if (Frequency < LowerLimitFrequencyBandTable[0])
{
Frequency = LowerLimitFrequencyBandTable[0];
@ -384,7 +385,17 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
// Frequency += 75; // is this for rounding
Frequency += gTxVfo->StepFrequency / 2; // this is though
gTxVfo->freq_config_RX.Frequency = FREQUENCY_FloorToStep(Frequency, gTxVfo->StepFrequency, LowerLimitFrequencyBandTable[gTxVfo->Band]);
Frequency = FREQUENCY_FloorToStep(Frequency, gTxVfo->StepFrequency, LowerLimitFrequencyBandTable[gTxVfo->Band]);
// clamp the frequency entered to some valid value
if (Frequency >= bx_stop1_Hz && Frequency < bx_start2_Hz)
{ // use the step size to properly limit the frequency
const uint32_t center = (bx_stop1_Hz + bx_start2_Hz) / 2;
Frequency = (Frequency < center) ? bx_stop1_Hz - gTxVfo->StepFrequency : bx_start2_Hz;
}
gTxVfo->freq_config_RX.Frequency = Frequency;
gRequestSaveChannel = 1;
return;

View File

@ -574,7 +574,7 @@ void BK4819_SetFilterBandwidth(const BK4819_FilterBandwidth_t Bandwidth, const b
BK4819_WriteRegister(BK4819_REG_43, // 0x3028); // 0 011 000 000 10 1 0 00
(0u << 15) | // 0
(3u << 12) | // 3 RF filter bandwidth
(1u << 9) | // *0 RF filter bandwidth when signal is weak
(0u << 9) | // *0 RF filter bandwidth when signal is weak
(6u << 6) | // *0 AFTxLPF2 filter Band Width
(2u << 4) | // 2 BW Mode Selection
(1u << 3) | // 1
@ -602,7 +602,7 @@ void BK4819_SetFilterBandwidth(const BK4819_FilterBandwidth_t Bandwidth, const b
BK4819_WriteRegister(BK4819_REG_43, // 0x4048); // 0 100 000 001 00 1 0 00
(0u << 15) | // 0
(3u << 12) | // 4 RF filter bandwidth
(1u << 9) | // *0 RF filter bandwidth when signal is weak
(0u << 9) | // *0 RF filter bandwidth when signal is weak
(0u << 6) | // *1 AFTxLPF2 filter Band Width
(0u << 4) | // 0 BW Mode Selection
(1u << 3) | // 1
@ -1337,7 +1337,7 @@ void BK4819_DisableFrequencyScan(void)
void BK4819_EnableFrequencyScan(void)
{
BK4819_WriteRegister(BK4819_REG_32, 0x0245);
BK4819_WriteRegister(BK4819_REG_32, 0x0245); // 00 0000100100010 1
}
void BK4819_SetScanFrequency(uint32_t Frequency)

Binary file not shown.

Binary file not shown.

View File

@ -23,7 +23,8 @@
const uint32_t bx_start1_Hz = 1800000; // 18MHz
const uint32_t bx_stop1_Hz = 63000000; // 630MHz
const uint32_t bx_start2_Hz = 76000000; // 760MHz
//const uint32_t bx_start2_Hz = 76000000; // 760MHz // my one radio the BK chip managed to lock down to this frequency
const uint32_t bx_start2_Hz = 84000000; // 840MHz // but best to go with datasheet specification really
const uint32_t bx_stop2_Hz = 130000000; // 1300MHz
const uint32_t LowerLimitFrequencyBandTable[7] =

View File

@ -591,8 +591,8 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
case BK4819_FILTER_BW_WIDE:
case BK4819_FILTER_BW_NARROW:
#ifdef ENABLE_AM_FIX
BK4819_SetFilterBandwidth(Bandwidth, gRxVfo->IsAM && gSetting_AM_fix);
// BK4819_SetFilterBandwidth(Bandwidth, false);
// BK4819_SetFilterBandwidth(Bandwidth, gRxVfo->IsAM && gSetting_AM_fix);
BK4819_SetFilterBandwidth(Bandwidth, false);
#else
BK4819_SetFilterBandwidth(Bandwidth, false);
#endif
@ -841,8 +841,8 @@ void RADIO_SetTxParameters(void)
case BK4819_FILTER_BW_WIDE:
case BK4819_FILTER_BW_NARROW:
#ifdef ENABLE_AM_FIX
BK4819_SetFilterBandwidth(Bandwidth, gCurrentVfo->IsAM && gSetting_AM_fix);
// BK4819_SetFilterBandwidth(Bandwidth, false);
// BK4819_SetFilterBandwidth(Bandwidth, gCurrentVfo->IsAM && gSetting_AM_fix);
BK4819_SetFilterBandwidth(Bandwidth, false);
#else
BK4819_SetFilterBandwidth(Bandwidth, false);
#endif