mirror of
https://github.com/esphome/esphome.git
synced 2026-09-18 18:48:39 +00:00
[gpio] Use a user provided default constructor for GPIOSwitch (#19203)
This commit is contained in:
@@ -9,6 +9,9 @@ namespace esphome::gpio {
|
||||
|
||||
class GPIOSwitch final : public switch_::Switch, public Component {
|
||||
public:
|
||||
// User provided, not "= default": `new(p) GPIOSwitch()` would zero-fill .bss that is already zero.
|
||||
GPIOSwitch() {}
|
||||
|
||||
void set_pin(GPIOPin *pin) { pin_ = pin; }
|
||||
|
||||
// ========== INTERNAL METHODS ==========
|
||||
@@ -25,7 +28,7 @@ class GPIOSwitch final : public switch_::Switch, public Component {
|
||||
protected:
|
||||
void write_state(bool state) override;
|
||||
|
||||
GPIOPin *pin_;
|
||||
GPIOPin *pin_{nullptr};
|
||||
#ifdef USE_GPIO_SWITCH_INTERLOCK
|
||||
FixedVector<Switch *> interlock_;
|
||||
uint32_t interlock_wait_time_{0};
|
||||
|
||||
Reference in New Issue
Block a user