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

Commit 6e36702

Browse files
authored
Merge pull request #21 from hmueller01/USE_LED_BUILTIN_REDO
redo configure use of builtin LED
2 parents e6d78cc + e9032c1 commit 6e36702

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
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: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,10 @@ class ESPAsync_WiFiManager_Lite
606606

607607
//////////////////////////////////////////
608608

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

611615
// For ESP8266
@@ -641,9 +645,11 @@ class ESPAsync_WiFiManager_Lite
641645
{
642646
#define TIMEOUT_CONNECT_WIFI 30000
643647

644-
//Turn OFF
648+
#if USE_LED_BUILTIN
649+
// Turn OFF
645650
pinMode(LED_BUILTIN, OUTPUT);
646651
digitalWrite(LED_BUILTIN, LED_OFF);
652+
#endif
647653

648654
#if USING_MRD
649655
//// New MRD ////
@@ -905,9 +911,10 @@ class ESPAsync_WiFiManager_Lite
905911

906912
if (connectMultiWiFi() == WL_CONNECTED)
907913
{
914+
#if USE_LED_BUILTIN
908915
// turn the LED_BUILTIN OFF to tell us we exit configuration mode.
909916
digitalWrite(LED_BUILTIN, LED_OFF);
910-
917+
#endif
911918
ESP_WML_LOGINFO(F("run: WiFi reconnected"));
912919
}
913920
}
@@ -917,9 +924,10 @@ class ESPAsync_WiFiManager_Lite
917924

918925
if (connectMultiWiFi() == WL_CONNECTED)
919926
{
927+
#if USE_LED_BUILTIN
920928
// turn the LED_BUILTIN OFF to tell us we exit configuration mode.
921929
digitalWrite(LED_BUILTIN, LED_OFF);
922-
930+
#endif
923931
ESP_WML_LOGINFO(F("run: WiFi reconnected"));
924932
}
925933

@@ -934,8 +942,10 @@ class ESPAsync_WiFiManager_Lite
934942
{
935943
configuration_mode = false;
936944
ESP_WML_LOGINFO(F("run: got WiFi back"));
945+
#if USE_LED_BUILTIN
937946
// turn the LED_BUILTIN OFF to tell us we exit configuration mode.
938947
digitalWrite(LED_BUILTIN, LED_OFF);
948+
#endif
939949
}
940950
}
941951

@@ -2919,8 +2929,10 @@ class ESPAsync_WiFiManager_Lite
29192929
WiFiNetworksFound = scanWifiNetworks(&indices);
29202930
#endif
29212931

2932+
#if USE_LED_BUILTIN
29222933
// turn the LED_BUILTIN ON to tell us we are in configuration mode.
29232934
digitalWrite(LED_BUILTIN, LED_ON);
2935+
#endif
29242936

29252937
if ( (portal_ssid == "") || portal_pass == "" )
29262938
{

0 commit comments

Comments
 (0)