From fbc20eeb45abffcbc6bb9227c3f9db24b4e3901a Mon Sep 17 00:00:00 2001 From: Egor Date: Wed, 8 Jan 2025 16:32:43 -0800 Subject: [PATCH] Some fixes --- ASCII_SA.py | 6 +++++- lib/comms/comms.h | 1 - lib/comms/radio_comms.cpp | 2 +- lib/config/config.cpp | 2 +- platformio.ini | 1 + src/main.cpp | 4 +++- 6 files changed, 11 insertions(+), 5 deletions(-) diff --git a/ASCII_SA.py b/ASCII_SA.py index 1a9299d..c99de89 100644 --- a/ASCII_SA.py +++ b/ASCII_SA.py @@ -140,7 +140,8 @@ def draw_histogram(stdscr, data, histogram_start_row, db_threshold, db_per_hash, # Clear the histogram area clear_histogram_area(stdscr, histogram_start_row, 15, max_width) - baseline_row = histogram_start_row + 12 # Set the baseline for bars + histogram_height = 20 + baseline_row = histogram_start_row + histogram_height # Set the baseline for bars legend_start = baseline_row + 1 # Legends go below the baseline # Calculate maximum bar height @@ -259,6 +260,9 @@ def read_serial_data(stdscr, port, baudrate, resolution_mhz, db_threshold, db_pe use_color, show_debug ) + elif response.startswith("LORA_RSSI"): + stdscr.addstr(0, 0, " ", curses.color_pair(1)) + stdscr.addstr(0, 0, response + "dB", curses.color_pair(1)) else: stdscr.refresh() except serial.SerialException as e: diff --git a/lib/comms/comms.h b/lib/comms/comms.h index 56bdd61..47451ba 100644 --- a/lib/comms/comms.h +++ b/lib/comms/comms.h @@ -83,7 +83,6 @@ struct Endpoint { union { - struct { uint8_t loop : 1, // self diff --git a/lib/comms/radio_comms.cpp b/lib/comms/radio_comms.cpp index b0f0d6e..488e09f 100644 --- a/lib/comms/radio_comms.cpp +++ b/lib/comms/radio_comms.cpp @@ -385,7 +385,7 @@ Message *RadioComms::receive(uint16_t timeout_ms) radio.clearDio1Action(); packetRssi = radio.getRSSI(true); - Serial.println("Lora Last Packet RSSI:" + String(packetRssi)); + Serial.println("LORA_RSSI: " + String(packetRssi)); size_t len = radio.getPacketLength(true); uint8_t *packet = msg; diff --git a/lib/config/config.cpp b/lib/config/config.cpp index b8efae6..469de55 100644 --- a/lib/config/config.cpp +++ b/lib/config/config.cpp @@ -535,7 +535,7 @@ String Config::getConfig(String key) { return listen_on_usb; } - + // Example: SET detection_strategy RSSI_MAX 900000..950000+390 if (key.equalsIgnoreCase("detection_strategy")) { return detectionStrategyToStr(*this); diff --git a/platformio.ini b/platformio.ini index d726ea8..abcfe78 100644 --- a/platformio.ini +++ b/platformio.ini @@ -50,6 +50,7 @@ lib_deps = build_flags = -DHELTEC_POWER_BUTTON -DHELTEC + -DSAMPLES_RSSI=5 -DARDUINO_USB_CDC_ON_BOOT=1 -DARDUINO_USB_MODE=1 -DDEFAULT_RX=916 diff --git a/src/main.cpp b/src/main.cpp index 5845bdc..b9401cf 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -238,6 +238,8 @@ uint64_t drone_detected_frequency_start = 0; uint64_t drone_detected_frequency_end = 0; bool single_page_scan = false; +float vbat = 0; + // #define PRINT_DEBUG #define PRINT_PROFILE_TIME @@ -1133,7 +1135,7 @@ void setup(void) osd.displayString(14, 15, " Lora SA"); osd.displayString(2, 1, " Spectral RF Analyzer"); #endif - float vbat; + float resolution; bt_start = millis(); wf_start = millis();