Skip to content

Commit

Permalink
BUG FIX #15: shifted numbers in spectrum freq input box
Browse files Browse the repository at this point in the history
  • Loading branch information
egzumer committed Oct 6, 2023
1 parent 43ccce3 commit 43f4790
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/spectrum.c
Original file line number Diff line number Diff line change
Expand Up @@ -561,22 +561,22 @@ static void UpdateFreqInput(KEY_Code_t key) {
for (int i = 0; i < 10; ++i) {
if (i < freqInputIndex) {
digitKey = freqInputArr[i];
freqInputString[i] = digitKey <= KEY_9 ? '0' + digitKey : '.';
freqInputString[i] = digitKey <= KEY_9 ? '0' + digitKey-KEY_0 : '.';
} else {
freqInputString[i] = '-';
}
}

uint32_t base = 100000; // 1MHz in BK units
for (int i = dotIndex - 1; i >= 0; --i) {
tempFreq += freqInputArr[i] * base;
tempFreq += (freqInputArr[i]-KEY_0) * base;
base *= 10;
}

base = 10000; // 0.1MHz in BK units
if (dotIndex < freqInputIndex) {
for (int i = dotIndex + 1; i < freqInputIndex; ++i) {
tempFreq += freqInputArr[i] * base;
tempFreq += (freqInputArr[i]-KEY_0) * base;
base /= 10;
}
}
Expand Down

0 comments on commit 43f4790

Please sign in to comment.