mirror of
https://github.com/esphome/esphome.git
synced 2024-12-22 13:34:54 +01:00
Allow one timing to cancel others (#6744)
Co-authored-by: Lars Bilger <lars.bilger@lht.dlh.de>
This commit is contained in:
parent
073fb4c124
commit
8952719045
2 changed files with 7 additions and 0 deletions
|
@ -98,6 +98,11 @@ void binary_sensor::MultiClickTrigger::schedule_is_not_valid_(uint32_t max_lengt
|
||||||
this->schedule_cooldown_();
|
this->schedule_cooldown_();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
void binary_sensor::MultiClickTrigger::cancel() {
|
||||||
|
ESP_LOGV(TAG, "Multi Click: Sequence explicitly cancelled.");
|
||||||
|
this->is_valid_ = false;
|
||||||
|
this->schedule_cooldown_();
|
||||||
|
}
|
||||||
void binary_sensor::MultiClickTrigger::trigger_() {
|
void binary_sensor::MultiClickTrigger::trigger_() {
|
||||||
ESP_LOGV(TAG, "Multi Click: Hooray, multi click is valid. Triggering!");
|
ESP_LOGV(TAG, "Multi Click: Hooray, multi click is valid. Triggering!");
|
||||||
this->at_index_.reset();
|
this->at_index_.reset();
|
||||||
|
|
|
@ -105,6 +105,8 @@ class MultiClickTrigger : public Trigger<>, public Component {
|
||||||
|
|
||||||
void set_invalid_cooldown(uint32_t invalid_cooldown) { this->invalid_cooldown_ = invalid_cooldown; }
|
void set_invalid_cooldown(uint32_t invalid_cooldown) { this->invalid_cooldown_ = invalid_cooldown; }
|
||||||
|
|
||||||
|
void cancel();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void on_state_(bool state);
|
void on_state_(bool state);
|
||||||
void schedule_cooldown_();
|
void schedule_cooldown_();
|
||||||
|
|
Loading…
Reference in a new issue