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

added switch to turn use of builtin LED off #20

Merged
merged 1 commit into from
Dec 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions examples/ESP_WiFi/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@

#define _ESP_WM_LITE_LOGLEVEL_ 2

// use builtin LED to show configuration mode
#define USE_LED_BUILTIN true

#define USING_MRD true

#if USING_MRD
Expand Down
3 changes: 3 additions & 0 deletions examples/ESP_WiFi_MQTT/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@

#define _ESP_WM_LITE_LOGLEVEL_ 2

// use builtin LED to show configuration mode
#define USE_LED_BUILTIN true

#define USING_MRD true

#if USING_MRD
Expand Down
18 changes: 15 additions & 3 deletions src/ESP_WiFiManager_Lite.h
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,10 @@ class ESP_WiFiManager_Lite
connectWiFi(ssid, pass);
}

#if !defined(USE_LED_BUILTIN)
#define USE_LED_BUILTIN true // use builtin LED to show configuration mode
#endif

#if ESP8266

// For ESP8266
Expand Down Expand Up @@ -624,9 +628,11 @@ class ESP_WiFiManager_Lite
{
#define TIMEOUT_CONNECT_WIFI 30000

//Turn OFF
#if USE_LED_BUILTIN
// Turn OFF
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, LED_OFF);
#endif

#if USING_MRD
//// New MRD ////
Expand Down Expand Up @@ -909,9 +915,10 @@ class ESP_WiFiManager_Lite

if (connectMultiWiFi() == WL_CONNECTED)
{
#if USE_LED_BUILTIN
// turn the LED_BUILTIN OFF to tell us we exit configuration mode.
digitalWrite(LED_BUILTIN, LED_OFF);

#endif
ESP_WML_LOGINFO(F("run: WiFi reconnected"));
}
}
Expand All @@ -921,9 +928,10 @@ class ESP_WiFiManager_Lite

if (connectMultiWiFi() == WL_CONNECTED)
{
#if USE_LED_BUILTIN
// turn the LED_BUILTIN OFF to tell us we exit configuration mode.
digitalWrite(LED_BUILTIN, LED_OFF);

#endif
ESP_WML_LOGINFO(F("run: WiFi reconnected"));
}

Expand All @@ -938,8 +946,10 @@ class ESP_WiFiManager_Lite
{
configuration_mode = false;
ESP_WML_LOGINFO(F("run: got WiFi back"));
#if USE_LED_BUILTIN
// turn the LED_BUILTIN OFF to tell us we exit configuration mode.
digitalWrite(LED_BUILTIN, LED_OFF);
#endif
}
}

Expand Down Expand Up @@ -2923,8 +2933,10 @@ class ESP_WiFiManager_Lite
WiFiNetworksFound = scanWifiNetworks(&indices);
#endif

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

if ( (portal_ssid == "") || portal_pass == "" )
{
Expand Down