Skip to content
This repository was archived by the owner on Feb 4, 2023. It is now read-only.

Commit eed2745

Browse files
authored
Fix bug
1 parent c9ad8ec commit eed2745

File tree

1 file changed

+31
-5
lines changed

1 file changed

+31
-5
lines changed

examples/AsyncHTTPRequest_ESP_WiFiManager/AsyncHTTPRequest_ESP_WiFiManager.ino

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -253,24 +253,26 @@ bool initialConfig = false;
253253
IPAddress dns1IP = gatewayIP;
254254
IPAddress dns2IP = IPAddress(8, 8, 8, 8);
255255

256+
#define USE_CUSTOM_AP_IP false
257+
256258
IPAddress APStaticIP = IPAddress(192, 168, 100, 1);
257259
IPAddress APStaticGW = IPAddress(192, 168, 100, 1);
258260
IPAddress APStaticSN = IPAddress(255, 255, 255, 0);
259261

260262
#include <ESPAsync_WiFiManager.h> //https://github.com/khoih-prog/ESPAsync_WiFiManager
261263

262264
// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
263-
#include <ESPAsync_WiFiManager-Impl.h> //https://github.com/khoih-prog/ESPAsync_WiFiManager
265+
//#include <ESPAsync_WiFiManager-Impl.h> //https://github.com/khoih-prog/ESPAsync_WiFiManager
264266

265267
#define HTTP_PORT 80
266268

267-
AsyncWebServer webServer(HTTP_PORT);
268-
DNSServer dnsServer;
269+
//AsyncWebServer webServer(HTTP_PORT);
270+
//DNSServer dnsServer;
269271

270272
#include <AsyncHTTPRequest_Generic.h> // https://github.com/khoih-prog/AsyncHTTPRequest_Generic
271273

272274
// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
273-
#include <AsyncHTTPRequest_Impl_Generic.h> // https://github.com/khoih-prog/AsyncHTTPRequest_Generic
275+
//#include <AsyncHTTPRequest_Impl_Generic.h> // https://github.com/khoih-prog/AsyncHTTPRequest_Generic
274276

275277
#include <Ticker.h>
276278

@@ -624,17 +626,28 @@ void setup()
624626
// Use this to default DHCP hostname to ESP8266-XXXXXX or ESP32-XXXXXX
625627
//ESPAsync_WiFiManager ESPAsync_wifiManager(&webServer, &dnsServer);
626628
// Use this to personalize DHCP hostname (RFC952 conformed)
629+
AsyncWebServer webServer(HTTP_PORT);
630+
631+
//ESPAsync_WiFiManager ESPAsync_wifiManager(&webServer, &dnsServer, "AutoConnectAP");
632+
#if ( USING_ESP32_S2 || USING_ESP32_C3 )
633+
ESPAsync_WiFiManager ESPAsync_wifiManager(&webServer, NULL, "AutoConnectAP");
634+
#else
635+
DNSServer dnsServer;
636+
627637
ESPAsync_WiFiManager ESPAsync_wifiManager(&webServer, &dnsServer, "AutoConnectAP");
638+
#endif
628639

629-
ESPAsync_wifiManager.setDebugOutput(true);
640+
//ESPAsync_wifiManager.setDebugOutput(true);
630641

631642
//reset settings - for testing
632643
//ESPAsync_wifiManager.resetSettings();
633644

645+
#if USE_CUSTOM_AP_IP
634646
//set custom ip for portal
635647
// New in v1.4.0
636648
ESPAsync_wifiManager.setAPStaticIPConfig(WM_AP_IPconfig);
637649
//////
650+
#endif
638651

639652
ESPAsync_wifiManager.setMinimumSignalQuality(-1);
640653

@@ -689,6 +702,19 @@ void setup()
689702

690703
initialConfig = true;
691704

705+
Serial.print(F("Starting configuration portal @ "));
706+
707+
#if USE_CUSTOM_AP_IP
708+
Serial.print(APStaticIP);
709+
#else
710+
Serial.print(F("192.168.4.1"));
711+
#endif
712+
713+
Serial.print(F(", SSID = "));
714+
Serial.print(AP_SSID);
715+
Serial.print(F(", PASS = "));
716+
Serial.println(AP_PASS);
717+
692718
// Starts an access point
693719
//if (!ESPAsync_wifiManager.startConfigPortal((const char *) ssid.c_str(), password))
694720
if ( !ESPAsync_wifiManager.startConfigPortal(AP_SSID.c_str(), AP_PASS.c_str()) )

0 commit comments

Comments
 (0)