0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-06-19 06:39:49 +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,8 +385,18 @@ 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;
}