mirror of
https://github.com/esphome/esphome.git
synced 2026-09-12 15:57:33 +00:00
Merge remote-tracking branch 'upstream/binary_sensor_multiclick_static_array' into integration
This commit is contained in:
@@ -105,10 +105,10 @@ class MultiClickTriggerBase : public Trigger<>, public Component {
|
||||
void set_invalid_cooldown(uint32_t invalid_cooldown) { this->invalid_cooldown_ = invalid_cooldown; }
|
||||
|
||||
void cancel();
|
||||
|
||||
protected:
|
||||
MultiClickTriggerBase(const MultiClickTriggerBase &) = delete;
|
||||
MultiClickTriggerBase &operator=(const MultiClickTriggerBase &) = delete;
|
||||
|
||||
protected:
|
||||
void on_state_(bool state);
|
||||
void schedule_cooldown_();
|
||||
void schedule_is_valid_(uint32_t min_length);
|
||||
@@ -131,12 +131,7 @@ template<size_t N> class MultiClickTrigger : public MultiClickTriggerBase {
|
||||
public:
|
||||
MultiClickTrigger(BinarySensor *parent, std::initializer_list<MultiClickTriggerEvent> timing)
|
||||
: MultiClickTriggerBase(parent) {
|
||||
size_t i = 0;
|
||||
for (const auto &t : timing) {
|
||||
if (i >= N)
|
||||
break;
|
||||
this->timing_storage_[i++] = t;
|
||||
}
|
||||
init_array_from(this->timing_storage_, timing);
|
||||
this->timing_ = this->timing_storage_.data();
|
||||
this->timing_count_ = N;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user