mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-31 07:03:55 +00:00 
			
		
		
		
	Merge branch 'api_connection_batch_prio' into integration
This commit is contained in:
		| @@ -180,7 +180,8 @@ void APIConnection::loop() { | ||||
|       on_fatal_error(); | ||||
|       ESP_LOGW(TAG, "%s is unresponsive; disconnecting", this->get_client_combined_info().c_str()); | ||||
|     } | ||||
|   } else if (now - this->last_traffic_ > KEEPALIVE_TIMEOUT_MS) { | ||||
|   } else if (now - this->last_traffic_ > KEEPALIVE_TIMEOUT_MS && !this->flags_.remove) { | ||||
|     // Only send ping if we're not disconnecting | ||||
|     ESP_LOGVV(TAG, "Sending keepalive PING"); | ||||
|     this->flags_.sent_ping = this->send_message(PingRequest()); | ||||
|     if (!this->flags_.sent_ping) { | ||||
| @@ -1625,8 +1626,15 @@ void APIConnection::DeferredBatch::add_item(EntityBase *entity, MessageCreator c | ||||
|  | ||||
| void APIConnection::DeferredBatch::add_item_front(EntityBase *entity, MessageCreator creator, uint8_t message_type, | ||||
|                                                   uint8_t estimated_size) { | ||||
|   // Insert at front for high priority messages (no deduplication check) | ||||
|   items.insert(items.begin(), BatchItem(entity, std::move(creator), message_type, estimated_size)); | ||||
|   // Add high priority message and swap to front | ||||
|   // This avoids expensive vector::insert which shifts all elements | ||||
|   // Note: We only ever have one high-priority message at a time (ping OR disconnect) | ||||
|   // If we're disconnecting, pings are blocked, so this simple swap is sufficient | ||||
|   items.emplace_back(entity, std::move(creator), message_type, estimated_size); | ||||
|   if (items.size() > 1) { | ||||
|     // Swap the new high-priority item to the front | ||||
|     std::swap(items.front(), items.back()); | ||||
|   } | ||||
| } | ||||
|  | ||||
| bool APIConnection::schedule_batch_() { | ||||
|   | ||||
| @@ -10,7 +10,7 @@ void opentherm::OpenthermOutput::write_state(float state) { | ||||
|   ESP_LOGD(TAG, "Received state: %.2f. Min value: %.2f, max value: %.2f", state, min_value_, max_value_); | ||||
|   this->state = state < 0.003 && this->zero_means_zero_ | ||||
|                     ? 0.0 | ||||
|                     : clamp(lerp(state, min_value_, max_value_), min_value_, max_value_); | ||||
|                     : clamp(std::lerp(min_value_, max_value_, state), min_value_, max_value_); | ||||
|   this->has_state_ = true; | ||||
|   ESP_LOGD(TAG, "Output %s set to %.2f", this->id_, this->state); | ||||
| } | ||||
|   | ||||
| @@ -88,9 +88,9 @@ void Servo::internal_write(float value) { | ||||
|   value = clamp(value, -1.0f, 1.0f); | ||||
|   float level; | ||||
|   if (value < 0.0) { | ||||
|     level = lerp(-value, this->idle_level_, this->min_level_); | ||||
|     level = std::lerp(this->idle_level_, this->min_level_, -value); | ||||
|   } else { | ||||
|     level = lerp(value, this->idle_level_, this->max_level_); | ||||
|     level = std::lerp(this->idle_level_, this->max_level_, value); | ||||
|   } | ||||
|   this->output_->set_level(level); | ||||
|   this->current_value_ = value; | ||||
|   | ||||
							
								
								
									
										1
									
								
								tests/components/captive_portal/test.bk72xx-ard.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								tests/components/captive_portal/test.bk72xx-ard.yaml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| <<: !include common.yaml | ||||
		Reference in New Issue
	
	Block a user