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