Skip to content

Commit

Permalink
Fix - Squelch level when filter mode changes
Browse files Browse the repository at this point in the history
  • Loading branch information
xawen committed Nov 28, 2023
1 parent e76b03e commit a24a0ed
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions app/spectrum.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ uint16_t RssiValue[128] = {0};
uint16_t SquelchLevel;
uint8_t bExit;
uint8_t bRXMode;
uint8_t bResetSquelch;
uint8_t bRestartScan;
uint8_t bFilterEnabled;
uint8_t bNarrow;
uint16_t RssiLow;
Expand Down Expand Up @@ -193,6 +195,7 @@ void ChangeHoldFreq(uint8_t Up) {
} else {
CurrentFreqIndex = (CurrentFreqIndex + CurrentStepCount -1) % CurrentStepCount;
}
CurrentFreq = FreqMin + (CurrentFreqIndex * CurrentFreqStep);
}

void ChangeSquelchLevel(uint8_t Up) {
Expand All @@ -206,6 +209,8 @@ void ChangeSquelchLevel(uint8_t Up) {
void ToggleFilter(void) {
bFilterEnabled ^= 1;
BK4819_EnableFilter(bFilterEnabled);
bResetSquelch = TRUE;
bRestartScan = TRUE;
DrawLabels();
}

Expand Down Expand Up @@ -445,6 +450,8 @@ void Spectrum_Loop(void) {
uint32_t FreqToCheck;
CurrentFreqIndex = 0;
CurrentFreq = FreqMin;
bResetSquelch = TRUE;
bRestartScan = FALSE;

UI_DrawStatusIcon(139, ICON_BATTERY, true, COLOR_FOREGROUND);
UI_DrawBattery();
Expand All @@ -453,11 +460,17 @@ void Spectrum_Loop(void) {

while (1) {
FreqToCheck = FreqMin;
RssiLow = 330;
RssiHigh = 72;
bRestartScan = TRUE;

for (uint8_t i = 0; i < CurrentStepCount; i++) {

if (bRestartScan) {
bRestartScan = FALSE;
RssiLow = 330;
RssiHigh = 72;
i = 0;
}

BK4819_set_rf_frequency(FreqToCheck, TRUE);

DELAY_WaitMS(CurrentScanDelay);
Expand All @@ -483,7 +496,8 @@ void Spectrum_Loop(void) {
}
}

if (SquelchLevel == 0) {
if (bResetSquelch) {
bResetSquelch = FALSE;
SquelchLevel = RssiHigh + 5;
}

Expand Down

0 comments on commit a24a0ed

Please sign in to comment.