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

Commit bffc4e2

Browse files
authored
Merge pull request #20 from hmueller01/USE_LED_BUILTIN
added switch to turn use of builtin LED off
2 parents fb35f3a + 618638a commit bffc4e2

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

examples/ESP_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/ESP_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/ESP_WiFiManager_Lite.h

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,10 @@ class ESP_WiFiManager_Lite
589589
connectWiFi(ssid, pass);
590590
}
591591

592+
#if !defined(USE_LED_BUILTIN)
593+
#define USE_LED_BUILTIN true // use builtin LED to show configuration mode
594+
#endif
595+
592596
#if ESP8266
593597

594598
// For ESP8266
@@ -624,9 +628,11 @@ class ESP_WiFiManager_Lite
624628
{
625629
#define TIMEOUT_CONNECT_WIFI 30000
626630

627-
//Turn OFF
631+
#if USE_LED_BUILTIN
632+
// Turn OFF
628633
pinMode(LED_BUILTIN, OUTPUT);
629634
digitalWrite(LED_BUILTIN, LED_OFF);
635+
#endif
630636

631637
#if USING_MRD
632638
//// New MRD ////
@@ -909,9 +915,10 @@ class ESP_WiFiManager_Lite
909915

910916
if (connectMultiWiFi() == WL_CONNECTED)
911917
{
918+
#if USE_LED_BUILTIN
912919
// turn the LED_BUILTIN OFF to tell us we exit configuration mode.
913920
digitalWrite(LED_BUILTIN, LED_OFF);
914-
921+
#endif
915922
ESP_WML_LOGINFO(F("run: WiFi reconnected"));
916923
}
917924
}
@@ -921,9 +928,10 @@ class ESP_WiFiManager_Lite
921928

922929
if (connectMultiWiFi() == WL_CONNECTED)
923930
{
931+
#if USE_LED_BUILTIN
924932
// turn the LED_BUILTIN OFF to tell us we exit configuration mode.
925933
digitalWrite(LED_BUILTIN, LED_OFF);
926-
934+
#endif
927935
ESP_WML_LOGINFO(F("run: WiFi reconnected"));
928936
}
929937

@@ -938,8 +946,10 @@ class ESP_WiFiManager_Lite
938946
{
939947
configuration_mode = false;
940948
ESP_WML_LOGINFO(F("run: got WiFi back"));
949+
#if USE_LED_BUILTIN
941950
// turn the LED_BUILTIN OFF to tell us we exit configuration mode.
942951
digitalWrite(LED_BUILTIN, LED_OFF);
952+
#endif
943953
}
944954
}
945955

@@ -2923,8 +2933,10 @@ class ESP_WiFiManager_Lite
29232933
WiFiNetworksFound = scanWifiNetworks(&indices);
29242934
#endif
29252935

2936+
#if USE_LED_BUILTIN
29262937
// turn the LED_BUILTIN ON to tell us we are in configuration mode.
29272938
digitalWrite(LED_BUILTIN, LED_ON);
2939+
#endif
29282940

29292941
if ( (portal_ssid == "") || portal_pass == "" )
29302942
{

0 commit comments

Comments
 (0)