diff --git a/docker/rootfs/etc/cont-init.d/10-requirements.sh b/docker/rootfs/etc/cont-init.d/10-requirements.sh old mode 100755 new mode 100644 diff --git a/docker/rootfs/etc/cont-init.d/20-nginx.sh b/docker/rootfs/etc/cont-init.d/20-nginx.sh old mode 100755 new mode 100644 diff --git a/docker/rootfs/etc/nginx/nginx.conf b/docker/rootfs/etc/nginx/nginx.conf old mode 100755 new mode 100644 diff --git a/docker/rootfs/etc/services.d/esphome/finish b/docker/rootfs/etc/services.d/esphome/finish old mode 100755 new mode 100644 diff --git a/docker/rootfs/etc/services.d/esphome/run b/docker/rootfs/etc/services.d/esphome/run old mode 100755 new mode 100644 diff --git a/docker/rootfs/etc/services.d/nginx/finish b/docker/rootfs/etc/services.d/nginx/finish old mode 100755 new mode 100644 diff --git a/docker/rootfs/etc/services.d/nginx/run b/docker/rootfs/etc/services.d/nginx/run old mode 100755 new mode 100644 diff --git a/esphome/components/am2320/am2320.cpp b/esphome/components/am2320/am2320.cpp index 59cb977fe8..3674460fbe 100644 --- a/esphome/components/am2320/am2320.cpp +++ b/esphome/components/am2320/am2320.cpp @@ -69,7 +69,7 @@ void AM2320Component::dump_config() { } float AM2320Component::get_setup_priority() const { return setup_priority::DATA; } -bool AM2320Component::read_bytes_(uint8_t a_register, uint8_t *data, uint8_t len, uint32_t conversion) { +bool AM2320Component::read_bytes(uint8_t a_register, uint8_t *data, uint8_t len, uint32_t conversion) { if (!this->write_bytes(a_register, data, 2)) { ESP_LOGW(TAG, "Writing bytes for AM2320 failed!"); return false; @@ -80,7 +80,7 @@ bool AM2320Component::read_bytes_(uint8_t a_register, uint8_t *data, uint8_t len return this->parent_->raw_receive(this->address_, data, len); } -bool AM2320Component::read_data_(uint8_t *data) { +bool AM2320Component::read_data(uint8_t *data) { // Wake up this->write_bytes(0, data, 0); @@ -95,12 +95,7 @@ bool AM2320Component::read_data_(uint8_t *data) { checksum = data[7] << 8; checksum += data[6]; - if (crc_16(data, 6) != checksum) { - ESP_LOGW(TAG, "AM2320 Checksum invalid!"); - return false; - } - - return true; + return !; } } // namespace am2320 diff --git a/esphome/components/apds9960/apds9960.cpp b/esphome/components/apds9960/apds9960.cpp index 2e09d11182..a8bc8b6c85 100644 --- a/esphome/components/apds9960/apds9960.cpp +++ b/esphome/components/apds9960/apds9960.cpp @@ -158,7 +158,7 @@ void APDS9960::update() { void APDS9960::loop() { this->read_gesture_data_(); } -void APDS9960::read_color_data_(uint8_t status) { +void APDS9960::read_color_data(uint8_t status) { if (!this->is_color_enabled_()) return; @@ -190,7 +190,7 @@ void APDS9960::read_color_data_(uint8_t status) { if (this->blue_channel_ != nullptr) this->blue_channel_->publish_state(blue_perc); } -void APDS9960::read_proximity_data_(uint8_t status) { +void APDS9960::read_proximity_data(uint8_t status) { if (this->proximity_ == nullptr) return; diff --git a/esphome/components/api/user_services.h b/esphome/components/api/user_services.h index 92e7a2ca0e..7360db5552 100644 --- a/esphome/components/api/user_services.h +++ b/esphome/components/api/user_services.h @@ -80,7 +80,7 @@ template class UserService : public UserServiceDescriptor, publi template template -void UserService::execute_(std::vector args, seq) { +void UserService::execute(std::vector args, seq) { this->trigger((args[S].get_value())...); } template void UserService::encode_list_service_response(APIBuffer &buffer) { diff --git a/esphome/components/bang_bang/bang_bang_climate.cpp b/esphome/components/bang_bang/bang_bang_climate.cpp index 1bdabaec37..d477d2d4af 100644 --- a/esphome/components/bang_bang/bang_bang_climate.cpp +++ b/esphome/components/bang_bang/bang_bang_climate.cpp @@ -90,7 +90,7 @@ void BangBangClimate::compute_state_() { this->switch_to_mode_(target_mode); } -void BangBangClimate::switch_to_mode_(climate::ClimateMode mode) { +void BangBangClimate::switch_to_mode(climate::ClimateMode mode) { if (mode == this->internal_mode_) // already in target mode return; diff --git a/esphome/components/bang_bang/bang_bang_climate.h b/esphome/components/bang_bang/bang_bang_climate.h index 716655d20f..b1e0aa1deb 100644 --- a/esphome/components/bang_bang/bang_bang_climate.h +++ b/esphome/components/bang_bang/bang_bang_climate.h @@ -33,11 +33,11 @@ class BangBangClimate : public climate::Climate, public Component { protected: /// Override control to change settings of the climate device. - void control(const climate::ClimateCall &call) override; + void control_(const climate::ClimateCall &call) override; /// Change the away setting, will reset target temperatures to defaults. void change_away_(bool away); /// Return the traits of this controller. - climate::ClimateTraits traits() override; + climate::ClimateTraits traits_() override; /// Re-compute the state of this climate controller. void compute_state_(); diff --git a/esphome/components/binary_sensor/automation.cpp b/esphome/components/binary_sensor/automation.cpp index b8be2d1b1f..e2d55137bf 100644 --- a/esphome/components/binary_sensor/automation.cpp +++ b/esphome/components/binary_sensor/automation.cpp @@ -79,14 +79,14 @@ void binary_sensor::MultiClickTrigger::schedule_cooldown_() { this->cancel_timeout("is_valid"); this->cancel_timeout("is_not_valid"); } -void binary_sensor::MultiClickTrigger::schedule_is_valid_(uint32_t min_length) { +void binary_sensor::MultiClickTrigger::schedule_is_valid(uint32_t min_length) { this->is_valid_ = false; this->set_timeout("is_valid", min_length, [this]() { ESP_LOGV(TAG, "Multi Click: You can now %s the button.", this->parent_->state ? "RELEASE" : "PRESS"); this->is_valid_ = true; }); } -void binary_sensor::MultiClickTrigger::schedule_is_not_valid_(uint32_t max_length) { +void binary_sensor::MultiClickTrigger::schedule_is_not_valid(uint32_t max_length) { this->set_timeout("is_not_valid", max_length, [this]() { ESP_LOGV(TAG, "Multi Click: You waited too long to %s.", this->parent_->state ? "RELEASE" : "PRESS"); this->is_valid_ = false; diff --git a/esphome/components/binary_sensor/automation.h b/esphome/components/binary_sensor/automation.h index e9ff37446d..633b117477 100644 --- a/esphome/components/binary_sensor/automation.h +++ b/esphome/components/binary_sensor/automation.h @@ -136,7 +136,7 @@ template class BinarySensorCondition : public Condition { template class BinarySensorPublishAction : public Action { public: explicit BinarySensorPublishAction(BinarySensor *sensor) : sensor_(sensor) {} - TEMPLATABLE_VALUE(bool, state) + templatable_value(bool, state) void play(Ts... x) override { auto val = this->state_.value(x...); this->sensor_->publish_state(val); diff --git a/esphome/components/binary_sensor/binary_sensor.h b/esphome/components/binary_sensor/binary_sensor.h index 51c7a57ff6..d2cb06d94f 100644 --- a/esphome/components/binary_sensor/binary_sensor.h +++ b/esphome/components/binary_sensor/binary_sensor.h @@ -77,7 +77,7 @@ class BinarySensor : public Nameable { virtual std::string device_class(); protected: - uint32_t hash_base() override; + uint32_t hash_base_() override; CallbackManager state_callback_{}; optional device_class_{}; ///< Stores the override of the device class diff --git a/esphome/components/bme280/bme280.cpp b/esphome/components/bme280/bme280.cpp index f32a0d2861..948a69112c 100644 --- a/esphome/components/bme280/bme280.cpp +++ b/esphome/components/bme280/bme280.cpp @@ -204,7 +204,7 @@ void BME280Component::update() { this->status_clear_warning(); }); } -float BME280Component::read_temperature_(int32_t *t_fine) { +float BME280Component::read_temperature(int32_t *t_fine) { uint8_t data[3]; if (!this->read_bytes(BME280_REGISTER_TEMPDATA, data, 3)) return NAN; @@ -226,7 +226,7 @@ float BME280Component::read_temperature_(int32_t *t_fine) { return temperature / 100.0f; } -float BME280Component::read_pressure_(int32_t t_fine) { +float BME280Component::read_pressure(int32_t t_fine) { uint8_t data[3]; if (!this->read_bytes(BME280_REGISTER_PRESSUREDATA, data, 3)) return NAN; @@ -265,7 +265,7 @@ float BME280Component::read_pressure_(int32_t t_fine) { return (p / 256.0f) / 100.0f; } -float BME280Component::read_humidity_(int32_t t_fine) { +float BME280Component::read_humidity(int32_t t_fine) { uint16_t raw_adc; if (!this->read_byte_16(BME280_REGISTER_HUMIDDATA, &raw_adc) || raw_adc == 0x8000) return NAN; @@ -302,17 +302,17 @@ void BME280Component::set_humidity_oversampling(BME280Oversampling humidity_over this->humidity_oversampling_ = humidity_over_sampling; } void BME280Component::set_iir_filter(BME280IIRFilter iir_filter) { this->iir_filter_ = iir_filter; } -uint8_t BME280Component::read_u8_(uint8_t a_register) { +uint8_t BME280Component::read_u8(uint8_t a_register) { uint8_t data = 0; this->read_byte(a_register, &data); return data; } -uint16_t BME280Component::read_u16_le_(uint8_t a_register) { +uint16_t BME280Component::read_u16_le(uint8_t a_register) { uint16_t data = 0; this->read_byte_16(a_register, &data); return (data >> 8) | (data << 8); } -int16_t BME280Component::read_s16_le_(uint8_t a_register) { return this->read_u16_le_(a_register); } +int16_t BME280Component::read_s16_le(uint8_t a_register) { return this->read_u16_le_(a_register); } } // namespace bme280 } // namespace esphome diff --git a/esphome/components/bme680/bme680.cpp b/esphome/components/bme680/bme680.cpp index 77f381664b..9a5f0ccbcb 100644 --- a/esphome/components/bme680/bme680.cpp +++ b/esphome/components/bme680/bme680.cpp @@ -242,7 +242,7 @@ void BME680Component::update() { this->set_timeout("data", this->calc_meas_duration_(), [this]() { this->read_data_(); }); } -uint8_t BME680Component::calc_heater_resistance_(uint16_t temperature) { +uint8_t BME680Component::calc_heater_resistance(uint16_t temperature) { if (temperature < 200) temperature = 200; if (temperature > 400) @@ -273,7 +273,7 @@ uint8_t BME680Component::calc_heater_resistance_(uint16_t temperature) { return heatr_res; } -uint8_t BME680Component::calc_heater_duration_(uint16_t duration) { +uint8_t BME680Component::calc_heater_duration(uint16_t duration) { uint8_t factor = 0; uint8_t duration_value; @@ -323,7 +323,7 @@ void BME680Component::read_data_() { this->status_clear_warning(); } -float BME680Component::calc_temperature_(uint32_t raw_temperature) { +float BME680Component::calc_temperature(uint32_t raw_temperature) { float var1 = 0; float var2 = 0; float var3 = 0; @@ -349,7 +349,7 @@ float BME680Component::calc_temperature_(uint32_t raw_temperature) { return calc_temp; } -float BME680Component::calc_pressure_(uint32_t raw_pressure) { +float BME680Component::calc_pressure(uint32_t raw_pressure) { const float tfine = this->calibration_.tfine; const float p1 = this->calibration_.p1; const float p2 = this->calibration_.p2; @@ -391,7 +391,7 @@ float BME680Component::calc_pressure_(uint32_t raw_pressure) { return calc_pres / 100.0f; } -float BME680Component::calc_humidity_(uint16_t raw_humidity) { +float BME680Component::calc_humidity(uint16_t raw_humidity) { const float tfine = this->calibration_.tfine; const float h1 = this->calibration_.h1; const float h2 = this->calibration_.h2; @@ -426,7 +426,7 @@ float BME680Component::calc_humidity_(uint16_t raw_humidity) { return calc_hum; } -uint32_t BME680Component::calc_gas_resistance_(uint16_t raw_gas, uint8_t range) { +uint32_t BME680Component::calc_gas_resistance(uint16_t raw_gas, uint8_t range) { float calc_gas_res; float var1 = 0; float var2 = 0; @@ -441,7 +441,7 @@ uint32_t BME680Component::calc_gas_resistance_(uint16_t raw_gas, uint8_t range) return static_cast(calc_gas_res); } -uint32_t BME680Component::calc_meas_duration_() { +uint32_t BME680Component::calc_meas_duration() { uint32_t tph_dur; // Calculate in us uint32_t meas_cycles; const uint8_t os_to_meas_cycles[6] = {0, 1, 2, 4, 8, 16}; diff --git a/esphome/components/bmp085/bmp085.cpp b/esphome/components/bmp085/bmp085.cpp index 88c5313df5..f078b7d3e0 100644 --- a/esphome/components/bmp085/bmp085.cpp +++ b/esphome/components/bmp085/bmp085.cpp @@ -128,7 +128,7 @@ void BMP085Component::read_pressure_() { this->pressure_->publish_state(pressure); this->status_clear_warning(); } -bool BMP085Component::set_mode_(uint8_t mode) { +bool BMP085Component::set_mode(uint8_t mode) { ESP_LOGV(TAG, "Setting mode to 0x%02X...", mode); return this->write_byte(BMP085_REGISTER_CONTROL, mode); } diff --git a/esphome/components/bmp280/bmp280.cpp b/esphome/components/bmp280/bmp280.cpp index aed9f3e515..cf39755f0a 100644 --- a/esphome/components/bmp280/bmp280.cpp +++ b/esphome/components/bmp280/bmp280.cpp @@ -155,7 +155,7 @@ void BMP280Component::update() { }); } -float BMP280Component::read_temperature_(int32_t *t_fine) { +float BMP280Component::read_temperature(int32_t *t_fine) { uint8_t data[3]; if (!this->read_bytes(BMP280_REGISTER_TEMPDATA, data, 3)) return NAN; @@ -177,7 +177,7 @@ float BMP280Component::read_temperature_(int32_t *t_fine) { return temperature / 100.0f; } -float BMP280Component::read_pressure_(int32_t t_fine) { +float BMP280Component::read_pressure(int32_t t_fine) { uint8_t data[3]; if (!this->read_bytes(BMP280_REGISTER_PRESSUREDATA, data, 3)) return NAN; @@ -222,17 +222,17 @@ void BMP280Component::set_pressure_oversampling(BMP280Oversampling pressure_over this->pressure_oversampling_ = pressure_over_sampling; } void BMP280Component::set_iir_filter(BMP280IIRFilter iir_filter) { this->iir_filter_ = iir_filter; } -uint8_t BMP280Component::read_u8_(uint8_t a_register) { +uint8_t BMP280Component::read_u8(uint8_t a_register) { uint8_t data = 0; this->read_byte(a_register, &data); return data; } -uint16_t BMP280Component::read_u16_le_(uint8_t a_register) { +uint16_t BMP280Component::read_u16_le(uint8_t a_register) { uint16_t data = 0; this->read_byte_16(a_register, &data); return (data >> 8) | (data << 8); } -int16_t BMP280Component::read_s16_le_(uint8_t a_register) { return this->read_u16_le_(a_register); } +int16_t BMP280Component::read_s16_le(uint8_t a_register) { return this->read_u16_le_(a_register); } } // namespace bmp280 } // namespace esphome diff --git a/esphome/components/climate/climate.h b/esphome/components/climate/climate.h index c58eed1a7c..cd5eb6ab09 100644 --- a/esphome/components/climate/climate.h +++ b/esphome/components/climate/climate.h @@ -182,7 +182,7 @@ class Climate : public Nameable { * modes, temperature range etc. Each integration must implement this method and the return value must * be constant during all of execution time. */ - virtual ClimateTraits traits() = 0; + virtual ClimateTraits traits_() = 0; /** Control the climate device, this is a virtual method that each climate integration must implement. * @@ -200,7 +200,7 @@ class Climate : public Nameable { */ void save_state_(); - uint32_t hash_base() override; + uint32_t hash_base_() override; CallbackManager state_callback_{}; ESPPreferenceObject rtc_; diff --git a/esphome/components/coolix/coolix.h b/esphome/components/coolix/coolix.h index 0d52018d2a..020ca070d6 100644 --- a/esphome/components/coolix/coolix.h +++ b/esphome/components/coolix/coolix.h @@ -22,9 +22,9 @@ class CoolixClimate : public climate::Climate, public Component { protected: /// Override control to change settings of the climate device. - void control(const climate::ClimateCall &call) override; + void control_(const climate::ClimateCall &call) override; /// Return the traits of this controller. - climate::ClimateTraits traits() override; + climate::ClimateTraits traits_() override; /// Transmit via IR the state of this climate controller. void transmit_state_(); diff --git a/esphome/components/cover/cover.h b/esphome/components/cover/cover.h index 12011e1b4c..a28f79256b 100644 --- a/esphome/components/cover/cover.h +++ b/esphome/components/cover/cover.h @@ -117,7 +117,7 @@ class Cover : public Nameable { * COVER_CLOSED constants). */ float position; - ESPDEPRECATED(".state is deprecated, please use .position instead") float state; + espdeprecated(".state is deprecated, please use .position instead") float state; }; /// The current tilt value of the cover from 0.0 to 1.0. float tilt{COVER_OPEN}; @@ -164,10 +164,10 @@ class Cover : public Nameable { friend CoverCall; virtual void control(const CoverCall &call) = 0; - virtual std::string device_class(); + virtual std::string device_class_(); optional restore_state_(); - uint32_t hash_base() override; + uint32_t hash_base_() override; CallbackManager state_callback_{}; optional device_class_override_{}; diff --git a/esphome/components/cse7766/cse7766.cpp b/esphome/components/cse7766/cse7766.cpp index 358453a63a..596e7ec4f2 100644 --- a/esphome/components/cse7766/cse7766.cpp +++ b/esphome/components/cse7766/cse7766.cpp @@ -42,11 +42,7 @@ bool CSE7766Component::check_byte_() { } if (index == 1) { - if (byte != 0x5A) { - ESP_LOGV(TAG, "Invalid Header 2 Start: 0x%02X!", byte); - return false; - } - return true; + return !; } if (index == 23) { @@ -54,11 +50,7 @@ bool CSE7766Component::check_byte_() { for (uint8_t i = 2; i < 23; i++) checksum += this->raw_data_[i]; - if (checksum != this->raw_data_[23]) { - ESP_LOGW(TAG, "Invalid checksum from CSE7766: 0x%02X != 0x%02X", checksum, this->raw_data_[23]); - return false; - } - return true; + return !; } return true; @@ -161,7 +153,7 @@ void CSE7766Component::update() { this->current_counts_ = 0; } -uint32_t CSE7766Component::get_24_bit_uint_(uint8_t start_index) { +uint32_t CSE7766Component::get_24_bit_uint(uint8_t start_index) { return (uint32_t(this->raw_data_[start_index]) << 16) | (uint32_t(this->raw_data_[start_index + 1]) << 8) | uint32_t(this->raw_data_[start_index + 2]); } diff --git a/esphome/components/dallas/dallas_component.cpp b/esphome/components/dallas/dallas_component.cpp index 1d3e693ff9..06f000cf40 100644 --- a/esphome/components/dallas/dallas_component.cpp +++ b/esphome/components/dallas/dallas_component.cpp @@ -110,13 +110,7 @@ void DallasComponent::update() { disable_interrupts(); bool result; - if (!this->one_wire_->reset()) { - result = false; - } else { - result = true; - this->one_wire_->skip(); - this->one_wire_->write8(DALLAS_COMMAND_START_CONVERSION); - } + result = !; enable_interrupts(); if (!result) { @@ -168,17 +162,7 @@ const std::string &DallasTemperatureSensor::get_address_name() { } bool DallasTemperatureSensor::read_scratch_pad() { ESPOneWire *wire = this->parent_->one_wire_; - if (!wire->reset()) { - return false; - } - - wire->select(this->address_); - wire->write8(DALLAS_COMMAND_READ_SCRATCH_PAD); - - for (unsigned char &i : this->scratch_pad_) { - i = wire->read8(); - } - return true; + return !; } bool DallasTemperatureSensor::setup_sensor() { disable_interrupts(); @@ -244,11 +228,7 @@ bool DallasTemperatureSensor::check_scratch_pad() { this->scratch_pad_[5], this->scratch_pad_[6], this->scratch_pad_[7], this->scratch_pad_[8], crc8(this->scratch_pad_, 8)); #endif - if (crc8(this->scratch_pad_, 8) != this->scratch_pad_[8]) { - ESP_LOGE(TAG, "Reading scratchpad from Dallas Sensor failed"); - return false; - } - return true; + return !; } float DallasTemperatureSensor::get_temp_c() { int16_t temp = (int16_t(this->scratch_pad_[1]) << 11) | (int16_t(this->scratch_pad_[0]) << 3); diff --git a/esphome/components/dht12/dht12.cpp b/esphome/components/dht12/dht12.cpp index 3c18f8055d..10c0970cfe 100644 --- a/esphome/components/dht12/dht12.cpp +++ b/esphome/components/dht12/dht12.cpp @@ -51,19 +51,14 @@ void DHT12Component::dump_config() { LOG_SENSOR(" ", "Humidity", this->humidity_sensor_); } float DHT12Component::get_setup_priority() const { return setup_priority::DATA; } -bool DHT12Component::read_data_(uint8_t *data) { +bool DHT12Component::read_data(uint8_t *data) { if (!this->read_bytes(0, data, 5)) { ESP_LOGW(TAG, "Updating DHT12 failed!"); return false; } uint8_t checksum = data[0] + data[1] + data[2] + data[3]; - if (data[4] != checksum) { - ESP_LOGW(TAG, "DHT12 Checksum invalid!"); - return false; - } - - return true; + return !; } } // namespace dht12 diff --git a/esphome/components/display/display_buffer.cpp b/esphome/components/display/display_buffer.cpp index 453e114338..677e0f7dbd 100644 --- a/esphome/components/display/display_buffer.cpp +++ b/esphome/components/display/display_buffer.cpp @@ -10,7 +10,7 @@ static const char *TAG = "display"; const uint8_t COLOR_OFF = 0; const uint8_t COLOR_ON = 1; -void DisplayBuffer::init_internal_(uint32_t buffer_length) { +void DisplayBuffer::init_internal(uint32_t buffer_length) { this->buffer_ = new uint8_t[buffer_length]; if (this->buffer_ == nullptr) { ESP_LOGE(TAG, "Could not allocate buffer for display!"); diff --git a/esphome/components/display/display_buffer.h b/esphome/components/display/display_buffer.h index 57b95eee29..70bfd0aa1e 100644 --- a/esphome/components/display/display_buffer.h +++ b/esphome/components/display/display_buffer.h @@ -390,7 +390,7 @@ class Image { template class DisplayPageShowAction : public Action { public: - TEMPLATABLE_VALUE(DisplayPage *, page) + templatable_value(DisplayPage *, page) void play(Ts... x) override { auto *page = this->page_.value(x...); if (page != nullptr) { diff --git a/esphome/components/endstop/endstop_cover.cpp b/esphome/components/endstop/endstop_cover.cpp index 1c239226c1..f2580b40ed 100644 --- a/esphome/components/endstop/endstop_cover.cpp +++ b/esphome/components/endstop/endstop_cover.cpp @@ -113,7 +113,7 @@ bool EndstopCover::is_at_target_() const { return true; } } -void EndstopCover::start_direction_(CoverOperation dir) { +void EndstopCover::start_direction(CoverOperation dir) { if (dir == this->current_operation) return; diff --git a/esphome/components/endstop/endstop_cover.h b/esphome/components/endstop/endstop_cover.h index f8d2746234..91a2e9791d 100644 --- a/esphome/components/endstop/endstop_cover.h +++ b/esphome/components/endstop/endstop_cover.h @@ -27,7 +27,7 @@ class EndstopCover : public cover::Cover, public Component { cover::CoverTraits get_traits() override; protected: - void control(const cover::CoverCall &call) override; + void control_(const cover::CoverCall &call) override; void stop_prev_trigger_(); bool is_open_() const { return this->open_endstop_->state; } bool is_closed_() const { return this->close_endstop_->state; } diff --git a/esphome/components/esp8266_pwm/esp8266_pwm.h b/esphome/components/esp8266_pwm/esp8266_pwm.h index b6839985b0..94424c1dae 100644 --- a/esphome/components/esp8266_pwm/esp8266_pwm.h +++ b/esphome/components/esp8266_pwm/esp8266_pwm.h @@ -25,7 +25,7 @@ class ESP8266PWM : public output::FloatOutput, public Component { float get_setup_priority() const override { return setup_priority::HARDWARE; } protected: - void write_state(float state) override; + void write_state_(float state) override; GPIOPin *pin_; float frequency_{1000.0}; @@ -36,7 +36,7 @@ class ESP8266PWM : public output::FloatOutput, public Component { template class SetFrequencyAction : public Action { public: SetFrequencyAction(ESP8266PWM *parent) : parent_(parent) {} - TEMPLATABLE_VALUE(float, frequency); + templatable_value(float, frequency); void play(Ts... x) { float freq = this->frequency_.value(x...); diff --git a/esphome/components/fan/automation.h b/esphome/components/fan/automation.h index dfa72a3ea6..f182847376 100644 --- a/esphome/components/fan/automation.h +++ b/esphome/components/fan/automation.h @@ -11,7 +11,7 @@ template class TurnOnAction : public Action { public: explicit TurnOnAction(FanState *state) : state_(state) {} - TEMPLATABLE_VALUE(bool, oscillating) + templatable_value(bool, oscillating) TEMPLATABLE_VALUE(FanSpeed, speed) void play(Ts... x) override { diff --git a/esphome/components/fan/fan_state.h b/esphome/components/fan/fan_state.h index 4e937c68bd..18e028dd0e 100644 --- a/esphome/components/fan/fan_state.h +++ b/esphome/components/fan/fan_state.h @@ -88,7 +88,7 @@ class FanState : public Nameable, public Component { protected: friend FanStateCall; - uint32_t hash_base() override; + uint32_t hash_base_() override; FanTraits traits_{}; CallbackManager state_callback_{}; diff --git a/esphome/components/fastled_base/fastled_light.h b/esphome/components/fastled_base/fastled_light.h index 0729941e31..84dbaac50e 100644 --- a/esphome/components/fastled_base/fastled_light.h +++ b/esphome/components/fastled_base/fastled_light.h @@ -223,7 +223,7 @@ class FastLEDLightOutput : public light::AddressableLight { } protected: - light::ESPColorView get_view_internal(int32_t index) const override { + light::ESPColorView get_view_internal_(int32_t index) const override { return {&this->leds_[index].r, &this->leds_[index].g, &this->leds_[index].b, nullptr, &this->effect_data_[index], &this->correction_}; } diff --git a/esphome/components/gpio/output/gpio_binary_output.h b/esphome/components/gpio/output/gpio_binary_output.h index 0a7dfb46e2..cb1d21c78b 100644 --- a/esphome/components/gpio/output/gpio_binary_output.h +++ b/esphome/components/gpio/output/gpio_binary_output.h @@ -20,7 +20,7 @@ class GPIOBinaryOutput : public output::BinaryOutput, public Component { float get_setup_priority() const override { return setup_priority::HARDWARE; } protected: - void write_state(bool state) override { this->pin_->digital_write(state); } + void write_state_(bool state) override { this->pin_->digital_write(state); } GPIOPin *pin_; }; diff --git a/esphome/components/gpio/switch/gpio_switch.cpp b/esphome/components/gpio/switch/gpio_switch.cpp index d22a74847e..fc08b60e96 100644 --- a/esphome/components/gpio/switch/gpio_switch.cpp +++ b/esphome/components/gpio/switch/gpio_switch.cpp @@ -66,7 +66,7 @@ void GPIOSwitch::dump_config() { } } } -void GPIOSwitch::write_state(bool state) { +void GPIOSwitch::write_state_(bool state) { if (state != this->inverted_) { // Turning ON, check interlocking for (auto *lock : this->interlock_) { diff --git a/esphome/components/gpio/switch/gpio_switch.h b/esphome/components/gpio/switch/gpio_switch.h index ceace477b2..a54d13dd6b 100644 --- a/esphome/components/gpio/switch/gpio_switch.h +++ b/esphome/components/gpio/switch/gpio_switch.h @@ -28,7 +28,7 @@ class GPIOSwitch : public switch_::Switch, public Component { void set_interlock(const std::vector &interlock); protected: - void write_state(bool state) override; + void write_state_(bool state) override; GPIOPin *pin_; GPIOSwitchRestoreMode restore_mode_{GPIO_SWITCH_RESTORE_DEFAULT_OFF}; diff --git a/esphome/components/hx711/hx711.cpp b/esphome/components/hx711/hx711.cpp index 1c808a2501..199cf3025a 100644 --- a/esphome/components/hx711/hx711.cpp +++ b/esphome/components/hx711/hx711.cpp @@ -32,7 +32,7 @@ void HX711Sensor::update() { this->publish_state(value); } } -bool HX711Sensor::read_sensor_(uint32_t *result) { +bool HX711Sensor::read_sensor(uint32_t *result) { if (this->dout_pin_->digital_read()) { ESP_LOGW(TAG, "HX711 is not ready for new measurements yet!"); this->status_set_warning(); diff --git a/esphome/components/i2c/i2c.cpp b/esphome/components/i2c/i2c.cpp index 3fa9d2c37a..60a058d414 100644 --- a/esphome/components/i2c/i2c.cpp +++ b/esphome/components/i2c/i2c.cpp @@ -82,11 +82,7 @@ bool I2CComponent::raw_end_transmission(uint8_t address) { bool I2CComponent::raw_request_from(uint8_t address, uint8_t len) { ESP_LOGVV(TAG, "Requesting %u bytes from 0x%02X:", len, address); uint8_t ret = this->wire_->requestFrom(address, len); - if (ret != len) { - ESP_LOGW(TAG, "Requesting %u bytes from 0x%02X failed!", len, address); - return false; - } - return true; + return !; } void HOT I2CComponent::raw_write(uint8_t address, const uint8_t *data, uint8_t len) { for (size_t i = 0; i < len; i++) { diff --git a/esphome/components/integration/integration_sensor.h b/esphome/components/integration/integration_sensor.h index 6b1f4ccf1b..433b19ecd0 100644 --- a/esphome/components/integration/integration_sensor.h +++ b/esphome/components/integration/integration_sensor.h @@ -56,9 +56,9 @@ class IntegrationSensor : public sensor::Sensor, public Component { this->publish_state(result); this->rtc_.save(&result); } - std::string unit_of_measurement() override; - std::string icon() override { return this->sensor_->get_icon(); } - int8_t accuracy_decimals() override { return this->sensor_->get_accuracy_decimals() + 2; } + std::string unit_of_measurement_() override; + std::string icon_() override { return this->sensor_->get_icon(); } + int8_t accuracy_decimals_() override { return this->sensor_->get_accuracy_decimals() + 2; } sensor::Sensor *sensor_; IntegrationSensorTime time_; diff --git a/esphome/components/lcd_gpio/gpio_lcd_display.h b/esphome/components/lcd_gpio/gpio_lcd_display.h index 01f6f95d9a..0909cc2c5f 100644 --- a/esphome/components/lcd_gpio/gpio_lcd_display.h +++ b/esphome/components/lcd_gpio/gpio_lcd_display.h @@ -33,11 +33,11 @@ class GPIOLCDDisplay : public lcd_base::LCDDisplay { void dump_config() override; protected: - bool is_four_bit_mode() override { return this->data_pins_[4] == nullptr; } - void write_n_bits(uint8_t value, uint8_t n) override; - void send(uint8_t value, bool rs) override; + bool is_four_bit_mode_() override { return this->data_pins_[4] == nullptr; } + void write_n_bits_(uint8_t value, uint8_t n) override; + void send_(uint8_t value, bool rs) override; - void call_writer() override { this->writer_(*this); } + void call_writer_() override { this->writer_(*this); } GPIOPin *rs_pin_{nullptr}; GPIOPin *rw_pin_{nullptr}; diff --git a/esphome/components/lcd_pcf8574/pcf8574_display.h b/esphome/components/lcd_pcf8574/pcf8574_display.h index 4db3afb9b0..e96539a305 100644 --- a/esphome/components/lcd_pcf8574/pcf8574_display.h +++ b/esphome/components/lcd_pcf8574/pcf8574_display.h @@ -16,11 +16,11 @@ class PCF8574LCDDisplay : public lcd_base::LCDDisplay, public i2c::I2CDevice { void no_backlight(); protected: - bool is_four_bit_mode() override { return true; } - void write_n_bits(uint8_t value, uint8_t n) override; - void send(uint8_t value, bool rs) override; + bool is_four_bit_mode_() override { return true; } + void write_n_bits_(uint8_t value, uint8_t n) override; + void send_(uint8_t value, bool rs) override; - void call_writer() override { this->writer_(*this); } + void call_writer_() override { this->writer_(*this); } // Stores the current state of the backlight. uint8_t backlight_value_; diff --git a/esphome/components/light/light_state.cpp b/esphome/components/light/light_state.cpp index cafced27fc..833e63f8da 100644 --- a/esphome/components/light/light_state.cpp +++ b/esphome/components/light/light_state.cpp @@ -7,12 +7,12 @@ namespace light { static const char *TAG = "light"; -void LightState::start_transition_(const LightColorValues &target, uint32_t length) { +void LightState::start_transition(const LightColorValues &target, uint32_t length) { this->transformer_ = make_unique(millis(), length, this->current_values, target); this->remote_values = this->transformer_->get_remote_values(); } -void LightState::start_flash_(const LightColorValues &target, uint32_t length) { +void LightState::start_flash(const LightColorValues &target, uint32_t length) { LightColorValues end_colors = this->current_values; // If starting a flash if one is already happening, set end values to end values of current flash // Hacky but works @@ -24,7 +24,7 @@ void LightState::start_flash_(const LightColorValues &target, uint32_t length) { LightState::LightState(const std::string &name, LightOutput *output) : Nameable(name), output_(output) {} -void LightState::set_immediately_(const LightColorValues &target) { +void LightState::set_immediately(const LightColorValues &target) { this->transformer_ = nullptr; this->current_values = this->remote_values = target; this->next_write_ = true; @@ -46,7 +46,7 @@ std::string LightState::get_effect_name() { return "None"; } -void LightState::start_effect_(uint32_t effect_index) { +void LightState::start_effect(uint32_t effect_index) { this->stop_effect_(); if (effect_index == 0) return; @@ -57,7 +57,7 @@ void LightState::start_effect_(uint32_t effect_index) { } bool LightState::supports_effects() { return !this->effects_.empty(); } -void LightState::set_transformer_(std::unique_ptr transformer) { +void LightState::set_transformer(std::unique_ptr transformer) { this->transformer_ = std::move(transformer); } void LightState::stop_effect_() { @@ -351,7 +351,7 @@ void LightCall::perform() { } } -LightColorValues LightCall::validate_() { +LightColorValues LightCall::validate() { // use remote values for fallback auto *name = this->parent_->get_name().c_str(); auto traits = this->parent_->get_traits(); diff --git a/esphome/components/light/light_state.h b/esphome/components/light/light_state.h index d67aa2c53d..bff02f690e 100644 --- a/esphome/components/light/light_state.h +++ b/esphome/components/light/light_state.h @@ -203,11 +203,11 @@ class LightState : public Nameable, public Component { LightColorValues current_values; /// Deprecated method to access current_values. - ESPDEPRECATED("get_current_values() is deprecated, please use .current_values instead.") + espdeprecated("get_current_values() is deprecated, please use .current_values instead.") LightColorValues get_current_values(); /// Deprecated method to access remote_values. - ESPDEPRECATED("get_remote_values() is deprecated, please use .remote_values instead.") + espdeprecated("get_remote_values() is deprecated, please use .remote_values instead.") LightColorValues get_remote_values(); /** The remote color values reported to the frontend. @@ -278,7 +278,7 @@ class LightState : public Nameable, public Component { friend LightOutput; friend LightCall; - uint32_t hash_base() override; + uint32_t hash_base_() override; /// Internal method to start an effect with the given index void start_effect_(uint32_t effect_index); diff --git a/esphome/components/max7219/max7219.cpp b/esphome/components/max7219/max7219.cpp index db43ff19f6..c7a6b4f12a 100644 --- a/esphome/components/max7219/max7219.cpp +++ b/esphome/components/max7219/max7219.cpp @@ -145,11 +145,11 @@ void MAX7219Component::display() { this->disable(); } } -void MAX7219Component::send_byte_(uint8_t a_register, uint8_t data) { +void MAX7219Component::send_byte(uint8_t a_register, uint8_t data) { this->write_byte(a_register); this->write_byte(data); } -void MAX7219Component::send_to_all_(uint8_t a_register, uint8_t data) { +void MAX7219Component::send_to_all(uint8_t a_register, uint8_t data) { this->enable(); for (uint8_t i = 0; i < this->num_chips_; i++) this->send_byte_(a_register, data); diff --git a/esphome/components/mcp23008/__init__.py b/esphome/components/mcp23008/__init__.py index ef76738f37..4241b6ba48 100644 --- a/esphome/components/mcp23008/__init__.py +++ b/esphome/components/mcp23008/__init__.py @@ -47,5 +47,5 @@ MCP23008_INPUT_PIN_SCHEMA = cv.Schema({ @pins.PIN_SCHEMA_REGISTRY.register(CONF_MCP23008, (MCP23008_OUTPUT_PIN_SCHEMA, MCP23008_INPUT_PIN_SCHEMA)) def mcp23008_pin_to_code(config): - parent = yield cg.get_variable(config[CONF_MCP23008]) - yield MCP23008GPIOPin.new(parent, config[CONF_NUMBER], config[CONF_MODE], config[CONF_INVERTED]) + parent = yield cg.get_variable(config[CONF_MCP23008]) + yield MCP23008GPIOPin.new(parent, config[CONF_NUMBER], config[CONF_MODE], config[CONF_INVERTED]) diff --git a/esphome/components/mcp23008/mcp23008.cpp b/esphome/components/mcp23008/mcp23008.cpp index ab6f89d39e..0261b7da53 100644 --- a/esphome/components/mcp23008/mcp23008.cpp +++ b/esphome/components/mcp23008/mcp23008.cpp @@ -19,7 +19,7 @@ void MCP23008::setup() { } bool MCP23008::digital_read(uint8_t pin) { uint8_t bit = pin % 8; - uint8_t reg_addr = MCP23008_GPIO; + uint8_t reg_addr = MCP23008_GPIO; uint8_t value = 0; this->read_reg_(reg_addr, &value); return value & (1 << bit); @@ -47,19 +47,19 @@ void MCP23008::pin_mode(uint8_t pin, uint8_t mode) { } } float MCP23008::get_setup_priority() const { return setup_priority::HARDWARE; } -bool MCP23008::read_reg_(uint8_t reg, uint8_t *value) { +bool MCP23008::read_reg(uint8_t reg, uint8_t *value) { if (this->is_failed()) return false; return this->read_byte(reg, value); } -bool MCP23008::write_reg_(uint8_t reg, uint8_t value) { +bool MCP23008::write_reg(uint8_t reg, uint8_t value) { if (this->is_failed()) return false; return this->write_byte(reg, value); } -void MCP23008::update_reg_(uint8_t pin, bool pin_value, uint8_t reg_addr) { +void MCP23008::update_reg(uint8_t pin, bool pin_value, uint8_t reg_addr) { uint8_t bit = pin % 8; uint8_t reg_value = 0; if (reg_addr == MCP23008_OLAT) { @@ -77,7 +77,7 @@ void MCP23008::update_reg_(uint8_t pin, bool pin_value, uint8_t reg_addr) { if (reg_addr == MCP23008_OLAT) { this->olat_ = reg_value; - } + } } MCP23008GPIOPin::MCP23008GPIOPin(MCP23008 *parent, uint8_t pin, uint8_t mode, bool inverted) diff --git a/esphome/components/mcp23017/mcp23017.cpp b/esphome/components/mcp23017/mcp23017.cpp index 687c816179..292160aaf6 100644 --- a/esphome/components/mcp23017/mcp23017.cpp +++ b/esphome/components/mcp23017/mcp23017.cpp @@ -48,19 +48,19 @@ void MCP23017::pin_mode(uint8_t pin, uint8_t mode) { } } float MCP23017::get_setup_priority() const { return setup_priority::HARDWARE; } -bool MCP23017::read_reg_(uint8_t reg, uint8_t *value) { +bool MCP23017::read_reg(uint8_t reg, uint8_t *value) { if (this->is_failed()) return false; return this->read_byte(reg, value); } -bool MCP23017::write_reg_(uint8_t reg, uint8_t value) { +bool MCP23017::write_reg(uint8_t reg, uint8_t value) { if (this->is_failed()) return false; return this->write_byte(reg, value); } -void MCP23017::update_reg_(uint8_t pin, bool pin_value, uint8_t reg_addr) { +void MCP23017::update_reg(uint8_t pin, bool pin_value, uint8_t reg_addr) { uint8_t bit = pin % 8; uint8_t reg_value = 0; if (reg_addr == MCP23017_OLATA) { diff --git a/esphome/components/mhz19/mhz19.cpp b/esphome/components/mhz19/mhz19.cpp index 8f46e288b6..358a60fb03 100644 --- a/esphome/components/mhz19/mhz19.cpp +++ b/esphome/components/mhz19/mhz19.cpp @@ -50,7 +50,7 @@ void MHZ19Component::update() { this->temperature_sensor_->publish_state(temp); } -bool MHZ19Component::mhz19_write_command_(const uint8_t *command, uint8_t *response) { +bool MHZ19Component::mhz19_write_command(const uint8_t *command, uint8_t *response) { this->flush(); this->write_array(command, MHZ19_REQUEST_LENGTH); this->write_byte(mhz19_checksum(command)); diff --git a/esphome/components/mqtt/mqtt_client.cpp b/esphome/components/mqtt/mqtt_client.cpp index e07204d559..2ca264c67f 100644 --- a/esphome/components/mqtt/mqtt_client.cpp +++ b/esphome/components/mqtt/mqtt_client.cpp @@ -286,7 +286,7 @@ void MQTTClientComponent::loop() { float MQTTClientComponent::get_setup_priority() const { return setup_priority::AFTER_WIFI; } // Subscribe -bool MQTTClientComponent::subscribe_(const char *topic, uint8_t qos) { +bool MQTTClientComponent::subscribe(const char *topic, uint8_t qos) { if (!this->is_connected()) return false; diff --git a/esphome/components/mqtt/mqtt_client.h b/esphome/components/mqtt/mqtt_client.h index 6f14b0c92c..1c8c0ce273 100644 --- a/esphome/components/mqtt/mqtt_client.h +++ b/esphome/components/mqtt/mqtt_client.h @@ -294,7 +294,7 @@ class MQTTJsonMessageTrigger : public Trigger { template class MQTTPublishAction : public Action { public: MQTTPublishAction(MQTTClientComponent *parent) : parent_(parent) {} - TEMPLATABLE_VALUE(std::string, topic) + templatable_value(std::string, topic) TEMPLATABLE_VALUE(std::string, payload) TEMPLATABLE_VALUE(uint8_t, qos) TEMPLATABLE_VALUE(bool, retain) @@ -311,7 +311,7 @@ template class MQTTPublishAction : public Action { template class MQTTPublishJsonAction : public Action { public: MQTTPublishJsonAction(MQTTClientComponent *parent) : parent_(parent) {} - TEMPLATABLE_VALUE(std::string, topic) + templatable_value(std::string, topic) TEMPLATABLE_VALUE(uint8_t, qos) TEMPLATABLE_VALUE(bool, retain) diff --git a/esphome/components/mqtt/mqtt_component.cpp b/esphome/components/mqtt/mqtt_component.cpp index 53c4e89e98..48da73b0eb 100644 --- a/esphome/components/mqtt/mqtt_component.cpp +++ b/esphome/components/mqtt/mqtt_component.cpp @@ -11,24 +11,24 @@ static const char *TAG = "mqtt.component"; void MQTTComponent::set_retain(bool retain) { this->retain_ = retain; } -std::string MQTTComponent::get_discovery_topic_(const MQTTDiscoveryInfo &discovery_info) const { +std::string MQTTComponent::get_discovery_topic(const MQTTDiscoveryInfo &discovery_info) const { std::string sanitized_name = sanitize_string_whitelist(App.get_name(), HOSTNAME_CHARACTER_WHITELIST); return discovery_info.prefix + "/" + this->component_type() + "/" + sanitized_name + "/" + this->get_default_object_id_() + "/config"; } -std::string MQTTComponent::get_default_topic_for_(const std::string &suffix) const { +std::string MQTTComponent::get_default_topic_for(const std::string &suffix) const { return global_mqtt_client->get_topic_prefix() + "/" + this->component_type() + "/" + this->get_default_object_id_() + "/" + suffix; } -const std::string MQTTComponent::get_state_topic_() const { +const std::string MQTTComponent::get_state_topic() const { if (this->custom_state_topic_.empty()) return this->get_default_topic_for_("state"); return this->custom_state_topic_; } -const std::string MQTTComponent::get_command_topic_() const { +const std::string MQTTComponent::get_command_topic() const { if (this->custom_command_topic_.empty()) return this->get_default_topic_for_("command"); return this->custom_command_topic_; @@ -116,7 +116,7 @@ bool MQTTComponent::is_discovery_enabled() const { return this->discovery_enabled_ && global_mqtt_client->is_discovery_enabled(); } -std::string MQTTComponent::get_default_object_id_() const { +std::string MQTTComponent::get_default_object_id() const { return sanitize_string_whitelist(to_lowercase_underscore(this->friendly_name()), HOSTNAME_CHARACTER_WHITELIST); } diff --git a/esphome/components/mqtt/mqtt_component.h b/esphome/components/mqtt/mqtt_component.h index 43465af498..67a2242d9a 100644 --- a/esphome/components/mqtt/mqtt_component.h +++ b/esphome/components/mqtt/mqtt_component.h @@ -141,14 +141,14 @@ class MQTTComponent : public Component { std::string get_default_topic_for_(const std::string &suffix) const; /// Get the friendly name of this MQTT component. - virtual std::string friendly_name() const = 0; + virtual std::string friendly_name_() const = 0; /** A unique ID for this MQTT component, empty for no unique id. See unique ID requirements: * https://developers.home-assistant.io/docs/en/entity_registry_index.html#unique-id-requirements * * @return The unique id as a string. */ - virtual std::string unique_id(); + virtual std::string unique_id_(); /// Get the MQTT topic that new states will be shared to. const std::string get_state_topic_() const; diff --git a/esphome/components/ms5611/ms5611.cpp b/esphome/components/ms5611/ms5611.cpp index 33ed6b1899..60f103f899 100644 --- a/esphome/components/ms5611/ms5611.cpp +++ b/esphome/components/ms5611/ms5611.cpp @@ -65,7 +65,7 @@ void MS5611Component::read_temperature_() { auto f = std::bind(&MS5611Component::read_pressure_, this, raw_temperature); this->set_timeout("pressure", 10, f); } -void MS5611Component::read_pressure_(uint32_t raw_temperature) { +void MS5611Component::read_pressure(uint32_t raw_temperature) { uint8_t bytes[3]; if (!this->read_bytes(MS5611_CMD_ADC_READ, bytes, 3)) { this->status_set_warning(); @@ -74,7 +74,7 @@ void MS5611Component::read_pressure_(uint32_t raw_temperature) { const uint32_t raw_pressure = (uint32_t(bytes[0]) << 16) | (uint32_t(bytes[1]) << 8) | (uint32_t(bytes[2])); this->calculate_values_(raw_temperature, raw_pressure); } -void MS5611Component::calculate_values_(uint32_t raw_temperature, uint32_t raw_pressure) { +void MS5611Component::calculate_values(uint32_t raw_temperature, uint32_t raw_pressure) { const int32_t d_t = int32_t(raw_temperature) - (uint32_t(this->prom_[4]) << 8); float temperature = (2000 + (int64_t(d_t) * this->prom_[5]) / 8388608.0f) / 100.0f; diff --git a/esphome/components/my9231/my9231.cpp b/esphome/components/my9231/my9231.cpp index 4b4603d56b..8dd4fee801 100644 --- a/esphome/components/my9231/my9231.cpp +++ b/esphome/components/my9231/my9231.cpp @@ -73,7 +73,7 @@ void MY9231OutputComponent::loop() { this->send_di_pulses_(8); this->update_ = false; } -void MY9231OutputComponent::set_channel_value_(uint8_t channel, uint16_t value) { +void MY9231OutputComponent::set_channel_value(uint8_t channel, uint16_t value) { ESP_LOGV(TAG, "set channels %u to %u", channel, value); uint8_t index = this->num_channels_ - channel - 1; if (this->pwm_amounts_[index] != value) { @@ -81,7 +81,7 @@ void MY9231OutputComponent::set_channel_value_(uint8_t channel, uint16_t value) } this->pwm_amounts_[index] = value; } -void MY9231OutputComponent::init_chips_(uint8_t command) { +void MY9231OutputComponent::init_chips(uint8_t command) { // Send 12 DI pulse. After 6 falling edges, the duty data are stored // and after 12 rising edges the command mode is activated. this->send_di_pulses_(12); @@ -93,13 +93,13 @@ void MY9231OutputComponent::init_chips_(uint8_t command) { // stored and after 16 falling edges the duty mode is activated. this->send_di_pulses_(16); } -void MY9231OutputComponent::write_word_(uint16_t value, uint8_t bits) { +void MY9231OutputComponent::write_word(uint16_t value, uint8_t bits) { for (uint8_t i = bits; i > 0; i--) { this->pin_di_->digital_write(value & (1 << (i - 1))); this->pin_dcki_->digital_write(!this->pin_dcki_->digital_read()); } } -void MY9231OutputComponent::send_di_pulses_(uint8_t count) { +void MY9231OutputComponent::send_di_pulses(uint8_t count) { delayMicroseconds(12); for (uint8_t i = 0; i < count; i++) { this->pin_di_->digital_write(true); diff --git a/esphome/components/my9231/my9231.h b/esphome/components/my9231/my9231.h index ee15f9743c..f1f08c0b08 100644 --- a/esphome/components/my9231/my9231.h +++ b/esphome/components/my9231/my9231.h @@ -32,7 +32,7 @@ class MY9231OutputComponent : public Component { void set_channel(uint8_t channel) { channel_ = channel; } protected: - void write_state(float state) override { + void write_state_(float state) override { auto amount = uint16_t(state * this->parent_->get_max_amount_()); this->parent_->set_channel_value_(this->channel_, amount); } diff --git a/esphome/components/nextion/nextion.cpp b/esphome/components/nextion/nextion.cpp index f41a97ce7e..a4ec955e0a 100644 --- a/esphome/components/nextion/nextion.cpp +++ b/esphome/components/nextion/nextion.cpp @@ -79,12 +79,7 @@ bool Nextion::send_command_printf(const char *format, ...) { return false; } this->send_command_no_ack(buffer); - if (!this->ack_()) { - ESP_LOGW(TAG, "Sending command '%s' failed because no ACK was received", buffer); - return false; - } - - return true; + return this->ack_(); } void Nextion::hide_component(const char *component) { this->send_command_printf("vis %s,0", component); } void Nextion::show_component(const char *component) { this->send_command_printf("vis %s,1", component); } diff --git a/esphome/components/ota/ota_component.cpp b/esphome/components/ota/ota_component.cpp index d37a7a0c6a..28db3f1a6d 100644 --- a/esphome/components/ota/ota_component.cpp +++ b/esphome/components/ota/ota_component.cpp @@ -300,7 +300,7 @@ error: #endif } -size_t OTAComponent::wait_receive_(uint8_t *buf, size_t bytes, bool check_disconnected) { +size_t OTAComponent::wait_receive(uint8_t *buf, size_t bytes, bool check_disconnected) { size_t available = 0; uint32_t start = millis(); do { @@ -387,8 +387,8 @@ void OTAComponent::start_safe_mode(uint8_t num_attempts, uint32_t enable_time) { this->write_rtc_(this->safe_mode_rtc_value_ + 1); } } -void OTAComponent::write_rtc_(uint32_t val) { this->rtc_.save(&val); } -uint32_t OTAComponent::read_rtc_() { +void OTAComponent::write_rtc(uint32_t val) { this->rtc_.save(&val); } +uint32_t OTAComponent::read_rtc() { uint32_t val; if (!this->rtc_.load(&val)) return 0; diff --git a/esphome/components/output/automation.h b/esphome/components/output/automation.h index 8c8a5ab61b..a63f8025c7 100644 --- a/esphome/components/output/automation.h +++ b/esphome/components/output/automation.h @@ -32,7 +32,7 @@ template class SetLevelAction : public Action { public: SetLevelAction(FloatOutput *output) : output_(output) {} - TEMPLATABLE_VALUE(float, level) + templatable_value(float, level) void play(Ts... x) override { this->output_->set_level(this->level_.value(x...)); } protected: diff --git a/esphome/components/output/switch/output_switch.cpp b/esphome/components/output/switch/output_switch.cpp index e2c3b19f28..c75b5715d2 100644 --- a/esphome/components/output/switch/output_switch.cpp +++ b/esphome/components/output/switch/output_switch.cpp @@ -18,7 +18,7 @@ void OutputSwitch::setup() { this->turn_off(); } } -void OutputSwitch::write_state(bool state) { +void OutputSwitch::write_state_(bool state) { if (state) { this->output_->turn_on(); } else { diff --git a/esphome/components/output/switch/output_switch.h b/esphome/components/output/switch/output_switch.h index fc9540fede..7fed243a09 100644 --- a/esphome/components/output/switch/output_switch.h +++ b/esphome/components/output/switch/output_switch.h @@ -16,7 +16,7 @@ class OutputSwitch : public switch_::Switch, public Component { void dump_config() override; protected: - void write_state(bool state) override; + void write_state_(bool state) override; output::BinaryOutput *output_; }; diff --git a/esphome/components/partition/light_partition.h b/esphome/components/partition/light_partition.h index 8085c43720..6df520c03f 100644 --- a/esphome/components/partition/light_partition.h +++ b/esphome/components/partition/light_partition.h @@ -53,7 +53,7 @@ class PartitionLightOutput : public light::AddressableLight { } protected: - light::ESPColorView get_view_internal(int32_t index) const override { + light::ESPColorView get_view_internal_(int32_t index) const override { uint32_t lo = 0; uint32_t hi = this->segments_.size() - 1; while (lo < hi) { diff --git a/esphome/components/pca9685/pca9685_output.cpp b/esphome/components/pca9685/pca9685_output.cpp index 72f5687bb9..7f6277cf90 100644 --- a/esphome/components/pca9685/pca9685_output.cpp +++ b/esphome/components/pca9685/pca9685_output.cpp @@ -130,7 +130,7 @@ PCA9685Channel *PCA9685Output::create_channel(uint8_t channel) { return c; } -void PCA9685Channel::write_state(float state) { +void PCA9685Channel::write_state_(float state) { const uint16_t max_duty = 4096; const float duty_rounded = roundf(state * max_duty); auto duty = static_cast(duty_rounded); diff --git a/esphome/components/pca9685/pca9685_output.h b/esphome/components/pca9685/pca9685_output.h index 55b52fc660..1577f87c4f 100644 --- a/esphome/components/pca9685/pca9685_output.h +++ b/esphome/components/pca9685/pca9685_output.h @@ -25,7 +25,7 @@ class PCA9685Channel : public output::FloatOutput { PCA9685Channel(PCA9685Output *parent, uint8_t channel) : parent_(parent), channel_(channel) {} protected: - void write_state(float state) override; + void write_state_(float state) override; PCA9685Output *parent_; uint8_t channel_; diff --git a/esphome/components/pcf8574/pcf8574.cpp b/esphome/components/pcf8574/pcf8574.cpp index d469cf835f..7b388bbb50 100644 --- a/esphome/components/pcf8574/pcf8574.cpp +++ b/esphome/components/pcf8574/pcf8574.cpp @@ -93,12 +93,7 @@ bool PCF8574Component::write_gpio_() { data = (value >> 8) & 0xFF; this->parent_->raw_write(this->address_, &data, 1); } - if (!this->parent_->raw_end_transmission(this->address_)) { - this->status_set_warning(); - return false; - } - this->status_clear_warning(); - return true; + return !; } float PCF8574Component::get_setup_priority() const { return setup_priority::IO; } diff --git a/esphome/components/pmsx003/pmsx003.cpp b/esphome/components/pmsx003/pmsx003.cpp index 548099a495..c63d208378 100644 --- a/esphome/components/pmsx003/pmsx003.cpp +++ b/esphome/components/pmsx003/pmsx003.cpp @@ -45,7 +45,7 @@ void PMSX003Component::loop() { } } float PMSX003Component::get_setup_priority() const { return setup_priority::DATA; } -optional PMSX003Component::check_byte_() { +optional PMSX003Component::check_byte() { uint8_t index = this->data_index_; uint8_t byte = this->data_[index]; @@ -158,7 +158,7 @@ void PMSX003Component::parse_data_() { this->status_clear_warning(); } -uint16_t PMSX003Component::get_16_bit_uint_(uint8_t start_index) { +uint16_t PMSX003Component::get_16_bit_uint(uint8_t start_index) { return (uint16_t(this->data_[start_index]) << 8) | uint16_t(this->data_[start_index + 1]); } void PMSX003Component::dump_config() { diff --git a/esphome/components/pn532/pn532.cpp b/esphome/components/pn532/pn532.cpp index 93000a7421..0b07ebe73d 100644 --- a/esphome/components/pn532/pn532.cpp +++ b/esphome/components/pn532/pn532.cpp @@ -154,7 +154,7 @@ void PN532::loop() { float PN532::get_setup_priority() const { return setup_priority::DATA; } -void PN532::pn532_write_command_(const std::vector &data) { +void PN532::pn532_write_command(const std::vector &data) { this->enable(); delay(2); // First byte, communication mode: Write data @@ -193,7 +193,7 @@ void PN532::pn532_write_command_(const std::vector &data) { this->disable(); } -bool PN532::pn532_write_command_check_ack_(const std::vector &data) { +bool PN532::pn532_write_command_check_ack(const std::vector &data) { // 1. write command this->pn532_write_command_(data); @@ -210,7 +210,7 @@ bool PN532::pn532_write_command_check_ack_(const std::vector &data) { return true; } -std::vector PN532::pn532_read_data_() { +std::vector PN532::pn532_read_data() { this->enable(); delay(2); // Read data (transmission from the PN532 to the host) diff --git a/esphome/components/rdm6300/rdm6300.h b/esphome/components/rdm6300/rdm6300.h index a67b6e7ce8..7cc174736d 100644 --- a/esphome/components/rdm6300/rdm6300.h +++ b/esphome/components/rdm6300/rdm6300.h @@ -33,13 +33,7 @@ class RDM6300BinarySensor : public binary_sensor::BinarySensor { void set_id(uint32_t id) { id_ = id; } bool process(uint32_t id) { - if (this->id_ == id) { - this->publish_state(true); - yield(); - this->publish_state(false); - return true; - } - return false; + return ; } protected: diff --git a/esphome/components/remote_base/jvc_protocol.h b/esphome/components/remote_base/jvc_protocol.h index 8a216f5348..bc18e4932d 100644 --- a/esphome/components/remote_base/jvc_protocol.h +++ b/esphome/components/remote_base/jvc_protocol.h @@ -22,7 +22,7 @@ DECLARE_REMOTE_PROTOCOL(JVC) template class JVCAction : public RemoteTransmitterActionBase { public: - TEMPLATABLE_VALUE(uint32_t, data) + templatable_value(uint32_t, data) void encode(RemoteTransmitData *dst, Ts... x) override { JVCData data{}; data.data = this->data_.value(x...); diff --git a/esphome/components/remote_base/lg_protocol.h b/esphome/components/remote_base/lg_protocol.h index b810115f58..72619eaeb9 100644 --- a/esphome/components/remote_base/lg_protocol.h +++ b/esphome/components/remote_base/lg_protocol.h @@ -24,7 +24,7 @@ DECLARE_REMOTE_PROTOCOL(LG) template class LGAction : public RemoteTransmitterActionBase { public: - TEMPLATABLE_VALUE(uint32_t, data) + templatable_value(uint32_t, data) TEMPLATABLE_VALUE(uint8_t, nbits) void encode(RemoteTransmitData *dst, Ts... x) override { LGData data{}; diff --git a/esphome/components/remote_base/nec_protocol.h b/esphome/components/remote_base/nec_protocol.h index c794991eab..fe69d17506 100644 --- a/esphome/components/remote_base/nec_protocol.h +++ b/esphome/components/remote_base/nec_protocol.h @@ -23,7 +23,7 @@ DECLARE_REMOTE_PROTOCOL(NEC) template class NECAction : public RemoteTransmitterActionBase { public: - TEMPLATABLE_VALUE(uint16_t, address) + templatable_value(uint16_t, address) TEMPLATABLE_VALUE(uint16_t, command) void encode(RemoteTransmitData *dst, Ts... x) override { NECData data{}; diff --git a/esphome/components/remote_base/panasonic_protocol.h b/esphome/components/remote_base/panasonic_protocol.h index b13bd3e92d..0ca014743f 100644 --- a/esphome/components/remote_base/panasonic_protocol.h +++ b/esphome/components/remote_base/panasonic_protocol.h @@ -24,7 +24,7 @@ DECLARE_REMOTE_PROTOCOL(Panasonic) template class PanasonicAction : public RemoteTransmitterActionBase { public: - TEMPLATABLE_VALUE(uint16_t, address) + templatable_value(uint16_t, address) TEMPLATABLE_VALUE(uint32_t, command) void encode(RemoteTransmitData *dst, Ts... x) override { PanasonicData data{}; diff --git a/esphome/components/remote_base/raw_protocol.h b/esphome/components/remote_base/raw_protocol.h index 1d9f1c5acc..adba3d33d6 100644 --- a/esphome/components/remote_base/raw_protocol.h +++ b/esphome/components/remote_base/raw_protocol.h @@ -44,7 +44,7 @@ template class RawAction : public RemoteTransmitterActionBasecode_static_ = code; this->code_static_len_ = len; } - TEMPLATABLE_VALUE(uint32_t, carrier_frequency); + templatable_value(uint32_t, carrier_frequency); void encode(RemoteTransmitData *dst, Ts... x) override { if (this->code_static_ != nullptr) { @@ -62,7 +62,7 @@ template class RawAction : public RemoteTransmitterActionBase(Ts...)> code_func_{}; + std::function(ts_...)> code_func_{}; const int32_t *code_static_{nullptr}; int32_t code_static_len_{0}; }; diff --git a/esphome/components/remote_base/rc5_protocol.h b/esphome/components/remote_base/rc5_protocol.h index 2e1da74d9f..3e73b76cd2 100644 --- a/esphome/components/remote_base/rc5_protocol.h +++ b/esphome/components/remote_base/rc5_protocol.h @@ -24,7 +24,7 @@ DECLARE_REMOTE_PROTOCOL(RC5) template class RC5Action : public RemoteTransmitterActionBase { public: - TEMPLATABLE_VALUE(uint8_t, address) + templatable_value(uint8_t, address) TEMPLATABLE_VALUE(uint8_t, command) void encode(RemoteTransmitData *dst, Ts... x) override { RC5Data data{}; diff --git a/esphome/components/remote_base/rc_switch_protocol.h b/esphome/components/remote_base/rc_switch_protocol.h index 728561c140..f2ad163714 100644 --- a/esphome/components/remote_base/rc_switch_protocol.h +++ b/esphome/components/remote_base/rc_switch_protocol.h @@ -57,8 +57,8 @@ uint32_t decode_binary_string(const std::string &data); template class RCSwitchRawAction : public RemoteTransmitterActionBase { public: - TEMPLATABLE_VALUE(RCSwitchBase, protocol); - TEMPLATABLE_VALUE(std::string, code); + templatable_value(RCSwitchBase, protocol); + templatable_value(std::string, code); void encode(RemoteTransmitData *dst, Ts... x) override { auto code = this->code_.value(x...); @@ -72,10 +72,10 @@ template class RCSwitchRawAction : public RemoteTransmitterActio template class RCSwitchTypeAAction : public RemoteTransmitterActionBase { public: - TEMPLATABLE_VALUE(RCSwitchBase, protocol); - TEMPLATABLE_VALUE(std::string, group); - TEMPLATABLE_VALUE(std::string, device); - TEMPLATABLE_VALUE(bool, state); + templatable_value(RCSwitchBase, protocol); + templatable_value(std::string, group); + templatable_value(std::string, device); + templatable_value(bool, state); void encode(RemoteTransmitData *dst, Ts... x) override { auto group = this->group_.value(x...); @@ -95,10 +95,10 @@ template class RCSwitchTypeAAction : public RemoteTransmitterAct template class RCSwitchTypeBAction : public RemoteTransmitterActionBase { public: - TEMPLATABLE_VALUE(RCSwitchBase, protocol); - TEMPLATABLE_VALUE(uint8_t, address); - TEMPLATABLE_VALUE(uint8_t, channel); - TEMPLATABLE_VALUE(bool, state); + templatable_value(RCSwitchBase, protocol); + templatable_value(uint8_t, address); + templatable_value(uint8_t, channel); + templatable_value(bool, state); void encode(RemoteTransmitData *dst, Ts... x) override { auto address = this->address_.value(x...); @@ -116,11 +116,11 @@ template class RCSwitchTypeBAction : public RemoteTransmitterAct template class RCSwitchTypeCAction : public RemoteTransmitterActionBase { public: - TEMPLATABLE_VALUE(RCSwitchBase, protocol); - TEMPLATABLE_VALUE(std::string, family); - TEMPLATABLE_VALUE(uint8_t, group); - TEMPLATABLE_VALUE(uint8_t, device); - TEMPLATABLE_VALUE(bool, state); + templatable_value(RCSwitchBase, protocol); + templatable_value(std::string, family); + templatable_value(uint8_t, group); + templatable_value(uint8_t, device); + templatable_value(bool, state); void encode(RemoteTransmitData *dst, Ts... x) override { auto family = this->family_.value(x...); @@ -140,10 +140,10 @@ template class RCSwitchTypeCAction : public RemoteTransmitterAct }; template class RCSwitchTypeDAction : public RemoteTransmitterActionBase { public: - TEMPLATABLE_VALUE(RCSwitchBase, protocol); - TEMPLATABLE_VALUE(std::string, group); - TEMPLATABLE_VALUE(uint8_t, device); - TEMPLATABLE_VALUE(bool, state); + templatable_value(RCSwitchBase, protocol); + templatable_value(std::string, group); + templatable_value(uint8_t, device); + templatable_value(bool, state); void encode(RemoteTransmitData *dst, Ts... x) override { auto group = this->group_.value(x...); diff --git a/esphome/components/remote_base/remote_base.cpp b/esphome/components/remote_base/remote_base.cpp index 3da1daff63..99ab4054f2 100644 --- a/esphome/components/remote_base/remote_base.cpp +++ b/esphome/components/remote_base/remote_base.cpp @@ -16,7 +16,7 @@ RemoteComponentBase::RemoteComponentBase(GPIOPin *pin) : pin_(pin) { void RemoteReceiverBinarySensorBase::dump_config() { LOG_BINARY_SENSOR("", "Remote Receiver Binary Sensor", this); } -void RemoteTransmitterBase::send_(uint32_t send_times, uint32_t send_wait) { +void RemoteTransmitterBase::send(uint32_t send_times, uint32_t send_wait) { #ifdef ESPHOME_LOG_HAS_VERY_VERBOSE const std::vector &vec = this->temp_.get_data(); char buffer[256]; diff --git a/esphome/components/remote_base/remote_base.h b/esphome/components/remote_base/remote_base.h index 6035e2fd57..e094dc6557 100644 --- a/esphome/components/remote_base/remote_base.h +++ b/esphome/components/remote_base/remote_base.h @@ -93,27 +93,15 @@ class RemoteReceiveData { void advance(uint32_t amount = 1) { this->index_ += amount; } bool expect_mark(uint32_t length) { - if (this->peek_mark(length)) { - this->advance(); - return true; - } - return false; + return ; } bool expect_space(uint32_t length) { - if (this->peek_space(length)) { - this->advance(); - return true; - } - return false; + return ; } bool expect_item(uint32_t mark, uint32_t space) { - if (this->peek_item(mark, space)) { - this->advance(2); - return true; - } - return false; + return ; } void reset() { this->index_ = 0; } @@ -275,13 +263,7 @@ class RemoteReceiverBinarySensorBase : public binary_sensor::BinarySensor, void dump_config() override; virtual bool matches(RemoteReceiveData src) = 0; bool on_receive(RemoteReceiveData src) override { - if (this->matches(src)) { - this->publish_state(true); - yield(); - this->publish_state(false); - return true; - } - return false; + return this->matches(src); } }; @@ -330,8 +312,8 @@ template class RemoteTransmitterActionBase : public Action class SamsungAction : public RemoteTransmitterActionBase { public: - TEMPLATABLE_VALUE(uint32_t, data) + templatable_value(uint32_t, data) void encode(RemoteTransmitData *dst, Ts... x) override { SamsungData data{}; data.data = this->data_.value(x...); diff --git a/esphome/components/remote_base/sony_protocol.h b/esphome/components/remote_base/sony_protocol.h index 9f0bcdf82f..57f0f53c0f 100644 --- a/esphome/components/remote_base/sony_protocol.h +++ b/esphome/components/remote_base/sony_protocol.h @@ -24,7 +24,7 @@ DECLARE_REMOTE_PROTOCOL(Sony) template class SonyAction : public RemoteTransmitterActionBase { public: - TEMPLATABLE_VALUE(uint32_t, data) + templatable_value(uint32_t, data) TEMPLATABLE_VALUE(uint8_t, nbits) void encode(RemoteTransmitData *dst, Ts... x) override { SonyData data{}; diff --git a/esphome/components/remote_transmitter/remote_transmitter.h b/esphome/components/remote_transmitter/remote_transmitter.h index a746d43926..32e509b4f8 100644 --- a/esphome/components/remote_transmitter/remote_transmitter.h +++ b/esphome/components/remote_transmitter/remote_transmitter.h @@ -19,7 +19,7 @@ class RemoteTransmitterComponent : public remote_base::RemoteTransmitterBase, pu void set_carrier_duty_percent(uint8_t carrier_duty_percent) { this->carrier_duty_percent_ = carrier_duty_percent; } protected: - void send_internal(uint32_t send_times, uint32_t send_wait) override; + void send_internal_(uint32_t send_times, uint32_t send_wait) override; #ifdef ARDUINO_ARCH_ESP8266 void calculate_on_off_time_(uint32_t carrier_frequency, uint32_t *on_time_period, uint32_t *off_time_period); diff --git a/esphome/components/remote_transmitter/remote_transmitter_esp8266.cpp b/esphome/components/remote_transmitter/remote_transmitter_esp8266.cpp index 7704f1d9ab..3afdfaeeb0 100644 --- a/esphome/components/remote_transmitter/remote_transmitter_esp8266.cpp +++ b/esphome/components/remote_transmitter/remote_transmitter_esp8266.cpp @@ -20,7 +20,7 @@ void RemoteTransmitterComponent::dump_config() { LOG_PIN(" Pin: ", this->pin_); } -void RemoteTransmitterComponent::calculate_on_off_time_(uint32_t carrier_frequency, uint32_t *on_time_period, +void RemoteTransmitterComponent::calculate_on_off_time(uint32_t carrier_frequency, uint32_t *on_time_period, uint32_t *off_time_period) { if (carrier_frequency == 0) { *on_time_period = 0; @@ -33,7 +33,7 @@ void RemoteTransmitterComponent::calculate_on_off_time_(uint32_t carrier_frequen *off_time_period = period - *on_time_period; } -void RemoteTransmitterComponent::mark_(uint32_t on_time, uint32_t off_time, uint32_t usec) { +void RemoteTransmitterComponent::mark(uint32_t on_time, uint32_t off_time, uint32_t usec) { if (this->carrier_duty_percent_ == 100 || (on_time == 0 && off_time == 0)) { this->pin_->digital_write(true); delay_microseconds_accurate(usec); @@ -58,7 +58,7 @@ void RemoteTransmitterComponent::mark_(uint32_t on_time, uint32_t off_time, uint current_time = micros(); } } -void RemoteTransmitterComponent::space_(uint32_t usec) { +void RemoteTransmitterComponent::space(uint32_t usec) { this->pin_->digital_write(false); delay_microseconds_accurate(usec); } diff --git a/esphome/components/restart/restart_switch.cpp b/esphome/components/restart/restart_switch.cpp index cd0979b9d3..a87b84478c 100644 --- a/esphome/components/restart/restart_switch.cpp +++ b/esphome/components/restart/restart_switch.cpp @@ -7,7 +7,7 @@ namespace restart { static const char *TAG = "restart"; -void RestartSwitch::write_state(bool state) { +void RestartSwitch::write_state_(bool state) { // Acknowledge this->publish_state(false); diff --git a/esphome/components/restart/restart_switch.h b/esphome/components/restart/restart_switch.h index 7f1902ab53..9b171370e3 100644 --- a/esphome/components/restart/restart_switch.h +++ b/esphome/components/restart/restart_switch.h @@ -11,7 +11,7 @@ class RestartSwitch : public switch_::Switch, public Component { void dump_config() override; protected: - void write_state(bool state) override; + void write_state_(bool state) override; }; } // namespace restart diff --git a/esphome/components/sds011/sds011.cpp b/esphome/components/sds011/sds011.cpp index 1abb6210ce..7b222c5521 100644 --- a/esphome/components/sds011/sds011.cpp +++ b/esphome/components/sds011/sds011.cpp @@ -93,7 +93,7 @@ float SDS011Component::get_setup_priority() const { return setup_priority::DATA; void SDS011Component::set_rx_mode_only(bool rx_mode_only) { this->rx_mode_only_ = rx_mode_only; } -void SDS011Component::sds011_write_command_(const uint8_t *command_data) { +void SDS011Component::sds011_write_command(const uint8_t *command_data) { this->flush(); this->write_byte(SDS011_MSG_HEAD); this->write_byte(SDS011_COMMAND_ID_REQUEST); @@ -102,7 +102,7 @@ void SDS011Component::sds011_write_command_(const uint8_t *command_data) { this->write_byte(SDS011_MSG_TAIL); } -uint8_t SDS011Component::sds011_checksum_(const uint8_t *command_data, uint8_t length) const { +uint8_t SDS011Component::sds011_checksum(const uint8_t *command_data, uint8_t length) const { uint8_t sum = 0; for (uint8_t i = 0; i < length; i++) { sum += command_data[i]; @@ -110,7 +110,7 @@ uint8_t SDS011Component::sds011_checksum_(const uint8_t *command_data, uint8_t l return sum; } -optional SDS011Component::check_byte_() const { +optional SDS011Component::check_byte() const { uint8_t index = this->data_index_; uint8_t byte = this->data_[index]; @@ -164,7 +164,7 @@ void SDS011Component::parse_data_() { } } -uint16_t SDS011Component::get_16_bit_uint_(uint8_t start_index) const { +uint16_t SDS011Component::get_16_bit_uint(uint8_t start_index) const { return (uint16_t(this->data_[start_index + 1]) << 8) | uint16_t(this->data_[start_index]); } void SDS011Component::set_update_interval_min(uint8_t update_interval_min) { diff --git a/esphome/components/sensor/automation.h b/esphome/components/sensor/automation.h index 079077dba0..8fcd8318af 100644 --- a/esphome/components/sensor/automation.h +++ b/esphome/components/sensor/automation.h @@ -24,7 +24,7 @@ class SensorRawStateTrigger : public Trigger { template class SensorPublishAction : public Action { public: SensorPublishAction(Sensor *sensor) : sensor_(sensor) {} - TEMPLATABLE_VALUE(float, state) + templatable_value(float, state) void play(Ts... x) override { this->sensor_->publish_state(this->state_.value(x...)); } protected: diff --git a/esphome/components/sensor/sensor.h b/esphome/components/sensor/sensor.h index 1c7c854394..10727b12ba 100644 --- a/esphome/components/sensor/sensor.h +++ b/esphome/components/sensor/sensor.h @@ -162,7 +162,7 @@ class Sensor : public Nameable { /// Return the accuracy in decimals for this sensor. virtual int8_t accuracy_decimals(); // NOLINT - uint32_t hash_base() override; + uint32_t hash_base_() override; CallbackManager raw_callback_; ///< Storage for raw state callbacks. CallbackManager callback_; ///< Storage for filtered state callbacks. diff --git a/esphome/components/servo/servo.h b/esphome/components/servo/servo.h index 3a0993c0c4..d6c6d274c9 100644 --- a/esphome/components/servo/servo.h +++ b/esphome/components/servo/servo.h @@ -62,7 +62,7 @@ class Servo : public Component { template class ServoWriteAction : public Action { public: ServoWriteAction(Servo *servo) : servo_(servo) {} - TEMPLATABLE_VALUE(float, value) + templatable_value(float, value) void play(Ts... x) override { this->servo_->write(this->value_.value(x...)); } protected: diff --git a/esphome/components/sht3xd/sht3xd.cpp b/esphome/components/sht3xd/sht3xd.cpp index f23c0d59b4..612ca9150c 100644 --- a/esphome/components/sht3xd/sht3xd.cpp +++ b/esphome/components/sht3xd/sht3xd.cpp @@ -65,7 +65,7 @@ void SHT3XDComponent::update() { }); } -bool SHT3XDComponent::write_command_(uint16_t command) { +bool SHT3XDComponent::write_command(uint16_t command) { // Warning ugly, trick the I2Ccomponent base by setting register to the first 8 bit. return this->write_byte(command >> 8, command & 0xFF); } @@ -93,28 +93,11 @@ uint8_t sht_crc(uint8_t data1, uint8_t data2) { return crc; } -bool SHT3XDComponent::read_data_(uint16_t *data, uint8_t len) { +bool SHT3XDComponent::read_data(uint16_t *data, uint8_t len) { const uint8_t num_bytes = len * 3; auto *buf = new uint8_t[num_bytes]; - if (!this->parent_->raw_receive(this->address_, buf, num_bytes)) { - delete[](buf); - return false; - } - - for (uint8_t i = 0; i < len; i++) { - const uint8_t j = 3 * i; - uint8_t crc = sht_crc(buf[j], buf[j + 1]); - if (crc != buf[j + 2]) { - ESP_LOGE(TAG, "CRC8 Checksum invalid! 0x%02X != 0x%02X", buf[j + 2], crc); - delete[](buf); - return false; - } - data[i] = (buf[j] << 8) | buf[j + 1]; - } - - delete[](buf); - return true; + return !; } } // namespace sht3xd diff --git a/esphome/components/shutdown/shutdown_switch.cpp b/esphome/components/shutdown/shutdown_switch.cpp index d27bb8aadc..44e619a241 100644 --- a/esphome/components/shutdown/shutdown_switch.cpp +++ b/esphome/components/shutdown/shutdown_switch.cpp @@ -8,7 +8,7 @@ namespace shutdown { static const char *TAG = "shutdown.switch"; void ShutdownSwitch::dump_config() { LOG_SWITCH("", "Shutdown Switch", this); } -void ShutdownSwitch::write_state(bool state) { +void ShutdownSwitch::write_state_(bool state) { // Acknowledge this->publish_state(false); diff --git a/esphome/components/shutdown/shutdown_switch.h b/esphome/components/shutdown/shutdown_switch.h index 6aa64ff06b..2f7f53751a 100644 --- a/esphome/components/shutdown/shutdown_switch.h +++ b/esphome/components/shutdown/shutdown_switch.h @@ -11,7 +11,7 @@ class ShutdownSwitch : public switch_::Switch, public Component { void dump_config() override; protected: - void write_state(bool state) override; + void write_state_(bool state) override; }; } // namespace shutdown diff --git a/esphome/components/sm16716/sm16716.h b/esphome/components/sm16716/sm16716.h index fe534d93fe..538e6a7151 100644 --- a/esphome/components/sm16716/sm16716.h +++ b/esphome/components/sm16716/sm16716.h @@ -30,7 +30,7 @@ class SM16716 : public Component { void set_channel(uint8_t channel) { channel_ = channel; } protected: - void write_state(float state) override { + void write_state_(float state) override { auto amount = uint8_t(state * 0xFF); this->parent_->set_channel_value_(this->channel_, amount); } diff --git a/esphome/components/ssd1306_base/ssd1306_base.cpp b/esphome/components/ssd1306_base/ssd1306_base.cpp index b6f2d94eac..9584564eb9 100644 --- a/esphome/components/ssd1306_base/ssd1306_base.cpp +++ b/esphome/components/ssd1306_base/ssd1306_base.cpp @@ -143,7 +143,7 @@ void SSD1306::update() { this->do_update_(); this->display(); } -int SSD1306::get_height_internal() { +int SSD1306::get_height_internal_() { switch (this->model_) { case SSD1306_MODEL_128_32: case SH1106_MODEL_128_32: @@ -161,7 +161,7 @@ int SSD1306::get_height_internal() { return 0; } } -int SSD1306::get_width_internal() { +int SSD1306::get_width_internal_() { switch (this->model_) { case SSD1306_MODEL_128_32: case SH1106_MODEL_128_32: @@ -178,7 +178,7 @@ int SSD1306::get_width_internal() { return 0; } } -size_t SSD1306::get_buffer_length_() { +size_t SSD1306::get_buffer_length() { return size_t(this->get_width_internal()) * size_t(this->get_height_internal()) / 8u; } diff --git a/esphome/components/ssd1306_base/ssd1306_base.h b/esphome/components/ssd1306_base/ssd1306_base.h index 66c12ec938..c2d39d4309 100644 --- a/esphome/components/ssd1306_base/ssd1306_base.h +++ b/esphome/components/ssd1306_base/ssd1306_base.h @@ -40,10 +40,10 @@ class SSD1306 : public PollingComponent, public display::DisplayBuffer { bool is_sh1106_() const; - void draw_absolute_pixel_internal(int x, int y, int color) override; + void draw_absolute_pixel_internal_(int x, int y, int color) override; - int get_height_internal() override; - int get_width_internal() override; + int get_height_internal_() override; + int get_width_internal_() override; size_t get_buffer_length_(); const char *model_str_(); diff --git a/esphome/components/ssd1306_i2c/ssd1306_i2c.h b/esphome/components/ssd1306_i2c/ssd1306_i2c.h index e3f21fe74c..f491cc9e02 100644 --- a/esphome/components/ssd1306_i2c/ssd1306_i2c.h +++ b/esphome/components/ssd1306_i2c/ssd1306_i2c.h @@ -13,8 +13,8 @@ class I2CSSD1306 : public ssd1306_base::SSD1306, public i2c::I2CDevice { void dump_config() override; protected: - void command(uint8_t value) override; - void write_display_data() override; + void command_(uint8_t value) override; + void write_display_data_() override; enum ErrorCode { NONE = 0, COMMUNICATION_FAILED } error_code_{NONE}; }; diff --git a/esphome/components/ssd1306_spi/ssd1306_spi.h b/esphome/components/ssd1306_spi/ssd1306_spi.h index c58ebc800a..3e4195ee0d 100644 --- a/esphome/components/ssd1306_spi/ssd1306_spi.h +++ b/esphome/components/ssd1306_spi/ssd1306_spi.h @@ -18,9 +18,9 @@ class SPISSD1306 : public ssd1306_base::SSD1306, void dump_config() override; protected: - void command(uint8_t value) override; + void command_(uint8_t value) override; - void write_display_data() override; + void write_display_data_() override; GPIOPin *dc_pin_; }; diff --git a/esphome/components/stepper/stepper.cpp b/esphome/components/stepper/stepper.cpp index b966fb00cc..ec5415888b 100644 --- a/esphome/components/stepper/stepper.cpp +++ b/esphome/components/stepper/stepper.cpp @@ -6,7 +6,7 @@ namespace stepper { static const char *TAG = "stepper"; -void Stepper::calculate_speed_(uint32_t now) { +void Stepper::calculate_speed(uint32_t now) { // delta t since last calculation in seconds float dt = (now - this->last_calculation_) * 1e-6f; this->last_calculation_ = now; @@ -28,7 +28,7 @@ void Stepper::calculate_speed_(uint32_t now) { } this->current_speed_ = clamp(this->current_speed_, 0.0f, this->max_speed_); } -int32_t Stepper::should_step_() { +int32_t Stepper::should_step() { uint32_t now = micros(); this->calculate_speed_(now); if (this->current_speed_ == 0.0f) diff --git a/esphome/components/stepper/stepper.h b/esphome/components/stepper/stepper.h index 33777dce83..a1330ebe94 100644 --- a/esphome/components/stepper/stepper.h +++ b/esphome/components/stepper/stepper.h @@ -41,7 +41,7 @@ template class SetTargetAction : public Action { public: explicit SetTargetAction(Stepper *parent) : parent_(parent) {} - TEMPLATABLE_VALUE(int32_t, target) + templatable_value(int32_t, target) void play(Ts... x) override { this->parent_->set_target(this->target_.value(x...)); } @@ -53,7 +53,7 @@ template class ReportPositionAction : public Action { public: explicit ReportPositionAction(Stepper *parent) : parent_(parent) {} - TEMPLATABLE_VALUE(int32_t, position) + templatable_value(int32_t, position) void play(Ts... x) override { this->parent_->report_position(this->position_.value(x...)); } @@ -65,7 +65,7 @@ template class SetSpeedAction : public Action { public: explicit SetSpeedAction(Stepper *parent) : parent_(parent) {} - TEMPLATABLE_VALUE(float, speed); + templatable_value(float, speed); void play(Ts... x) override { float speed = this->speed_.value(x...); diff --git a/esphome/components/sun/sun.cpp b/esphome/components/sun/sun.cpp index e0da63bb4b..25084b87da 100644 --- a/esphome/components/sun/sun.cpp +++ b/esphome/components/sun/sun.cpp @@ -101,7 +101,7 @@ double Sun::azimuth_rad_(double sun_time) { return az; } double Sun::azimuth_(double sun_time) { return this->azimuth_rad_(sun_time) * TO_DEGREES; } -double Sun::calc_sun_time_(const time::ESPTime &time) { +double Sun::calc_sun_time(const time::ESPTime &time) { // Time as seen at 0° longitude if (!time.is_valid()) return NAN; @@ -111,7 +111,7 @@ double Sun::calc_sun_time_(const time::ESPTime &time) { double add = this->longitude_ / 360.0; return base + add; } -uint32_t Sun::calc_epoch_(time::ESPTime base, double sun_time) { +uint32_t Sun::calc_epoch(time::ESPTime base, double sun_time) { sun_time -= this->longitude_ / 360.0; base.day_of_year = uint32_t(floor(sun_time)); @@ -127,7 +127,7 @@ uint32_t Sun::calc_epoch_(time::ESPTime base, double sun_time) { base.recalc_timestamp_utc(true); return base.timestamp; } -double Sun::sun_time_for_elevation_(int32_t day_of_year, double elevation, bool rising) { +double Sun::sun_time_for_elevation(int32_t day_of_year, double elevation, bool rising) { // Use binary search, newton's method would be better but binary search already // converges quite well (19 cycles) and much simpler. Function is guaranteed to be // monotonous. diff --git a/esphome/components/sun/sun.h b/esphome/components/sun/sun.h index 501d122da0..51e154ec1a 100644 --- a/esphome/components/sun/sun.h +++ b/esphome/components/sun/sun.h @@ -117,7 +117,7 @@ class SunTrigger : public Trigger<>, public PollingComponent, public Parented class SunCondition : public Condition, public Parented { public: - TEMPLATABLE_VALUE(double, elevation); + templatable_value(double, elevation); void set_above(bool above) { above_ = above; } bool check(Ts... x) override { diff --git a/esphome/components/switch/automation.h b/esphome/components/switch/automation.h index 90bdabf0f4..ff0f5bd8f1 100644 --- a/esphome/components/switch/automation.h +++ b/esphome/components/switch/automation.h @@ -72,7 +72,7 @@ class SwitchTurnOffTrigger : public Trigger<> { template class SwitchPublishAction : public Action { public: SwitchPublishAction(Switch *a_switch) : switch_(a_switch) {} - TEMPLATABLE_VALUE(bool, state) + templatable_value(bool, state) void play(Ts... x) override { this->switch_->publish_state(this->state_.value(x...)); } protected: diff --git a/esphome/components/switch/switch.h b/esphome/components/switch/switch.h index be4fc24c4a..b7d11af939 100644 --- a/esphome/components/switch/switch.h +++ b/esphome/components/switch/switch.h @@ -112,7 +112,7 @@ class Switch : public Nameable { */ virtual std::string icon(); // NOLINT - uint32_t hash_base() override; + uint32_t hash_base_() override; optional icon_{}; ///< The icon shown here. Not set means use default from switch. Empty means no icon. diff --git a/esphome/components/tcl112/tcl112.h b/esphome/components/tcl112/tcl112.h index 0b80dedbef..366596b2be 100644 --- a/esphome/components/tcl112/tcl112.h +++ b/esphome/components/tcl112/tcl112.h @@ -22,9 +22,9 @@ class Tcl112Climate : public climate::Climate, public Component { protected: /// Override control to change settings of the climate device. - void control(const climate::ClimateCall &call) override; + void control_(const climate::ClimateCall &call) override; /// Return the traits of this controller. - climate::ClimateTraits traits() override; + climate::ClimateTraits traits_() override; /// Transmit via IR the state of this climate controller. void transmit_state_(); diff --git a/esphome/components/template/cover/template_cover.cpp b/esphome/components/template/cover/template_cover.cpp index 381e6dd6cd..1684cb1de6 100644 --- a/esphome/components/template/cover/template_cover.cpp +++ b/esphome/components/template/cover/template_cover.cpp @@ -8,7 +8,7 @@ using namespace esphome::cover; static const char *TAG = "template.cover"; -TemplateCover::TemplateCover() + : open_trigger_(new Trigger<>()), close_trigger_(new Trigger<>), stop_trigger_(new Trigger<>()), diff --git a/esphome/components/template/cover/template_cover.h b/esphome/components/template/cover/template_cover.h index 3b9dcea50b..a01abd1366 100644 --- a/esphome/components/template/cover/template_cover.h +++ b/esphome/components/template/cover/template_cover.h @@ -37,8 +37,8 @@ class TemplateCover : public cover::Cover, public Component { float get_setup_priority() const override; protected: - void control(const cover::CoverCall &call) override; - cover::CoverTraits get_traits() override; + void control_(const cover::CoverCall &call) override; + cover::CoverTraits get_traits_() override; void stop_prev_trigger_(); TemplateCoverRestoreMode restore_mode_{COVER_RESTORE}; diff --git a/esphome/components/template/switch/template_switch.cpp b/esphome/components/template/switch/template_switch.cpp index 5868b30996..467660f9a7 100644 --- a/esphome/components/template/switch/template_switch.cpp +++ b/esphome/components/template/switch/template_switch.cpp @@ -17,7 +17,7 @@ void TemplateSwitch::loop() { this->publish_state(*s); } -void TemplateSwitch::write_state(bool state) { +void TemplateSwitch::write_state_(bool state) { if (this->prev_trigger_ != nullptr) { this->prev_trigger_->stop(); } @@ -34,7 +34,7 @@ void TemplateSwitch::write_state(bool state) { this->publish_state(state); } void TemplateSwitch::set_optimistic(bool optimistic) { this->optimistic_ = optimistic; } -bool TemplateSwitch::assumed_state() { return this->assumed_state_; } +bool TemplateSwitch::assumed_state_() { return this->assumed_state_; } void TemplateSwitch::set_state_lambda(std::function()> &&f) { this->f_ = f; } float TemplateSwitch::get_setup_priority() const { return setup_priority::HARDWARE; } Trigger<> *TemplateSwitch::get_turn_on_trigger() const { return this->turn_on_trigger_; } diff --git a/esphome/components/template/switch/template_switch.h b/esphome/components/template/switch/template_switch.h index ef9b567451..759615604b 100644 --- a/esphome/components/template/switch/template_switch.h +++ b/esphome/components/template/switch/template_switch.h @@ -25,9 +25,9 @@ class TemplateSwitch : public switch_::Switch, public Component { float get_setup_priority() const override; protected: - bool assumed_state() override; + bool assumed_state_() override; - void write_state(bool state) override; + void write_state_(bool state) override; optional()>> f_; bool optimistic_{false}; diff --git a/esphome/components/text_sensor/text_sensor.h b/esphome/components/text_sensor/text_sensor.h index 719f0b0d62..78fa28b085 100644 --- a/esphome/components/text_sensor/text_sensor.h +++ b/esphome/components/text_sensor/text_sensor.h @@ -41,7 +41,7 @@ class TextSensor : public Nameable { bool has_state(); protected: - uint32_t hash_base() override; + uint32_t hash_base_() override; CallbackManager callback_; optional icon_; diff --git a/esphome/components/time/real_time_clock.cpp b/esphome/components/time/real_time_clock.cpp index 81524826be..3b1f58e830 100644 --- a/esphome/components/time/real_time_clock.cpp +++ b/esphome/components/time/real_time_clock.cpp @@ -17,7 +17,7 @@ void RealTimeClock::call_setup() { tzset(); this->setup(); } -void RealTimeClock::synchronize_epoch_(uint32_t epoch) { +void RealTimeClock::synchronize_epoch(uint32_t epoch) { struct timeval timev { .tv_sec = static_cast(epoch), .tv_usec = 0, }; @@ -76,11 +76,7 @@ std::string ESPTime::strftime(const std::string &format) { template bool increment_time_value(T ¤t, uint16_t begin, uint16_t end) { current++; - if (current >= end) { - current = begin; - return true; - } - return false; + return ; } static bool is_leap_year(uint32_t year) { return (year % 4) == 0 && ((year % 100) != 0 || (year % 400) == 0); } diff --git a/esphome/components/time/real_time_clock.h b/esphome/components/time/real_time_clock.h index 9f40fdc5b5..126213bdf7 100644 --- a/esphome/components/time/real_time_clock.h +++ b/esphome/components/time/real_time_clock.h @@ -32,7 +32,7 @@ struct ESPTime { /// daylight savings time flag bool is_dst; union { - ESPDEPRECATED(".time is deprecated, use .timestamp instead") time_t time; + espdeprecated(".time is deprecated, use .timestamp instead") time_t time; /// unix epoch time (seconds since UTC Midnight January 1, 1970) time_t timestamp; }; diff --git a/esphome/components/time_based/time_based_cover.cpp b/esphome/components/time_based/time_based_cover.cpp index bbc887debc..cbdfe10bf3 100644 --- a/esphome/components/time_based/time_based_cover.cpp +++ b/esphome/components/time_based/time_based_cover.cpp @@ -81,7 +81,7 @@ bool TimeBasedCover::is_at_target_() const { return true; } } -void TimeBasedCover::start_direction_(CoverOperation dir) { +void TimeBasedCover::start_direction(CoverOperation dir) { if (dir == this->current_operation) return; diff --git a/esphome/components/time_based/time_based_cover.h b/esphome/components/time_based/time_based_cover.h index 60819d797b..29e8df1a0e 100644 --- a/esphome/components/time_based/time_based_cover.h +++ b/esphome/components/time_based/time_based_cover.h @@ -22,7 +22,7 @@ class TimeBasedCover : public cover::Cover, public Component { cover::CoverTraits get_traits() override; protected: - void control(const cover::CoverCall &call) override; + void control_(const cover::CoverCall &call) override; void stop_prev_trigger_(); bool is_at_target_() const; diff --git a/esphome/components/tsl2561/tsl2561.cpp b/esphome/components/tsl2561/tsl2561.cpp index ffd39a54b0..5bb5eb1889 100644 --- a/esphome/components/tsl2561/tsl2561.cpp +++ b/esphome/components/tsl2561/tsl2561.cpp @@ -63,7 +63,7 @@ void TSL2561Sensor::update() { this->set_timeout("illuminance", timeout, [this]() { this->read_data_(); }); } -float TSL2561Sensor::calculate_lx_(uint16_t ch0, uint16_t ch1) { +float TSL2561Sensor::calculate_lx(uint16_t ch0, uint16_t ch1) { if ((ch0 == 0xFFFF) || (ch1 == 0xFFFF)) { ESP_LOGW(TAG, "TSL2561 sensor is saturated."); return NAN; diff --git a/esphome/components/uart/switch/uart_switch.cpp b/esphome/components/uart/switch/uart_switch.cpp index 9974ee1179..813adf0b81 100644 --- a/esphome/components/uart/switch/uart_switch.cpp +++ b/esphome/components/uart/switch/uart_switch.cpp @@ -6,7 +6,7 @@ namespace uart { static const char *TAG = "uart.switch"; -void UARTSwitch::write_state(bool state) { +void UARTSwitch::write_state_(bool state) { if (!state) { this->publish_state(false); return; diff --git a/esphome/components/uart/switch/uart_switch.h b/esphome/components/uart/switch/uart_switch.h index c8a1b0d8c5..d10995ddb4 100644 --- a/esphome/components/uart/switch/uart_switch.h +++ b/esphome/components/uart/switch/uart_switch.h @@ -14,7 +14,7 @@ class UARTSwitch : public switch_::Switch, public UARTDevice, public Component { void dump_config() override; protected: - void write_state(bool state) override; + void write_state_(bool state) override; std::vector data_; }; diff --git a/esphome/components/uart/uart.cpp b/esphome/components/uart/uart.cpp index 56661b8aa7..907946fa84 100644 --- a/esphome/components/uart/uart.cpp +++ b/esphome/components/uart/uart.cpp @@ -205,7 +205,7 @@ bool UARTComponent::read_array(uint8_t *data, size_t len) { return true; } -bool UARTComponent::check_read_timeout_(size_t len) { +bool UARTComponent::check_read_timeout(size_t len) { if (this->available() >= int(len)) return true; diff --git a/esphome/components/uln2003/uln2003.cpp b/esphome/components/uln2003/uln2003.cpp index b1a397ad6c..fcbf0834d4 100644 --- a/esphome/components/uln2003/uln2003.cpp +++ b/esphome/components/uln2003/uln2003.cpp @@ -56,7 +56,7 @@ void ULN2003::dump_config() { } ESP_LOGCONFIG(TAG, " Step Mode: %s", step_mode_s); } -void ULN2003::write_step_(int32_t step) { +void ULN2003::write_step(int32_t step) { int32_t n = this->step_mode_ == ULN2003_STEP_MODE_HALF_STEP ? 8 : 4; auto i = static_cast((step % n + n) % n); uint8_t res = 0; diff --git a/esphome/components/waveshare_epaper/waveshare_epaper.h b/esphome/components/waveshare_epaper/waveshare_epaper.h index a8b85c93e9..92a2af0d08 100644 --- a/esphome/components/waveshare_epaper/waveshare_epaper.h +++ b/esphome/components/waveshare_epaper/waveshare_epaper.h @@ -36,7 +36,7 @@ class WaveshareEPaper : public PollingComponent, void on_safe_shutdown() override; protected: - void draw_absolute_pixel_internal(int x, int y, int color) override; + void draw_absolute_pixel_internal_(int x, int y, int color) override; bool wait_until_idle_(); @@ -90,9 +90,9 @@ class WaveshareEPaperTypeA : public WaveshareEPaper { protected: void write_lut_(const uint8_t *lut); - int get_width_internal() override; + int get_width_internal_() override; - int get_height_internal() override; + int get_height_internal_() override; uint32_t full_update_every_{30}; uint32_t at_update_{0}; @@ -120,9 +120,9 @@ class WaveshareEPaper2P7In : public WaveshareEPaper { } protected: - int get_width_internal() override; + int get_width_internal_() override; - int get_height_internal() override; + int get_height_internal_() override; }; class WaveshareEPaper4P2In : public WaveshareEPaper { @@ -163,9 +163,9 @@ class WaveshareEPaper4P2In : public WaveshareEPaper { } protected: - int get_width_internal() override; + int get_width_internal_() override; - int get_height_internal() override; + int get_height_internal_() override; }; class WaveshareEPaper7P5In : public WaveshareEPaper { @@ -186,9 +186,9 @@ class WaveshareEPaper7P5In : public WaveshareEPaper { } protected: - int get_width_internal() override; + int get_width_internal_() override; - int get_height_internal() override; + int get_height_internal_() override; }; } // namespace waveshare_epaper diff --git a/esphome/components/web_server/web_server.cpp b/esphome/components/web_server/web_server.cpp index 882af4b995..99354e0019 100644 --- a/esphome/components/web_server/web_server.cpp +++ b/esphome/components/web_server/web_server.cpp @@ -147,7 +147,7 @@ void report_ota_error() { ESP_LOGW(TAG, "OTA Update failed! Error: %s", ss.c_str()); } -void WebServer::handleUpload(AsyncWebServerRequest *request, const String &filename, size_t index, uint8_t *data, +void WebServer::handle_upload(AsyncWebServerRequest *request, const String &filename, size_t index, uint8_t *data, size_t len, bool final) { bool success; if (index == 0) { @@ -527,7 +527,7 @@ std::string WebServer::light_json(light::LightState *obj) { } #endif -bool WebServer::canHandle(AsyncWebServerRequest *request) { +bool WebServer::can_handle(AsyncWebServerRequest *request) { if (request->url() == "/") return true; @@ -569,7 +569,7 @@ bool WebServer::canHandle(AsyncWebServerRequest *request) { return false; } -void WebServer::handleRequest(AsyncWebServerRequest *request) { +void WebServer::handle_request(AsyncWebServerRequest *request) { if (request->url() == "/") { this->handle_index_request(request); return; @@ -624,7 +624,7 @@ void WebServer::handleRequest(AsyncWebServerRequest *request) { #endif } -bool WebServer::isRequestHandlerTrivial() { return false; } +bool WebServer::is_request_handler_trivial() { return false; } } // namespace web_server } // namespace esphome diff --git a/esphome/components/web_server/web_server.h b/esphome/components/web_server/web_server.h index 7840a81dce..fd2ca93d55 100644 --- a/esphome/components/web_server/web_server.h +++ b/esphome/components/web_server/web_server.h @@ -119,13 +119,13 @@ class WebServer : public Controller, public Component, public AsyncWebHandler { #endif /// Override the web handler's canHandle method. - bool canHandle(AsyncWebServerRequest *request) override; + bool can_handle(AsyncWebServerRequest *request) override; /// Override the web handler's handleRequest method. - void handleRequest(AsyncWebServerRequest *request) override; - void handleUpload(AsyncWebServerRequest *request, const String &filename, size_t index, uint8_t *data, size_t len, + void handle_request(AsyncWebServerRequest *request) override; + void handle_upload(AsyncWebServerRequest *request, const String &filename, size_t index, uint8_t *data, size_t len, bool final) override; /// This web handle is not trivial. - bool isRequestHandlerTrivial() override; + bool is_request_handler_trivial() override; protected: uint16_t port_; diff --git a/esphome/components/wifi/wifi_component_esp8266.cpp b/esphome/components/wifi/wifi_component_esp8266.cpp index afd5b7c0cc..261b2c156b 100644 --- a/esphome/components/wifi/wifi_component_esp8266.cpp +++ b/esphome/components/wifi/wifi_component_esp8266.cpp @@ -20,7 +20,7 @@ namespace wifi { static const char *TAG = "wifi_esp8266"; -bool WiFiComponent::wifi_mode_(optional sta, optional ap) { +bool WiFiComponent::wifi_mode(optional sta, optional ap) { uint8_t current_mode = wifi_get_opmode(); bool current_sta = current_mode & 0b01; bool current_ap = current_mode & 0b10; @@ -411,7 +411,7 @@ void WiFiComponent::wifi_event_callback(System_Event_t *event) { } void WiFiComponent::wifi_register_callbacks_() { wifi_set_event_handler_cb(&WiFiComponent::wifi_event_callback); } -wl_status_t WiFiComponent::wifi_sta_status_() { +wl_status_t WiFiComponent::wifi_sta_status() { station_status_t status = wifi_station_get_connect_status(); switch (status) { case STATION_GOT_IP: @@ -469,7 +469,7 @@ void WiFiComponent::s_wifi_scan_done_callback(void *arg, STATUS status) { global_wifi_component->wifi_scan_done_callback_(arg, status); } -void WiFiComponent::wifi_scan_done_callback_(void *arg, STATUS status) { +void WiFiComponent::wifi_scan_done_callback(void *arg, STATUS status) { this->scan_result_.clear(); if (status != OK) { @@ -486,7 +486,7 @@ void WiFiComponent::wifi_scan_done_callback_(void *arg, STATUS status) { } this->scan_done_ = true; } -bool WiFiComponent::wifi_ap_ip_config_(optional manual_ip) { +bool WiFiComponent::wifi_ap_ip_config(optional manual_ip) { // enable AP if (!this->wifi_mode_({}, true)) return false; diff --git a/esphome/core/preferences.cpp b/esphome/core/preferences.cpp index 65140bbdc8..8279833ffa 100644 --- a/esphome/core/preferences.cpp +++ b/esphome/core/preferences.cpp @@ -55,11 +55,7 @@ bool ESPPreferenceObject::save_() { #define ESP_RTC_USER_MEM_SIZE_BYTES ESP_RTC_USER_MEM_SIZE_WORDS * 4 static inline bool esp_rtc_user_mem_read(uint32_t index, uint32_t *dest) { - if (index >= ESP_RTC_USER_MEM_SIZE_WORDS) { - return false; - } - *dest = ESP_RTC_USER_MEM[index]; - return true; + return !; } #ifdef USE_ESP8266_PREFERENCES_FLASH diff --git a/script/helpers.py b/script/helpers.py old mode 100644 new mode 100755 diff --git a/setup.py b/setup.py old mode 100755 new mode 100644