digiEcoMode fix
This commit is contained in:
parent
92bc0a7667
commit
ad5a5ccf18
|
|
@ -48,7 +48,7 @@ ___________________________________________________________________*/
|
||||||
#include "A7670_utils.h"
|
#include "A7670_utils.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
String versionDate = "2024.12.30";
|
String versionDate = "2024.12.31";
|
||||||
Configuration Config;
|
Configuration Config;
|
||||||
WiFiClient espClient;
|
WiFiClient espClient;
|
||||||
#ifdef HAS_GPS
|
#ifdef HAS_GPS
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
|
#include "battery_utils.h"
|
||||||
#include "station_utils.h"
|
#include "station_utils.h"
|
||||||
#include "query_utils.h"
|
#include "query_utils.h"
|
||||||
#include "lora_utils.h"
|
#include "lora_utils.h"
|
||||||
|
|
@ -10,6 +11,8 @@ extern String versionDate;
|
||||||
extern int rssi;
|
extern int rssi;
|
||||||
extern float snr;
|
extern float snr;
|
||||||
extern int freqError;
|
extern int freqError;
|
||||||
|
extern bool shouldSleepLowVoltage;
|
||||||
|
extern bool saveNewDigiEcoModeConfig;
|
||||||
|
|
||||||
|
|
||||||
namespace QUERY_Utils {
|
namespace QUERY_Utils {
|
||||||
|
|
@ -53,12 +56,16 @@ namespace QUERY_Utils {
|
||||||
answer.concat("?WHERE on development 73!");
|
answer.concat("?WHERE on development 73!");
|
||||||
} else if (queryQuestion.indexOf("?APRSEEM") == 0 && Config.digi.ecoMode == true) { // Exit Digipeater EcoMode
|
} else if (queryQuestion.indexOf("?APRSEEM") == 0 && Config.digi.ecoMode == true) { // Exit Digipeater EcoMode
|
||||||
answer = "DigiEcoMode:Stop";
|
answer = "DigiEcoMode:Stop";
|
||||||
Config.digi.ecoMode = false;
|
Config.digi.ecoMode = false;
|
||||||
Config.display.alwaysOn = true;
|
Config.display.alwaysOn = true;
|
||||||
Config.display.timeout = 10;
|
Config.display.timeout = 10;
|
||||||
|
shouldSleepLowVoltage = true; // to make sure all packets in outputPacketBuffer are sended before restart.
|
||||||
|
saveNewDigiEcoModeConfig = true;
|
||||||
} else if (queryQuestion.indexOf("?APRSSEM") == 0 && Config.digi.ecoMode == false) { // Start Digipeater EcoMode
|
} else if (queryQuestion.indexOf("?APRSSEM") == 0 && Config.digi.ecoMode == false) { // Start Digipeater EcoMode
|
||||||
answer = "DigiEcoMode:Start";
|
answer = "DigiEcoMode:Start";
|
||||||
Config.digi.ecoMode = true;
|
Config.digi.ecoMode = true;
|
||||||
|
shouldSleepLowVoltage = true; // to make sure all packets in outputPacketBuffer are sended before restart.
|
||||||
|
saveNewDigiEcoModeConfig = true;
|
||||||
} else if (queryQuestion.indexOf("?APRSEMS") == 0) { // Digipeater EcoMode Status
|
} else if (queryQuestion.indexOf("?APRSEMS") == 0) { // Digipeater EcoMode Status
|
||||||
answer = (Config.digi.ecoMode) ? "DigiEcoMode:ON" : "DigiEcoMode:OFF";
|
answer = (Config.digi.ecoMode) ? "DigiEcoMode:ON" : "DigiEcoMode:OFF";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,8 @@ std::vector<LastHeardStation> lastHeardStations;
|
||||||
std::vector<String> outputPacketBuffer;
|
std::vector<String> outputPacketBuffer;
|
||||||
std::vector<Packet25SegBuffer> packet25SegBuffer;
|
std::vector<Packet25SegBuffer> packet25SegBuffer;
|
||||||
|
|
||||||
|
bool saveNewDigiEcoModeConfig = false;
|
||||||
|
|
||||||
|
|
||||||
namespace STATION_Utils {
|
namespace STATION_Utils {
|
||||||
|
|
||||||
|
|
@ -92,13 +94,8 @@ namespace STATION_Utils {
|
||||||
int timeToWait = 3 * 1000; // 3 segs between packet Tx and also Rx ???
|
int timeToWait = 3 * 1000; // 3 segs between packet Tx and also Rx ???
|
||||||
uint32_t lastRx = millis() - lastRxTime;
|
uint32_t lastRx = millis() - lastRxTime;
|
||||||
uint32_t lastTx = millis() - lastTxTime;
|
uint32_t lastTx = millis() - lastTxTime;
|
||||||
bool saveNewDigiEcoModeConfig = false;
|
|
||||||
if (outputPacketBuffer.size() > 0 && lastTx > timeToWait && lastRx > timeToWait) {
|
if (outputPacketBuffer.size() > 0 && lastTx > timeToWait && lastRx > timeToWait) {
|
||||||
LoRa_Utils::sendNewPacket(outputPacketBuffer[0]);
|
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());
|
outputPacketBuffer.erase(outputPacketBuffer.begin());
|
||||||
lastTxTime = millis();
|
lastTxTime = millis();
|
||||||
}
|
}
|
||||||
|
|
@ -110,7 +107,9 @@ namespace STATION_Utils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (saveNewDigiEcoModeConfig) {
|
if (saveNewDigiEcoModeConfig) {
|
||||||
|
setCpuFrequencyMhz(80);
|
||||||
Config.writeFile();
|
Config.writeFile();
|
||||||
|
delay(1000);
|
||||||
displayToggle(false);
|
displayToggle(false);
|
||||||
ESP.restart();
|
ESP.restart();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue