diff --git a/app/main.c b/app/main.c index cbb089c..2aa73a1 100644 --- a/app/main.c +++ b/app/main.c @@ -334,6 +334,7 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) // #endif if (IS_FREQ_CHANNEL(gTxVfo->CHANNEL_SAVE)) { // user is entering frequency + uint32_t Frequency; if (gInputBoxIndex < 6) @@ -349,16 +350,22 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) NUMBER_Get(gInputBox, &Frequency); -// if (Frequency < bx_start1_Hz || Frequency >= bx_stop2_Hz) -// { // the BK4819 chip does not do this frequency range -// } -// else -// if (Frequency >= bx_stop1_Hz && Frequency < bx_start2_Hz) -// { // the BK4819 chip does not do this frequency range -// } -// else -// if (gSetting_350EN || Frequency < 35000000 || Frequency >= 40000000) - if (RX_FREQUENCY_Check(Frequency) == 0) + if (Frequency < LowerLimitFrequencyBandTable[0]) + { + Frequency = LowerLimitFrequencyBandTable[0]; + } + else + if (Frequency >= bx_stop1_Hz && Frequency < bx_start2_Hz) + { // move the frequency to the closest limit + const uint32_t center = (bx_stop1_Hz + bx_start2_Hz) / 2; + Frequency = (Frequency < center) ? bx_stop1_Hz - 10 : bx_start2_Hz; + } + else + if (Frequency > UpperLimitFrequencyBandTable[6]) + { + Frequency = UpperLimitFrequencyBandTable[6]; + } + { unsigned int i; for (i = 0; i < 7; i++) @@ -380,8 +387,9 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) RADIO_ConfigureChannel(Vfo, 2); } - Frequency += 75; - +// 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]); gRequestSaveChannel = 1; diff --git a/firmware.bin b/firmware.bin index b4badb5..f824da8 100644 Binary files a/firmware.bin and b/firmware.bin differ diff --git a/firmware.packed.bin b/firmware.packed.bin index af1f3b0..4e37676 100644 Binary files a/firmware.packed.bin and b/firmware.packed.bin differ diff --git a/frequencies.c b/frequencies.c index faf71cd..d68ee6a 100644 --- a/frequencies.c +++ b/frequencies.c @@ -21,7 +21,7 @@ // the BK4819 has 2 bands it covers, 18MHz ~ 630MHz and 760MHz ~ 1300MHz const uint32_t bx_start1_Hz = 1800000; // 18MHz -const uint32_t bx_stop1_Hz = 1800000; // 630MHz +const uint32_t bx_stop1_Hz = 63000000; // 630MHz const uint32_t bx_start2_Hz = 76000000; // 760MHz const uint32_t bx_stop2_Hz = 130000000; // 1300MHz @@ -189,7 +189,7 @@ int TX_FREQUENCY_Check(const uint32_t Frequency) if (Frequency < LowerLimitFrequencyBandTable[0] || Frequency > UpperLimitFrequencyBandTable[6]) return -1; - if (Frequency >= 63000000 && Frequency < 75700000) + if (Frequency >= bx_stop1_Hz && Frequency < bx_start2_Hz) return -1; switch (gSetting_F_LOCK) @@ -254,7 +254,7 @@ int RX_FREQUENCY_Check(const uint32_t Frequency) if (Frequency < LowerLimitFrequencyBandTable[0] || Frequency > UpperLimitFrequencyBandTable[6]) return -1; - if (Frequency >= 63000000 && Frequency < 75700000) + if (Frequency >= bx_stop1_Hz && Frequency < bx_start2_Hz) return -1; return 0; // OK frequency