From 18d71769dac942d2427e6e7bfab639dcbc8e09f6 Mon Sep 17 00:00:00 2001 From: Just Call Me Koko Date: Wed, 3 Sep 2025 13:57:00 -0400 Subject: [PATCH] Adjust GPS POI log format --- esp32_marauder/MenuFunctions.cpp | 2 +- esp32_marauder/WiFiScan.cpp | 36 ++++++++++++++++++++------------ esp32_marauder/WiFiScan.h | 8 +++---- 3 files changed, 28 insertions(+), 18 deletions(-) diff --git a/esp32_marauder/MenuFunctions.cpp b/esp32_marauder/MenuFunctions.cpp index 1fc73f4..1ecd195 100644 --- a/esp32_marauder/MenuFunctions.cpp +++ b/esp32_marauder/MenuFunctions.cpp @@ -3399,7 +3399,7 @@ void MenuFunctions::RunSetup() wifi_scan_obj.currentScanMode = GPS_POI; display_obj.tft.setCursor(0, TFT_HEIGHT / 2); display_obj.clearScreen(); - if (wifi_scan_obj.RunGPSInfo(true, false)) + if (wifi_scan_obj.RunGPSInfo(true, false, true)) display_obj.showCenterText("POI Logged", TFT_HEIGHT / 2); else display_obj.showCenterText("POI Log Failed", TFT_HEIGHT / 2); diff --git a/esp32_marauder/WiFiScan.cpp b/esp32_marauder/WiFiScan.cpp index 4871e0a..74f131d 100644 --- a/esp32_marauder/WiFiScan.cpp +++ b/esp32_marauder/WiFiScan.cpp @@ -1248,7 +1248,7 @@ void WiFiScan::StopScan(uint8_t scan_mode) else if ((currentScanMode == GPS_TRACKER) || (currentScanMode == GPS_POI)) { - this->writeFooter(); + this->writeFooter(currentScanMode == GPS_POI); } @@ -2218,30 +2218,40 @@ void WiFiScan::RunGenerateSSIDs(int count) { #endif } -void WiFiScan::logPoint(String lat, String lon, float alt, String datetime) { +void WiFiScan::logPoint(String lat, String lon, float alt, String datetime, bool poi) { datetime.replace(" ", "T"); datetime += "Z"; - buffer_obj.append(" \n"); + if (!poi) + buffer_obj.append(" \n"); + else + buffer_obj.append(" \n"); buffer_obj.append(" " + String(alt, 2) + "\n"); buffer_obj.append(" \n"); - buffer_obj.append(" \n"); + if (!poi) + buffer_obj.append(" \n"); + else + buffer_obj.append(" \n"); //gpxFile.flush(); } -void WiFiScan::writeHeader() { +void WiFiScan::writeHeader(bool poi) { Serial.println("Writing header to GPX file..."); buffer_obj.append("\n"); buffer_obj.append("\n"); - buffer_obj.append(" \n"); + if (!poi) + buffer_obj.append(" \n"); buffer_obj.append(" ESP32 Track\n"); - buffer_obj.append(" \n"); + if (!poi) + buffer_obj.append(" \n"); } -void WiFiScan::writeFooter() { +void WiFiScan::writeFooter(bool poi) { Serial.println("Writing footer to GPX file...\n"); - buffer_obj.append(" \n"); - buffer_obj.append(" \n"); + if (!poi) { + buffer_obj.append(" \n"); + buffer_obj.append(" \n"); + } buffer_obj.append("\n"); } @@ -2251,18 +2261,18 @@ void WiFiScan::RunSetupGPSTracker(uint8_t scan_mode) { else if (scan_mode == GPS_POI) this->startGPX("poi"); - this->writeHeader(); + this->writeHeader(scan_mode == GPS_POI); initTime = millis(); } -bool WiFiScan::RunGPSInfo(bool tracker, bool display) { +bool WiFiScan::RunGPSInfo(bool tracker, bool display, bool poi) { bool return_val = true; #ifdef HAS_GPS String text=gps_obj.getText(); if (tracker) { if (gps_obj.getFixStatus()) { - this->logPoint(gps_obj.getLat(), gps_obj.getLon(), gps_obj.getAlt(), gps_obj.getDatetime()); + this->logPoint(gps_obj.getLat(), gps_obj.getLon(), gps_obj.getAlt(), gps_obj.getDatetime(), poi); } else return_val = false; diff --git a/esp32_marauder/WiFiScan.h b/esp32_marauder/WiFiScan.h index 0c4f7bb..d91eeef 100644 --- a/esp32_marauder/WiFiScan.h +++ b/esp32_marauder/WiFiScan.h @@ -563,8 +563,8 @@ class WiFiScan void RunPortScanAll(uint8_t scan_mode, uint16_t color); bool checkMem(); void parseBSSID(const char* bssidStr, uint8_t* bssid); - void writeHeader(); - void writeFooter(); + void writeHeader(bool poi = false); + void writeFooter(bool poi = false); public: @@ -675,8 +675,8 @@ class WiFiScan #ifdef HAS_SCREEN int8_t checkAnalyzerButtons(uint32_t currentTime); #endif - bool RunGPSInfo(bool tracker = false, bool display = true); - void logPoint(String lat, String lon, float alt, String datetime); + bool RunGPSInfo(bool tracker = false, bool display = true, bool poi = false); + void logPoint(String lat, String lon, float alt, String datetime, bool poi = false); void setMac(); void renderRawStats(); void renderPacketRate();