From deb0f566667f6849ec6bbe98774b5f00f1fe0baf Mon Sep 17 00:00:00 2001 From: Egor Shitikov Date: Thu, 1 Aug 2024 18:23:47 -0700 Subject: [PATCH 1/2] RSS METHOD --- src/main.cpp | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 747e5b4..be9fc58 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -23,7 +23,7 @@ // frequency range in MHz to scan #define FREQ_BEGIN 850 -// TODO: if % RANGE_PER_PAGE 1= 0 +// TODO: if % RANGE_PER_PAGE != 0 #define FREQ_END 950 // Feature to scan diapazones. Other frequency settings will be ignored. @@ -33,6 +33,11 @@ int SCAN_DIAPAZONES[] = {}; // MHZ per page // to put everething into one page set RANGE_PER_PAGE = FREQ_END - 800 unsigned int RANGE_PER_PAGE = FREQ_END - FREQ_BEGIN; // FREQ_END - FREQ_BEGIN +//To Enable Multi Screen scan +// unsigned int RANGE_PER_PAGE = 50; +// Default Range on Menu Button Switch +#define DEFAULT_RANGE_PER_PAGE = 50; + // TODO: Ignore power lines #define UP_FILTER 5 @@ -102,6 +107,8 @@ unsigned int median_freqancy = FREQ_BEGIN + range_freqancy / 2; // REB trigger PIN #define REB_PIN 42 +#define SCREAN_HEIGHT 64 + #define WATERFALL_ENABLED true #define WATERFALL_START 37 #define OSD_ENABLED true @@ -420,7 +427,7 @@ void setup() both.print("."); if (button.pressed()) { - RANGE_PER_PAGE = 50; + RANGE_PER_PAGE = DEFAULT_RANGE_PER_PAGE; single_page_scan = false; tone(BUZZZER_PIN, 205, 100); delay(50); @@ -562,10 +569,21 @@ void loop() waterfall[i][x][w] = false; freq = fr_begin + (range * ((float)x / STEPS)); radio.setFrequency(freq); - // RSSI METHOD + // TODOL: RSSI METHOD // Gets RSSI (Recorded Signal Strength Indicator) + // Restart continuous receive mode on the new frequency + // state = radio.startReceive(); + //if (state == RADIOLIB_ERR_NONE) { + //Serial.println(F("Started continuous receive mode")); + //} else { + //Serial.print(F("Failed to start receive mode, error code: ")); + //Serial.println(state); + //} // rssi = radio.getRSSI(false); // Serial.println(String(rssi) + "db"); + // This code will iterate over the specified frequencies, changing the frequency every + // second and printing the RSSI value for each frequency to the serial monitor. Adjust the frequencies array + // to include the specific frequencies you're interested in monitoring. #ifdef PRINT_SCAN_VALUES Serial.println(); Serial.print("step-"); From a7d3cdfa8cd725fb3390d509e7c1c5c522eff44f Mon Sep 17 00:00:00 2001 From: Egor Shitikov Date: Thu, 1 Aug 2024 19:29:12 -0700 Subject: [PATCH 2/2] some fixes --- src/main.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index be9fc58..a8eb7f6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -36,7 +36,7 @@ unsigned int RANGE_PER_PAGE = FREQ_END - FREQ_BEGIN; // FREQ_END - FREQ_BEGIN //To Enable Multi Screen scan // unsigned int RANGE_PER_PAGE = 50; // Default Range on Menu Button Switch -#define DEFAULT_RANGE_PER_PAGE = 50; +#define DEFAULT_RANGE_PER_PAGE 50 // TODO: Ignore power lines @@ -569,7 +569,7 @@ void loop() waterfall[i][x][w] = false; freq = fr_begin + (range * ((float)x / STEPS)); radio.setFrequency(freq); - // TODOL: RSSI METHOD + // TODO: RSSI METHOD // Gets RSSI (Recorded Signal Strength Indicator) // Restart continuous receive mode on the new frequency // state = radio.startReceive(); @@ -581,9 +581,12 @@ void loop() //} // rssi = radio.getRSSI(false); // Serial.println(String(rssi) + "db"); + // delay(25); // This code will iterate over the specified frequencies, changing the frequency every // second and printing the RSSI value for each frequency to the serial monitor. Adjust the frequencies array // to include the specific frequencies you're interested in monitoring. + //A short delay after changing the frequency + //ensures the module has time to stabilize and get an accurate RSSI reading. #ifdef PRINT_SCAN_VALUES Serial.println(); Serial.print("step-"); @@ -597,8 +600,10 @@ void loop() // wait for spectral scan to finish while (radio.spectralScanGetStatus() != RADIOLIB_ERR_NONE) { + //TODO: offload logic here it is non blocking spectral scan heltec_delay(1); } + // read the results Array to which the results will be saved radio.spectralScanGetResult(result); detected = false;