From 0a3c21af1f9fd8b656a109b3e3ecb0cd6189acd8 Mon Sep 17 00:00:00 2001 From: Dual Tachyon Date: Fri, 15 Sep 2023 21:36:10 +0100 Subject: [PATCH] Fixed step 2/3 of 8.33kHz. --- app/app.c | 6 +++++- frequencies.c | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/app.c b/app/app.c index e95f6134..6bd889f0 100644 --- a/app/app.c +++ b/app/app.c @@ -386,9 +386,13 @@ void APP_SetFrequencyByStep(VFO_Info_t *pInfo, int8_t Step) if (pInfo->StepFrequency == 833) { const uint32_t Lower = LowerLimitFrequencyBandTable[pInfo->Band]; const uint32_t Delta = Frequency - Lower; - const uint32_t Base = (Delta / 2500) * 2500; + uint32_t Base = (Delta / 2500) * 2500; const uint32_t Index = ((Delta - Base) % 2500) / 833; + if (Index == 2) { + Base++; + } + Frequency = Lower + Base + (Index * 833); } diff --git a/frequencies.c b/frequencies.c index 163412e1..274c5090 100644 --- a/frequencies.c +++ b/frequencies.c @@ -123,9 +123,13 @@ uint32_t FREQUENCY_FloorToStep(uint32_t Upper, uint32_t Step, uint32_t Lower) if (Step == 833) { const uint32_t Delta = Upper - Lower; - const uint32_t Base = (Delta / 2500) * 2500; + uint32_t Base = (Delta / 2500) * 2500; const uint32_t Index = ((Delta - Base) % 2500) / 833; + if (Index == 2) { + Base++; + } + return Lower + Base + (Index * 833); }