1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-29 00:22:21 +01:00

Addressable updates

This commit is contained in:
Otto Winter
2019-04-25 10:36:55 +02:00
parent 766f6c045d
commit 595dfe7e24
13 changed files with 193 additions and 41 deletions

View File

@@ -1,6 +1,7 @@
#pragma once
#include "light_effect.h"
#include "esphome/core/automation.h"
namespace esphome {
namespace light {
@@ -63,6 +64,21 @@ class LambdaLightEffect : public LightEffect {
uint32_t last_run_{0};
};
class AutomationLightEffect : public LightEffect {
public:
AutomationLightEffect(const std::string &name) : LightEffect(name) {}
void stop() override { this->trig_->stop(); }
void apply() override {
if (!this->trig_->is_running()) {
this->trig_->trigger();
}
}
Trigger<> *get_trig() const { return trig_; }
protected:
Trigger<> *trig_{new Trigger<>};
};
struct StrobeLightEffectColor {
LightColorValues color;
uint32_t duration;