mirror of
https://github.com/esphome/esphome.git
synced 2024-12-22 13:34:54 +01:00
Cleanup flash transitions (#2227)
This commit is contained in:
parent
edcd88123d
commit
9937ad7fa0
1 changed files with 1 additions and 4 deletions
|
@ -86,12 +86,10 @@ class LightFlashTransformer : public LightTransformer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (millis() > this->start_time_ + this->length_ - this->transition_length_ &&
|
if (millis() > this->start_time_ + this->length_ - this->transition_length_) {
|
||||||
!this->secondary_transition_occurred_) {
|
|
||||||
// second transition back to start value
|
// second transition back to start value
|
||||||
this->transformer_ = this->state_.get_output()->create_default_transition();
|
this->transformer_ = this->state_.get_output()->create_default_transition();
|
||||||
this->transformer_->setup(this->state_.current_values, this->get_start_values(), this->transition_length_);
|
this->transformer_->setup(this->state_.current_values, this->get_start_values(), this->transition_length_);
|
||||||
this->secondary_transition_occurred_ = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// once transition is complete, don't change states until next transition
|
// once transition is complete, don't change states until next transition
|
||||||
|
@ -108,7 +106,6 @@ class LightFlashTransformer : public LightTransformer {
|
||||||
protected:
|
protected:
|
||||||
LightState &state_;
|
LightState &state_;
|
||||||
uint32_t transition_length_;
|
uint32_t transition_length_;
|
||||||
bool secondary_transition_occurred_{false};
|
|
||||||
std::unique_ptr<LightTransformer> transformer_{nullptr};
|
std::unique_ptr<LightTransformer> transformer_{nullptr};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue