diff --git a/src/aprs_is_utils.cpp b/src/aprs_is_utils.cpp index e5ce1ee..5a52507 100644 --- a/src/aprs_is_utils.cpp +++ b/src/aprs_is_utils.cpp @@ -138,7 +138,8 @@ namespace APRS_IS_Utils { //Serial.println(ackMessage); String addToBuffer = Config.callsign; - addToBuffer += ">APLRG1,RFONLY"; + addToBuffer += ">APLRG1"; + if (!thirdParty) addToBuffer += ",RFONLY"; if (Config.beacon.path != "") { addToBuffer += ","; addToBuffer += Config.beacon.path; diff --git a/src/query_utils.cpp b/src/query_utils.cpp index 8471455..6ba02ca 100644 --- a/src/query_utils.cpp +++ b/src/query_utils.cpp @@ -3,6 +3,7 @@ #include "query_utils.h" #include "lora_utils.h" + extern Configuration Config; extern std::vector lastHeardStations; extern String versionDate; @@ -50,6 +51,16 @@ namespace QUERY_Utils { // agregar callsign para completar donde esta X callsign --> posicion Serial.println("estaciones escuchadas directo (ultimos 30 min)"); answer.concat("?WHERE on development 73!"); + } else if (queryQuestion.indexOf("?APRSEEM") == 0) { // Exit DigiRepeater EcoMode + answer = "DigiEcoMode:Stop"; + Config.digi.ecoMode = false; + Config.display.alwaysOn = true; + Config.display.timeout = 10; + } else if (queryQuestion.indexOf("?APRSSEM") == 0) { // Start DigiRepeater EcoMode + answer = "DigiEcoMode:Start"; + Config.digi.ecoMode = true; + } else if (queryQuestion.indexOf("?APRSEMS") == 0) { // DigiRepeater EcoMode Status + answer = (Config.digi.ecoMode) ? "DigiEcoMode:ON" : "DigiEcoMode:OFF"; } String queryAnswer = Config.callsign; diff --git a/src/station_utils.cpp b/src/station_utils.cpp index 4e2f545..3eebc28 100644 --- a/src/station_utils.cpp +++ b/src/station_utils.cpp @@ -3,6 +3,7 @@ #include "aprs_is_utils.h" #include "configuration.h" #include "lora_utils.h" +#include "display.h" #include "utils.h" #include @@ -100,11 +101,16 @@ namespace STATION_Utils { } void processOutputPacketBuffer() { - int timeToWait = 3 * 1000; // 3 segs between packet Tx and also Rx ??? - uint32_t lastRx = millis() - lastRxTime; - uint32_t lastTx = millis() - lastTxTime; + int timeToWait = 3 * 1000; // 3 segs between packet Tx and also Rx ??? + uint32_t lastRx = millis() - lastRxTime; + uint32_t lastTx = millis() - lastTxTime; + bool saveNewDigiEcoModeConfig = false; if (outputPacketBuffer.size() > 0 && lastTx > timeToWait && lastRx > timeToWait) { LoRa_Utils::sendNewPacket(outputPacketBuffer[0]); + if (outputPacketBuffer[0].indexOf("DigiEcoMode:Start") != -1 || outputPacketBuffer[0].indexOf("DigiEcoMode:Stop") != -1) { + saveNewDigiEcoModeConfig = true; + shouldSleepLowVoltage = true; // to make sure all packets in outputPacketBuffer are sended before restart. + } outputPacketBuffer.erase(outputPacketBuffer.begin()); lastTxTime = millis(); } @@ -115,6 +121,11 @@ namespace STATION_Utils { delay(4000); } } + if (saveNewDigiEcoModeConfig) { + Config.writeFile(); + displayToggle(false); + ESP.restart(); + } } void addToOutputPacketBuffer(const String& packet) { diff --git a/src/utils.cpp b/src/utils.cpp index 8c39665..bfc6953 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -87,6 +87,7 @@ namespace Utils { digitalWrite(INTERNAL_LED_PIN,HIGH); #endif Serial.println("\nStarting Station: " + Config.callsign + " Version: " + versionDate); + Serial.println((Config.digi.ecoMode) ? "(DigiEcoMode: ON)" : "(DigiEcoMode: OFF)"); displayShow(" LoRa APRS", "", "", " ( iGATE & DIGI )", "", "" , " CA2RXU " + versionDate, 4000); #ifdef INTERNAL_LED_PIN digitalWrite(INTERNAL_LED_PIN,LOW);