mirror of
https://github.com/esphome/esphome.git
synced 2024-11-23 07:28:10 +01:00
Fix or filter (#6574)
Co-authored-by: Jonathan Swoboda <jonathan.swoboda>
This commit is contained in:
parent
aee2a49cad
commit
0874440a31
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) {
|
||||
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