1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-26 23:22:21 +01:00

Reduce API memory footprint through bitfield consolidation and type sizing (#9252)

This commit is contained in:
J. Nick Koston
2025-06-29 18:42:57 -05:00
committed by GitHub
parent d78b720350
commit 24bbfcdce7
5 changed files with 96 additions and 84 deletions

View File

@@ -104,7 +104,7 @@ void APIServer::setup() {
return;
}
for (auto &c : this->clients_) {
if (!c->remove_)
if (!c->flags_.remove)
c->try_send_log_message(level, tag, message);
}
});
@@ -116,7 +116,7 @@ void APIServer::setup() {
esp32_camera::global_esp32_camera->add_image_callback(
[this](const std::shared_ptr<esp32_camera::CameraImage> &image) {
for (auto &c : this->clients_) {
if (!c->remove_)
if (!c->flags_.remove)
c->set_camera_state(image);
}
});
@@ -176,7 +176,7 @@ void APIServer::loop() {
while (client_index < this->clients_.size()) {
auto &client = this->clients_[client_index];
if (!client->remove_) {
if (!client->flags_.remove) {
// Common case: process active client
client->loop();
client_index++;
@@ -431,7 +431,7 @@ void APIServer::set_port(uint16_t port) { this->port_ = port; }
void APIServer::set_password(const std::string &password) { this->password_ = password; }
void APIServer::set_batch_delay(uint32_t batch_delay) { this->batch_delay_ = batch_delay; }
void APIServer::set_batch_delay(uint16_t batch_delay) { this->batch_delay_ = batch_delay; }
void APIServer::send_homeassistant_service_call(const HomeassistantServiceResponse &call) {
for (auto &client : this->clients_) {
@@ -502,7 +502,7 @@ bool APIServer::save_noise_psk(psk_t psk, bool make_active) {
#ifdef USE_HOMEASSISTANT_TIME
void APIServer::request_time() {
for (auto &client : this->clients_) {
if (!client->remove_ && client->is_authenticated())
if (!client->flags_.remove && client->is_authenticated())
client->send_time_request();
}
}