From 03ff9fca0baa403fe6e971b1ba802d3a47e55646 Mon Sep 17 00:00:00 2001 From: Rapsssito Date: Sat, 13 Jul 2024 11:24:39 +0200 Subject: [PATCH] Fix linting issues --- .../components/esp32_ble_server/ble_server_automations.cpp | 4 ++-- esphome/components/esp32_ble_server/ble_server_automations.h | 2 +- esphome/core/event_emitter.cpp | 4 ++-- esphome/core/event_emitter.h | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/esphome/components/esp32_ble_server/ble_server_automations.cpp b/esphome/components/esp32_ble_server/ble_server_automations.cpp index 202d15de17..e5009ce5f8 100644 --- a/esphome/components/esp32_ble_server/ble_server_automations.cpp +++ b/esphome/components/esp32_ble_server/ble_server_automations.cpp @@ -10,8 +10,8 @@ namespace esp32_ble_server_automations { using namespace esp32_ble; Trigger> *BLETriggers::create_on_write_trigger(BLECharacteristic *characteristic) { - Trigger> *on_write_trigger = - new Trigger>(); // NOLINT(cppcoreguidelines-owning-memory) + Trigger> *on_write_trigger = // NOLINT(cppcoreguidelines-owning-memory) + new Trigger>(); characteristic->EventEmitter>::on( BLECharacteristicEvt::VectorEvt::ON_WRITE, [on_write_trigger](const std::vector &data) { on_write_trigger->trigger(data); }); diff --git a/esphome/components/esp32_ble_server/ble_server_automations.h b/esphome/components/esp32_ble_server/ble_server_automations.h index c7483c7ae5..d37959537e 100644 --- a/esphome/components/esp32_ble_server/ble_server_automations.h +++ b/esphome/components/esp32_ble_server/ble_server_automations.h @@ -49,7 +49,7 @@ template class BLECharacteristicSetValueAction : public Actionparent_->set_value(this->value_.value(x...)); // Set the listener for read events this->listener_id_ = this->parent_->EventEmitter::on( - BLECharacteristicEvt::EmptyEvt::ON_READ, [this, x...](void) { + BLECharacteristicEvt::EmptyEvt::ON_READ, [this, x...]() { // Set the value of the characteristic every time it is read this->parent_->set_value(this->value_.value(x...)); }); diff --git a/esphome/core/event_emitter.cpp b/esphome/core/event_emitter.cpp index ba658d66ca..f86b221dad 100644 --- a/esphome/core/event_emitter.cpp +++ b/esphome/core/event_emitter.cpp @@ -4,9 +4,9 @@ namespace esphome { static const char *const TAG = "event_emitter"; -void RaiseEventEmitterFullError(EventEmitterListenerID id) { +void RaiseEventEmitterFullError() { ESP_LOGE(TAG, "EventEmitter has reached the maximum number of listeners for event"); - ESP_LOGW(TAG, "Removing listener with ID %ld to make space for new listener", id); + ESP_LOGW(TAG, "Removing listener to make space for new listener"); } } // namespace esphome diff --git a/esphome/core/event_emitter.h b/esphome/core/event_emitter.h index 0f33dd2687..a5d4bea978 100644 --- a/esphome/core/event_emitter.h +++ b/esphome/core/event_emitter.h @@ -9,7 +9,7 @@ namespace esphome { using EventEmitterListenerID = uint32_t; -void RaiseEventEmitterFullError(EventEmitterListenerID id); +void RaiseEventEmitterFullError(); // EventEmitter class that can emit events with a specific name (it is highly recommended to use an enum class for this) // and a list of arguments. Supports multiple listeners for each event. @@ -40,7 +40,7 @@ template class EventEmitter { // Check if the map is full if (listeners_[event].size() == std::numeric_limits::max()) { // Raise an error if the map is full - RaiseEventEmitterFullError(0); + RaiseEventEmitterFullError(); off(event, 0); return 0; }