Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

Commit

Permalink
Fixed step 2/3 of 8.33kHz.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dual Tachyon authored and Dual Tachyon committed Sep 15, 2023
1 parent 3da2409 commit 632fd3e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion app/app.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
6 changes: 5 additions & 1 deletion frequencies.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 632fd3e

Please sign in to comment.