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

Commit 57eba05

Browse files
committed
Merge branch 'main' into CaptivePortal
2 parents 96c36bf + 6e36702 commit 57eba05

File tree

3 files changed

+22
-4
lines changed

3 files changed

+22
-4
lines changed

examples/ESPAsync_WiFi/defines.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222

2323
#define _ESP_WM_LITE_LOGLEVEL_ 2
2424

25+
// use builtin LED to show configuration mode
26+
#define USE_LED_BUILTIN true
27+
2528
#define USING_MRD true
2629

2730
#if USING_MRD

examples/ESPAsync_WiFi_MQTT/defines.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222

2323
#define _ESP_WM_LITE_LOGLEVEL_ 2
2424

25+
// use builtin LED to show configuration mode
26+
#define USE_LED_BUILTIN true
27+
2528
#define USING_MRD true
2629

2730
#if USING_MRD

src/ESPAsync_WiFiManager_Lite.h

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -607,6 +607,10 @@ class ESPAsync_WiFiManager_Lite
607607

608608
//////////////////////////////////////////
609609

610+
#if !defined(USE_LED_BUILTIN)
611+
#define USE_LED_BUILTIN true // use builtin LED to show configuration mode
612+
#endif
613+
610614
#if ESP8266
611615

612616
// For ESP8266
@@ -642,9 +646,11 @@ class ESPAsync_WiFiManager_Lite
642646
{
643647
#define TIMEOUT_CONNECT_WIFI 30000
644648

645-
//Turn OFF
649+
#if USE_LED_BUILTIN
650+
// Turn OFF
646651
pinMode(LED_BUILTIN, OUTPUT);
647652
digitalWrite(LED_BUILTIN, LED_OFF);
653+
#endif
648654

649655
#if USING_MRD
650656
//// New MRD ////
@@ -911,9 +917,10 @@ class ESPAsync_WiFiManager_Lite
911917

912918
if (connectMultiWiFi() == WL_CONNECTED)
913919
{
920+
#if USE_LED_BUILTIN
914921
// turn the LED_BUILTIN OFF to tell us we exit configuration mode.
915922
digitalWrite(LED_BUILTIN, LED_OFF);
916-
923+
#endif
917924
ESP_WML_LOGINFO(F("run: WiFi reconnected"));
918925
}
919926
}
@@ -923,9 +930,10 @@ class ESPAsync_WiFiManager_Lite
923930

924931
if (connectMultiWiFi() == WL_CONNECTED)
925932
{
933+
#if USE_LED_BUILTIN
926934
// turn the LED_BUILTIN OFF to tell us we exit configuration mode.
927935
digitalWrite(LED_BUILTIN, LED_OFF);
928-
936+
#endif
929937
ESP_WML_LOGINFO(F("run: WiFi reconnected"));
930938
}
931939

@@ -941,14 +949,16 @@ class ESPAsync_WiFiManager_Lite
941949
// WiFi is connected and we are in configuration_mode
942950
configuration_mode = false;
943951
ESP_WML_LOGINFO(F("run: got WiFi back"));
952+
#if USE_LED_BUILTIN
944953
// turn the LED_BUILTIN OFF to tell us we exit configuration mode.
945954
digitalWrite(LED_BUILTIN, LED_OFF);
955+
#endif
946956

947957
if (dnsServer) {
948958
dnsServer->stop();
949959
delete dnsServer;
950960
dnsServer = nullptr;
951-
}
961+
}
952962
if (server) {
953963
server->end();
954964
delete server;
@@ -2938,8 +2948,10 @@ class ESPAsync_WiFiManager_Lite
29382948
WiFiNetworksFound = scanWifiNetworks(&indices);
29392949
#endif
29402950

2951+
#if USE_LED_BUILTIN
29412952
// turn the LED_BUILTIN ON to tell us we are in configuration mode.
29422953
digitalWrite(LED_BUILTIN, LED_ON);
2954+
#endif
29432955

29442956
if ( (portal_ssid == "") || portal_pass == "" )
29452957
{

0 commit comments

Comments
 (0)