|
2 | 2 | The MIT License(MIT)
|
3 | 3 |
|
4 | 4 | Cayenne Arduino Client Library
|
5 |
| -Copyright © 2016 myDevices |
| 5 | +Copyright (c) 2016 myDevices |
6 | 6 |
|
7 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
8 | 8 | documentation files(the "Software"), to deal in the Software without restriction, including without limitation
|
@@ -45,16 +45,17 @@ class CayenneMQTTWiFiClient : public CayenneArduinoMQTTClient
|
45 | 45 | }
|
46 | 46 |
|
47 | 47 | 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); |
57 | 50 | }
|
| 51 | + else { |
| 52 | + WiFi.begin(ssid); |
| 53 | + } |
| 54 | + while (WiFi.status() != WL_CONNECTED) { |
| 55 | + delay(500); |
| 56 | + } |
| 57 | + CAYENNE_LOG("Connected to WiFi"); |
| 58 | + |
58 | 59 | IPAddress local_ip = WiFi.localIP();
|
59 | 60 | CAYENNE_LOG("IP: %d.%d.%d.%d", local_ip[0], local_ip[1], local_ip[2], local_ip[3]);
|
60 | 61 | CayenneArduinoMQTTClient::begin(_wifiClient, username, password, clientID, WRITE_CHUNK_SIZE);
|
|
0 commit comments