Cleanup flash transitions (#2227)

This commit is contained in:
Alex 2021-09-01 18:56:40 -05:00 committed by GitHub
parent edcd88123d
commit 9937ad7fa0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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};
}; };