IOT Pet Feeder - dweet problems


#1

Hey,

Lately, we’ve received quite a few questions from users that have been experiencing difficulties with the integration of Dweet in the IoT pet feeder.
After a thorough investigation of the issue, we reached the conclusion that the problem has to do with the response time from Dweet. In order to fix the issue, all you have to do is change the timeout from 500 milliseconds to 1000 milliseconds and that should solve the problem. If it persists, you can make the timeout even longer.

Here’s a detailed explanation, about where exactly you need to change the timeout in the code:

In ESP8266.cpp , line 932 you will find the recvSingle function, which looks like this:

int ESP8266::recvSingle(char *buffer, int bufferLen)
{
int i = 0;
int bodyFlag =1;
unsigned long start = millis();
while (millis() - start < 500) {
while (m_puart->available() > 0 && i < bufferLen)
{
//when using software serial due to buffer issues read incoming string char by char
char c = m_puart->read();
Serial.print©;

The line “while (millis() - start < 500)” is a timeout for the response from dweet, the default is set to 500. This should be changed to 1000 or more.

That’s it :slight_smile:
Good luck and let us know if it worked for you.