From 59485c1d2b9090dfe2e30ff41e8111ad0466a6e8 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 8 Nov 2025 23:14:57 -0600 Subject: [PATCH] save 4 bytes --- esphome/components/remote_base/raw_protocol.h | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/esphome/components/remote_base/raw_protocol.h b/esphome/components/remote_base/raw_protocol.h index 4f50a85908..f59431c88a 100644 --- a/esphome/components/remote_base/raw_protocol.h +++ b/esphome/components/remote_base/raw_protocol.h @@ -44,19 +44,18 @@ template class RawAction : public RemoteTransmitterActionBasecode_.func = func; - this->static_ = false; + this->len_ = -1; } void set_code_static(const int32_t *code, size_t len) { - this->code_.static_code.data = code; - this->code_.static_code.len = len; - this->static_ = true; + this->code_.data = code; + this->len_ = len; } TEMPLATABLE_VALUE(uint32_t, carrier_frequency); void encode(RemoteTransmitData *dst, Ts... x) override { - if (this->static_) { - for (size_t i = 0; i < this->code_.static_code.len; i++) { - auto val = this->code_.static_code.data[i]; + if (this->len_ >= 0) { + for (size_t i = 0; i < static_cast(this->len_); i++) { + auto val = this->code_.data[i]; if (val < 0) { dst->space(static_cast(-val)); } else { @@ -70,13 +69,10 @@ template class RawAction : public RemoteTransmitterActionBase