mirror of
https://github.com/Threnklyn/esphome-dev.git
synced 2026-05-31 18:18:27 +02:00
Activate some clang-tidy checks (#1884)
This commit is contained in:
@@ -120,7 +120,7 @@ void ESPRangeView::darken(uint8_t delta) {
|
||||
for (auto c : *this)
|
||||
c.darken(delta);
|
||||
}
|
||||
ESPRangeView &ESPRangeView::operator=(const ESPRangeView &rhs) {
|
||||
ESPRangeView &ESPRangeView::operator=(const ESPRangeView &rhs) { // NOLINT
|
||||
// If size doesn't match, error (todo warning)
|
||||
if (rhs.size() != this->size())
|
||||
return *this;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "esphome/core/component.h"
|
||||
#include "esphome/components/light/light_state.h"
|
||||
#include "esphome/components/light/addressable_light.h"
|
||||
@@ -51,9 +53,9 @@ class AddressableLightEffect : public LightEffect {
|
||||
class AddressableLambdaLightEffect : public AddressableLightEffect {
|
||||
public:
|
||||
AddressableLambdaLightEffect(const std::string &name,
|
||||
const std::function<void(AddressableLight &, Color, bool initial_run)> &f,
|
||||
std::function<void(AddressableLight &, Color, bool initial_run)> f,
|
||||
uint32_t update_interval)
|
||||
: AddressableLightEffect(name), f_(f), update_interval_(update_interval) {}
|
||||
: AddressableLightEffect(name), f_(std::move(f)), update_interval_(update_interval) {}
|
||||
void start() override { this->initial_run_ = true; }
|
||||
void apply(AddressableLight &it, const Color ¤t_color) override {
|
||||
const uint32_t now = millis();
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "light_effect.h"
|
||||
#include "esphome/core/automation.h"
|
||||
|
||||
@@ -85,8 +87,8 @@ class RandomLightEffect : public LightEffect {
|
||||
|
||||
class LambdaLightEffect : public LightEffect {
|
||||
public:
|
||||
LambdaLightEffect(const std::string &name, const std::function<void()> &f, uint32_t update_interval)
|
||||
: LightEffect(name), f_(f), update_interval_(update_interval) {}
|
||||
LambdaLightEffect(const std::string &name, std::function<void()> f, uint32_t update_interval)
|
||||
: LightEffect(name), f_(std::move(f)), update_interval_(update_interval) {}
|
||||
|
||||
void apply() override {
|
||||
const uint32_t now = millis();
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "esphome/core/component.h"
|
||||
#include "light_color_values.h"
|
||||
#include "light_state.h"
|
||||
@@ -11,7 +13,7 @@ class LightState;
|
||||
|
||||
class LightEffect {
|
||||
public:
|
||||
explicit LightEffect(const std::string &name) : name_(name) {}
|
||||
explicit LightEffect(std::string name) : name_(std::move(name)) {}
|
||||
|
||||
/// Initialize this LightEffect. Will be called once after creation.
|
||||
virtual void start() {}
|
||||
|
||||
@@ -173,7 +173,7 @@ void LightState::loop() {
|
||||
}
|
||||
LightTraits LightState::get_traits() { return this->output_->get_traits(); }
|
||||
const std::vector<LightEffect *> &LightState::get_effects() const { return this->effects_; }
|
||||
void LightState::add_effects(const std::vector<LightEffect *> effects) {
|
||||
void LightState::add_effects(const std::vector<LightEffect *> &effects) {
|
||||
this->effects_.reserve(this->effects_.size() + effects.size());
|
||||
for (auto *effect : effects) {
|
||||
this->effects_.push_back(effect);
|
||||
|
||||
@@ -269,7 +269,7 @@ class LightState : public Nameable, public Component {
|
||||
|
||||
const std::vector<LightEffect *> &get_effects() const;
|
||||
|
||||
void add_effects(std::vector<LightEffect *> effects);
|
||||
void add_effects(const std::vector<LightEffect *> &effects);
|
||||
|
||||
void current_values_as_binary(bool *binary);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user