mirror of
https://github.com/esphome/esphome.git
synced 2025-07-28 14:16:40 +00:00
Fixes for async MQTT (#9273)
This commit is contained in:
parent
aaa7117ec9
commit
8014cbc71e
@ -163,12 +163,20 @@ void MQTTBackendESP32::mqtt_event_handler_(const Event &event) {
|
||||
case MQTT_EVENT_CONNECTED:
|
||||
ESP_LOGV(TAG, "MQTT_EVENT_CONNECTED");
|
||||
this->is_connected_ = true;
|
||||
#if defined(USE_MQTT_IDF_ENQUEUE)
|
||||
this->last_dropped_log_time_ = 0;
|
||||
xTaskNotifyGive(this->task_handle_);
|
||||
#endif
|
||||
this->on_connect_.call(event.session_present);
|
||||
break;
|
||||
case MQTT_EVENT_DISCONNECTED:
|
||||
ESP_LOGV(TAG, "MQTT_EVENT_DISCONNECTED");
|
||||
// TODO is there a way to get the disconnect reason?
|
||||
this->is_connected_ = false;
|
||||
#if defined(USE_MQTT_IDF_ENQUEUE)
|
||||
this->last_dropped_log_time_ = 0;
|
||||
xTaskNotifyGive(this->task_handle_);
|
||||
#endif
|
||||
this->on_disconnect_.call(MQTTClientDisconnectReason::TCP_DISCONNECTED);
|
||||
break;
|
||||
|
||||
|
@ -116,7 +116,7 @@ struct QueueElement {
|
||||
class MQTTBackendESP32 final : public MQTTBackend {
|
||||
public:
|
||||
static const size_t MQTT_BUFFER_SIZE = 4096;
|
||||
static const size_t TASK_STACK_SIZE = 2048;
|
||||
static const size_t TASK_STACK_SIZE = 3072;
|
||||
static const size_t TASK_STACK_SIZE_TLS = 4096; // Larger stack for TLS operations
|
||||
static const ssize_t TASK_PRIORITY = 5;
|
||||
static const uint8_t MQTT_QUEUE_LENGTH = 30; // 30*12 bytes = 360
|
||||
|
Loading…
x
Reference in New Issue
Block a user