esp-idf-mqtt-camera icon indicating copy to clipboard operation
esp-idf-mqtt-camera copied to clipboard

multiple mqtt_event_handler(), why?

Open riwalker opened this issue 10 months ago • 6 comments

sorry if this is a noob question, but why do you have 2 x mqtt_event_handler() ? one in main.c the other main_sub.c, as both files included in the Makefile... i dont see #if build flag, so confused one uses xTaskNotifyGive( mqttBuf->taskHandle ); the other xEventGroupClearBits(s_mqtt_event_group, MQTT_CONNECTED_BIT);

if the are both used, then totally confused...

I understand that to publish a message, then it has to be done in the CB, hence the xTaskNotify or xEventGroupClearBits, so another function can publish. I really would have through that any function should be able to publish at any time, but understand its only within the CB when CONNECTED. so shoudl we instead use esp_mqtt_client_enqueue(), so then the message just gets sent in the CB ? or is that why you are using QueueHandle_t xQueueCmd;, si that publish messages are simply queued, then all sent together in the CB notify with xTaskNotify ?

riwalker avatar Apr 08 '24 21:04 riwalker