From fba9460216e876e13243d4262e2977290097bda7 Mon Sep 17 00:00:00 2001 From: richonguzman Date: Tue, 5 Sep 2023 18:33:42 -0300 Subject: [PATCH] basic Tracker Mode added --- data/tracker_config.json | 1 + src/LoRa_APRS_Tracker.cpp | 15 +++++++++------ src/configuration.cpp | 1 + src/configuration.h | 1 + src/msg_utils.cpp | 36 +++++++++++++++++++++--------------- 5 files changed, 33 insertions(+), 21 deletions(-) diff --git a/data/tracker_config.json b/data/tracker_config.json index 3d12206..8ca3885 100644 --- a/data/tracker_config.json +++ b/data/tracker_config.json @@ -60,6 +60,7 @@ "power": 20 }, "other": { + "simplifiedTrackerMode": false, "showSymbolOnScreen": true, "sendCommentAfterXBeacons": 10, "displayEcoMode": false, diff --git a/src/LoRa_APRS_Tracker.cpp b/src/LoRa_APRS_Tracker.cpp index 77d9035..cd41e85 100644 --- a/src/LoRa_APRS_Tracker.cpp +++ b/src/LoRa_APRS_Tracker.cpp @@ -29,7 +29,7 @@ TinyGPSPlus gps; BluetoothSerial SerialBT; OneButton userButton = OneButton(BUTTON_PIN, true, true); -String versionDate = "2023.08.26"; +String versionDate = "2023.09.05"; int myBeaconsIndex = 0; int myBeaconsSize = Config.beacons.size(); @@ -93,9 +93,11 @@ void setup() { logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "Main", "WiFi controller stopped"); BLUETOOTH_Utils::setup(); - userButton.attachClick(BUTTON_Utils::singlePress); - userButton.attachLongPressStart(BUTTON_Utils::longPress); - userButton.attachDoubleClick(BUTTON_Utils::doublePress); + if (!Config.simplifiedTrackerMode) { + userButton.attachClick(BUTTON_Utils::singlePress); + userButton.attachLongPressStart(BUTTON_Utils::longPress); + userButton.attachDoubleClick(BUTTON_Utils::doublePress); + } powerManagement.lowerCpuFrequency(); logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "Main", "Smart Beacon is: %s", utils::getSmartBeaconState()); @@ -104,14 +106,15 @@ void setup() { } void loop() { - //Serial.println(BME_Utils::readDataSensor()); currentBeacon = &Config.beacons[myBeaconsIndex]; if (statusState) { Config.validateConfigFile(currentBeacon->callsign); } powerManagement.batteryManager(); - userButton.tick(); + if (!Config.simplifiedTrackerMode) { + userButton.tick(); + } utils::checkDisplayEcoMode(); GPS_Utils::getData(); diff --git a/src/configuration.cpp b/src/configuration.cpp index c1e5bb6..2fdb9a6 100644 --- a/src/configuration.cpp +++ b/src/configuration.cpp @@ -59,6 +59,7 @@ void Configuration::readFile(fs::FS &fs, const char *fileName) { bme.active = data["bme"]["active"].as(); + simplifiedTrackerMode = data["other"]["simplifiedTrackerMode"].as(); showSymbolOnScreen = data["other"]["showSymbolOnScreen"].as(); sendCommentAfterXBeacons = data["other"]["sendCommentAfterXBeacons"].as(); displayEcoMode = data["other"]["displayEcoMode"].as(); diff --git a/src/configuration.h b/src/configuration.h index 0bff4ad..e958ebc 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -53,6 +53,7 @@ public: Ptt ptt; BME bme; + bool simplifiedTrackerMode; bool showSymbolOnScreen; int sendCommentAfterXBeacons; bool displayEcoMode; diff --git a/src/msg_utils.cpp b/src/msg_utils.cpp index 6603816..c87da96 100644 --- a/src/msg_utils.cpp +++ b/src/msg_utils.cpp @@ -189,27 +189,33 @@ namespace MSG_Utils { menuTime = millis(); } else { show_display("< MSG Rx >", "From --> " + Sender, "", receivedMessage , 3000); - saveNewMessage("APRS", Sender, receivedMessage); + if (!Config.simplifiedTrackerMode) { + saveNewMessage("APRS", Sender, receivedMessage); + } } } else { show_display("< MSG >", "From --> " + Sender, "", receivedMessage , 3000); - saveNewMessage("APRS", Sender, receivedMessage); + if (!Config.simplifiedTrackerMode) { + saveNewMessage("APRS", Sender, receivedMessage); + } } } } else if (packetReceived.indexOf(":!") > 10 || packetReceived.indexOf(":=") > 10 ) { // packetReceived has APRS - GPS info - lastHeardTracker = Sender; // eliminar? - int encodedBytePosition = 0; - if (packetReceived.indexOf(":!") > 10) { - encodedBytePosition = packetReceived.indexOf(":!") + 14; - } - if (packetReceived.indexOf(":=") > 10) { - encodedBytePosition = packetReceived.indexOf(":=") + 14; - } - if (encodedBytePosition != 0) { - if (String(packetReceived[encodedBytePosition]) == "G" || String(packetReceived[encodedBytePosition]) == "Q") { - GPS_Utils::decodeEncodedGPS(packetReceived, Sender); - } else { - GPS_Utils::getReceivedGPS(packetReceived, Sender); + lastHeardTracker = Sender; + if (!Config.simplifiedTrackerMode) { + int encodedBytePosition = 0; + if (packetReceived.indexOf(":!") > 10) { + encodedBytePosition = packetReceived.indexOf(":!") + 14; + } + if (packetReceived.indexOf(":=") > 10) { + encodedBytePosition = packetReceived.indexOf(":=") + 14; + } + if (encodedBytePosition != 0) { + if (String(packetReceived[encodedBytePosition]) == "G" || String(packetReceived[encodedBytePosition]) == "Q") { + GPS_Utils::decodeEncodedGPS(packetReceived, Sender); + } else { + GPS_Utils::getReceivedGPS(packetReceived, Sender); + } } } }