Skip to content

Commit 3c579ac

Browse files
committed
Fix for incorrect WiFi connection failed message.
1 parent e9a3e23 commit 3c579ac

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

src/CayenneMQTTWiFiClient.h

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
The MIT License(MIT)
33
44
Cayenne Arduino Client Library
5-
Copyright © 2016 myDevices
5+
Copyright (c) 2016 myDevices
66
77
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
88
documentation files(the "Software"), to deal in the Software without restriction, including without limitation
@@ -45,16 +45,17 @@ class CayenneMQTTWiFiClient : public CayenneArduinoMQTTClient
4545
}
4646

4747
CAYENNE_LOG("Connecting to %s", ssid);
48-
while (WL_CONNECTED != status) {
49-
if (wifiPassword && strlen(wifiPassword)) {
50-
status = WiFi.begin((char*)ssid, (char*)wifiPassword);
51-
}
52-
else {
53-
status = WiFi.begin((char*)ssid);
54-
}
55-
delay(5000);
56-
CAYENNE_LOG("Connnection failed, retrying");
48+
if (wifiPassword && strlen(wifiPassword)) {
49+
WiFi.begin(ssid, wifiPassword);
5750
}
51+
else {
52+
WiFi.begin(ssid);
53+
}
54+
while (WiFi.status() != WL_CONNECTED) {
55+
delay(500);
56+
}
57+
CAYENNE_LOG("Connected to WiFi");
58+
5859
IPAddress local_ip = WiFi.localIP();
5960
CAYENNE_LOG("IP: %d.%d.%d.%d", local_ip[0], local_ip[1], local_ip[2], local_ip[3]);
6061
CayenneArduinoMQTTClient::begin(_wifiClient, username, password, clientID, WRITE_CHUNK_SIZE);

0 commit comments

Comments
 (0)