comakingspace / FlipDotDisplay

3 stars 0 forks source link

MQTT message size too short for full binary update #3

Open Pakue95 opened 6 years ago

Pakue95 commented 6 years ago

Right now the MQTT doesn't like to send/receive more than 103 bytes. Longer messages get ignores.

NitramLegov commented 6 years ago

The problem is within the adafruit library: https://github.com/adafruit/Adafruit_MQTT_Library/blob/master/Adafruit_MQTT.h

It defines the maximum message length : // how much data we save in a subscription object // and how many subscriptions we want to be able to track.

if defined (AVR_ATmega32U4) || defined(AVR_ATmega328P)

define MAXSUBSCRIPTIONS 5

define SUBSCRIPTIONDATALEN 20

else

define MAXSUBSCRIPTIONS 15

define SUBSCRIPTIONDATALEN 100

endif

Unfortunately it is a define and not a variable. Thus, as far as I know we would have to fork the library in order to change the value.

Pakue95 commented 6 years ago

I tried increasing this value, but the limit still is present. Maybe another hard-coded max value somewhere?

Pakue95 commented 6 years ago

Someone else also has that problem. Should be fixed however...

https://github.com/adafruit/Adafruit_MQTT_Library/issues/17

NitramLegov commented 5 years ago

I think in order to fix this problem, we should switch to another implementation of MQTT on our microcontrollers. There is a embedded-c version made by the eclipse paho project here. I am not sure if it will run on the ESP though. There seems to be a port by "tuanpmt" here Another MQTT implementation is available by espressif here, which seems to be based on the above mentioned port by tuanmpt. Then there is pubsubclient, which is capable of changing the maximum package size by adjusting the header file. It is limited regarding QoS, but that shouldn´t be critical in our case.

I would say we should try the clients in order to see which one fits best. right now, i would prefer the one from eclipse or espressif

Pakue95 commented 5 years ago

Might be an opportunity to change the development environment from Arduino to Espressif.