Closed ajinkya-open closed 1 year ago
There is some issue with your code, but I won't have time to figure out why
The real issue is you don;t have enough memory to run your code
Carefully look at the library code for ESP8266
from
uint16_t AsyncMqttClient::publish(const char* topic, uint8_t qos, bool retain, const char* payload, size_t length,
bool dup, uint16_t message_id)
{
(void) dup;
(void) message_id;
if (_state != CONNECTED || GET_FREE_MEMORY() < MQTT_MIN_FREE_MEMORY)
return 0;
AMQTT_LOGINFO("PUBLISH");
AsyncMqttClientInternals::OutPacket* msg = new AsyncMqttClientInternals::PublishOutPacket(topic, qos, retain, payload,
length);
_addBack(msg);
return msg->packetId();
}
If you don't have enough Free Memory =>GET_FREE_MEMORY() < 4096
will happen in extreme cases while GET_FREE_MEMORY() < 512
might not happen.
Try using ESP32 with larger memory size.
Good Luck,
Describe the bug
A clear and concise description of what the bug is. my observation: following configuration with 512 helps mqtt to get re-connect again when router is restarted and net gets online, but when i put 4096 , it dont reconnect automatically in file : AsyncMqttClient_Generic.hpp
ifndef MQTT_MIN_FREE_MEMORY
// #define MQTT_MIN_FREE_MEMORY 4096
define MQTT_MIN_FREE_MEMORY 512
endif
Steps to Reproduce
to reproduce the error following is the hardware
Chip is ESP8266EX Features: WiFi Crystal is 26MHz
Uploading stub... Running stub... Stub running... Changing baud rate to 460800 Changed. Configuring flash size...
Expected behavior
expected behaviour should be it should autoconnect with 4096 value [ i may be not aware of that #define parameter, please enlighten is i am being blind to any obvious thing, thanks ]
Actual behavior
behaviour should be autoconected after router it rebooted , you can check this scene by running library on esp8266 as above and then reboot router from web ui control panel, and observe the disconnection in serial logs
Debug and AT-command log (if applicable)
[ logs when 512 size connect logs ]
[ log when 4096] first it connected automtically but when in restart it it show freq disconnection
Screenshots
NA
Information
Please ensure to specify the following:
my included libraries:
platform ini file as below
code snippets from my code
//in setup>>