1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-22 03:33:52 +01:00

no vector

This commit is contained in:
J. Nick Koston
2025-10-18 09:59:24 -10:00
parent 6a96e0ee90
commit c76e386a79
6 changed files with 65 additions and 10 deletions

View File

@@ -471,8 +471,10 @@ void ListEntitiesLightResponse::encode(ProtoWriteBuffer buffer) const {
buffer.encode_string(1, this->object_id_ref_);
buffer.encode_fixed32(2, this->key);
buffer.encode_string(3, this->name_ref_);
for (auto &it : this->supported_color_modes) {
buffer.encode_uint32(12, static_cast<uint32_t>(it), true);
for (uint8_t bit = 0; bit < 32; bit++) {
if (this->supported_color_modes & (1U << bit)) {
buffer.encode_uint32(12, bit, true);
}
}
buffer.encode_float(9, this->min_mireds);
buffer.encode_float(10, this->max_mireds);
@@ -492,9 +494,11 @@ void ListEntitiesLightResponse::calculate_size(ProtoSize &size) const {
size.add_length(1, this->object_id_ref_.size());
size.add_fixed32(1, this->key);
size.add_length(1, this->name_ref_.size());
if (!this->supported_color_modes.empty()) {
for (const auto &it : this->supported_color_modes) {
size.add_uint32_force(1, static_cast<uint32_t>(it));
if (this->supported_color_modes != 0) {
for (uint8_t bit = 0; bit < 32; bit++) {
if (this->supported_color_modes & (1U << bit)) {
size.add_uint32_force(1, static_cast<uint32_t>(bit));
}
}
}
size.add_float(1, this->min_mireds);