gioblu / PJON

PJON (Padded Jittering Operative Network) is an experimental, arduino-compatible, multi-master, multi-media network protocol.
Other
2.73k stars 239 forks source link

Unable to compile MQTT examples #420

Closed JeroenVanHoye closed 1 year ago

JeroenVanHoye commented 2 years ago

When trying to compile examples that make use of PJONMQTTTranslate.h the Arduino IDE throws an error that it can not find the ReconnectingMqttClient.h library.

What needs to be installed for this to work?

Many thanks in advance!

fredilarsen commented 1 year ago

You need this repo: https://github.com/fredilarsen/ReconnectingMqttClient Download it and unzip it to your Arduino/libraries folder.

2114L3 commented 1 year ago

This doesnt seem to be working with the example > PJON > ESP8266 > Local > MQTTTranslate > EnvironmentalController. The ReconnectingMqttClient uses ethernetlink which isnt supported on ESP8266/ESP32 re the wiki

compiling it throws errors on ntohl, htonl, htons, etc eg: Arduino/libraries/PJON/src/strategies/EthernetTCP/EthernetLink.h:377:48: error: 'ntohl' was not declared in this scope content_length = ntohl(content_length);

is there something else missing? or is MQTTTranslate not possible on platforms unsupported by ET?

looks like ESPs are excluded from these define statements https://github.com/gioblu/PJON/blob/38e36bb1228c1690143cfbf693a0bcb809514d6c/src/interfaces/ARDUINO/PJON_ARDUINO_Interface.h#LL147C64-L147C64

fredilarsen commented 1 year ago

@2114L3 I can confirm that the ReconnectingMqttClient does work on ESP8266, I just used it in my latest project.

I did now test building the EnvironmentController example and it builds fine with Arduino IDE 1.8.13 for "LOLIN(WEMOS) D1 R2 & mini" which is the ESP8266 board I prefer using. I also tested compiling with Arduino 2.1, and that works as well.

What IDE/version are you using? And which board are you selecting when building?

2114L3 commented 1 year ago

Thank you!

I was: Arduino IDE 1.8.19 (linux) ReconnectingMqttClient 1.2.0 ESP8266 Community 2.4.1 "WeMos D1 R2 & mini"

noting your board quote has LOLIN and mine did not - I've spotted i was on ESP3266 community 2.4.1, updating this to 3.1.2 has resolved the issue and compiling.

regarding the wiki listing ET unsupported for ESP*, as EthernetLink is from within ET had me worried and lead me wrong.

hope this helps the original question.

fredilarsen commented 1 year ago

Thanks for the feedback. @gioblu This issue can be closed.