mirror of
https://github.com/Genaker/LoraSA.git
synced 2026-03-28 17:42:59 +01:00
@@ -137,10 +137,11 @@ def draw_histogram(stdscr, data, histogram_start_row, db_threshold, db_per_hash,
|
||||
"""
|
||||
max_height, max_width = stdscr.getmaxyx()
|
||||
|
||||
histogram_height = 20
|
||||
# Clear the histogram area
|
||||
clear_histogram_area(stdscr, histogram_start_row, 15, max_width)
|
||||
clear_histogram_area(stdscr, histogram_start_row, histogram_height, max_width)
|
||||
|
||||
baseline_row = histogram_start_row + 12 # Set the baseline for bars
|
||||
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:
|
||||
|
||||
@@ -83,7 +83,6 @@ struct Endpoint
|
||||
{
|
||||
union
|
||||
{
|
||||
|
||||
struct
|
||||
{
|
||||
uint8_t loop : 1, // self
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
@@ -75,9 +76,39 @@ build_flags =
|
||||
-DHELTEC
|
||||
-DOSD_ENABLED
|
||||
-DOSD_SIDE_BAR
|
||||
-DSAMPLES_RSSI=5
|
||||
-DARDUINO_USB_CDC_ON_BOOT=1
|
||||
-DARDUINO_USB_MODE=1
|
||||
-DOSD_DOT_DISPLAY
|
||||
-DSIDEBAR_START_ROW=3
|
||||
-DOSD_CHART_START_ROW=14
|
||||
|
||||
[env:heltec_wifi_lora_32_V3-OSD-LORA]
|
||||
platform = espressif32
|
||||
board = heltec_wifi_lora_32_V3
|
||||
framework = arduino
|
||||
upload_speed = 921600
|
||||
monitor_speed = 115200
|
||||
board_build.f_cpu = 240000000
|
||||
board_build.filesystem = littlefs
|
||||
lib_deps =
|
||||
ropg/Heltec_ESP32_LoRa_v3@^0.9.1
|
||||
bblanchon/ArduinoJson@^7.2.0
|
||||
ESP Async WebServer
|
||||
build_flags =
|
||||
-DHELTEC_POWER_BUTTON
|
||||
-DHELTEC
|
||||
-DOSD_ENABLED
|
||||
-DOSD_SIDE_BAR
|
||||
-DARDUINO_USB_CDC_ON_BOOT=1
|
||||
-DARDUINO_USB_MODE=1
|
||||
-DOSD_DOT_DISPLAY
|
||||
-DDEFAULT_RX=916
|
||||
-DDEFAULT_TX=915
|
||||
-DDEFAULT_LORA_ENABLED=true
|
||||
-DDEFAULT_LORA_TX_POWER=22
|
||||
-DDEFAULT_LORA_SF=12
|
||||
-DOSD_BAR_CHAR="\"\.\""
|
||||
|
||||
[env:heltec_wifi_lora_32_V3_433]
|
||||
platform = espressif32
|
||||
@@ -156,7 +187,7 @@ build_flags =
|
||||
-DDISPLAY_RAW_SCAN=1
|
||||
-DDEFAULT_LORA_SF=12
|
||||
|
||||
[env:lilygo-T3S3-v1-2-lr1121]
|
||||
[env:lilygo-T3S3-v1-2-lr1121-2400]
|
||||
platform = espressif32
|
||||
board = t3_s3_v1_x
|
||||
framework = arduino
|
||||
@@ -173,7 +204,6 @@ lib_deps =
|
||||
build_flags =
|
||||
-DLILYGO
|
||||
-DT3_S3_V1_2_LR1121
|
||||
-DT3_V1_3_SX1262
|
||||
-DARDUINO_LILYGO_T3S3_LR1121
|
||||
-DESP32
|
||||
-DSAMPLES_RSSI=5
|
||||
@@ -186,6 +216,34 @@ build_flags =
|
||||
-DARDUINO_LILYGO_T3_S3_V1_X
|
||||
-DARDUINO_USB_MODE=1
|
||||
|
||||
[env:lilygo-T3S3-v1-2-lr1121-900]
|
||||
platform = espressif32
|
||||
board = t3_s3_v1_x
|
||||
framework = arduino
|
||||
upload_speed = 921600
|
||||
monitor_speed = 115200
|
||||
board_build.f_cpu = 240000000
|
||||
board_build.filesystem = littlefs
|
||||
lib_deps =
|
||||
ropg/Heltec_ESP32_LoRa_v3@^0.9.1
|
||||
RadioLib
|
||||
U8g2
|
||||
XPowersLib
|
||||
ESP Async WebServer
|
||||
build_flags =
|
||||
-DLILYGO
|
||||
-DT3_S3_V1_2_LR1121
|
||||
-DARDUINO_LILYGO_T3S3_LR1121
|
||||
-DESP32
|
||||
-DSAMPLES_RSSI=5
|
||||
-DUSING_LR1121
|
||||
-DFREQ_BEGIN=860
|
||||
-DFREQ_END=900
|
||||
-DFREQ_RX=2440
|
||||
-DARDUINO_ARCH_ESP32
|
||||
-DARDUINO_USB_CDC_ON_BOOT=1
|
||||
-DARDUINO_LILYGO_T3_S3_V1_X
|
||||
-DARDUINO_USB_MODE=1
|
||||
|
||||
[env:lilygo-T3S3-v1-2-sx1280]
|
||||
platform = espressif32
|
||||
|
||||
26
src/main.cpp
26
src/main.cpp
@@ -97,8 +97,15 @@ unsigned int osdCyclesCount = 0;
|
||||
#define OSD_MAX_CLEAR_CYCLES 10
|
||||
#ifdef OSD_ENABLED
|
||||
#include "DFRobot_OSD.h"
|
||||
#ifndef SIDEBAR_START_ROW
|
||||
#define SIDEBAR_START_ROW 1
|
||||
#endif
|
||||
#ifndef SIDEBAR_END_ROW
|
||||
#define SIDEBAR_END_ROW 10
|
||||
#endif
|
||||
#ifndef OSD_CHART_START_ROW
|
||||
#define OSD_CHART_START_ROW 14
|
||||
#endif
|
||||
// Set SIDEBAR_POSITION to 1 to right side
|
||||
#define SIDEBAR_POSITION OSD_WIDTH - 7
|
||||
// #define SIDEBAR_ACCENT_ONLY 1
|
||||
@@ -238,6 +245,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
|
||||
@@ -331,14 +340,18 @@ void osdPrintSignalLevelChart(int col, int signal_value)
|
||||
{
|
||||
if (i < (drone_detection_level - signal_value) / dbPerChar)
|
||||
{
|
||||
osd.displayString(15 - i, col, OSD_BAR_CHAR);
|
||||
if (i == 0)
|
||||
{
|
||||
osd.displayString(OSD_CHART_START_ROW - i, col, ":");
|
||||
}
|
||||
osd.displayString(OSD_CHART_START_ROW - i, col, OSD_BAR_CHAR);
|
||||
// osd.displayString(5, col, "s:" + String(signal_value));
|
||||
// osd.displayString(
|
||||
// 6, col, String((drone_detection_level - signal_value) / dbPerChar));
|
||||
}
|
||||
else
|
||||
{
|
||||
osd.displayString(15 - i, col, " ");
|
||||
osd.displayString(OSD_CHART_START_ROW - i, col, " ");
|
||||
// osd.displayString(15 - i - 1, col, " ");
|
||||
// break;
|
||||
}
|
||||
@@ -349,7 +362,7 @@ void osdPrintSignalLevelChart(int col, int signal_value)
|
||||
for (int i = 0; i <= barSize; i++)
|
||||
{
|
||||
// Clear bar
|
||||
osd.displayString(15 - i, col, " ");
|
||||
osd.displayString(OSD_CHART_START_ROW - i, col, " ");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -569,6 +582,7 @@ float getRSSI(void *param)
|
||||
// Try getRssiInst
|
||||
float rssi;
|
||||
radio.getRssiInst(&rssi);
|
||||
Serial.println("RSSI: " + String(rssi));
|
||||
// pass the replies
|
||||
return rssi;
|
||||
#else
|
||||
@@ -611,7 +625,7 @@ int16_t initForScan(float freq)
|
||||
#if defined(USING_SX1280PA)
|
||||
state = radio.beginGFSK(freq);
|
||||
#elif defined(USING_LR1121)
|
||||
state = radio.beginGFSK(freq, 4.8F, 5.0F, 156.2F, 10, 16U, 1.7F);
|
||||
state = radio.beginGFSK(freq, 4.8F, 5.0F, 156.2F, 10, 16U, 1.6F);
|
||||
#else
|
||||
state = radio.beginFSK(freq);
|
||||
#endif
|
||||
@@ -1133,7 +1147,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();
|
||||
@@ -1586,7 +1600,6 @@ std::unordered_map<int, int16_t> findMaxRssi(int16_t *rssis, uint32_t *freqs_khz
|
||||
|
||||
void dumpHashMap(const std::unordered_map<unsigned int, RSSIData> &map)
|
||||
{
|
||||
|
||||
for (const auto &entry : map)
|
||||
{
|
||||
Serial.println("Key: " + String(entry.first) +
|
||||
@@ -1663,7 +1676,6 @@ void display_raw_scan(ScanTaskResult &dump)
|
||||
if (ly > 55)
|
||||
{
|
||||
ly = 0;
|
||||
|
||||
// go to next column
|
||||
lx = lx + 45;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user