From cd515a4f0c1b1b7393908d28b78d626b55ef5464 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 65601e07..8f92c498 100644 --- a/app/app.c +++ b/app/app.c @@ -385,9 +385,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); }