mirror of
https://github.com/esphome/esphome.git
synced 2024-12-26 07:24:54 +01:00
Fix or filter (#6574)
Co-authored-by: Jonathan Swoboda <jonathan.swoboda>
This commit is contained in:
parent
44d13f2405
commit
3e64876097
2 changed files with 6 additions and 1 deletions
|
@ -359,11 +359,15 @@ OrFilter::OrFilter(std::vector<Filter *> filters) : filters_(std::move(filters))
|
|||
OrFilter::PhiNode::PhiNode(OrFilter *or_parent) : or_parent_(or_parent) {}
|
||||
|
||||
optional<float> OrFilter::PhiNode::new_value(float value) {
|
||||
this->or_parent_->output(value);
|
||||
if (!this->or_parent_->has_value_) {
|
||||
this->or_parent_->output(value);
|
||||
this->or_parent_->has_value_ = true;
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
optional<float> OrFilter::new_value(float value) {
|
||||
this->has_value_ = false;
|
||||
for (Filter *filter : this->filters_)
|
||||
filter->input(value);
|
||||
|
||||
|
|
|
@ -388,6 +388,7 @@ class OrFilter : public Filter {
|
|||
};
|
||||
|
||||
std::vector<Filter *> filters_;
|
||||
bool has_value_{false};
|
||||
PhiNode phi_;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue