Skip to content

Commit d5eb0c7

Browse files
committed
Immediately check wifi on boot.
1 parent faeb17d commit d5eb0c7

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

git-version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
*
88
* git describe --tags --always --dirty
99
*/
10-
#define GIT_VERSION "v0.1.5"
10+
#define GIT_VERSION "v0.1.6"

mqtt_esp8266_uart_bridge.ino

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ ESP8266WiFiMulti wifiMulti;
6969
WiFiUDP udp;
7070
NTPClient ntpClient(udp, NTP_SERVER, 0, NTP_UPDATE_INTERVAL);
7171
PubSubClient mqtt(wifi);
72-
typeof(millis()) last_wifi_check = 0;
72+
typeof(millis()) last_wifi_check = -WIFI_RETRY_DELAY;
7373
unsigned long last_mqtt_check = 0;
7474

7575

@@ -146,9 +146,6 @@ String hexToStr(uint8_t* arr, int n)
146146
* Called whenever a payload is received from a subscribed MQTT topic.
147147
*/
148148
void mqtt_receive_callback(char* topic, byte* payload, unsigned int length) {
149-
char buffer[256];
150-
buffer[0] = 0;
151-
int len = 0;
152149

153150
if (strcmp(topic, (MQTT_TOPIC_PREFIX + my_mac + MQTT_CONTROL_TOPIC).c_str()) == 0) {
154151
// TODO: use this to change behavior
@@ -176,7 +173,7 @@ bool check_wifi()
176173
if ((millis() - last_wifi_check) >= WIFI_RETRY_DELAY) {
177174
Serial.print("[INFO] WiFi connecting.");
178175

179-
int retries = 5;
176+
int retries = 10;
180177
while (retries > 0 && wifiMulti.run() != WL_CONNECTED) {
181178
delay(500);
182179
Serial.print(".");

0 commit comments

Comments
 (0)