mirror of
https://github.com/esphome/esphome.git
synced 2024-11-27 01:08:03 +01:00
[duty_cycle] initialize two missing variables (#2088)
This commit is contained in:
parent
bdbd813455
commit
b0d12aeea1
2 changed files with 2 additions and 1 deletions
|
@ -13,6 +13,7 @@ void DutyCycleSensor::setup() {
|
||||||
this->store_.pin = this->pin_->to_isr();
|
this->store_.pin = this->pin_->to_isr();
|
||||||
this->store_.last_level = this->pin_->digital_read();
|
this->store_.last_level = this->pin_->digital_read();
|
||||||
this->last_update_ = micros();
|
this->last_update_ = micros();
|
||||||
|
this->store_.last_interrupt = micros();
|
||||||
|
|
||||||
this->pin_->attach_interrupt(DutyCycleSensorStore::gpio_intr, &this->store_, CHANGE);
|
this->pin_->attach_interrupt(DutyCycleSensorStore::gpio_intr, &this->store_, CHANGE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ class DutyCycleSensor : public sensor::Sensor, public PollingComponent {
|
||||||
protected:
|
protected:
|
||||||
GPIOPin *pin_;
|
GPIOPin *pin_;
|
||||||
|
|
||||||
DutyCycleSensorStore store_;
|
DutyCycleSensorStore store_{};
|
||||||
uint32_t last_update_;
|
uint32_t last_update_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue