From 7288d286b8673cf9efd1aa3f25690026f2f943fe Mon Sep 17 00:00:00 2001 From: richonguzman Date: Tue, 7 May 2024 19:36:58 -0400 Subject: [PATCH] wxRequest Time and Status --- src/LoRa_APRS_Tracker.cpp | 7 ++++++- src/configuration.cpp | 10 +++++----- src/configuration.h | 2 +- src/msg_utils.cpp | 5 +++++ src/station_utils.cpp | 12 +++++++++--- 5 files changed, 26 insertions(+), 10 deletions(-) diff --git a/src/LoRa_APRS_Tracker.cpp b/src/LoRa_APRS_Tracker.cpp index 4e1dbb7..ce18976 100644 --- a/src/LoRa_APRS_Tracker.cpp +++ b/src/LoRa_APRS_Tracker.cpp @@ -133,6 +133,8 @@ String winlinkAlias = ""; String winlinkAliasComplete = ""; bool winlinkCommentState = false; +bool wxRequestStatus = false; +uint32_t wxRequestTime = 0; uint32_t batteryMeasurmentTime = 0; APRSPacket lastReceivedPacket; @@ -192,7 +194,10 @@ void setup() { void loop() { currentBeacon = &Config.beacons[myBeaconsIndex]; if (statusState) { - Config.validateConfigFile(currentBeacon->callsign); + if (Config.validateConfigFile(currentBeacon->callsign)) { + KEYBOARD_Utils::rightArrow(); + currentBeacon = &Config.beacons[myBeaconsIndex]; + } miceActive = Config.validateMicE(currentBeacon->micE); } STATION_Utils::checkSmartBeaconValue(); diff --git a/src/configuration.cpp b/src/configuration.cpp index 74594aa..2388d54 100644 --- a/src/configuration.cpp +++ b/src/configuration.cpp @@ -106,13 +106,13 @@ void Configuration::readFile(fs::FS &fs, const char *fileName) { configFile.close(); } -void Configuration::validateConfigFile(String currentBeaconCallsign) { +bool Configuration::validateConfigFile(String currentBeaconCallsign) { if (currentBeaconCallsign.indexOf("NOCALL") != -1) { logger.log(logging::LoggerLevel::LOGGER_LEVEL_ERROR, "Config", "Change all your callsigns in 'data/tracker_config.json' and upload it via 'Upload File System image'"); - show_display("ERROR", "Change all callsigns!", "'tracker_config.json'", "upload it via --> ", "'Upload File System image'"); - while (true) { - delay(1000); - } + show_display("ERROR", "Change callsigns!", "'tracker_config.json'", "upload it via --> ", "'Upload File System image'"); + return true; + } else { + return false; } } diff --git a/src/configuration.h b/src/configuration.h index b4f8b19..87e456d 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -105,7 +105,7 @@ public: bool disableGPS; Configuration(); - void validateConfigFile(String currentBeaconCallsign); + bool validateConfigFile(String currentBeaconCallsign); bool validateMicE(String currentBeaconMicE); private: diff --git a/src/msg_utils.cpp b/src/msg_utils.cpp index f44e469..795ce80 100644 --- a/src/msg_utils.cpp +++ b/src/msg_utils.cpp @@ -38,6 +38,9 @@ extern uint32_t lastTxTime; extern uint8_t winlinkStatus; +extern bool wxRequestStatus; +extern uint32_t wxRequestTime; + extern APRSPacket lastReceivedPacket; extern uint32_t lastMsgRxTime; extern uint32_t lastRetryTime; @@ -235,6 +238,8 @@ namespace MSG_Utils { show_display("<>", 500); } else if (station.indexOf("CA2RXU-15") == 0 && textMessage.indexOf("wrl") == 0) { show_display("","", "--- Sending Query ---", 1000); + wxRequestTime = millis(); + wxRequestStatus = true; } else { if (station == "WLNK-1") { show_display("WINLINK Tx", "", newPacket, 1000); diff --git a/src/station_utils.cpp b/src/station_utils.cpp index c999953..d957cab 100644 --- a/src/station_utils.cpp +++ b/src/station_utils.cpp @@ -43,6 +43,9 @@ extern bool smartBeaconValue; extern uint8_t winlinkStatus; extern bool winlinkCommentState; +extern bool wxRequestStatus; +extern uint32_t wxRequestTime; + String firstNearTracker; String secondNearTracker; String thirdNearTracker; @@ -370,10 +373,13 @@ namespace STATION_Utils { } void checkSmartBeaconValue() { - if (winlinkStatus != 0) { - smartBeaconValue = false; - } else { + if (wxRequestStatus && (millis() - wxRequestTime) > 20000) { + wxRequestStatus = false; + } + if(winlinkStatus == 0 && !wxRequestStatus) { smartBeaconValue = currentBeacon->smartBeaconState; + } else { + smartBeaconValue = false; } }