@@ -596,6 +596,10 @@ class ESP_WiFiManager_Lite
596596 connectWiFi (ssid, pass);
597597 }
598598
599+ #if !defined(USE_LED_BUILTIN)
600+ #define USE_LED_BUILTIN true // use builtin LED to show configuration mode
601+ #endif
602+
599603#if ESP8266
600604
601605 // For ESP8266
@@ -631,9 +635,11 @@ class ESP_WiFiManager_Lite
631635 {
632636#define TIMEOUT_CONNECT_WIFI 30000
633637
634- // Turn OFF
638+ #if USE_LED_BUILTIN
639+ // Turn OFF
635640 pinMode (LED_BUILTIN, OUTPUT);
636641 digitalWrite (LED_BUILTIN, LED_OFF);
642+ #endif
637643
638644#if USING_MRD
639645 // // New MRD ////
@@ -921,9 +927,10 @@ class ESP_WiFiManager_Lite
921927
922928 if (connectMultiWiFi () == WL_CONNECTED)
923929 {
930+ #if USE_LED_BUILTIN
924931 // turn the LED_BUILTIN OFF to tell us we exit configuration mode.
925932 digitalWrite (LED_BUILTIN, LED_OFF);
926-
933+ # endif
927934 ESP_WML_LOGINFO (F (" run: WiFi reconnected" ));
928935 }
929936 }
@@ -933,9 +940,10 @@ class ESP_WiFiManager_Lite
933940
934941 if (connectMultiWiFi () == WL_CONNECTED)
935942 {
943+ #if USE_LED_BUILTIN
936944 // turn the LED_BUILTIN OFF to tell us we exit configuration mode.
937945 digitalWrite (LED_BUILTIN, LED_OFF);
938-
946+ # endif
939947 ESP_WML_LOGINFO (F (" run: WiFi reconnected" ));
940948 }
941949
@@ -951,15 +959,17 @@ class ESP_WiFiManager_Lite
951959 // WiFi is connected and we are in configuration_mode
952960 configuration_mode = false ;
953961 ESP_WML_LOGINFO (F (" run: got WiFi back" ));
962+ #if USE_LED_BUILTIN
954963 // turn the LED_BUILTIN OFF to tell us we exit configuration mode.
955964 digitalWrite (LED_BUILTIN, LED_OFF);
965+ #endif
956966
957967 if (dnsServer)
958968 {
959969 dnsServer->stop ();
960970 delete dnsServer;
961971 dnsServer = nullptr ;
962- }
972+ }
963973
964974 if (server)
965975 {
@@ -1172,7 +1182,6 @@ class ESP_WiFiManager_Lite
11721182 setForcedCP (false );
11731183
11741184 // Delay then reset the ESP8266 after save data
1175- delay (1000 );
11761185 resetFunc ();
11771186 }
11781187
@@ -1186,7 +1195,6 @@ class ESP_WiFiManager_Lite
11861195 setForcedCP (true );
11871196
11881197 // Delay then reset the ESP8266 after save data
1189- delay (1000 );
11901198 resetFunc ();
11911199 }
11921200
@@ -2547,11 +2555,7 @@ class ESP_WiFiManager_Lite
25472555 drd->loop ();
25482556#endif
25492557
2550- #if ESP8266
2551- ESP.reset ();
2552- #else
2553- ESP.restart ();
2554- #endif
2558+ resetFunc ();
25552559
25562560#endif
25572561 }
@@ -2931,8 +2935,7 @@ class ESP_WiFiManager_Lite
29312935
29322936 // TO DO : what command to reset
29332937 // Delay then reset the board after save data
2934- delay (1000 );
2935- resetFunc (); // call reset
2938+ resetFunc ();
29362939 }
29372940 } // if (server)
29382941 }
@@ -2952,8 +2955,10 @@ class ESP_WiFiManager_Lite
29522955 WiFiNetworksFound = scanWifiNetworks (&indices);
29532956#endif
29542957
2958+ #if USE_LED_BUILTIN
29552959 // turn the LED_BUILTIN ON to tell us we are in configuration mode.
29562960 digitalWrite (LED_BUILTIN, LED_ON);
2961+ #endif
29572962
29582963 if ( (portal_ssid == " " ) || portal_pass == " " )
29592964 {
0 commit comments