From 6b23b7cad7cecdd892dd36f8e9a5fce0e9d3cb29 Mon Sep 17 00:00:00 2001 From: RoboMagus <68224306+RoboMagus@users.noreply.github.com> Date: Thu, 15 Sep 2022 01:53:02 +0200 Subject: [PATCH] Unify 'nullptr' initalization of class members; (#3805) --- esphome/components/ade7953/ade7953.h | 2 +- esphome/components/api/api_frame_helper.h | 6 +++--- esphome/components/hydreon_rgxx/hydreon_rgxx.h | 6 +++--- esphome/components/mlx90393/sensor_mlx90393.h | 2 +- esphome/components/pid/pid_climate.h | 4 ++-- esphome/components/pulse_meter/pulse_meter_sensor.h | 4 ++-- .../components/pvvx_mithermometer/display/pvvx_display.h | 2 +- esphome/core/automation.h | 2 +- esphome/core/component.h | 2 +- esphome/core/gpio.h | 2 +- 10 files changed, 16 insertions(+), 16 deletions(-) diff --git a/esphome/components/ade7953/ade7953.h b/esphome/components/ade7953/ade7953.h index bb160cd8eb..418ad1c9e7 100644 --- a/esphome/components/ade7953/ade7953.h +++ b/esphome/components/ade7953/ade7953.h @@ -82,7 +82,7 @@ class ADE7953 : public i2c::I2CDevice, public PollingComponent { return i2c::ERROR_OK; } - InternalGPIOPin *irq_pin_ = nullptr; + InternalGPIOPin *irq_pin_{nullptr}; bool is_setup_{false}; sensor::Sensor *voltage_sensor_{nullptr}; sensor::Sensor *current_a_sensor_{nullptr}; diff --git a/esphome/components/api/api_frame_helper.h b/esphome/components/api/api_frame_helper.h index 57e3c961d5..348a9b574f 100644 --- a/esphome/components/api/api_frame_helper.h +++ b/esphome/components/api/api_frame_helper.h @@ -116,9 +116,9 @@ class APINoiseFrameHelper : public APIFrameHelper { std::vector prologue_; std::shared_ptr ctx_; - NoiseHandshakeState *handshake_ = nullptr; - NoiseCipherState *send_cipher_ = nullptr; - NoiseCipherState *recv_cipher_ = nullptr; + NoiseHandshakeState *handshake_{nullptr}; + NoiseCipherState *send_cipher_{nullptr}; + NoiseCipherState *recv_cipher_{nullptr}; NoiseProtocolId nid_; enum class State { diff --git a/esphome/components/hydreon_rgxx/hydreon_rgxx.h b/esphome/components/hydreon_rgxx/hydreon_rgxx.h index 1697060d28..34b9bd8d5e 100644 --- a/esphome/components/hydreon_rgxx/hydreon_rgxx.h +++ b/esphome/components/hydreon_rgxx/hydreon_rgxx.h @@ -58,9 +58,9 @@ class HydreonRGxxComponent : public PollingComponent, public uart::UARTDevice { sensor::Sensor *sensors_[NUM_SENSORS] = {nullptr}; #ifdef USE_BINARY_SENSOR - binary_sensor::BinarySensor *too_cold_sensor_ = nullptr; - binary_sensor::BinarySensor *lens_bad_sensor_ = nullptr; - binary_sensor::BinarySensor *em_sat_sensor_ = nullptr; + binary_sensor::BinarySensor *too_cold_sensor_{nullptr}; + binary_sensor::BinarySensor *lens_bad_sensor_{nullptr}; + binary_sensor::BinarySensor *em_sat_sensor_{nullptr}; #endif int16_t boot_count_ = 0; diff --git a/esphome/components/mlx90393/sensor_mlx90393.h b/esphome/components/mlx90393/sensor_mlx90393.h index fc33ad1aa8..8dfb7e6a13 100644 --- a/esphome/components/mlx90393/sensor_mlx90393.h +++ b/esphome/components/mlx90393/sensor_mlx90393.h @@ -52,7 +52,7 @@ class MLX90393Cls : public PollingComponent, public i2c::I2CDevice, public MLX90 uint8_t temperature_oversampling_ = 0; uint8_t filter_; uint8_t resolutions_[3] = {0}; - GPIOPin *drdy_pin_ = nullptr; + GPIOPin *drdy_pin_{nullptr}; }; } // namespace mlx90393 diff --git a/esphome/components/pid/pid_climate.h b/esphome/components/pid/pid_climate.h index ff301386b6..095c00eb49 100644 --- a/esphome/components/pid/pid_climate.h +++ b/esphome/components/pid/pid_climate.h @@ -59,8 +59,8 @@ class PIDClimate : public climate::Climate, public Component { /// The sensor used for getting the current temperature sensor::Sensor *sensor_; - output::FloatOutput *cool_output_ = nullptr; - output::FloatOutput *heat_output_ = nullptr; + output::FloatOutput *cool_output_{nullptr}; + output::FloatOutput *heat_output_{nullptr}; PIDController controller_; /// Output value as reported by the PID controller, for PIDClimateSensor float output_value_; diff --git a/esphome/components/pulse_meter/pulse_meter_sensor.h b/esphome/components/pulse_meter/pulse_meter_sensor.h index cf08f8c92d..bf50eab6ff 100644 --- a/esphome/components/pulse_meter/pulse_meter_sensor.h +++ b/esphome/components/pulse_meter/pulse_meter_sensor.h @@ -31,11 +31,11 @@ class PulseMeterSensor : public sensor::Sensor, public Component { protected: static void gpio_intr(PulseMeterSensor *sensor); - InternalGPIOPin *pin_ = nullptr; + InternalGPIOPin *pin_{nullptr}; ISRInternalGPIOPin isr_pin_; uint32_t filter_us_ = 0; uint32_t timeout_us_ = 1000000UL * 60UL * 5UL; - sensor::Sensor *total_sensor_ = nullptr; + sensor::Sensor *total_sensor_{nullptr}; InternalFilterMode filter_mode_{FILTER_EDGE}; Deduplicator pulse_width_dedupe_; diff --git a/esphome/components/pvvx_mithermometer/display/pvvx_display.h b/esphome/components/pvvx_mithermometer/display/pvvx_display.h index 4de1ab7ba6..c7e7cc04fb 100644 --- a/esphome/components/pvvx_mithermometer/display/pvvx_display.h +++ b/esphome/components/pvvx_mithermometer/display/pvvx_display.h @@ -114,7 +114,7 @@ class PVVXDisplay : public ble_client::BLEClientNode, public PollingComponent { void delayed_disconnect_(); #ifdef USE_TIME void sync_time_(); - time::RealTimeClock *time_ = nullptr; + time::RealTimeClock *time_{nullptr}; #endif uint16_t char_handle_ = 0; bool connection_established_ = false; diff --git a/esphome/core/automation.h b/esphome/core/automation.h index 92bc32247b..84c754e081 100644 --- a/esphome/core/automation.h +++ b/esphome/core/automation.h @@ -176,7 +176,7 @@ template class Action { return this->next_->is_running(); } - Action *next_ = nullptr; + Action *next_{nullptr}; /// The number of instances of this sequence in the list of actions /// that is currently being executed. diff --git a/esphome/core/component.h b/esphome/core/component.h index e394736653..cb97a93d21 100644 --- a/esphome/core/component.h +++ b/esphome/core/component.h @@ -254,7 +254,7 @@ class Component { uint32_t component_state_{0x0000}; ///< State of this component. float setup_priority_override_{NAN}; - const char *component_source_ = nullptr; + const char *component_source_{nullptr}; }; /** This class simplifies creating components that periodically check a state. diff --git a/esphome/core/gpio.h b/esphome/core/gpio.h index b953a95664..1b6f2ba1e6 100644 --- a/esphome/core/gpio.h +++ b/esphome/core/gpio.h @@ -73,7 +73,7 @@ class ISRInternalGPIOPin { void pin_mode(gpio::Flags flags); protected: - void *arg_ = nullptr; + void *arg_{nullptr}; }; class InternalGPIOPin : public GPIOPin {