mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-31 07:03:55 +00:00 
			
		
		
		
	Fixes for async MQTT (#9273)
This commit is contained in:
		| @@ -163,12 +163,20 @@ void MQTTBackendESP32::mqtt_event_handler_(const Event &event) { | |||||||
|     case MQTT_EVENT_CONNECTED: |     case MQTT_EVENT_CONNECTED: | ||||||
|       ESP_LOGV(TAG, "MQTT_EVENT_CONNECTED"); |       ESP_LOGV(TAG, "MQTT_EVENT_CONNECTED"); | ||||||
|       this->is_connected_ = true; |       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); |       this->on_connect_.call(event.session_present); | ||||||
|       break; |       break; | ||||||
|     case MQTT_EVENT_DISCONNECTED: |     case MQTT_EVENT_DISCONNECTED: | ||||||
|       ESP_LOGV(TAG, "MQTT_EVENT_DISCONNECTED"); |       ESP_LOGV(TAG, "MQTT_EVENT_DISCONNECTED"); | ||||||
|       // TODO is there a way to get the disconnect reason? |       // TODO is there a way to get the disconnect reason? | ||||||
|       this->is_connected_ = false; |       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); |       this->on_disconnect_.call(MQTTClientDisconnectReason::TCP_DISCONNECTED); | ||||||
|       break; |       break; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -116,7 +116,7 @@ struct QueueElement { | |||||||
| class MQTTBackendESP32 final : public MQTTBackend { | class MQTTBackendESP32 final : public MQTTBackend { | ||||||
|  public: |  public: | ||||||
|   static const size_t MQTT_BUFFER_SIZE = 4096; |   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 size_t TASK_STACK_SIZE_TLS = 4096;  // Larger stack for TLS operations | ||||||
|   static const ssize_t TASK_PRIORITY = 5; |   static const ssize_t TASK_PRIORITY = 5; | ||||||
|   static const uint8_t MQTT_QUEUE_LENGTH = 30;  // 30*12 bytes = 360 |   static const uint8_t MQTT_QUEUE_LENGTH = 30;  // 30*12 bytes = 360 | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user