diff --git a/esphome/components/ade7953_i2c/ade7953_i2c.cpp b/esphome/components/ade7953_i2c/ade7953_i2c.cpp index ae381824d..59c2254d4 100644 --- a/esphome/components/ade7953_i2c/ade7953_i2c.cpp +++ b/esphome/components/ade7953_i2c/ade7953_i2c.cpp @@ -1,6 +1,6 @@ #include "ade7953_i2c.h" -#include "esphome/core/log.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" namespace esphome { namespace ade7953_i2c { diff --git a/esphome/components/ade7953_spi/ade7953_spi.cpp b/esphome/components/ade7953_spi/ade7953_spi.cpp index 77a2a8adc..6b16d933a 100644 --- a/esphome/components/ade7953_spi/ade7953_spi.cpp +++ b/esphome/components/ade7953_spi/ade7953_spi.cpp @@ -1,6 +1,6 @@ #include "ade7953_spi.h" -#include "esphome/core/log.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" namespace esphome { namespace ade7953_spi { diff --git a/esphome/components/ads1118/ads1118.cpp b/esphome/components/ads1118/ads1118.cpp index 976b599a6..1daa8fdfd 100644 --- a/esphome/components/ads1118/ads1118.cpp +++ b/esphome/components/ads1118/ads1118.cpp @@ -1,4 +1,5 @@ #include "ads1118.h" +#include "esphome/core/helpers.h" #include "esphome/core/log.h" namespace esphome { diff --git a/esphome/components/ags10/ags10.cpp b/esphome/components/ags10/ags10.cpp index 16228708e..797a07afa 100644 --- a/esphome/components/ags10/ags10.cpp +++ b/esphome/components/ags10/ags10.cpp @@ -1,4 +1,5 @@ #include "ags10.h" +#include "esphome/core/helpers.h" #include diff --git a/esphome/components/aht10/aht10.cpp b/esphome/components/aht10/aht10.cpp index cb4a49488..7f17e1c0d 100644 --- a/esphome/components/aht10/aht10.cpp +++ b/esphome/components/aht10/aht10.cpp @@ -13,9 +13,9 @@ // results making successive requests; the current implementation makes 3 attempts with a delay of 30ms each time. #include "aht10.h" -#include "esphome/core/log.h" #include "esphome/core/hal.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" namespace esphome { namespace aht10 { diff --git a/esphome/components/am43/am43_base.h b/esphome/components/am43/am43_base.h index e817f161f..35354af9e 100644 --- a/esphome/components/am43/am43_base.h +++ b/esphome/components/am43/am43_base.h @@ -1,7 +1,7 @@ #pragma once -#include "esphome/core/log.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" namespace esphome { namespace am43 { diff --git a/esphome/components/api/api_frame_helper.cpp b/esphome/components/api/api_frame_helper.cpp index f5467992c..e0eb94836 100644 --- a/esphome/components/api/api_frame_helper.cpp +++ b/esphome/components/api/api_frame_helper.cpp @@ -1,9 +1,9 @@ #include "api_frame_helper.h" #ifdef USE_API -#include "esphome/core/log.h" +#include "esphome/core/application.h" #include "esphome/core/hal.h" #include "esphome/core/helpers.h" -#include "esphome/core/application.h" +#include "esphome/core/log.h" #include "proto.h" #include "api_pb2_size.h" #include diff --git a/esphome/components/api/homeassistant_service.h b/esphome/components/api/homeassistant_service.h index e91756c3c..32d13b69a 100644 --- a/esphome/components/api/homeassistant_service.h +++ b/esphome/components/api/homeassistant_service.h @@ -3,8 +3,8 @@ #include "api_server.h" #ifdef USE_API #include "api_pb2.h" -#include "esphome/core/helpers.h" #include "esphome/core/automation.h" +#include "esphome/core/helpers.h" #include namespace esphome { diff --git a/esphome/components/api/proto.cpp b/esphome/components/api/proto.cpp index 7af2e9253..25daf17cc 100644 --- a/esphome/components/api/proto.cpp +++ b/esphome/components/api/proto.cpp @@ -1,5 +1,6 @@ #include "proto.h" #include +#include "esphome/core/helpers.h" #include "esphome/core/log.h" namespace esphome { diff --git a/esphome/components/api/proto.h b/esphome/components/api/proto.h index b3440dbfe..5265c4520 100644 --- a/esphome/components/api/proto.h +++ b/esphome/components/api/proto.h @@ -1,8 +1,8 @@ #pragma once #include "esphome/core/component.h" -#include "esphome/core/log.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" #include diff --git a/esphome/components/ble_client/sensor/ble_sensor.cpp b/esphome/components/ble_client/sensor/ble_sensor.cpp index 6dafe371b..f91b07fee 100644 --- a/esphome/components/ble_client/sensor/ble_sensor.cpp +++ b/esphome/components/ble_client/sensor/ble_sensor.cpp @@ -1,7 +1,7 @@ #include "ble_sensor.h" -#include "esphome/core/log.h" #include "esphome/core/application.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" #include "esphome/components/esp32_ble_tracker/esp32_ble_tracker.h" #ifdef USE_ESP32 diff --git a/esphome/components/bme680_bsec/bme680_bsec.cpp b/esphome/components/bme680_bsec/bme680_bsec.cpp index d3868e256..562d39e7b 100644 --- a/esphome/components/bme680_bsec/bme680_bsec.cpp +++ b/esphome/components/bme680_bsec/bme680_bsec.cpp @@ -1,6 +1,6 @@ #include "bme680_bsec.h" -#include "esphome/core/log.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" #include namespace esphome { diff --git a/esphome/components/ccs811/ccs811.cpp b/esphome/components/ccs811/ccs811.cpp index 700e1b4df..cecb92b3d 100644 --- a/esphome/components/ccs811/ccs811.cpp +++ b/esphome/components/ccs811/ccs811.cpp @@ -1,6 +1,7 @@ #include "ccs811.h" -#include "esphome/core/log.h" #include "esphome/core/hal.h" +#include "esphome/core/helpers.h" +#include "esphome/core/log.h" namespace esphome { namespace ccs811 { diff --git a/esphome/components/climate/climate.h b/esphome/components/climate/climate.h index d81702fb0..b31a2eedf 100644 --- a/esphome/components/climate/climate.h +++ b/esphome/components/climate/climate.h @@ -3,8 +3,8 @@ #include "esphome/core/component.h" #include "esphome/core/entity_base.h" #include "esphome/core/helpers.h" -#include "esphome/core/preferences.h" #include "esphome/core/log.h" +#include "esphome/core/preferences.h" #include "climate_mode.h" #include "climate_traits.h" diff --git a/esphome/components/cse7766/cse7766.cpp b/esphome/components/cse7766/cse7766.cpp index b0876778a..fe81ae91f 100644 --- a/esphome/components/cse7766/cse7766.cpp +++ b/esphome/components/cse7766/cse7766.cpp @@ -223,11 +223,6 @@ void CSE7766Component::parse_data_() { #endif } -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]); -} - void CSE7766Component::dump_config() { ESP_LOGCONFIG(TAG, "CSE7766:"); LOG_SENSOR(" ", "Voltage", this->voltage_sensor_); diff --git a/esphome/components/cse7766/cse7766.h b/esphome/components/cse7766/cse7766.h index 5d89b3b75..8902eafe3 100644 --- a/esphome/components/cse7766/cse7766.h +++ b/esphome/components/cse7766/cse7766.h @@ -1,6 +1,7 @@ #pragma once #include "esphome/core/component.h" +#include "esphome/core/helpers.h" #include "esphome/components/sensor/sensor.h" #include "esphome/components/uart/uart.h" @@ -28,7 +29,10 @@ class CSE7766Component : public Component, public uart::UARTDevice { protected: bool check_byte_(); void parse_data_(); - uint32_t get_24_bit_uint_(uint8_t start_index); + uint32_t get_24_bit_uint_(uint8_t start_index) const { + return encode_uint24(this->raw_data_[start_index], this->raw_data_[start_index + 1], + this->raw_data_[start_index + 2]); + } uint8_t raw_data_[24]; uint8_t raw_data_index_{0}; diff --git a/esphome/components/cst816/touchscreen/cst816_touchscreen.cpp b/esphome/components/cst816/touchscreen/cst816_touchscreen.cpp index 47d52ac24..0c5099d4f 100644 --- a/esphome/components/cst816/touchscreen/cst816_touchscreen.cpp +++ b/esphome/components/cst816/touchscreen/cst816_touchscreen.cpp @@ -1,4 +1,5 @@ #include "cst816_touchscreen.h" +#include "esphome/core/helpers.h" namespace esphome { namespace cst816 { diff --git a/esphome/components/dac7678/dac7678_output.cpp b/esphome/components/dac7678/dac7678_output.cpp index bf0a9a309..5c10bbc1b 100644 --- a/esphome/components/dac7678/dac7678_output.cpp +++ b/esphome/components/dac7678/dac7678_output.cpp @@ -1,7 +1,7 @@ #include "dac7678_output.h" -#include "esphome/core/log.h" -#include "esphome/core/helpers.h" #include "esphome/core/hal.h" +#include "esphome/core/helpers.h" +#include "esphome/core/log.h" namespace esphome { namespace dac7678 { diff --git a/esphome/components/daly_bms/daly_bms.cpp b/esphome/components/daly_bms/daly_bms.cpp index 1dd052046..2d270cc56 100644 --- a/esphome/components/daly_bms/daly_bms.cpp +++ b/esphome/components/daly_bms/daly_bms.cpp @@ -1,7 +1,8 @@ #include "daly_bms.h" #include -#include "esphome/core/log.h" #include "esphome/core/application.h" +#include "esphome/core/helpers.h" +#include "esphome/core/log.h" namespace esphome { namespace daly_bms { diff --git a/esphome/components/debug/debug_component.cpp b/esphome/components/debug/debug_component.cpp index 41e07dac3..ade0968e0 100644 --- a/esphome/components/debug/debug_component.cpp +++ b/esphome/components/debug/debug_component.cpp @@ -2,9 +2,9 @@ #include #include "esphome/core/application.h" -#include "esphome/core/log.h" #include "esphome/core/hal.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" #include "esphome/core/version.h" #include #include diff --git a/esphome/components/debug/debug_component.h b/esphome/components/debug/debug_component.h index 50d26ad2e..efd0dafab 100644 --- a/esphome/components/debug/debug_component.h +++ b/esphome/components/debug/debug_component.h @@ -2,8 +2,8 @@ #include "esphome/core/component.h" #include "esphome/core/defines.h" -#include "esphome/core/macros.h" #include "esphome/core/helpers.h" +#include "esphome/core/macros.h" #ifdef USE_SENSOR #include "esphome/components/sensor/sensor.h" diff --git a/esphome/components/dht/dht.cpp b/esphome/components/dht/dht.cpp index 27234ed4d..7248ef624 100644 --- a/esphome/components/dht/dht.cpp +++ b/esphome/components/dht/dht.cpp @@ -1,6 +1,6 @@ #include "dht.h" -#include "esphome/core/log.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" namespace esphome { namespace dht { diff --git a/esphome/components/duty_cycle/duty_cycle_sensor.cpp b/esphome/components/duty_cycle/duty_cycle_sensor.cpp index 6c24fc7a8..8939de0ee 100644 --- a/esphome/components/duty_cycle/duty_cycle_sensor.cpp +++ b/esphome/components/duty_cycle/duty_cycle_sensor.cpp @@ -1,6 +1,6 @@ #include "duty_cycle_sensor.h" -#include "esphome/core/log.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" namespace esphome { namespace duty_cycle { diff --git a/esphome/components/ee895/ee895.cpp b/esphome/components/ee895/ee895.cpp index 4ce29bcfa..bdaa3f320 100644 --- a/esphome/components/ee895/ee895.cpp +++ b/esphome/components/ee895/ee895.cpp @@ -1,6 +1,6 @@ #include "ee895.h" -#include "esphome/core/log.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" namespace esphome { namespace ee895 { diff --git a/esphome/components/esp32/preferences.cpp b/esphome/components/esp32/preferences.cpp index 9e510a063..e53cdd90d 100644 --- a/esphome/components/esp32/preferences.cpp +++ b/esphome/components/esp32/preferences.cpp @@ -1,8 +1,8 @@ #ifdef USE_ESP32 -#include "esphome/core/preferences.h" #include "esphome/core/helpers.h" #include "esphome/core/log.h" +#include "esphome/core/preferences.h" #include #include #include diff --git a/esphome/components/esp32_ble/ble_uuid.h b/esphome/components/esp32_ble/ble_uuid.h index d90db3a59..06f84d4da 100644 --- a/esphome/components/esp32_ble/ble_uuid.h +++ b/esphome/components/esp32_ble/ble_uuid.h @@ -1,7 +1,7 @@ #pragma once -#include "esphome/core/helpers.h" #include "esphome/core/hal.h" +#include "esphome/core/helpers.h" #ifdef USE_ESP32 diff --git a/esphome/components/esp32_ble_server/ble_characteristic.cpp b/esphome/components/esp32_ble_server/ble_characteristic.cpp index 15739d60b..373d57436 100644 --- a/esphome/components/esp32_ble_server/ble_characteristic.cpp +++ b/esphome/components/esp32_ble_server/ble_characteristic.cpp @@ -2,6 +2,7 @@ #include "ble_server.h" #include "ble_service.h" +#include "esphome/core/helpers.h" #include "esphome/core/log.h" #ifdef USE_ESP32 diff --git a/esphome/components/esp32_dac/esp32_dac.cpp b/esphome/components/esp32_dac/esp32_dac.cpp index 46e355355..01bf0e04c 100644 --- a/esphome/components/esp32_dac/esp32_dac.cpp +++ b/esphome/components/esp32_dac/esp32_dac.cpp @@ -1,6 +1,6 @@ #include "esp32_dac.h" -#include "esphome/core/log.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" #ifdef USE_ESP32 diff --git a/esphome/components/esp8266_pwm/esp8266_pwm.cpp b/esphome/components/esp8266_pwm/esp8266_pwm.cpp index fcf66ee1a..03fa3c683 100644 --- a/esphome/components/esp8266_pwm/esp8266_pwm.cpp +++ b/esphome/components/esp8266_pwm/esp8266_pwm.cpp @@ -1,10 +1,10 @@ #ifdef USE_ESP8266 #include "esp8266_pwm.h" -#include "esphome/core/macros.h" #include "esphome/core/defines.h" -#include "esphome/core/log.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" +#include "esphome/core/macros.h" #include diff --git a/esphome/components/exposure_notifications/exposure_notifications.cpp b/esphome/components/exposure_notifications/exposure_notifications.cpp index 3083cf429..307bee26f 100644 --- a/esphome/components/exposure_notifications/exposure_notifications.cpp +++ b/esphome/components/exposure_notifications/exposure_notifications.cpp @@ -1,6 +1,6 @@ #include "exposure_notifications.h" -#include "esphome/core/log.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" #ifdef USE_ESP32 diff --git a/esphome/components/ft5x06/touchscreen/ft5x06_touchscreen.cpp b/esphome/components/ft5x06/touchscreen/ft5x06_touchscreen.cpp index f2af2d532..9873a88fd 100644 --- a/esphome/components/ft5x06/touchscreen/ft5x06_touchscreen.cpp +++ b/esphome/components/ft5x06/touchscreen/ft5x06_touchscreen.cpp @@ -1,5 +1,6 @@ #include "ft5x06_touchscreen.h" +#include "esphome/core/helpers.h" #include "esphome/core/log.h" namespace esphome { diff --git a/esphome/components/gcja5/gcja5.cpp b/esphome/components/gcja5/gcja5.cpp index 29b0b910a..a7342bc82 100644 --- a/esphome/components/gcja5/gcja5.cpp +++ b/esphome/components/gcja5/gcja5.cpp @@ -76,16 +76,6 @@ bool GCJA5Component::calculate_checksum_() { return (crc == this->rx_message_[30]); } -uint32_t GCJA5Component::get_32_bit_uint_(uint8_t start_index) { - return (((uint32_t) this->rx_message_[start_index + 3]) << 24) | - (((uint32_t) this->rx_message_[start_index + 2]) << 16) | - (((uint32_t) this->rx_message_[start_index + 1]) << 8) | ((uint32_t) this->rx_message_[start_index]); -} - -uint16_t GCJA5Component::get_16_bit_uint_(uint8_t start_index) { - return (((uint32_t) this->rx_message_[start_index + 1]) << 8) | ((uint32_t) this->rx_message_[start_index]); -} - void GCJA5Component::parse_data_() { ESP_LOGVV(TAG, "GCJA5 Data: "); for (uint8_t i = 0; i < 32; i++) { diff --git a/esphome/components/gcja5/gcja5.h b/esphome/components/gcja5/gcja5.h index 844da33a5..ea1fb78bf 100644 --- a/esphome/components/gcja5/gcja5.h +++ b/esphome/components/gcja5/gcja5.h @@ -1,6 +1,7 @@ #pragma once #include "esphome/core/component.h" +#include "esphome/core/helpers.h" #include "esphome/components/sensor/sensor.h" #include "esphome/components/uart/uart.h" @@ -28,8 +29,13 @@ class GCJA5Component : public Component, public uart::UARTDevice { void parse_data_(); bool calculate_checksum_(); - uint32_t get_32_bit_uint_(uint8_t start_index); - uint16_t get_16_bit_uint_(uint8_t start_index); + uint16_t get_16_bit_uint_(uint8_t start_index) const { + return encode_uint16(this->rx_message_[start_index + 1], this->rx_message_[start_index]); + } + uint32_t get_32_bit_uint_(uint8_t start_index) const { + return encode_uint32(this->rx_message_[start_index + 3], this->rx_message_[start_index + 2], + this->rx_message_[start_index + 1], this->rx_message_[start_index]); + } uint32_t last_transmission_{0}; std::vector rx_message_; diff --git a/esphome/components/globals/globals_component.h b/esphome/components/globals/globals_component.h index 0283f3259..4c6a12aa7 100644 --- a/esphome/components/globals/globals_component.h +++ b/esphome/components/globals/globals_component.h @@ -1,7 +1,7 @@ #pragma once -#include "esphome/core/component.h" #include "esphome/core/automation.h" +#include "esphome/core/component.h" #include "esphome/core/helpers.h" #include diff --git a/esphome/components/gpio/one_wire/gpio_one_wire.cpp b/esphome/components/gpio/one_wire/gpio_one_wire.cpp index 7022c5fc3..ee80fde6f 100644 --- a/esphome/components/gpio/one_wire/gpio_one_wire.cpp +++ b/esphome/components/gpio/one_wire/gpio_one_wire.cpp @@ -1,6 +1,6 @@ #include "gpio_one_wire.h" -#include "esphome/core/log.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" namespace esphome { namespace gpio { diff --git a/esphome/components/grove_tb6612fng/grove_tb6612fng.h b/esphome/components/grove_tb6612fng/grove_tb6612fng.h index 2743ef4ed..68281117e 100644 --- a/esphome/components/grove_tb6612fng/grove_tb6612fng.h +++ b/esphome/components/grove_tb6612fng/grove_tb6612fng.h @@ -1,9 +1,9 @@ #pragma once #include "esphome/components/i2c/i2c.h" +#include "esphome/core/automation.h" #include "esphome/core/component.h" #include "esphome/core/hal.h" -#include "esphome/core/automation.h" //#include "esphome/core/helpers.h" /* diff --git a/esphome/components/growatt_solar/growatt_solar.cpp b/esphome/components/growatt_solar/growatt_solar.cpp index bb8a756e5..686c1c232 100644 --- a/esphome/components/growatt_solar/growatt_solar.cpp +++ b/esphome/components/growatt_solar/growatt_solar.cpp @@ -1,6 +1,7 @@ #include "growatt_solar.h" -#include "esphome/core/log.h" #include "esphome/core/application.h" +#include "esphome/core/helpers.h" +#include "esphome/core/log.h" namespace esphome { namespace growatt_solar { diff --git a/esphome/components/havells_solar/havells_solar.cpp b/esphome/components/havells_solar/havells_solar.cpp index 285f5d6ea..20dddf39e 100644 --- a/esphome/components/havells_solar/havells_solar.cpp +++ b/esphome/components/havells_solar/havells_solar.cpp @@ -1,5 +1,6 @@ #include "havells_solar.h" #include "havells_solar_registers.h" +#include "esphome/core/helpers.h" #include "esphome/core/log.h" namespace esphome { diff --git a/esphome/components/honeywellabp2_i2c/honeywellabp2.cpp b/esphome/components/honeywellabp2_i2c/honeywellabp2.cpp index 72433913a..11f5dbc31 100644 --- a/esphome/components/honeywellabp2_i2c/honeywellabp2.cpp +++ b/esphome/components/honeywellabp2_i2c/honeywellabp2.cpp @@ -1,6 +1,6 @@ #include "honeywellabp2.h" -#include "esphome/core/log.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" namespace esphome { namespace honeywellabp2_i2c { diff --git a/esphome/components/hte501/hte501.cpp b/esphome/components/hte501/hte501.cpp index e40d53b52..0f97c67f9 100644 --- a/esphome/components/hte501/hte501.cpp +++ b/esphome/components/hte501/hte501.cpp @@ -1,4 +1,5 @@ #include "hte501.h" +#include "esphome/core/helpers.h" #include "esphome/core/log.h" namespace esphome { diff --git a/esphome/components/hx711/hx711.cpp b/esphome/components/hx711/hx711.cpp index d9b82fd7c..0fc8b2960 100644 --- a/esphome/components/hx711/hx711.cpp +++ b/esphome/components/hx711/hx711.cpp @@ -1,6 +1,6 @@ #include "hx711.h" -#include "esphome/core/log.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" namespace esphome { namespace hx711 { diff --git a/esphome/components/i2c/i2c_bus_arduino.cpp b/esphome/components/i2c/i2c_bus_arduino.cpp index c06206d43..dca77e878 100644 --- a/esphome/components/i2c/i2c_bus_arduino.cpp +++ b/esphome/components/i2c/i2c_bus_arduino.cpp @@ -1,9 +1,9 @@ #ifdef USE_ARDUINO #include "i2c_bus_arduino.h" -#include "esphome/core/log.h" -#include "esphome/core/helpers.h" #include "esphome/core/application.h" +#include "esphome/core/helpers.h" +#include "esphome/core/log.h" #include #include diff --git a/esphome/components/i2s_audio/i2s_audio.h b/esphome/components/i2s_audio/i2s_audio.h index e839bcd89..cfccf7e01 100644 --- a/esphome/components/i2s_audio/i2s_audio.h +++ b/esphome/components/i2s_audio/i2s_audio.h @@ -3,8 +3,8 @@ #ifdef USE_ESP32 #include "esphome/core/component.h" -#include "esphome/core/helpers.h" #include "esphome/core/defines.h" +#include "esphome/core/helpers.h" #ifdef USE_I2S_LEGACY #include #else diff --git a/esphome/components/iaqcore/iaqcore.cpp b/esphome/components/iaqcore/iaqcore.cpp index 27ae77628..2a84eabf7 100644 --- a/esphome/components/iaqcore/iaqcore.cpp +++ b/esphome/components/iaqcore/iaqcore.cpp @@ -1,7 +1,7 @@ #include "iaqcore.h" -#include "esphome/core/log.h" #include "esphome/core/hal.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" namespace esphome { namespace iaqcore { diff --git a/esphome/components/image/image.cpp b/esphome/components/image/image.cpp index 82e46e346..7b65c4d0c 100644 --- a/esphome/components/image/image.cpp +++ b/esphome/components/image/image.cpp @@ -1,6 +1,7 @@ #include "image.h" #include "esphome/core/hal.h" +#include "esphome/core/helpers.h" namespace esphome { namespace image { diff --git a/esphome/components/ina2xx_base/ina2xx_base.cpp b/esphome/components/ina2xx_base/ina2xx_base.cpp index a477da03a..2112a28b0 100644 --- a/esphome/components/ina2xx_base/ina2xx_base.cpp +++ b/esphome/components/ina2xx_base/ina2xx_base.cpp @@ -1,7 +1,7 @@ #include "ina2xx_base.h" -#include "esphome/core/log.h" #include "esphome/core/hal.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" #include #include diff --git a/esphome/components/integration/integration_sensor.cpp b/esphome/components/integration/integration_sensor.cpp index 2ac7caca2..c09778e79 100644 --- a/esphome/components/integration/integration_sensor.cpp +++ b/esphome/components/integration/integration_sensor.cpp @@ -1,7 +1,7 @@ #include "integration_sensor.h" +#include "esphome/core/hal.h" #include "esphome/core/helpers.h" #include "esphome/core/log.h" -#include "esphome/core/hal.h" namespace esphome { namespace integration { diff --git a/esphome/components/kmeteriso/kmeteriso.cpp b/esphome/components/kmeteriso/kmeteriso.cpp index 4856ee0e8..b3fbc31fe 100644 --- a/esphome/components/kmeteriso/kmeteriso.cpp +++ b/esphome/components/kmeteriso/kmeteriso.cpp @@ -1,5 +1,6 @@ #include "kmeteriso.h" #include "esphome/core/hal.h" +#include "esphome/core/helpers.h" #include "esphome/core/log.h" namespace esphome { diff --git a/esphome/components/lcd_base/lcd_display.cpp b/esphome/components/lcd_base/lcd_display.cpp index 65d7aa508..d3434cce1 100644 --- a/esphome/components/lcd_base/lcd_display.cpp +++ b/esphome/components/lcd_base/lcd_display.cpp @@ -1,7 +1,7 @@ #include "lcd_display.h" -#include "esphome/core/log.h" -#include "esphome/core/helpers.h" #include "esphome/core/hal.h" +#include "esphome/core/helpers.h" +#include "esphome/core/log.h" namespace esphome { namespace lcd_base { diff --git a/esphome/components/libretiny/preferences.cpp b/esphome/components/libretiny/preferences.cpp index d32a6fb3c..ce4ed915c 100644 --- a/esphome/components/libretiny/preferences.cpp +++ b/esphome/components/libretiny/preferences.cpp @@ -1,8 +1,8 @@ #ifdef USE_LIBRETINY -#include "esphome/core/preferences.h" #include "esphome/core/helpers.h" #include "esphome/core/log.h" +#include "esphome/core/preferences.h" #include #include #include diff --git a/esphome/components/light/esp_hsv_color.h b/esphome/components/light/esp_hsv_color.h index 39f5e5570..cdde91c71 100644 --- a/esphome/components/light/esp_hsv_color.h +++ b/esphome/components/light/esp_hsv_color.h @@ -1,7 +1,7 @@ #pragma once -#include "esphome/core/helpers.h" #include "esphome/core/color.h" +#include "esphome/core/helpers.h" namespace esphome { namespace light { diff --git a/esphome/components/light/light_transformer.h b/esphome/components/light/light_transformer.h index 35b045d5b..fb9b70918 100644 --- a/esphome/components/light/light_transformer.h +++ b/esphome/components/light/light_transformer.h @@ -1,7 +1,7 @@ #pragma once -#include "esphome/core/helpers.h" #include "esphome/core/hal.h" +#include "esphome/core/helpers.h" #include "light_color_values.h" namespace esphome { diff --git a/esphome/components/lightwaverf/LwTx.cpp b/esphome/components/lightwaverf/LwTx.cpp index 2f46b04b2..f5ef6ddb2 100644 --- a/esphome/components/lightwaverf/LwTx.cpp +++ b/esphome/components/lightwaverf/LwTx.cpp @@ -8,8 +8,8 @@ #include "LwTx.h" #include #include -#include "esphome/core/log.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" namespace esphome { namespace lightwaverf { diff --git a/esphome/components/lock/lock.h b/esphome/components/lock/lock.h index 7a98187a4..2173c8490 100644 --- a/esphome/components/lock/lock.h +++ b/esphome/components/lock/lock.h @@ -2,9 +2,9 @@ #include "esphome/core/component.h" #include "esphome/core/entity_base.h" -#include "esphome/core/preferences.h" #include "esphome/core/helpers.h" #include "esphome/core/log.h" +#include "esphome/core/preferences.h" #include namespace esphome { diff --git a/esphome/components/ltr501/ltr501.cpp b/esphome/components/ltr501/ltr501.cpp index 0e6ce7f88..12f227ab9 100644 --- a/esphome/components/ltr501/ltr501.cpp +++ b/esphome/components/ltr501/ltr501.cpp @@ -1,7 +1,7 @@ #include "ltr501.h" #include "esphome/core/application.h" -#include "esphome/core/log.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" using esphome::i2c::ErrorCode; diff --git a/esphome/components/ltr_als_ps/ltr_als_ps.cpp b/esphome/components/ltr_als_ps/ltr_als_ps.cpp index e8d940801..9b635a12b 100644 --- a/esphome/components/ltr_als_ps/ltr_als_ps.cpp +++ b/esphome/components/ltr_als_ps/ltr_als_ps.cpp @@ -1,7 +1,7 @@ #include "ltr_als_ps.h" #include "esphome/core/application.h" -#include "esphome/core/log.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" using esphome::i2c::ErrorCode; diff --git a/esphome/components/lvgl/lvgl_esphome.cpp b/esphome/components/lvgl/lvgl_esphome.cpp index ac5fb019d..dd877df0f 100644 --- a/esphome/components/lvgl/lvgl_esphome.cpp +++ b/esphome/components/lvgl/lvgl_esphome.cpp @@ -1,7 +1,7 @@ #include "esphome/core/defines.h" -#include "esphome/core/log.h" -#include "esphome/core/helpers.h" #include "esphome/core/hal.h" +#include "esphome/core/helpers.h" +#include "esphome/core/log.h" #include "lvgl_hal.h" #include "lvgl_esphome.h" diff --git a/esphome/components/max31855/max31855.cpp b/esphome/components/max31855/max31855.cpp index e4ca94c5a..26fba428c 100644 --- a/esphome/components/max31855/max31855.cpp +++ b/esphome/components/max31855/max31855.cpp @@ -1,5 +1,6 @@ #include "max31855.h" +#include "esphome/core/helpers.h" #include "esphome/core/log.h" namespace esphome { diff --git a/esphome/components/max7219/max7219.cpp b/esphome/components/max7219/max7219.cpp index 4bc5abc75..3f78b35bb 100644 --- a/esphome/components/max7219/max7219.cpp +++ b/esphome/components/max7219/max7219.cpp @@ -1,7 +1,7 @@ #include "max7219.h" -#include "esphome/core/log.h" -#include "esphome/core/helpers.h" #include "esphome/core/hal.h" +#include "esphome/core/helpers.h" +#include "esphome/core/log.h" namespace esphome { namespace max7219 { diff --git a/esphome/components/max7219digit/max7219digit.cpp b/esphome/components/max7219digit/max7219digit.cpp index e293a0984..1721dc80c 100644 --- a/esphome/components/max7219digit/max7219digit.cpp +++ b/esphome/components/max7219digit/max7219digit.cpp @@ -1,8 +1,8 @@ #include "max7219digit.h" -#include "esphome/core/log.h" -#include "esphome/core/helpers.h" -#include "esphome/core/hal.h" #include "esphome/core/application.h" +#include "esphome/core/hal.h" +#include "esphome/core/helpers.h" +#include "esphome/core/log.h" #include "max7219font.h" #include diff --git a/esphome/components/mcp4461/mcp4461.cpp b/esphome/components/mcp4461/mcp4461.cpp index 88e7475a7..39127a6c0 100644 --- a/esphome/components/mcp4461/mcp4461.cpp +++ b/esphome/components/mcp4461/mcp4461.cpp @@ -1,7 +1,7 @@ #include "mcp4461.h" -#include "esphome/core/helpers.h" #include "esphome/core/hal.h" +#include "esphome/core/helpers.h" namespace esphome { namespace mcp4461 { diff --git a/esphome/components/micronova/micronova.h b/esphome/components/micronova/micronova.h index aebef277e..fc68d941c 100644 --- a/esphome/components/micronova/micronova.h +++ b/esphome/components/micronova/micronova.h @@ -1,10 +1,10 @@ #pragma once -#include "esphome/core/component.h" #include "esphome/components/uart/uart.h" -#include "esphome/core/log.h" +#include "esphome/core/component.h" #include "esphome/core/defines.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" #include diff --git a/esphome/components/midea/air_conditioner.cpp b/esphome/components/midea/air_conditioner.cpp index 9ee48bbfa..170a2f6a4 100644 --- a/esphome/components/midea/air_conditioner.cpp +++ b/esphome/components/midea/air_conditioner.cpp @@ -1,7 +1,7 @@ #ifdef USE_ARDUINO -#include "esphome/core/log.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" #include "air_conditioner.h" #include "ac_adapter.h" #include diff --git a/esphome/components/midea_ir/midea_ir.cpp b/esphome/components/midea_ir/midea_ir.cpp index aa5e2b46f..c269b2f7d 100644 --- a/esphome/components/midea_ir/midea_ir.cpp +++ b/esphome/components/midea_ir/midea_ir.cpp @@ -1,7 +1,7 @@ #include "midea_ir.h" #include "midea_data.h" -#include "esphome/core/log.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" #include "esphome/components/coolix/coolix.h" namespace esphome { diff --git a/esphome/components/mlx90614/mlx90614.cpp b/esphome/components/mlx90614/mlx90614.cpp index 97888b59b..afc565d38 100644 --- a/esphome/components/mlx90614/mlx90614.cpp +++ b/esphome/components/mlx90614/mlx90614.cpp @@ -1,6 +1,7 @@ #include "mlx90614.h" #include "esphome/core/hal.h" +#include "esphome/core/helpers.h" #include "esphome/core/log.h" namespace esphome { diff --git a/esphome/components/modbus/modbus.cpp b/esphome/components/modbus/modbus.cpp index e81609a2c..c2efa93fa 100644 --- a/esphome/components/modbus/modbus.cpp +++ b/esphome/components/modbus/modbus.cpp @@ -1,7 +1,7 @@ #include "modbus.h" -#include "esphome/core/log.h" -#include "esphome/core/helpers.h" #include "esphome/core/application.h" +#include "esphome/core/helpers.h" +#include "esphome/core/log.h" namespace esphome { namespace modbus { diff --git a/esphome/components/mpl3115a2/mpl3115a2.cpp b/esphome/components/mpl3115a2/mpl3115a2.cpp index d415b7729..9b65fb04e 100644 --- a/esphome/components/mpl3115a2/mpl3115a2.cpp +++ b/esphome/components/mpl3115a2/mpl3115a2.cpp @@ -1,5 +1,6 @@ #include "mpl3115a2.h" #include "esphome/core/hal.h" +#include "esphome/core/helpers.h" #include "esphome/core/log.h" namespace esphome { diff --git a/esphome/components/mqtt/mqtt_backend_esp32.cpp b/esphome/components/mqtt/mqtt_backend_esp32.cpp index 2cccb957e..64dc27d84 100644 --- a/esphome/components/mqtt/mqtt_backend_esp32.cpp +++ b/esphome/components/mqtt/mqtt_backend_esp32.cpp @@ -4,8 +4,8 @@ #ifdef USE_ESP32 #include -#include "esphome/core/log.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" namespace esphome { namespace mqtt { diff --git a/esphome/components/msa3xx/msa3xx.cpp b/esphome/components/msa3xx/msa3xx.cpp index 5488b33f9..17f0a9c41 100644 --- a/esphome/components/msa3xx/msa3xx.cpp +++ b/esphome/components/msa3xx/msa3xx.cpp @@ -1,7 +1,7 @@ #include "msa3xx.h" -#include "esphome/core/log.h" #include "esphome/core/hal.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" namespace esphome { namespace msa3xx { diff --git a/esphome/components/my9231/my9231.cpp b/esphome/components/my9231/my9231.cpp index 35231f22c..691c94525 100644 --- a/esphome/components/my9231/my9231.cpp +++ b/esphome/components/my9231/my9231.cpp @@ -1,6 +1,6 @@ #include "my9231.h" -#include "esphome/core/log.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" namespace esphome { namespace my9231 { diff --git a/esphome/components/neopixelbus/neopixelbus_light.h b/esphome/components/neopixelbus/neopixelbus_light.h index 523388607..d94a92361 100644 --- a/esphome/components/neopixelbus/neopixelbus_light.h +++ b/esphome/components/neopixelbus/neopixelbus_light.h @@ -2,10 +2,10 @@ #ifdef USE_ARDUINO -#include "esphome/core/macros.h" +#include "esphome/core/color.h" #include "esphome/core/component.h" #include "esphome/core/helpers.h" -#include "esphome/core/color.h" +#include "esphome/core/macros.h" #include "esphome/components/light/light_output.h" #include "esphome/components/light/addressable_light.h" diff --git a/esphome/components/network/ip_address.h b/esphome/components/network/ip_address.h index 1598daf6f..d76da573b 100644 --- a/esphome/components/network/ip_address.h +++ b/esphome/components/network/ip_address.h @@ -5,8 +5,8 @@ #include #include #include -#include "esphome/core/macros.h" #include "esphome/core/helpers.h" +#include "esphome/core/macros.h" #if defined(USE_ESP_IDF) || defined(USE_LIBRETINY) || USE_ARDUINO_VERSION_CODE > VERSION_CODE(3, 0, 0) #include diff --git a/esphome/components/nfc/nci_message.h b/esphome/components/nfc/nci_message.h index c6b853740..0c5c871f7 100644 --- a/esphome/components/nfc/nci_message.h +++ b/esphome/components/nfc/nci_message.h @@ -1,7 +1,7 @@ #pragma once -#include "esphome/core/log.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" #include diff --git a/esphome/components/nfc/ndef_record.h b/esphome/components/nfc/ndef_record.h index 20542bf24..76d8b6a50 100644 --- a/esphome/components/nfc/ndef_record.h +++ b/esphome/components/nfc/ndef_record.h @@ -1,7 +1,7 @@ #pragma once -#include "esphome/core/log.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" #include diff --git a/esphome/components/nfc/ndef_record_text.h b/esphome/components/nfc/ndef_record_text.h index aa8f13bb4..e6c15704f 100644 --- a/esphome/components/nfc/ndef_record_text.h +++ b/esphome/components/nfc/ndef_record_text.h @@ -1,7 +1,7 @@ #pragma once -#include "esphome/core/log.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" #include "ndef_record.h" #include diff --git a/esphome/components/nfc/ndef_record_uri.h b/esphome/components/nfc/ndef_record_uri.h index fc8f2d9a7..1eadda1b4 100644 --- a/esphome/components/nfc/ndef_record_uri.h +++ b/esphome/components/nfc/ndef_record_uri.h @@ -1,7 +1,7 @@ #pragma once -#include "esphome/core/log.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" #include "ndef_record.h" #include diff --git a/esphome/components/nfc/nfc.h b/esphome/components/nfc/nfc.h index 23bfdd8ef..2e5c5cd9c 100644 --- a/esphome/components/nfc/nfc.h +++ b/esphome/components/nfc/nfc.h @@ -1,7 +1,7 @@ #pragma once -#include "esphome/core/log.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" #include "ndef_record.h" #include "ndef_message.h" #include "nfc_tag.h" diff --git a/esphome/components/nfc/nfc_tag.h b/esphome/components/nfc/nfc_tag.h index 58875a744..55600c3bd 100644 --- a/esphome/components/nfc/nfc_tag.h +++ b/esphome/components/nfc/nfc_tag.h @@ -3,8 +3,8 @@ #include #include -#include "esphome/core/log.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" #include "ndef_message.h" namespace esphome { diff --git a/esphome/components/noblex/noblex.cpp b/esphome/components/noblex/noblex.cpp index 3521745bd..53f807809 100644 --- a/esphome/components/noblex/noblex.cpp +++ b/esphome/components/noblex/noblex.cpp @@ -1,6 +1,6 @@ #include "noblex.h" -#include "esphome/core/log.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" namespace esphome { namespace noblex { diff --git a/esphome/components/npi19/npi19.cpp b/esphome/components/npi19/npi19.cpp index 3da5a9dbf..17ca0ef23 100644 --- a/esphome/components/npi19/npi19.cpp +++ b/esphome/components/npi19/npi19.cpp @@ -1,7 +1,7 @@ #include "npi19.h" -#include "esphome/core/log.h" -#include "esphome/core/helpers.h" #include "esphome/core/hal.h" +#include "esphome/core/helpers.h" +#include "esphome/core/log.h" namespace esphome { namespace npi19 { diff --git a/esphome/components/opentherm/opentherm.h b/esphome/components/opentherm/opentherm.h index 4280832d0..a5822cdfe 100644 --- a/esphome/components/opentherm/opentherm.h +++ b/esphome/components/opentherm/opentherm.h @@ -9,8 +9,8 @@ #include #include "esphome/core/hal.h" -#include "esphome/core/log.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" #if defined(ESP32) || defined(USE_ESP_IDF) #include "driver/timer.h" diff --git a/esphome/components/output/float_output.cpp b/esphome/components/output/float_output.cpp index e7dba1d81..3b83c8571 100644 --- a/esphome/components/output/float_output.cpp +++ b/esphome/components/output/float_output.cpp @@ -1,6 +1,6 @@ #include "float_output.h" -#include "esphome/core/log.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" namespace esphome { namespace output { diff --git a/esphome/components/pca9685/pca9685_output.cpp b/esphome/components/pca9685/pca9685_output.cpp index 5d0989682..2fe22fd1c 100644 --- a/esphome/components/pca9685/pca9685_output.cpp +++ b/esphome/components/pca9685/pca9685_output.cpp @@ -1,7 +1,7 @@ #include "pca9685_output.h" -#include "esphome/core/log.h" -#include "esphome/core/helpers.h" #include "esphome/core/hal.h" +#include "esphome/core/helpers.h" +#include "esphome/core/log.h" namespace esphome { namespace pca9685 { diff --git a/esphome/components/pcd8544/pcd_8544.cpp b/esphome/components/pcd8544/pcd_8544.cpp index 5651d60b1..f5b018b12 100644 --- a/esphome/components/pcd8544/pcd_8544.cpp +++ b/esphome/components/pcd8544/pcd_8544.cpp @@ -1,7 +1,7 @@ #include "pcd_8544.h" -#include "esphome/core/log.h" #include "esphome/core/application.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" namespace esphome { namespace pcd8544 { diff --git a/esphome/components/pid/pid_climate.h b/esphome/components/pid/pid_climate.h index b5275e977..1a09ffdd2 100644 --- a/esphome/components/pid/pid_climate.h +++ b/esphome/components/pid/pid_climate.h @@ -1,8 +1,8 @@ #pragma once +#include "esphome/core/automation.h" #include "esphome/core/component.h" #include "esphome/core/helpers.h" -#include "esphome/core/automation.h" #include "esphome/components/climate/climate.h" #include "esphome/components/sensor/sensor.h" #include "esphome/components/output/float_output.h" diff --git a/esphome/components/pid/sensor/pid_climate_sensor.cpp b/esphome/components/pid/sensor/pid_climate_sensor.cpp index 2a76c775d..41ca027d8 100644 --- a/esphome/components/pid/sensor/pid_climate_sensor.cpp +++ b/esphome/components/pid/sensor/pid_climate_sensor.cpp @@ -1,6 +1,6 @@ #include "pid_climate_sensor.h" -#include "esphome/core/log.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" namespace esphome { namespace pid { diff --git a/esphome/components/pipsolar/output/pipsolar_output.cpp b/esphome/components/pipsolar/output/pipsolar_output.cpp index b843f1f3e..00ec73b56 100644 --- a/esphome/components/pipsolar/output/pipsolar_output.cpp +++ b/esphome/components/pipsolar/output/pipsolar_output.cpp @@ -1,6 +1,6 @@ #include "pipsolar_output.h" -#include "esphome/core/log.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" namespace esphome { namespace pipsolar { diff --git a/esphome/components/pipsolar/pipsolar.cpp b/esphome/components/pipsolar/pipsolar.cpp index 98273f52a..40405114a 100644 --- a/esphome/components/pipsolar/pipsolar.cpp +++ b/esphome/components/pipsolar/pipsolar.cpp @@ -1,6 +1,6 @@ #include "pipsolar.h" -#include "esphome/core/log.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" namespace esphome { namespace pipsolar { diff --git a/esphome/components/pm1006/pm1006.cpp b/esphome/components/pm1006/pm1006.cpp index f28c64772..c466c4bb2 100644 --- a/esphome/components/pm1006/pm1006.cpp +++ b/esphome/components/pm1006/pm1006.cpp @@ -95,9 +95,5 @@ void PM1006Component::parse_data_() { } } -uint16_t PM1006Component::get_16_bit_uint_(uint8_t start_index) const { - return encode_uint16(this->data_[start_index], this->data_[start_index + 1]); -} - } // namespace pm1006 } // namespace esphome diff --git a/esphome/components/pm1006/pm1006.h b/esphome/components/pm1006/pm1006.h index 238ac6700..98637dad7 100644 --- a/esphome/components/pm1006/pm1006.h +++ b/esphome/components/pm1006/pm1006.h @@ -1,6 +1,7 @@ #pragma once #include "esphome/core/component.h" +#include "esphome/core/helpers.h" #include "esphome/components/sensor/sensor.h" #include "esphome/components/uart/uart.h" @@ -22,8 +23,10 @@ class PM1006Component : public PollingComponent, public uart::UARTDevice { protected: optional check_byte_() const; void parse_data_(); - uint16_t get_16_bit_uint_(uint8_t start_index) const; uint8_t pm1006_checksum_(const uint8_t *command_data, uint8_t length) const; + uint16_t get_16_bit_uint_(uint8_t start_index) const { + return encode_uint16(this->data_[start_index], this->data_[start_index + 1]); + } sensor::Sensor *pm_2_5_sensor_{nullptr}; diff --git a/esphome/components/pmsa003i/pmsa003i.cpp b/esphome/components/pmsa003i/pmsa003i.cpp index 3a5473d75..4702c0cf5 100644 --- a/esphome/components/pmsa003i/pmsa003i.cpp +++ b/esphome/components/pmsa003i/pmsa003i.cpp @@ -1,6 +1,6 @@ #include "pmsa003i.h" -#include "esphome/core/log.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" #include namespace esphome { diff --git a/esphome/components/pmsx003/pmsx003.cpp b/esphome/components/pmsx003/pmsx003.cpp index 0abed8a5a..eb10d19c9 100644 --- a/esphome/components/pmsx003/pmsx003.cpp +++ b/esphome/components/pmsx003/pmsx003.cpp @@ -314,9 +314,5 @@ void PMSX003Component::parse_data_() { this->status_clear_warning(); } -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]); -} - } // namespace pmsx003 } // namespace esphome diff --git a/esphome/components/pmsx003/pmsx003.h b/esphome/components/pmsx003/pmsx003.h index 85bb1ff9f..e422d4165 100644 --- a/esphome/components/pmsx003/pmsx003.h +++ b/esphome/components/pmsx003/pmsx003.h @@ -1,8 +1,9 @@ #pragma once +#include "esphome/core/component.h" +#include "esphome/core/helpers.h" #include "esphome/components/sensor/sensor.h" #include "esphome/components/uart/uart.h" -#include "esphome/core/component.h" namespace esphome { namespace pmsx003 { @@ -77,7 +78,9 @@ class PMSX003Component : public uart::UARTDevice, public Component { void parse_data_(); bool check_payload_length_(uint16_t payload_length); void send_command_(PMSX0003Command cmd, uint16_t data); - uint16_t get_16_bit_uint_(uint8_t start_index); + uint16_t get_16_bit_uint_(uint8_t start_index) const { + return encode_uint16(this->data_[start_index], this->data_[start_index + 1]); + } uint8_t data_[64]; uint8_t data_index_{0}; diff --git a/esphome/components/pylontech/pylontech.cpp b/esphome/components/pylontech/pylontech.cpp index cf133742d..ef3de069c 100644 --- a/esphome/components/pylontech/pylontech.cpp +++ b/esphome/components/pylontech/pylontech.cpp @@ -1,6 +1,6 @@ #include "pylontech.h" -#include "esphome/core/log.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" namespace esphome { namespace pylontech { diff --git a/esphome/components/qmp6988/qmp6988.h b/esphome/components/qmp6988/qmp6988.h index f0c11adf4..61b46a418 100644 --- a/esphome/components/qmp6988/qmp6988.h +++ b/esphome/components/qmp6988/qmp6988.h @@ -1,9 +1,9 @@ #pragma once -#include "esphome/core/log.h" #include "esphome/core/component.h" #include "esphome/core/hal.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" #include "esphome/components/sensor/sensor.h" #include "esphome/components/i2c/i2c.h" diff --git a/esphome/components/rdm6300/rdm6300.cpp b/esphome/components/rdm6300/rdm6300.cpp index bfdd88007..f9b6126c4 100644 --- a/esphome/components/rdm6300/rdm6300.cpp +++ b/esphome/components/rdm6300/rdm6300.cpp @@ -1,4 +1,5 @@ #include "rdm6300.h" +#include "esphome/core/helpers.h" #include "esphome/core/log.h" namespace esphome { diff --git a/esphome/components/remote_receiver/remote_receiver_esp8266.cpp b/esphome/components/remote_receiver/remote_receiver_esp8266.cpp index 744fdb38f..a0fd56bcf 100644 --- a/esphome/components/remote_receiver/remote_receiver_esp8266.cpp +++ b/esphome/components/remote_receiver/remote_receiver_esp8266.cpp @@ -1,7 +1,7 @@ #include "remote_receiver.h" #include "esphome/core/hal.h" -#include "esphome/core/log.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" #ifdef USE_ESP8266 diff --git a/esphome/components/remote_receiver/remote_receiver_libretiny.cpp b/esphome/components/remote_receiver/remote_receiver_libretiny.cpp index 3d40402e6..7a6054737 100644 --- a/esphome/components/remote_receiver/remote_receiver_libretiny.cpp +++ b/esphome/components/remote_receiver/remote_receiver_libretiny.cpp @@ -1,7 +1,7 @@ #include "remote_receiver.h" #include "esphome/core/hal.h" -#include "esphome/core/log.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" #ifdef USE_LIBRETINY diff --git a/esphome/components/rotary_encoder/rotary_encoder.cpp b/esphome/components/rotary_encoder/rotary_encoder.cpp index 9a9c3a633..79bc12359 100644 --- a/esphome/components/rotary_encoder/rotary_encoder.cpp +++ b/esphome/components/rotary_encoder/rotary_encoder.cpp @@ -1,6 +1,6 @@ #include "rotary_encoder.h" -#include "esphome/core/log.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" namespace esphome { namespace rotary_encoder { diff --git a/esphome/components/sdm_meter/sdm_meter.cpp b/esphome/components/sdm_meter/sdm_meter.cpp index 61c7e0684..12a327726 100644 --- a/esphome/components/sdm_meter/sdm_meter.cpp +++ b/esphome/components/sdm_meter/sdm_meter.cpp @@ -1,5 +1,6 @@ #include "sdm_meter.h" #include "sdm_meter_registers.h" +#include "esphome/core/helpers.h" #include "esphome/core/log.h" namespace esphome { diff --git a/esphome/components/sdp3x/sdp3x.cpp b/esphome/components/sdp3x/sdp3x.cpp index 4b6cc1f83..58aefe09d 100644 --- a/esphome/components/sdp3x/sdp3x.cpp +++ b/esphome/components/sdp3x/sdp3x.cpp @@ -1,7 +1,7 @@ #include "sdp3x.h" -#include "esphome/core/log.h" #include "esphome/core/hal.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" namespace esphome { namespace sdp3x { diff --git a/esphome/components/sds011/sds011.cpp b/esphome/components/sds011/sds011.cpp index 158eff99f..4e12c0e32 100644 --- a/esphome/components/sds011/sds011.cpp +++ b/esphome/components/sds011/sds011.cpp @@ -182,9 +182,6 @@ void SDS011Component::parse_data_() { } } -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) { this->update_interval_min_ = update_interval_min; } diff --git a/esphome/components/sds011/sds011.h b/esphome/components/sds011/sds011.h index 19e0cd3ef..1f404601b 100644 --- a/esphome/components/sds011/sds011.h +++ b/esphome/components/sds011/sds011.h @@ -1,6 +1,7 @@ #pragma once #include "esphome/core/component.h" +#include "esphome/core/helpers.h" #include "esphome/components/sensor/sensor.h" #include "esphome/components/uart/uart.h" @@ -32,7 +33,9 @@ class SDS011Component : public Component, public uart::UARTDevice { uint8_t sds011_checksum_(const uint8_t *command_data, uint8_t length) const; optional check_byte_() const; void parse_data_(); - uint16_t get_16_bit_uint_(uint8_t start_index) const; + uint16_t get_16_bit_uint_(uint8_t start_index) const { + return encode_uint16(this->data_[start_index + 1], this->data_[start_index]); + } sensor::Sensor *pm_2_5_sensor_{nullptr}; sensor::Sensor *pm_10_0_sensor_{nullptr}; diff --git a/esphome/components/seeed_mr24hpc1/seeed_mr24hpc1.cpp b/esphome/components/seeed_mr24hpc1/seeed_mr24hpc1.cpp index b584db7e6..8683d6cad 100644 --- a/esphome/components/seeed_mr24hpc1/seeed_mr24hpc1.cpp +++ b/esphome/components/seeed_mr24hpc1/seeed_mr24hpc1.cpp @@ -1,5 +1,6 @@ #include "seeed_mr24hpc1.h" +#include "esphome/core/helpers.h" #include "esphome/core/log.h" #include diff --git a/esphome/components/seeed_mr60bha2/seeed_mr60bha2.cpp b/esphome/components/seeed_mr60bha2/seeed_mr60bha2.cpp index 75f3f092a..c815c9841 100644 --- a/esphome/components/seeed_mr60bha2/seeed_mr60bha2.cpp +++ b/esphome/components/seeed_mr60bha2/seeed_mr60bha2.cpp @@ -1,4 +1,5 @@ #include "seeed_mr60bha2.h" +#include "esphome/core/helpers.h" #include "esphome/core/log.h" #include diff --git a/esphome/components/seeed_mr60fda2/seeed_mr60fda2.cpp b/esphome/components/seeed_mr60fda2/seeed_mr60fda2.cpp index 4bb1f8fe7..e40cd9c0c 100644 --- a/esphome/components/seeed_mr60fda2/seeed_mr60fda2.cpp +++ b/esphome/components/seeed_mr60fda2/seeed_mr60fda2.cpp @@ -1,4 +1,5 @@ #include "seeed_mr60fda2.h" +#include "esphome/core/helpers.h" #include "esphome/core/log.h" #include diff --git a/esphome/components/selec_meter/selec_meter.cpp b/esphome/components/selec_meter/selec_meter.cpp index 4233bd8e0..ae4132789 100644 --- a/esphome/components/selec_meter/selec_meter.cpp +++ b/esphome/components/selec_meter/selec_meter.cpp @@ -1,5 +1,6 @@ #include "selec_meter.h" #include "selec_meter_registers.h" +#include "esphome/core/helpers.h" #include "esphome/core/log.h" namespace esphome { diff --git a/esphome/components/sensirion_common/i2c_sensirion.cpp b/esphome/components/sensirion_common/i2c_sensirion.cpp index d8ab817a7..f71b3c14c 100644 --- a/esphome/components/sensirion_common/i2c_sensirion.cpp +++ b/esphome/components/sensirion_common/i2c_sensirion.cpp @@ -1,6 +1,7 @@ #include "i2c_sensirion.h" -#include "esphome/core/log.h" #include "esphome/core/hal.h" +#include "esphome/core/helpers.h" +#include "esphome/core/log.h" #include namespace esphome { diff --git a/esphome/components/sensirion_common/i2c_sensirion.h b/esphome/components/sensirion_common/i2c_sensirion.h index 24b706cf3..aba93d6cc 100644 --- a/esphome/components/sensirion_common/i2c_sensirion.h +++ b/esphome/components/sensirion_common/i2c_sensirion.h @@ -1,5 +1,6 @@ #pragma once #include "esphome/components/i2c/i2c.h" +#include "esphome/core/helpers.h" #include diff --git a/esphome/components/sensor/filter.h b/esphome/components/sensor/filter.h index 3cfaebb70..94fec8208 100644 --- a/esphome/components/sensor/filter.h +++ b/esphome/components/sensor/filter.h @@ -3,9 +3,9 @@ #include #include #include +#include "esphome/core/automation.h" #include "esphome/core/component.h" #include "esphome/core/helpers.h" -#include "esphome/core/automation.h" namespace esphome { namespace sensor { diff --git a/esphome/components/sensor/sensor.h b/esphome/components/sensor/sensor.h index c396e1d56..ab9ff1565 100644 --- a/esphome/components/sensor/sensor.h +++ b/esphome/components/sensor/sensor.h @@ -1,9 +1,9 @@ #pragma once -#include "esphome/core/log.h" #include "esphome/core/component.h" #include "esphome/core/entity_base.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" #include "esphome/components/sensor/filter.h" #include diff --git a/esphome/components/servo/servo.h b/esphome/components/servo/servo.h index 13a7472ae..92d18bf60 100644 --- a/esphome/components/servo/servo.h +++ b/esphome/components/servo/servo.h @@ -1,7 +1,7 @@ #pragma once -#include "esphome/core/component.h" #include "esphome/core/automation.h" +#include "esphome/core/component.h" #include "esphome/core/helpers.h" #include "esphome/core/preferences.h" #include "esphome/components/output/float_output.h" diff --git a/esphome/components/sml/sml.cpp b/esphome/components/sml/sml.cpp index 7ae9044c7..c1ffdc0e6 100644 --- a/esphome/components/sml/sml.cpp +++ b/esphome/components/sml/sml.cpp @@ -1,6 +1,6 @@ #include "sml.h" -#include "esphome/core/log.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" #include "sml_parser.h" namespace esphome { diff --git a/esphome/components/sonoff_d1/sonoff_d1.h b/esphome/components/sonoff_d1/sonoff_d1.h index 4df0f5afb..19ff83f37 100644 --- a/esphome/components/sonoff_d1/sonoff_d1.h +++ b/esphome/components/sonoff_d1/sonoff_d1.h @@ -31,9 +31,9 @@ ----- */ -#include "esphome/core/log.h" -#include "esphome/core/helpers.h" #include "esphome/core/component.h" +#include "esphome/core/helpers.h" +#include "esphome/core/log.h" #include "esphome/components/uart/uart.h" #include "esphome/components/light/light_output.h" #include "esphome/components/light/light_state.h" diff --git a/esphome/components/ssd1306_base/ssd1306_base.cpp b/esphome/components/ssd1306_base/ssd1306_base.cpp index 90b805a79..0547a7718 100644 --- a/esphome/components/ssd1306_base/ssd1306_base.cpp +++ b/esphome/components/ssd1306_base/ssd1306_base.cpp @@ -1,6 +1,6 @@ #include "ssd1306_base.h" -#include "esphome/core/log.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" namespace esphome { namespace ssd1306_base { diff --git a/esphome/components/ssd1322_base/ssd1322_base.cpp b/esphome/components/ssd1322_base/ssd1322_base.cpp index 520248a66..eb8d87998 100644 --- a/esphome/components/ssd1322_base/ssd1322_base.cpp +++ b/esphome/components/ssd1322_base/ssd1322_base.cpp @@ -1,6 +1,6 @@ #include "ssd1322_base.h" -#include "esphome/core/log.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" namespace esphome { namespace ssd1322_base { diff --git a/esphome/components/ssd1325_base/ssd1325_base.cpp b/esphome/components/ssd1325_base/ssd1325_base.cpp index 711f9e519..e7d2386ac 100644 --- a/esphome/components/ssd1325_base/ssd1325_base.cpp +++ b/esphome/components/ssd1325_base/ssd1325_base.cpp @@ -1,6 +1,6 @@ #include "ssd1325_base.h" -#include "esphome/core/log.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" namespace esphome { namespace ssd1325_base { diff --git a/esphome/components/ssd1327_base/ssd1327_base.cpp b/esphome/components/ssd1327_base/ssd1327_base.cpp index 4223a013a..6b83ec5f9 100644 --- a/esphome/components/ssd1327_base/ssd1327_base.cpp +++ b/esphome/components/ssd1327_base/ssd1327_base.cpp @@ -1,6 +1,6 @@ #include "ssd1327_base.h" -#include "esphome/core/log.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" namespace esphome { namespace ssd1327_base { diff --git a/esphome/components/ssd1331_base/ssd1331_base.cpp b/esphome/components/ssd1331_base/ssd1331_base.cpp index 14f94dee4..8ee12387e 100644 --- a/esphome/components/ssd1331_base/ssd1331_base.cpp +++ b/esphome/components/ssd1331_base/ssd1331_base.cpp @@ -1,6 +1,6 @@ #include "ssd1331_base.h" -#include "esphome/core/log.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" namespace esphome { namespace ssd1331_base { diff --git a/esphome/components/ssd1351_base/ssd1351_base.cpp b/esphome/components/ssd1351_base/ssd1351_base.cpp index 38ea05a0b..09530e8a2 100644 --- a/esphome/components/ssd1351_base/ssd1351_base.cpp +++ b/esphome/components/ssd1351_base/ssd1351_base.cpp @@ -1,6 +1,6 @@ #include "ssd1351_base.h" -#include "esphome/core/log.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" namespace esphome { namespace ssd1351_base { diff --git a/esphome/components/st7567_base/st7567_base.cpp b/esphome/components/st7567_base/st7567_base.cpp index 0cfd2c0e1..0afd2a70b 100644 --- a/esphome/components/st7567_base/st7567_base.cpp +++ b/esphome/components/st7567_base/st7567_base.cpp @@ -1,6 +1,6 @@ #include "st7567_base.h" -#include "esphome/core/log.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" namespace esphome { namespace st7567_base { diff --git a/esphome/components/st7735/st7735.cpp b/esphome/components/st7735/st7735.cpp index f37770a76..9c9c0a3df 100644 --- a/esphome/components/st7735/st7735.cpp +++ b/esphome/components/st7735/st7735.cpp @@ -1,7 +1,7 @@ #include "st7735.h" -#include "esphome/core/log.h" -#include "esphome/core/helpers.h" #include "esphome/core/hal.h" +#include "esphome/core/helpers.h" +#include "esphome/core/log.h" namespace esphome { namespace st7735 { diff --git a/esphome/components/switch/switch.h b/esphome/components/switch/switch.h index b5395a2c8..e8018ed36 100644 --- a/esphome/components/switch/switch.h +++ b/esphome/components/switch/switch.h @@ -2,8 +2,8 @@ #include "esphome/core/component.h" #include "esphome/core/entity_base.h" -#include "esphome/core/preferences.h" #include "esphome/core/helpers.h" +#include "esphome/core/preferences.h" namespace esphome { namespace switch_ { diff --git a/esphome/components/t6615/t6615.cpp b/esphome/components/t6615/t6615.cpp index 1c7883350..c2ac88ee2 100644 --- a/esphome/components/t6615/t6615.cpp +++ b/esphome/components/t6615/t6615.cpp @@ -1,4 +1,5 @@ #include "t6615.h" +#include "esphome/core/helpers.h" #include "esphome/core/log.h" namespace esphome { diff --git a/esphome/components/tcs34725/tcs34725.cpp b/esphome/components/tcs34725/tcs34725.cpp index 0aed2c8f4..9926ebc55 100644 --- a/esphome/components/tcs34725/tcs34725.cpp +++ b/esphome/components/tcs34725/tcs34725.cpp @@ -1,8 +1,8 @@ #include "tcs34725.h" -#include "esphome/core/log.h" #include "esphome/core/hal.h" -#include #include "esphome/core/helpers.h" +#include "esphome/core/log.h" +#include namespace esphome { namespace tcs34725 { diff --git a/esphome/components/tee501/tee501.cpp b/esphome/components/tee501/tee501.cpp index 329aee7c5..45241627f 100644 --- a/esphome/components/tee501/tee501.cpp +++ b/esphome/components/tee501/tee501.cpp @@ -1,4 +1,5 @@ #include "tee501.h" +#include "esphome/core/helpers.h" #include "esphome/core/log.h" namespace esphome { diff --git a/esphome/components/tem3200/tem3200.cpp b/esphome/components/tem3200/tem3200.cpp index bd8aaca53..c0655d02b 100644 --- a/esphome/components/tem3200/tem3200.cpp +++ b/esphome/components/tem3200/tem3200.cpp @@ -1,7 +1,7 @@ #include "tem3200.h" -#include "esphome/core/log.h" -#include "esphome/core/helpers.h" #include "esphome/core/hal.h" +#include "esphome/core/helpers.h" +#include "esphome/core/log.h" namespace esphome { namespace tem3200 { diff --git a/esphome/components/tlc59208f/tlc59208f_output.cpp b/esphome/components/tlc59208f/tlc59208f_output.cpp index 28bcad294..b1aad42bd 100644 --- a/esphome/components/tlc59208f/tlc59208f_output.cpp +++ b/esphome/components/tlc59208f/tlc59208f_output.cpp @@ -1,7 +1,7 @@ #include "tlc59208f_output.h" -#include "esphome/core/log.h" -#include "esphome/core/helpers.h" #include "esphome/core/hal.h" +#include "esphome/core/helpers.h" +#include "esphome/core/log.h" namespace esphome { namespace tlc59208f { diff --git a/esphome/components/tm1621/tm1621.cpp b/esphome/components/tm1621/tm1621.cpp index 8f18a3d38..502e45b35 100644 --- a/esphome/components/tm1621/tm1621.cpp +++ b/esphome/components/tm1621/tm1621.cpp @@ -1,7 +1,7 @@ #include "tm1621.h" -#include "esphome/core/log.h" -#include "esphome/core/helpers.h" #include "esphome/core/hal.h" +#include "esphome/core/helpers.h" +#include "esphome/core/log.h" namespace esphome { namespace tm1621 { diff --git a/esphome/components/tm1637/tm1637.cpp b/esphome/components/tm1637/tm1637.cpp index 11881c70e..358a683ef 100644 --- a/esphome/components/tm1637/tm1637.cpp +++ b/esphome/components/tm1637/tm1637.cpp @@ -1,7 +1,7 @@ #include "tm1637.h" -#include "esphome/core/log.h" -#include "esphome/core/helpers.h" #include "esphome/core/hal.h" +#include "esphome/core/helpers.h" +#include "esphome/core/log.h" namespace esphome { namespace tm1637 { diff --git a/esphome/components/tm1638/tm1638.cpp b/esphome/components/tm1638/tm1638.cpp index 3ed467a6b..f43b496b3 100644 --- a/esphome/components/tm1638/tm1638.cpp +++ b/esphome/components/tm1638/tm1638.cpp @@ -1,8 +1,8 @@ #include "tm1638.h" #include "sevenseg.h" -#include "esphome/core/log.h" -#include "esphome/core/helpers.h" #include "esphome/core/hal.h" +#include "esphome/core/helpers.h" +#include "esphome/core/log.h" namespace esphome { namespace tm1638 { diff --git a/esphome/components/tm1651/tm1651.cpp b/esphome/components/tm1651/tm1651.cpp index 97beefff6..64c3e62b3 100644 --- a/esphome/components/tm1651/tm1651.cpp +++ b/esphome/components/tm1651/tm1651.cpp @@ -1,8 +1,8 @@ #ifdef USE_ARDUINO #include "tm1651.h" -#include "esphome/core/log.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" namespace esphome { namespace tm1651 { diff --git a/esphome/components/tx20/tx20.cpp b/esphome/components/tx20/tx20.cpp index 16ca8d369..73b865e8b 100644 --- a/esphome/components/tx20/tx20.cpp +++ b/esphome/components/tx20/tx20.cpp @@ -1,6 +1,6 @@ #include "tx20.h" -#include "esphome/core/log.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" #include diff --git a/esphome/components/uart/uart.cpp b/esphome/components/uart/uart.cpp index 9834462ff..b18454bf9 100644 --- a/esphome/components/uart/uart.cpp +++ b/esphome/components/uart/uart.cpp @@ -1,8 +1,8 @@ #include "uart.h" -#include "esphome/core/log.h" -#include "esphome/core/helpers.h" #include "esphome/core/application.h" #include "esphome/core/defines.h" +#include "esphome/core/helpers.h" +#include "esphome/core/log.h" #include namespace esphome { diff --git a/esphome/components/uponor_smatrix/climate/uponor_smatrix_climate.cpp b/esphome/components/uponor_smatrix/climate/uponor_smatrix_climate.cpp index cc9b8a0f9..d7e672d8c 100644 --- a/esphome/components/uponor_smatrix/climate/uponor_smatrix_climate.cpp +++ b/esphome/components/uponor_smatrix/climate/uponor_smatrix_climate.cpp @@ -1,7 +1,7 @@ #include "uponor_smatrix_climate.h" +#include "esphome/core/application.h" #include "esphome/core/helpers.h" #include "esphome/core/log.h" -#include "esphome/core/application.h" namespace esphome { namespace uponor_smatrix { diff --git a/esphome/components/uponor_smatrix/uponor_smatrix.cpp b/esphome/components/uponor_smatrix/uponor_smatrix.cpp index 2dbbef72a..a0017518b 100644 --- a/esphome/components/uponor_smatrix/uponor_smatrix.cpp +++ b/esphome/components/uponor_smatrix/uponor_smatrix.cpp @@ -1,6 +1,7 @@ #include "uponor_smatrix.h" -#include "esphome/core/log.h" #include "esphome/core/application.h" +#include "esphome/core/helpers.h" +#include "esphome/core/log.h" namespace esphome { namespace uponor_smatrix { diff --git a/esphome/components/waveshare_epaper/waveshare_epaper.cpp b/esphome/components/waveshare_epaper/waveshare_epaper.cpp index 79aae70e4..084747c09 100644 --- a/esphome/components/waveshare_epaper/waveshare_epaper.cpp +++ b/esphome/components/waveshare_epaper/waveshare_epaper.cpp @@ -1,7 +1,7 @@ #include "waveshare_epaper.h" -#include "esphome/core/log.h" #include "esphome/core/application.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" #include #include diff --git a/esphome/components/web_server_base/web_server_base.cpp b/esphome/components/web_server_base/web_server_base.cpp index 7c09022f2..283558538 100644 --- a/esphome/components/web_server_base/web_server_base.cpp +++ b/esphome/components/web_server_base/web_server_base.cpp @@ -1,8 +1,8 @@ #include "web_server_base.h" #ifdef USE_NETWORK -#include "esphome/core/log.h" #include "esphome/core/application.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" #ifdef USE_ARDUINO #include diff --git a/esphome/components/web_server_idf/utils.cpp b/esphome/components/web_server_idf/utils.cpp index 6299937ce..349acce50 100644 --- a/esphome/components/web_server_idf/utils.cpp +++ b/esphome/components/web_server_idf/utils.cpp @@ -1,7 +1,7 @@ #ifdef USE_ESP_IDF #include -#include "esphome/core/log.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" #include "http_parser.h" #include "utils.h" diff --git a/esphome/components/web_server_idf/web_server_idf.cpp b/esphome/components/web_server_idf/web_server_idf.cpp index 428bd262e..6bfc49c67 100644 --- a/esphome/components/web_server_idf/web_server_idf.cpp +++ b/esphome/components/web_server_idf/web_server_idf.cpp @@ -2,8 +2,8 @@ #include -#include "esphome/core/log.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" #include "esp_tls_crypto.h" diff --git a/esphome/components/wiegand/wiegand.cpp b/esphome/components/wiegand/wiegand.cpp index 10c77a8aa..5a2bb8dee 100644 --- a/esphome/components/wiegand/wiegand.cpp +++ b/esphome/components/wiegand/wiegand.cpp @@ -1,6 +1,6 @@ #include "wiegand.h" -#include "esphome/core/log.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" namespace esphome { namespace wiegand { diff --git a/esphome/components/wifi/wifi_component_esp8266.cpp b/esphome/components/wifi/wifi_component_esp8266.cpp index 9ea8417c9..3e121098e 100644 --- a/esphome/components/wifi/wifi_component_esp8266.cpp +++ b/esphome/components/wifi/wifi_component_esp8266.cpp @@ -32,11 +32,11 @@ extern "C" { #endif } +#include "esphome/core/application.h" +#include "esphome/core/hal.h" #include "esphome/core/helpers.h" #include "esphome/core/log.h" -#include "esphome/core/hal.h" #include "esphome/core/util.h" -#include "esphome/core/application.h" namespace esphome { namespace wifi { diff --git a/esphome/components/wifi/wifi_component_libretiny.cpp b/esphome/components/wifi/wifi_component_libretiny.cpp index 715963b03..eb88ed81a 100644 --- a/esphome/components/wifi/wifi_component_libretiny.cpp +++ b/esphome/components/wifi/wifi_component_libretiny.cpp @@ -9,10 +9,10 @@ #include "lwip/err.h" #include "lwip/dns.h" +#include "esphome/core/application.h" +#include "esphome/core/hal.h" #include "esphome/core/helpers.h" #include "esphome/core/log.h" -#include "esphome/core/hal.h" -#include "esphome/core/application.h" #include "esphome/core/util.h" namespace esphome { diff --git a/esphome/components/wled/wled_light_effect.cpp b/esphome/components/wled/wled_light_effect.cpp index 84842dff3..25577ccc1 100644 --- a/esphome/components/wled/wled_light_effect.cpp +++ b/esphome/components/wled/wled_light_effect.cpp @@ -1,8 +1,8 @@ #ifdef USE_ARDUINO #include "wled_light_effect.h" -#include "esphome/core/log.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" #ifdef USE_ESP32 #include diff --git a/esphome/components/xgzp68xx/xgzp68xx.cpp b/esphome/components/xgzp68xx/xgzp68xx.cpp index 198014cca..52933ebde 100644 --- a/esphome/components/xgzp68xx/xgzp68xx.cpp +++ b/esphome/components/xgzp68xx/xgzp68xx.cpp @@ -1,7 +1,7 @@ #include "xgzp68xx.h" -#include "esphome/core/log.h" #include "esphome/core/hal.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" #include "esphome/components/i2c/i2c.h" #include diff --git a/esphome/components/xiaomi_hhccjcy10/xiaomi_hhccjcy10.cpp b/esphome/components/xiaomi_hhccjcy10/xiaomi_hhccjcy10.cpp index 45d4cceb5..2bc52b808 100644 --- a/esphome/components/xiaomi_hhccjcy10/xiaomi_hhccjcy10.cpp +++ b/esphome/components/xiaomi_hhccjcy10/xiaomi_hhccjcy10.cpp @@ -1,6 +1,6 @@ #include "xiaomi_hhccjcy10.h" -#include "esphome/core/log.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" #ifdef USE_ESP32 diff --git a/esphome/components/xpt2046/touchscreen/xpt2046.cpp b/esphome/components/xpt2046/touchscreen/xpt2046.cpp index 3f0cff3d3..fa99e3afa 100644 --- a/esphome/components/xpt2046/touchscreen/xpt2046.cpp +++ b/esphome/components/xpt2046/touchscreen/xpt2046.cpp @@ -1,6 +1,6 @@ #include "xpt2046.h" -#include "esphome/core/log.h" #include "esphome/core/helpers.h" +#include "esphome/core/log.h" #include diff --git a/esphome/components/xpt2046/touchscreen/xpt2046.h b/esphome/components/xpt2046/touchscreen/xpt2046.h index a635c08f8..f691ae2c7 100644 --- a/esphome/components/xpt2046/touchscreen/xpt2046.h +++ b/esphome/components/xpt2046/touchscreen/xpt2046.h @@ -1,9 +1,9 @@ #pragma once -#include "esphome/core/component.h" -#include "esphome/core/automation.h" #include "esphome/components/spi/spi.h" #include "esphome/components/touchscreen/touchscreen.h" +#include "esphome/core/automation.h" +#include "esphome/core/component.h" #include "esphome/core/helpers.h" #include "esphome/core/log.h" diff --git a/esphome/core/helpers.h b/esphome/core/helpers.h index 4212aeca9..7d25e7d26 100644 --- a/esphome/core/helpers.h +++ b/esphome/core/helpers.h @@ -192,15 +192,15 @@ bool random_bytes(uint8_t *data, size_t len); constexpr uint16_t encode_uint16(uint8_t msb, uint8_t lsb) { return (static_cast(msb) << 8) | (static_cast(lsb)); } +/// Encode a 24-bit value given three bytes in most to least significant byte order. +constexpr uint32_t encode_uint24(uint8_t byte1, uint8_t byte2, uint8_t byte3) { + return (static_cast(byte1) << 16) | (static_cast(byte2) << 8) | (static_cast(byte3)); +} /// Encode a 32-bit value given four bytes in most to least significant byte order. constexpr uint32_t encode_uint32(uint8_t byte1, uint8_t byte2, uint8_t byte3, uint8_t byte4) { return (static_cast(byte1) << 24) | (static_cast(byte2) << 16) | (static_cast(byte3) << 8) | (static_cast(byte4)); } -/// Encode a 24-bit value given three bytes in most to least significant byte order. -constexpr uint32_t encode_uint24(uint8_t byte1, uint8_t byte2, uint8_t byte3) { - return ((static_cast(byte1) << 16) | (static_cast(byte2) << 8) | (static_cast(byte3))); -} /// Encode a value from its constituent bytes (from most to least significant) in an array with length sizeof(T). template::value, int> = 0> diff --git a/esphome/core/scheduler.cpp b/esphome/core/scheduler.cpp index 2dea450ea..eed222c97 100644 --- a/esphome/core/scheduler.cpp +++ b/esphome/core/scheduler.cpp @@ -2,9 +2,9 @@ #include "application.h" #include "esphome/core/defines.h" -#include "esphome/core/log.h" -#include "esphome/core/helpers.h" #include "esphome/core/hal.h" +#include "esphome/core/helpers.h" +#include "esphome/core/log.h" #include #include