Open Tierran opened 6 years ago
I also have corrupted messages in the callback when I publish messages it seems roughly at the same time as the callback messages. I also increased the MQTT_MAX_PACKET_SIZE to 512 because I have messages larger than 128
Never mind, it seems that my issue was because I was somehow publishing in the callback... I didn't realise at first that I was publishing in a sub function within the callback ( I knew about the publish_in_callback example...)
Also, not only the payload has to be copied in the callback before any publish, but also the topic char* string as well it seems. Otherwise I was still having corruption and reboots.
I'm using a ESP8266 Wimos D1 Mini
I have an Adafruit Feather HUZZAH running a grid eye sensor and I am using this client to push messages to a MQTT server so I can process them. In order to send the entire message, I increased the MQTT_MAX_PACKET_SIZE to 512. This should be enough for the header and the message. The message is simply a comma delineated list of the 64 temperature values that the sensor reads and I send every 5 seconds.
Usually the message comes through fine:
26.00,25.00,25.00,24.25,24.50,24.50,24.50,25.00,25.00,24.75,24.50,24.75,25.00,25.25,24.25,24.50,25.25,25.00,25.00,24.75,25.25,24.75,24.75,25.00,25.00,25.00,25.00,24.25,24.75,25.00,24.75,25.00,25.00,25.75,24.50,25.00,25.25,25.25,25.25,25.00,25.00,24.75,24.75,24.75,24.50,24.50,24.50,25.25,24.25,25.00,24.75,24.50,24.75,24.75,24.50,24.75,25.50,25.25,24.50,24.00,25.25,24.50,25.00,25.00
But every so often, the message seems to have the topic mixed into the message:
26.25,24.75,24.50,24.25,24.75,24.25,24.75,24.50,25.25,25.00,24.25,24.75,24.25,24.50,24.75,24.50,25.25,25.00,25.00,24.25,25.00,24.75,25.00,24.75,25.25,25.25,25.25,24.75,25.00,25.25,24.75,25.25,25.00,25.00,25.00,24.50,24.75,25.00,0�/grideye/ae3faa7fcf5c26.50,25.50,24.75,24.75,25.50,24.75,25.00,25.25,25.25,25.50,25.00,25.00,24.75,25.25,24.75,25.25,25.75,25.25,25.75,24.25,25.00,25.
Any thoughts on what might be happening here?