forked from mirror/uv-k5-firmware
Fixed Quansheng's bug with 8.33khz stepping.
This commit is contained in:
parent
86b737ca4d
commit
ac5ff212ec
10
app/app.c
10
app/app.c
@ -381,6 +381,16 @@ void APP_SetFrequencyByStep(VFO_Info_t *pInfo, int8_t Step)
|
||||
uint32_t Frequency;
|
||||
|
||||
Frequency = pInfo->ConfigRX.Frequency + (Step * pInfo->StepFrequency);
|
||||
|
||||
if (pInfo->StepFrequency == 833) {
|
||||
const uint32_t Lower = LowerLimitFrequencyBandTable[pInfo->Band];
|
||||
const uint32_t Delta = Frequency - Lower;
|
||||
const uint32_t Base = (Delta / 2500) * 2500;
|
||||
const uint32_t Index = ((Delta - Base) % 2500) / 833;
|
||||
|
||||
Frequency = Lower + Base + (Index * 833);
|
||||
}
|
||||
|
||||
if (Frequency > UpperLimitFrequencyBandTable[pInfo->Band]) {
|
||||
pInfo->ConfigRX.Frequency = LowerLimitFrequencyBandTable[pInfo->Band];
|
||||
} else if (Frequency < LowerLimitFrequencyBandTable[pInfo->Band]) {
|
||||
|
@ -121,7 +121,16 @@ uint32_t FREQUENCY_FloorToStep(uint32_t Upper, uint32_t Step, uint32_t Lower)
|
||||
{
|
||||
uint32_t Index;
|
||||
|
||||
if (Step == 833) {
|
||||
const uint32_t Delta = Upper - Lower;
|
||||
const uint32_t Base = (Delta / 2500) * 2500;
|
||||
const uint32_t Index = ((Delta - Base) % 2500) / 833;
|
||||
|
||||
return Lower + Base + (Index * 833);
|
||||
}
|
||||
|
||||
Index = (Upper - Lower) / Step;
|
||||
|
||||
return Lower + (Step * Index);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user