[multiple] Add default initializers to uninitialized member variables (#14556)

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Jonathan Swoboda
2026-03-06 14:04:00 -05:00
committed by GitHub
parent 42dbb51022
commit 3c7956e72d
8 changed files with 27 additions and 27 deletions

View File

@@ -164,10 +164,10 @@ class BedJetHub : public esphome::ble_client::BLEClientNode, public PollingCompo
std::unique_ptr<BedjetCodec> codec_;
bool discover_characteristics_();
uint16_t char_handle_cmd_;
uint16_t char_handle_name_;
uint16_t char_handle_status_;
uint16_t config_descr_status_;
uint16_t char_handle_cmd_{0};
uint16_t char_handle_name_{0};
uint16_t char_handle_status_{0};
uint16_t config_descr_status_{0};
uint8_t write_notify_config_descriptor_(bool enable);
};

View File

@@ -67,21 +67,21 @@ class CurrentBasedCover : public cover::Cover, public Component {
sensor::Sensor *open_sensor_{nullptr};
Trigger<> open_trigger_;
float open_moving_current_threshold_;
float open_moving_current_threshold_{0.0f};
float open_obstacle_current_threshold_{FLT_MAX};
uint32_t open_duration_;
uint32_t open_duration_{0};
sensor::Sensor *close_sensor_{nullptr};
Trigger<> close_trigger_;
float close_moving_current_threshold_;
float close_moving_current_threshold_{0.0f};
float close_obstacle_current_threshold_{FLT_MAX};
uint32_t close_duration_;
uint32_t close_duration_{0};
uint32_t max_duration_{UINT32_MAX};
bool malfunction_detection_{true};
Trigger<> malfunction_trigger_;
uint32_t start_sensing_delay_;
float obstacle_rollback_;
uint32_t start_sensing_delay_{0};
float obstacle_rollback_{0.0f};
Trigger<> *prev_command_trigger_{nullptr};
uint32_t last_recompute_time_{0};

View File

@@ -145,7 +145,7 @@ class DeepSleepComponent : public Component {
#endif // USE_BK72XX
#ifdef USE_ESP32
InternalGPIOPin *wakeup_pin_;
InternalGPIOPin *wakeup_pin_{nullptr};
WakeupPinMode wakeup_pin_mode_{WAKEUP_PIN_MODE_IGNORE};
#if !defined(USE_ESP32_VARIANT_ESP32C2) && !defined(USE_ESP32_VARIANT_ESP32C3)

View File

@@ -63,8 +63,8 @@ class MAX6956 : public Component, public i2c::I2CDevice {
bool read_reg_(uint8_t reg, uint8_t *value);
// write a value to a given register
bool write_reg_(uint8_t reg, uint8_t value);
max6956::MAX6956CURRENTMODE brightness_mode_;
uint8_t global_brightness_;
max6956::MAX6956CURRENTMODE brightness_mode_{};
uint8_t global_brightness_{0};
private:
int8_t prev_bright_[28] = {0};

View File

@@ -67,9 +67,9 @@ class MS8607Component : public PollingComponent, public i2c::I2CDevice {
/// use raw temperature & pressure to calculate & publish values
void calculate_values_(uint32_t raw_temperature, uint32_t raw_pressure);
sensor::Sensor *temperature_sensor_;
sensor::Sensor *pressure_sensor_;
sensor::Sensor *humidity_sensor_;
sensor::Sensor *temperature_sensor_{nullptr};
sensor::Sensor *pressure_sensor_{nullptr};
sensor::Sensor *humidity_sensor_{nullptr};
/** I2CDevice object to communicate with secondary I2C address for the humidity sensor
*
@@ -77,7 +77,7 @@ class MS8607Component : public PollingComponent, public i2c::I2CDevice {
*
* Default address for humidity is 0x40
*/
MS8607HumidityDevice *humidity_device_;
MS8607HumidityDevice *humidity_device_{nullptr};
/// This device's pressure & temperature calibration values, read from PROM
struct CalibrationValues {

View File

@@ -96,7 +96,7 @@ class RemoteTransmitterComponent : public remote_base::RemoteTransmitterBase,
bool inverted_{false};
bool non_blocking_{false};
#endif
uint8_t carrier_duty_percent_;
uint8_t carrier_duty_percent_{50};
Trigger<> transmit_trigger_;
Trigger<> complete_trigger_;

View File

@@ -104,12 +104,12 @@ class SEN5XComponent : public PollingComponent, public sensirion_common::Sensiri
char serial_number_[17] = "UNKNOWN";
uint16_t voc_baseline_state_[4]{0};
uint32_t voc_baseline_time_;
uint16_t firmware_version_;
uint32_t voc_baseline_time_{0};
uint16_t firmware_version_{0};
Sen5xType type_{Sen5xType::UNKNOWN};
ERRORCODE error_code_;
ERRORCODE error_code_{ERRORCODE::UNKNOWN};
bool initialized_{false};
bool store_baseline_;
bool store_baseline_{false};
sensor::Sensor *pm_1_0_sensor_{nullptr};
sensor::Sensor *pm_2_5_sensor_{nullptr};

View File

@@ -107,11 +107,11 @@ class Sim800LComponent : public uart::UARTDevice, public PollingComponent {
std::string recipient_;
std::string outgoing_message_;
std::string ussd_;
bool send_pending_;
bool dial_pending_;
bool connect_pending_;
bool disconnect_pending_;
bool send_ussd_pending_;
bool send_pending_{false};
bool dial_pending_{false};
bool connect_pending_{false};
bool disconnect_pending_{false};
bool send_ussd_pending_{false};
uint8_t call_state_{6};
CallbackManager<void(std::string, std::string)> sms_received_callback_;