From fa2d558a51f1f06db96add1f89903f0e2cd51d5d Mon Sep 17 00:00:00 2001 From: James Wood Date: Tue, 1 Sep 2015 11:13:55 +1000 Subject: [PATCH] Fix modes Switching to mode 3 (which no longer exists) --- PrawnBot-ESP.ino | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/PrawnBot-ESP.ino b/PrawnBot-ESP.ino index ecf5120..0c88ed8 100644 --- a/PrawnBot-ESP.ino +++ b/PrawnBot-ESP.ino @@ -29,7 +29,7 @@ void callback(char* theTopic, byte* incoming, unsigned int length) { Serial.print(String(theTopic)); Serial.print(": "); Serial.println(incomingMessage); - if (incomingMessage == "feed") botMode = 1; + if (incomingMessage == "feed" && botMode != 2) botMode = 1; //if not jammed else if (incomingMessage == "ping") mqttclient.publish(topic, (char*)("pong")); } @@ -66,8 +66,7 @@ void loop() { if (!mqttclient.connected()) mqttclient.connect(clientName); feedButtonDebounced.update(); motorSwitchDebounced.update(); - mqttclient.loop(); // - if (motorJammed == true) botMode = 3; + mqttclient.loop(); switch (botMode) { case 0: // Listening if(lastAnnounced != 0) { @@ -96,7 +95,7 @@ void loop() { messageToReport="fed"; } else if (millis() - modeStartTime > dispenseTimeout) { - botMode = 3; + botMode = 2; //jammed modeStartTime = 0; } break;