AutoConnect library doesn't allow to perform any other operation

spike32
Posts: 2
Joined: Fri Oct 22, 2021 10:30 am

AutoConnect library doesn't allow to perform any other operation

Postby spike32 » Fri Oct 22, 2021 10:37 am

Hello everyone! I need to build an application in which my ESP32 uses the AutoConnect library (https://github.com/Hieromon/AutoConnect) for creating a captive portal and meanwhile performing other operations. The thing is that when I start the captive portal it doesn't perform any other operation. Here's reported some code.

Code: Select all

#include <WiFi.h>
#include <WebServer.h> 
#include <AutoConnect.h>

WebServer Server;
AutoConnect      Portal(Server);

void rootPage() {
  char content[] = "Hello, world";
  Server.send(200, "text/plain", content);
}

void setup() {
  delay(1000);
  Serial.begin(115200);
  Serial.println();

  Server.on("/", rootPage);
  if (Portal.begin()) {
    Serial.println("WiFi connected: " + WiFi.localIP().toString());
  }
  Serial.println("Print after Portal.begin()");
}

void loop() {
    Portal.handleClient();
    Serial.println("Perform an operation...");
    delay(2000);
}
For instance here, in the loop() method I can't see any message printed onto my serial monitor, as well as the print after Portal.begin() is being called seems to not be executed. How can I perform more actions while the captive portal is being initialized and started?

edmoreyra
Posts: 1
Joined: Wed Aug 24, 2022 10:44 pm

Re: AutoConnect library doesn't allow to perform any other operation

Postby edmoreyra » Wed Aug 24, 2022 10:47 pm

pre-include
WiFiManager wm;
wm.setConfigPortalBlocking(false);
wm.setConfigPortalTimeout(180); //
bool res;
res = wm.autoConnect("AutoConnectAP"); // anonymous ap

Who is online

Users browsing this forum: Majestic-12 [Bot] and 72 guests