From 4fdd7f3fd60471b1e4c4b6bec7afd82b8f2132cf Mon Sep 17 00:00:00 2001 From: jameswood Date: Mon, 31 Aug 2015 22:59:08 +1000 Subject: [PATCH] Improve performance of motor detect switch by using the right variable WHOOPS --- PrawnBot-ESP.ino | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/PrawnBot-ESP.ino b/PrawnBot-ESP.ino index 83791d1..ecf5120 100644 --- a/PrawnBot-ESP.ino +++ b/PrawnBot-ESP.ino @@ -63,6 +63,7 @@ void getOnline(){ void loop() { if(WiFi.status() != WL_CONNECTED) getOnline(); + if (!mqttclient.connected()) mqttclient.connect(clientName); feedButtonDebounced.update(); motorSwitchDebounced.update(); mqttclient.loop(); // @@ -87,7 +88,7 @@ void loop() { lastAnnounced = 1; } digitalWrite(motorPin, HIGH); - if (feedButtonDebounced.fell()){ + if (motorSwitchDebounced.fell()){ digitalWrite(motorPin, LOW); botMode = 0; modeStartTime = 0;