WiFiAP stops after 1min no cliente connected

This commit is contained in:
richonguzman 2024-10-10 09:58:00 -03:00
parent 3317e33346
commit 8cbc232fd9
5 changed files with 25 additions and 7 deletions

View File

@ -53,6 +53,7 @@ ____________________________________________________
____________________________________________________
## Timeline (Versions):
- 2024.10.10 Configuration WiFiAP stops after 1 minute of no-client connected.
- 2024.10.09 WEB INSTALLER/FLASHER.
- 2024.10.07 Battery Monitor process added (Voltage Sleep to protect Battery).
- 2024.09.17 Battery Voltage now as Encoded Telemetry in GPS Beacon.

View File

@ -49,7 +49,7 @@ TinyGPSPlus gps;
OneButton userButton = OneButton(BUTTON_PIN, true, true);
#endif
String versionDate = "2024.10.07";
String versionDate = "2024.10.10";
uint8_t myBeaconsIndex = 0;
int myBeaconsSize = Config.beacons.size();

View File

@ -486,7 +486,7 @@ namespace KEYBOARD_Utils {
displayShow("", "", " STARTING WiFi AP", 2000);
Config.wifiAP.active = true;
Config.writeFile();
ESP.restart();
ESP.restart();
}
}

View File

@ -195,16 +195,19 @@ namespace STATION_Utils {
String tempPacket = basePacket;
tempPacket += "EQNS.0,0.01,0";
displayShow("<<< TX >>>", "Telemetry Packet:", "Equation Coefficients",100);
LoRa_Utils::sendNewPacket(tempPacket);
delay(3000);
tempPacket = basePacket;
tempPacket += "UNIT.VDC";
displayShow("<<< TX >>>", "Telemetry Packet:", "Unit/Label",100);
LoRa_Utils::sendNewPacket(tempPacket);
delay(3000);
tempPacket = basePacket;
tempPacket += "PARM.V_Batt";
displayShow("<<< TX >>>", "Telemetry Packet:", "Parameter Name",100);
LoRa_Utils::sendNewPacket(tempPacket);
delay(3000);
sendStartTelemetry = false;

View File

@ -5,10 +5,10 @@
#include "display.h"
extern Configuration Config;
extern logging::Logger logger;
extern Configuration Config;
extern logging::Logger logger;
//uint32_t WiFiAutoAPTime = millis();
uint32_t noClientsTime = 0;
namespace WIFI_Utils {
@ -17,7 +17,6 @@ namespace WIFI_Utils {
WiFi.mode(WIFI_MODE_NULL);
WiFi.mode(WIFI_AP);
WiFi.softAP("LoRaTracker-AP", Config.wifiAP.password);
//WiFiAutoAPTime = millis();
}
void checkIfWiFiAP() {
@ -26,7 +25,22 @@ namespace WIFI_Utils {
logger.log(logging::LoggerLevel::LOGGER_LEVEL_WARN, "Main", "WebConfiguration Started!");
startAutoAP();
WEB_Utils::setup();
while (true) {}
while (true) {
if (WiFi.softAPgetStationNum() > 0) {
noClientsTime = 0;
} else {
if (noClientsTime == 0) {
noClientsTime = millis();
} else if ((millis() - noClientsTime) > 60 * 1000) {
logger.log(logging::LoggerLevel::LOGGER_LEVEL_WARN, "Main", "WebConfiguration Stopped!");
displayShow("", "", " STOPPING WiFi AP", 2000);
Config.wifiAP.active = false;
Config.writeFile();
WiFi.softAPdisconnect(true);
ESP.restart();
}
}
}
} else {
WiFi.mode(WIFI_OFF);
logger.log(logging::LoggerLevel::LOGGER_LEVEL_DEBUG, "Main", "WiFi controller stopped");