B4R Question b4xlib based on MQTT Library - Project reboots on periodically checking of connection to broker

hatzisn

Expert
Licensed User
Longtime User
Good evening everybody,

happy holidays. I am facing a problem with the atouched project.

It is a B4R b4xlib that allows you to add directly mqtt in the B4R projects without writing any code. It is initialized either with the IP (Initialize) or a host (Initialize2).
Everything works perfectly except the following: Recently I decided to add a selfcheck if the module is still connected to the MQTT broker since if the WiFi goes offline it stops also the communications inside the local network in my router and no mqtt_disconnected event is fired. What I did to overcome this was trying to publish something in a given topic at regular time intervals and receive also the answer if it is connected to the broker. If it receives the message it sets a boolean to true and the next time the timer fires it does not enter the code block to be executed if it is not connected and resets the boolean to false again and this goes around at regular intervals (set boolean false -> publish -> receive -> set boolean true if received-> get in the next interval in the timer and if boolean is false execute the not connected code block otherwise loop in the next interval).

It constantly reboots at the timer execution and I cannot figure out why, since no logs are printed to see what is wrong... Can anyone of you figure it out?
I tried to increase the StackBufferSize and also add Delay(1) in tim_Tick to emulate the yield(); command in ESP 8266 but not a chance...
I am using an ESP8266 (a WeMos D1 Mini R3).

Thanks in advance
 

Attachments

  • DHQIMQTTLib.zip
    3.5 KB · Views: 11
Top