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

Commit 3ef4320

Browse files
authored
Merge pull request #14 from hmueller01/USE_LED_BUILTIN
configure use of builtin LED
2 parents 2f6b415 + b1bb446 commit 3ef4320

File tree

3 files changed

+22
-5
lines changed

3 files changed

+22
-5
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 & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -598,6 +598,10 @@ class ESPAsync_WiFiManager_Lite
598598

599599
//////////////////////////////////////////
600600

601+
#if !defined(USE_LED_BUILTIN)
602+
#define USE_LED_BUILTIN true // use builtin LED to show configuration mode
603+
#endif
604+
601605
#if ESP8266
602606

603607
// For ESP8266
@@ -633,10 +637,12 @@ class ESPAsync_WiFiManager_Lite
633637
{
634638
#define TIMEOUT_CONNECT_WIFI 30000
635639

640+
#if USE_LED_BUILTIN
636641
//Turn OFF
637642
pinMode(LED_BUILTIN, OUTPUT);
638643
digitalWrite(LED_BUILTIN, LED_OFF);
639-
644+
#endif
645+
640646
#if USING_MRD
641647
//// New MRD ////
642648
mrd = new MultiResetDetector(MRD_TIMEOUT, MRD_ADDRESS);
@@ -891,9 +897,10 @@ class ESPAsync_WiFiManager_Lite
891897

892898
if (connectMultiWiFi() == WL_CONNECTED)
893899
{
900+
#if USE_LED_BUILTIN
894901
// turn the LED_BUILTIN OFF to tell us we exit configuration mode.
895902
digitalWrite(LED_BUILTIN, LED_OFF);
896-
903+
#endif
897904
ESP_WML_LOGINFO(F("run: WiFi reconnected"));
898905
}
899906
}
@@ -902,9 +909,10 @@ class ESPAsync_WiFiManager_Lite
902909

903910
if (connectMultiWiFi() == WL_CONNECTED)
904911
{
912+
#if USE_LED_BUILTIN
905913
// turn the LED_BUILTIN OFF to tell us we exit configuration mode.
906914
digitalWrite(LED_BUILTIN, LED_OFF);
907-
915+
#endif
908916
ESP_WML_LOGINFO(F("run: WiFi reconnected"));
909917
}
910918
#endif
@@ -918,8 +926,10 @@ class ESPAsync_WiFiManager_Lite
918926
{
919927
configuration_mode = false;
920928
ESP_WML_LOGINFO(F("run: got WiFi back"));
929+
#if USE_LED_BUILTIN
921930
// turn the LED_BUILTIN OFF to tell us we exit configuration mode.
922931
digitalWrite(LED_BUILTIN, LED_OFF);
932+
#endif
923933
}
924934
}
925935

@@ -2852,10 +2862,11 @@ class ESPAsync_WiFiManager_Lite
28522862

28532863
WiFiNetworksFound = scanWifiNetworks(&indices);
28542864
#endif
2855-
2865+
2866+
#if USE_LED_BUILTIN
28562867
// turn the LED_BUILTIN ON to tell us we are in configuration mode.
28572868
digitalWrite(LED_BUILTIN, LED_ON);
2858-
2869+
#endif
28592870
if ( (portal_ssid == "") || portal_pass == "" )
28602871
{
28612872
String chipID = String(ESP_getChipId(), HEX);

0 commit comments

Comments
 (0)