Fix clang-tidy

This commit is contained in:
Rapsssito 2024-08-14 14:13:36 +02:00
parent 4cec5d8351
commit 734c2d6bbc

View file

@ -196,8 +196,7 @@ void ESP32ImprovComponent::set_state_(improv::State state) {
ESP_LOGV(TAG, "Setting state: %d", state); ESP_LOGV(TAG, "Setting state: %d", state);
this->state_ = state; this->state_ = state;
if (this->status_->get_value().empty() || this->status_->get_value()[0] != state) { if (this->status_->get_value().empty() || this->status_->get_value()[0] != state) {
uint8_t data[1]{state}; this->status_->set_value(ByteBuffer::wrap(static_cast<uint8_t>(state)));
this->status_->set_value(ByteBuffer::wrap(data));
if (state != improv::STATE_STOPPED) if (state != improv::STATE_STOPPED)
this->status_->notify(); this->status_->notify();
} }
@ -226,8 +225,7 @@ void ESP32ImprovComponent::set_error_(improv::Error error) {
ESP_LOGE(TAG, "Error: %d", error); ESP_LOGE(TAG, "Error: %d", error);
} }
if (this->error_->get_value().empty() || this->error_->get_value()[0] != error) { if (this->error_->get_value().empty() || this->error_->get_value()[0] != error) {
uint8_t data[1]{error}; this->error_->set_value(ByteBuffer::wrap(static_cast<uint8_t>(error)));
this->error_->set_value(ByteBuffer::wrap(data));
if (this->state_ != improv::STATE_STOPPED) if (this->state_ != improv::STATE_STOPPED)
this->error_->notify(); this->error_->notify();
} }