mirror of
https://github.com/esphome/esphome.git
synced 2024-12-24 16:58:07 +01:00
Fix strobe/flicker effect not using selected value (#749)
Fixes https://github.com/esphome/issues/issues/562
This commit is contained in:
parent
996c50e8f2
commit
aae633277f
@ -24,9 +24,12 @@ void LightState::start_flash_(const LightColorValues &target, uint32_t length) {
|
|||||||
|
|
||||||
LightState::LightState(const std::string &name, LightOutput *output) : Nameable(name), output_(output) {}
|
LightState::LightState(const std::string &name, LightOutput *output) : Nameable(name), output_(output) {}
|
||||||
|
|
||||||
void LightState::set_immediately_(const LightColorValues &target) {
|
void LightState::set_immediately_(const LightColorValues &target, bool set_remote_values) {
|
||||||
this->transformer_ = nullptr;
|
this->transformer_ = nullptr;
|
||||||
this->current_values = this->remote_values = target;
|
this->current_values = target;
|
||||||
|
if (set_remote_values) {
|
||||||
|
this->remote_values = target;
|
||||||
|
}
|
||||||
this->next_write_ = true;
|
this->next_write_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -327,10 +330,10 @@ void LightCall::perform() {
|
|||||||
|
|
||||||
// Also set light color values when starting an effect
|
// Also set light color values when starting an effect
|
||||||
// For example to turn off the light
|
// For example to turn off the light
|
||||||
this->parent_->set_immediately_(v);
|
this->parent_->set_immediately_(v, true);
|
||||||
} else {
|
} else {
|
||||||
// INSTANT CHANGE
|
// INSTANT CHANGE
|
||||||
this->parent_->set_immediately_(v);
|
this->parent_->set_immediately_(v, this->publish_);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this->publish_) {
|
if (this->publish_) {
|
||||||
|
@ -291,7 +291,7 @@ class LightState : public Nameable, public Component {
|
|||||||
void start_flash_(const LightColorValues &target, uint32_t length);
|
void start_flash_(const LightColorValues &target, uint32_t length);
|
||||||
|
|
||||||
/// Internal method to set the color values to target immediately (with no transition).
|
/// Internal method to set the color values to target immediately (with no transition).
|
||||||
void set_immediately_(const LightColorValues &target);
|
void set_immediately_(const LightColorValues &target, bool set_remote_values);
|
||||||
|
|
||||||
/// Internal method to start a transformer.
|
/// Internal method to start a transformer.
|
||||||
void set_transformer_(std::unique_ptr<LightTransformer> transformer);
|
void set_transformer_(std::unique_ptr<LightTransformer> transformer);
|
||||||
|
Loading…
Reference in New Issue
Block a user