11 if (
state == this->last_state_) {
14 this->last_state_ =
state;
17 if (this->is_in_cooldown_) {
21 if (!this->at_index_.has_value()) {
26 ESP_LOGV(TAG,
"Multi Click: Starting multi click action!");
28 if (this->timing_.size() == 1 && evt.
max_length == 4294967294UL) {
29 this->set_timeout(
"trigger", evt.
min_length, [
this]() { this->trigger_(); });
35 ESP_LOGV(TAG,
"Multi Click: action not started because first level does not match!");
41 if (!this->is_valid_) {
42 this->schedule_cooldown_();
46 if (*this->at_index_ == this->timing_.size()) {
54 ESP_LOGV(TAG,
"A i=%zu min=%" PRIu32
" max=%" PRIu32, *this->at_index_, evt.
min_length, evt.
max_length);
57 }
else if (*this->at_index_ + 1 != this->timing_.size()) {
58 ESP_LOGV(TAG,
"B i=%zu min=%" PRIu32, *this->at_index_, evt.
min_length);
59 this->cancel_timeout(
"is_not_valid");
62 ESP_LOGV(TAG,
"C i=%zu min=%" PRIu32, *this->at_index_, evt.
min_length);
63 this->is_valid_ =
false;
64 this->cancel_timeout(
"is_not_valid");
65 this->set_timeout(
"trigger", evt.
min_length, [
this]() { this->trigger_(); });
68 *this->at_index_ = *this->at_index_ + 1;