Spectrum support for rx_offset.

This commit is contained in:
Nunu 2023-12-06 14:04:31 +01:00
parent b12dc22c42
commit 42e382e5a1
2 changed files with 5 additions and 5 deletions

1
.gitignore vendored
View File

@ -4,3 +4,4 @@ firmware
/firmware.packed.bin /firmware.packed.bin
/firmware.bin /firmware.bin
/compiled-firmware /compiled-firmware
/.vscode/*

View File

@ -25,7 +25,6 @@ struct FrequencyBandInfo {
uint32_t middle; uint32_t middle;
}; };
#define F_MIN frequencyBandTable[0].lower
#define F_MAX frequencyBandTable[ARRAY_SIZE(frequencyBandTable) - 1].upper #define F_MAX frequencyBandTable[ARRAY_SIZE(frequencyBandTable) - 1].upper
const uint16_t RSSI_MAX_VALUE = 65535; const uint16_t RSSI_MAX_VALUE = 65535;
@ -226,7 +225,7 @@ static void ToggleAFDAC(bool on) {
} }
static void SetF(uint32_t f) { static void SetF(uint32_t f) {
fMeasure = f; fMeasure = f + gEeprom.RX_OFFSET;
BK4819_SetFrequency(fMeasure); BK4819_SetFrequency(fMeasure);
BK4819_PickRXFilterPathBasedOnFrequency(fMeasure); BK4819_PickRXFilterPathBasedOnFrequency(fMeasure);
@ -435,7 +434,7 @@ static void UpdateScanStep(bool inc) {
static void UpdateCurrentFreq(bool inc) { static void UpdateCurrentFreq(bool inc) {
if (inc && currentFreq < F_MAX) { if (inc && currentFreq < F_MAX) {
currentFreq += settings.frequencyChangeStep; currentFreq += settings.frequencyChangeStep;
} else if (!inc && currentFreq > F_MIN) { } else if (!inc && currentFreq > RX_freq_min() && currentFreq > settings.frequencyChangeStep) {
currentFreq -= settings.frequencyChangeStep; currentFreq -= settings.frequencyChangeStep;
} else { } else {
return; return;
@ -450,7 +449,7 @@ static void UpdateCurrentFreqStill(bool inc) {
uint32_t f = fMeasure; uint32_t f = fMeasure;
if (inc && f < F_MAX) { if (inc && f < F_MAX) {
f += offset; f += offset;
} else if (!inc && f > F_MIN) { } else if (!inc && f > RX_freq_min()) {
f -= offset; f -= offset;
} }
SetF(f); SetF(f);
@ -810,7 +809,7 @@ static void OnKeyDownFreqInput(uint8_t key) {
UpdateFreqInput(key); UpdateFreqInput(key);
break; break;
case KEY_MENU: case KEY_MENU:
if (tempFreq < F_MIN || tempFreq > F_MAX) { if (tempFreq < RX_freq_min() || tempFreq > F_MAX) {
break; break;
} }
SetState(previousState); SetState(previousState);