mirror of
https://github.com/esphome/esphome.git
synced 2026-09-18 10:38:38 +00:00
[gpio] Use a user provided default constructor for GPIOBinarySensor (#19143)
This commit is contained in:
@@ -47,6 +47,9 @@ class GPIOBinarySensorStore {
|
||||
|
||||
class GPIOBinarySensor final : public binary_sensor::BinarySensor, public Component {
|
||||
public:
|
||||
// User provided, not "= default": `new(p) GPIOBinarySensor()` would zero-fill .bss that is already zero.
|
||||
GPIOBinarySensor() {}
|
||||
|
||||
// No destructor needed: ESPHome components are created at boot and live forever.
|
||||
// Interrupts are only detached on reboot when memory is cleared anyway.
|
||||
|
||||
@@ -70,7 +73,7 @@ class GPIOBinarySensor final : public binary_sensor::BinarySensor, public Compon
|
||||
void loop() override;
|
||||
|
||||
protected:
|
||||
GPIOPin *pin_;
|
||||
GPIOPin *pin_{nullptr};
|
||||
GPIOBinarySensorStore store_;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user