FreeRTOS/iot-reference-esp32

Correct way to deinit

Closed this issue · 3 comments

As part of the project we need to be able to disconnect and reconnect MQTT .

I am struggling to deinit the demo i.e. sub_pub_unsub_demo correctly. Reversing the sequence does not really help. I have tried

  1. MQTT_Disconnect
  2. MQTTAgent_CancelAll
  3. xCoreMqttAgentManagerDeregisterHandler
  4. MQTTAgent_Terminate
  5. Task deletions

in sequence with no luck. When I try to reinitialize , it has references of the first run and crashes everytime.

Is there any sample code available for correct way to deinit as per the full process ?

@dhavalgujar would you be able to suggest the correct way to do this ? No one has shed any thoughts on this for 2 weeks.

Hey @zafeer-birde, I apologize for the long delay in getting a response.
I wanted to check if you are still facing issues with deinitializing in the demo you linked, or if you figured out how to do this.

Hey again, on the chance you, or somebody else, comes back to this in the future
When running idf.py menuconfig By going to Component Config -> ESP-MQTT Configurations you can enable "Skip publish if disconnected", which might assist in correctly de-initing the demo.

Closing issue due to no response, please re-open this if you are still seeing this issue!