diff --git a/platformio.ini b/platformio.ini index bb897d5..f7b327f 100644 --- a/platformio.ini +++ b/platformio.ini @@ -157,6 +157,7 @@ build_flags = -DARDUINO_USB_CDC_ON_BOOT=1 -DARDUINO_LILYGO_T3_S3_V1_X -DARDUINO_USB_MODE=1 + -DBANDWIDTH=4.8 [env:lilygo-T3-v1-6-xs1276] platform = espressif32 @@ -259,6 +260,8 @@ build_flags = -DRADIOLIB_EXCLUDE_SX127X=true -DRADIOLIB_EXCLUDE_SX128X=true -DROTATION=1 # 1 = default; 3 = inverted + -DBANDWIDTH=156.2 + lib_deps = SPI Wire diff --git a/src/main.cpp b/src/main.cpp index c2ad7ea..8ae8a1e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1736,7 +1736,7 @@ void loop(void) scanBT(); bt_start = millis(); } -#endif #endif sideBarCol = SIDEBAR_START_COL; +#endif } diff --git a/tft_src/main.cpp b/tft_src/main.cpp index 340f88d..2c1a9fb 100644 --- a/tft_src/main.cpp +++ b/tft_src/main.cpp @@ -16,9 +16,14 @@ // #include "global_config.h" #include "images.h" // #include "ui.h" -#include "comms.h" #include #include + +#ifdef SERIAL_OUT +#include +#include +#endif + #include struct Entry @@ -96,7 +101,6 @@ constexpr bool DRAW_DETECTION_TICKS = true; #define FREQ_BEGIN 150 #define FREQ_END 950 -#define BANDWIDTH 467.0 #define MHZ_PX (float)((float)(FREQ_END - FREQ_BEGIN) / DISPLAY_WIDTH) #define DEFAULT_DRONE_DETECTION_LEVEL -90 #define DRONE_LEGEND 1; @@ -255,6 +259,7 @@ void setBrightness() ledcWrite(st7789_brightness_channel, current_brightness); } +#ifdef SERIAL_OUT struct frequency_scan_result { uint64_t begin; @@ -306,6 +311,7 @@ void dumpToCommsTask() m.payload.dump = frequency_scan_result.dump; Comms0->send(m); } +#endif #define battery_w 13 #define battery_h 13 @@ -480,7 +486,10 @@ constexpr unsigned int STATUS_BAR_HEIGHT = 5; void loop() { +#ifdef SERIAL_OUT checkComms(); +#endif + // Serial.println("Loop"); if (screen_update_loop_counter == 0) { @@ -574,6 +583,7 @@ void loop() st7789->drawPixel(x1, rssiToPix(rssi2) - 3, rssiToColor(abs(rssi2))); st7789->drawPixel(x1, rssiToPix(rssi2) - 4, rssiToColor(abs(rssi2))); +#ifdef SERIAL_OUT frequency_scan_result.dump.freqs_khz[frequency_scan_result.dump.sz] = (int)freq * 1000; @@ -584,6 +594,7 @@ void loop() Serial.println("frequency_scan_result overflow 10000"); } +#endif if (true /*draw full line*/) { st7789->drawFastVLine(x1, rssiToPix(rssi2), lower_level - rssiToPix(rssi2), @@ -798,10 +809,13 @@ void loop() display_scan_i_end = 0; } +#ifdef SERIAL_OUT + // Dump to Serial dumpToCommsTask(); - fr = FREQ_BEGIN; frequency_scan_result.dump.sz = 0; +#endif + fr = FREQ_BEGIN; rssi_single_start = 0; rssi_single_end = 0; x1 = 0; @@ -823,15 +837,19 @@ void loop() #endif } +#ifdef SERIAL_OUT Config config; +#endif void setup() { uint32_t *f = new uint32_t[10000]; int16_t *r = new int16_t[10000]; +#ifdef SERIAL_OUT frequency_scan_result.dump.freqs_khz = f; frequency_scan_result.dump.rssis = r; +#endif for (int i = 0; i < MAX_MHZ_INTERVAL; i++) { @@ -879,6 +897,9 @@ void setup() Serial.println(state); } heltec_setup(); + +#ifdef SERIAL_OUT + config = Config::init(); bool comms_initialized = Comms::initComms(config); if (comms_initialized) @@ -889,6 +910,8 @@ void setup() { Serial.println("Comms did not initialize"); } +#endif + delay(2000); st7789->fillScreen(ST7789_BLACK); }