tuanpmt / ESP8266MQTTClient

Apache License 2.0
83 stars 42 forks source link

mqtt.begin is not working #17

Closed apanasara closed 5 years ago

apanasara commented 5 years ago

mqtt.begin is not working

MQTTClient mqtt;
mqtt.begin("mqtt://test.mosquitto.org:1883");

Hence following command goes to infinite loop. & produces stack mqtt.handle();

so I added a Boolean flag onConnect() command &

boolean flag = true;
…
mqtt.onConnect([]() {
   ….  ;
   flag=false;
});
…..
void loop()
{
   if(!flag);
   {
    …
    mqtt.handle();
   }
   else
   {
      Serial.println("Mqtt not connected...");
      delay(5000);
   }
}

### _stacktraced

Decoding 12 results 0x4010020c: _umm_free at C:\Users\Amit Suani\Documents\ArduinoData\packages\esp8266\hardware\esp8266\2.4.2\cores\esp8266\umm_malloc/umm_malloc.c line 1295 0x401009e8: free at C:\Users\Amit Suani\Documents\ArduinoData\packages\esp8266\hardware\esp8266\2.4.2\cores\esp8266\umm_malloc/umm_malloc.c line 1755 0x402069f8: axTLS::WiFiClientSecure::stop() at C:\Users\Amit Suani\Documents\ArduinoData\packages\esp8266\hardware\esp8266\2.4.2\libraries\ESP8266WiFi\src/WiFiClientSecureAxTLS.cpp line 312 (discriminator 1) 0x40206a14: _GLOBAL__sub_I__ZN7BearSSL16WiFiClientSecure14_bearssl_stackE at WiFiClientSecureBearSSL.cpp line ? 0x4010020c: _umm_free at C:\Users\Amit Suani\Documents\ArduinoData\packages\esp8266\hardware\esp8266\2.4.2\cores\esp8266\umm_malloc/umm_malloc.c line 1295 0x401009e8: free at C:\Users\Amit Suani\Documents\ArduinoData\packages\esp8266\hardware\esp8266\2.4.2\cores\esp8266\umm_malloc/umm_malloc.c line 1755 0x40207085: MQTTClient::begin(String, LwtOptions, int, bool) at C:\Users\Amit Suani\Documents\Arduino\libraries\ESP8266MQTTClient\src/ESP8266MQTTClient.cpp line 275 0x40203d59: ArduinoJson::Internals::JsonParser ::Reader, ArduinoJson::Internals::StringWriter >::eat(char) at C:\Users\Amit Suani\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Deserialization/JsonParser.hpp line 42 : (inlined by) ArduinoJson::Internals::JsonParser ::Reader, ArduinoJson::Internals::StringWriter >::parseObject() at C:\Users\Amit Suani\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Deserialization/JsonParserImpl.hpp line 94 0x40204139: ArduinoJson::Internals::FloatParts ::FloatParts(float) at C:\Users\Amit Suani\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Deserialization/../Serialization/../Serialization/FloatParts.hpp line 34 0x40203550: postTransmission() at D:\php\Modbus Master\mqttclient_esp8266/mqttclient_esp8266.ino line 53 0x40207264: MQTTClient::deliverPublish(unsigned char*) at C:\Users\Amit Suani\Documents\Arduino\libraries\ESP8266MQTTClient\src/ESP8266MQTTClient.cpp line 275 -0x40100a49:_ cont_wrapper at C:\Users\Amit Suani\Documents\ArduinoData\packages\esp8266\hardware\esp8266\2.4.2\cores\esp8266/cont.S line 81

apanasara commented 5 years ago

Sorry, I used wrong OS while uploading sketch in NodeMCU...