Skip to content

Commit

Permalink
WiFiStart now public. cleanup debugging messages, use SECRET_WIFI_PWD
Browse files Browse the repository at this point in the history
  • Loading branch information
gojimmypi committed Jun 19, 2020
1 parent 0fcfdb7 commit 85a87c2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
12 changes: 7 additions & 5 deletions WiFiHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ String wifiMacAddress() {
return myMacAddress;
}

void WiFiStart(bool EnterpriseMode = false) {
void WiFiStart(bool EnterpriseMode) {
WIFI_DEBUG_PRINTLN(DEBUG_SEPARATOR);
WIFI_DEBUG_PRINT("wifiConnect: Connecting to ");
WIFI_DEBUG_PRINTLN(SECRET_WIFI_SSID);
Expand Down Expand Up @@ -136,7 +136,7 @@ void WiFiStart(bool EnterpriseMode = false) {
// station mode assumed.
#endif
HEAP_DEBUG_PRINTLN(DEFAULT_DEBUG_MESSAGE);
WiFi.begin(SECRET_WIFI_SSID, WIFI_PWD);
WiFi.begin(SECRET_WIFI_SSID, SECRET_WIFI_PWD);
HEAP_DEBUG_PRINTLN(DEFAULT_DEBUG_MESSAGE);
}
}
Expand Down Expand Up @@ -168,16 +168,18 @@ int wifiConnect(int maxAttempts) {
countAttempt++;
if (countAttempt > maxAttempts) {
countAttempt = 0;
WIFI_DEBUG_PRINTLN("WiFi Disconnect... ");
WIFI_DEBUG_PRINTLN(F("WiFi Disconnect... "));
WiFi.disconnect();
delay(5000);
WIFI_DEBUG_PRINTLN("WiFi Retrying. ");
WIFI_DEBUG_PRINT(F("WiFi Retrying. "));
WIFI_DEBUG_PRINTLN(F(SECRET_WIFI_SSID));

#if defined(ARDUINO_ARCH_ESP32) || defined(ARDUINO_ARCH_ESP8266)
WiFi.mode(WIFI_STA);
#else
// station mode assumed.
#endif
WiFi.begin(SECRET_WIFI_SSID, WIFI_PWD);
WiFi.begin(SECRET_WIFI_SSID, SECRET_WIFI_PWD);
// TODO reboot?
}
}
Expand Down
1 change: 1 addition & 0 deletions WiFiHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@


int wifiConnect(int maxAttempts = 50);
void WiFiStart(bool EnterpriseMode = false);

String wifiMacAddress();

Expand Down

0 comments on commit 85a87c2

Please sign in to comment.