From 7c84e3be185947e9784dfc206c3b136a7f5148d6 Mon Sep 17 00:00:00 2001 From: jameswood Date: Mon, 31 Aug 2015 22:06:38 +1000 Subject: [PATCH] Wifi Robustness Reconnect if lost --- PrawnBot-ESP.ino | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/PrawnBot-ESP.ino b/PrawnBot-ESP.ino index 6ab4336..66787de 100644 --- a/PrawnBot-ESP.ino +++ b/PrawnBot-ESP.ino @@ -37,7 +37,11 @@ void setup() { Serial.begin(115200); delay(10); WiFi.begin(ssid, password); - while (WiFi.status() != WL_CONNECTED) { + getOnline(); +} + +void getOnline(){ + while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print(":) "); } @@ -52,6 +56,7 @@ void setup() { } void loop() { + if(WiFi.status() != WL_CONNECTED) getOnline(); client.loop(); if (motorJammed == true) botMode = 3; switch (botMode) {