mirror of
https://github.com/esphome/esphome.git
synced 2026-05-28 21:59:59 +08:00
[multiple] Add default initializers to uninitialized member variables (#14636)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -41,9 +41,9 @@ class DutyTimeSensor : public sensor::Sensor, public PollingComponent {
|
|||||||
sensor::Sensor *last_duty_time_sensor_{nullptr};
|
sensor::Sensor *last_duty_time_sensor_{nullptr};
|
||||||
ESPPreferenceObject pref_;
|
ESPPreferenceObject pref_;
|
||||||
|
|
||||||
uint32_t total_sec_;
|
uint32_t total_sec_{0};
|
||||||
uint32_t last_time_;
|
uint32_t last_time_{0};
|
||||||
uint32_t edge_time_;
|
uint32_t edge_time_{0};
|
||||||
bool last_state_{false};
|
bool last_state_{false};
|
||||||
bool restore_;
|
bool restore_;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -56,8 +56,8 @@ class GrowattSolar : public PollingComponent, public modbus::ModbusDevice {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool waiting_to_update_;
|
bool waiting_to_update_{false};
|
||||||
uint32_t last_send_;
|
uint32_t last_send_{0};
|
||||||
|
|
||||||
struct GrowattPhase {
|
struct GrowattPhase {
|
||||||
sensor::Sensor *voltage_sensor_{nullptr};
|
sensor::Sensor *voltage_sensor_{nullptr};
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ class HTE501Component : public PollingComponent, public i2c::I2CDevice {
|
|||||||
void update() override;
|
void update() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
sensor::Sensor *temperature_sensor_;
|
sensor::Sensor *temperature_sensor_{nullptr};
|
||||||
sensor::Sensor *humidity_sensor_;
|
sensor::Sensor *humidity_sensor_{nullptr};
|
||||||
|
|
||||||
enum ErrorCode { NONE = 0, COMMUNICATION_FAILED, CRC_CHECK_FAILED } error_code_{NONE};
|
enum ErrorCode { NONE = 0, COMMUNICATION_FAILED, CRC_CHECK_FAILED } error_code_{NONE};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ class SelectCall {
|
|||||||
Select *const parent_;
|
Select *const parent_;
|
||||||
optional<size_t> index_;
|
optional<size_t> index_;
|
||||||
SelectOperation operation_{SELECT_OP_NONE};
|
SelectOperation operation_{SELECT_OP_NONE};
|
||||||
bool cycle_;
|
bool cycle_{false};
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace esphome::select
|
} // namespace esphome::select
|
||||||
|
|||||||
@@ -89,8 +89,8 @@ class UponorSmatrixComponent : public uart::UARTDevice, public Component {
|
|||||||
|
|
||||||
std::vector<uint8_t> rx_buffer_;
|
std::vector<uint8_t> rx_buffer_;
|
||||||
std::queue<std::vector<uint8_t>> tx_queue_;
|
std::queue<std::vector<uint8_t>> tx_queue_;
|
||||||
uint32_t last_rx_;
|
uint32_t last_rx_{0};
|
||||||
uint32_t last_tx_;
|
uint32_t last_tx_{0};
|
||||||
|
|
||||||
#ifdef USE_TIME
|
#ifdef USE_TIME
|
||||||
time::RealTimeClock *time_id_{nullptr};
|
time::RealTimeClock *time_id_{nullptr};
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ class IPAddressWiFiInfo final : public Component, public text_sensor::TextSensor
|
|||||||
const network::IPAddress &dns2) override;
|
const network::IPAddress &dns2) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::array<text_sensor::TextSensor *, 5> ip_sensors_;
|
std::array<text_sensor::TextSensor *, 5> ip_sensors_{};
|
||||||
};
|
};
|
||||||
|
|
||||||
class DNSAddressWifiInfo final : public Component, public text_sensor::TextSensor, public wifi::WiFiIPStateListener {
|
class DNSAddressWifiInfo final : public Component, public text_sensor::TextSensor, public wifi::WiFiIPStateListener {
|
||||||
|
|||||||
@@ -25,9 +25,9 @@ class X9cOutput : public output::FloatOutput, public Component {
|
|||||||
InternalGPIOPin *cs_pin_;
|
InternalGPIOPin *cs_pin_;
|
||||||
InternalGPIOPin *inc_pin_;
|
InternalGPIOPin *inc_pin_;
|
||||||
InternalGPIOPin *ud_pin_;
|
InternalGPIOPin *ud_pin_;
|
||||||
float initial_value_;
|
float initial_value_{0.0f};
|
||||||
float pot_value_;
|
float pot_value_{0.0f};
|
||||||
int step_delay_;
|
int step_delay_{0};
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace x9c
|
} // namespace x9c
|
||||||
|
|||||||
Reference in New Issue
Block a user