Use SoftAP from network manager

This commit is contained in:
Petr Kracik
2026-03-05 23:25:04 +01:00
committed by Petr Kracík
parent ec28dc0978
commit 413318e94b
3 changed files with 1 additions and 22 deletions

View File

@@ -27,7 +27,6 @@ namespace WIFI_Utils {
void checkWiFi();
void startAutoAP();
void startWiFi();
void checkAutoAPTimeout();
void setup();
}

View File

@@ -106,6 +106,7 @@ void setup() {
Serial.begin(115200);
networkManager = new NetworkManager();
networkManager->setup();
networkManager->setAPTimeout(Config.wifiAutoAP.timeout * 60 * 1000); // Convert minutes to milliseconds
POWER_Utils::setup();
Utils::setupDisplay();
LoRa_Utils::setup();
@@ -137,7 +138,6 @@ void loop() {
Utils::checkSleepByLowBatteryVoltage(1);
SLEEP_Utils::startSleeping();
} else {
WIFI_Utils::checkAutoAPTimeout();
networkManager->loop();
if (isUpdatingOTA) {

View File

@@ -34,7 +34,6 @@ extern WiFi_AP *currentWiFi;
extern bool backupDigiMode;
extern uint32_t lastServerCheck;
uint32_t WiFiAutoAPTime = millis();
uint8_t wifiCounter = 0;
uint32_t lastBackupDigiTime = millis();
uint32_t lastWiFiCheck = 0;
@@ -83,7 +82,6 @@ namespace WIFI_Utils {
void startAutoAP() {
displayShow("", " Starting Auto AP", " Please connect to it " , " loading ...", 1000);
networkManager->setupAP(Config.callsign + "-AP", Config.wifiAutoAP.password);
WiFiAutoAPTime = millis();
}
void startWiFi() {
@@ -127,24 +125,6 @@ namespace WIFI_Utils {
}
}
void checkAutoAPTimeout() {
if (networkManager->isWifiAPActive() && Config.wifiAutoAP.timeout > 0) {
if (WiFi.softAPgetStationNum() > 0) {
WiFiAutoAPTime = 0;
} else {
if (WiFiAutoAPTime == 0) {
WiFiAutoAPTime = millis();
} else if ((millis() - WiFiAutoAPTime) > Config.wifiAutoAP.timeout * 60 * 1000) {
Serial.println("Stopping auto AP");
networkManager->disableAP();
Serial.println("Auto AP stopped (timeout)");
}
}
}
}
void setup() {
if (Config.digi.ecoMode == 0) startWiFi();
btStop();