use `encode_uintXX` (#8847)

Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Thomas Rupprecht 2025-06-11 07:06:45 +02:00 committed by GitHub
parent 0e27ac281f
commit 487e1f871f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
150 changed files with 201 additions and 181 deletions

View File

@ -1,6 +1,6 @@
#include "ade7953_i2c.h" #include "ade7953_i2c.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace ade7953_i2c { namespace ade7953_i2c {

View File

@ -1,6 +1,6 @@
#include "ade7953_spi.h" #include "ade7953_spi.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace ade7953_spi { namespace ade7953_spi {

View File

@ -1,4 +1,5 @@
#include "ads1118.h" #include "ads1118.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h" #include "esphome/core/log.h"
namespace esphome { namespace esphome {

View File

@ -1,4 +1,5 @@
#include "ags10.h" #include "ags10.h"
#include "esphome/core/helpers.h"
#include <cinttypes> #include <cinttypes>

View File

@ -13,9 +13,9 @@
// results making successive requests; the current implementation makes 3 attempts with a delay of 30ms each time. // results making successive requests; the current implementation makes 3 attempts with a delay of 30ms each time.
#include "aht10.h" #include "aht10.h"
#include "esphome/core/log.h"
#include "esphome/core/hal.h" #include "esphome/core/hal.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace aht10 { namespace aht10 {

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace am43 { namespace am43 {

View File

@ -1,9 +1,9 @@
#include "api_frame_helper.h" #include "api_frame_helper.h"
#ifdef USE_API #ifdef USE_API
#include "esphome/core/log.h" #include "esphome/core/application.h"
#include "esphome/core/hal.h" #include "esphome/core/hal.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/application.h" #include "esphome/core/log.h"
#include "proto.h" #include "proto.h"
#include "api_pb2_size.h" #include "api_pb2_size.h"
#include <cstring> #include <cstring>

View File

@ -3,8 +3,8 @@
#include "api_server.h" #include "api_server.h"
#ifdef USE_API #ifdef USE_API
#include "api_pb2.h" #include "api_pb2.h"
#include "esphome/core/helpers.h"
#include "esphome/core/automation.h" #include "esphome/core/automation.h"
#include "esphome/core/helpers.h"
#include <vector> #include <vector>
namespace esphome { namespace esphome {

View File

@ -1,5 +1,6 @@
#include "proto.h" #include "proto.h"
#include <cinttypes> #include <cinttypes>
#include "esphome/core/helpers.h"
#include "esphome/core/log.h" #include "esphome/core/log.h"
namespace esphome { namespace esphome {

View File

@ -1,8 +1,8 @@
#pragma once #pragma once
#include "esphome/core/component.h" #include "esphome/core/component.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#include <vector> #include <vector>

View File

@ -1,7 +1,7 @@
#include "ble_sensor.h" #include "ble_sensor.h"
#include "esphome/core/log.h"
#include "esphome/core/application.h" #include "esphome/core/application.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#include "esphome/components/esp32_ble_tracker/esp32_ble_tracker.h" #include "esphome/components/esp32_ble_tracker/esp32_ble_tracker.h"
#ifdef USE_ESP32 #ifdef USE_ESP32

View File

@ -1,6 +1,6 @@
#include "bme680_bsec.h" #include "bme680_bsec.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#include <string> #include <string>
namespace esphome { namespace esphome {

View File

@ -1,6 +1,7 @@
#include "ccs811.h" #include "ccs811.h"
#include "esphome/core/log.h"
#include "esphome/core/hal.h" #include "esphome/core/hal.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace ccs811 { namespace ccs811 {

View File

@ -3,8 +3,8 @@
#include "esphome/core/component.h" #include "esphome/core/component.h"
#include "esphome/core/entity_base.h" #include "esphome/core/entity_base.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/preferences.h"
#include "esphome/core/log.h" #include "esphome/core/log.h"
#include "esphome/core/preferences.h"
#include "climate_mode.h" #include "climate_mode.h"
#include "climate_traits.h" #include "climate_traits.h"

View File

@ -223,11 +223,6 @@ void CSE7766Component::parse_data_() {
#endif #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() { void CSE7766Component::dump_config() {
ESP_LOGCONFIG(TAG, "CSE7766:"); ESP_LOGCONFIG(TAG, "CSE7766:");
LOG_SENSOR(" ", "Voltage", this->voltage_sensor_); LOG_SENSOR(" ", "Voltage", this->voltage_sensor_);

View File

@ -1,6 +1,7 @@
#pragma once #pragma once
#include "esphome/core/component.h" #include "esphome/core/component.h"
#include "esphome/core/helpers.h"
#include "esphome/components/sensor/sensor.h" #include "esphome/components/sensor/sensor.h"
#include "esphome/components/uart/uart.h" #include "esphome/components/uart/uart.h"
@ -28,7 +29,10 @@ class CSE7766Component : public Component, public uart::UARTDevice {
protected: protected:
bool check_byte_(); bool check_byte_();
void parse_data_(); 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_[24];
uint8_t raw_data_index_{0}; uint8_t raw_data_index_{0};

View File

@ -1,4 +1,5 @@
#include "cst816_touchscreen.h" #include "cst816_touchscreen.h"
#include "esphome/core/helpers.h"
namespace esphome { namespace esphome {
namespace cst816 { namespace cst816 {

View File

@ -1,7 +1,7 @@
#include "dac7678_output.h" #include "dac7678_output.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h"
#include "esphome/core/hal.h" #include "esphome/core/hal.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace dac7678 { namespace dac7678 {

View File

@ -1,7 +1,8 @@
#include "daly_bms.h" #include "daly_bms.h"
#include <vector> #include <vector>
#include "esphome/core/log.h"
#include "esphome/core/application.h" #include "esphome/core/application.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace daly_bms { namespace daly_bms {

View File

@ -2,9 +2,9 @@
#include <algorithm> #include <algorithm>
#include "esphome/core/application.h" #include "esphome/core/application.h"
#include "esphome/core/log.h"
#include "esphome/core/hal.h" #include "esphome/core/hal.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#include "esphome/core/version.h" #include "esphome/core/version.h"
#include <cinttypes> #include <cinttypes>
#include <climits> #include <climits>

View File

@ -2,8 +2,8 @@
#include "esphome/core/component.h" #include "esphome/core/component.h"
#include "esphome/core/defines.h" #include "esphome/core/defines.h"
#include "esphome/core/macros.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/macros.h"
#ifdef USE_SENSOR #ifdef USE_SENSOR
#include "esphome/components/sensor/sensor.h" #include "esphome/components/sensor/sensor.h"

View File

@ -1,6 +1,6 @@
#include "dht.h" #include "dht.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace dht { namespace dht {

View File

@ -1,6 +1,6 @@
#include "duty_cycle_sensor.h" #include "duty_cycle_sensor.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace duty_cycle { namespace duty_cycle {

View File

@ -1,6 +1,6 @@
#include "ee895.h" #include "ee895.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace ee895 { namespace ee895 {

View File

@ -1,8 +1,8 @@
#ifdef USE_ESP32 #ifdef USE_ESP32
#include "esphome/core/preferences.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h" #include "esphome/core/log.h"
#include "esphome/core/preferences.h"
#include <nvs_flash.h> #include <nvs_flash.h>
#include <cstring> #include <cstring>
#include <cinttypes> #include <cinttypes>

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
#include "esphome/core/helpers.h"
#include "esphome/core/hal.h" #include "esphome/core/hal.h"
#include "esphome/core/helpers.h"
#ifdef USE_ESP32 #ifdef USE_ESP32

View File

@ -2,6 +2,7 @@
#include "ble_server.h" #include "ble_server.h"
#include "ble_service.h" #include "ble_service.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h" #include "esphome/core/log.h"
#ifdef USE_ESP32 #ifdef USE_ESP32

View File

@ -1,6 +1,6 @@
#include "esp32_dac.h" #include "esp32_dac.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#ifdef USE_ESP32 #ifdef USE_ESP32

View File

@ -1,10 +1,10 @@
#ifdef USE_ESP8266 #ifdef USE_ESP8266
#include "esp8266_pwm.h" #include "esp8266_pwm.h"
#include "esphome/core/macros.h"
#include "esphome/core/defines.h" #include "esphome/core/defines.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#include "esphome/core/macros.h"
#include <core_esp8266_waveform.h> #include <core_esp8266_waveform.h>

View File

@ -1,6 +1,6 @@
#include "exposure_notifications.h" #include "exposure_notifications.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#ifdef USE_ESP32 #ifdef USE_ESP32

View File

@ -1,5 +1,6 @@
#include "ft5x06_touchscreen.h" #include "ft5x06_touchscreen.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h" #include "esphome/core/log.h"
namespace esphome { namespace esphome {

View File

@ -76,16 +76,6 @@ bool GCJA5Component::calculate_checksum_() {
return (crc == this->rx_message_[30]); 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_() { void GCJA5Component::parse_data_() {
ESP_LOGVV(TAG, "GCJA5 Data: "); ESP_LOGVV(TAG, "GCJA5 Data: ");
for (uint8_t i = 0; i < 32; i++) { for (uint8_t i = 0; i < 32; i++) {

View File

@ -1,6 +1,7 @@
#pragma once #pragma once
#include "esphome/core/component.h" #include "esphome/core/component.h"
#include "esphome/core/helpers.h"
#include "esphome/components/sensor/sensor.h" #include "esphome/components/sensor/sensor.h"
#include "esphome/components/uart/uart.h" #include "esphome/components/uart/uart.h"
@ -28,8 +29,13 @@ class GCJA5Component : public Component, public uart::UARTDevice {
void parse_data_(); void parse_data_();
bool calculate_checksum_(); bool calculate_checksum_();
uint32_t get_32_bit_uint_(uint8_t start_index); uint16_t get_16_bit_uint_(uint8_t start_index) const {
uint16_t get_16_bit_uint_(uint8_t start_index); 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}; uint32_t last_transmission_{0};
std::vector<uint8_t> rx_message_; std::vector<uint8_t> rx_message_;

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
#include "esphome/core/component.h"
#include "esphome/core/automation.h" #include "esphome/core/automation.h"
#include "esphome/core/component.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include <cstring> #include <cstring>

View File

@ -1,6 +1,6 @@
#include "gpio_one_wire.h" #include "gpio_one_wire.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace gpio { namespace gpio {

View File

@ -1,9 +1,9 @@
#pragma once #pragma once
#include "esphome/components/i2c/i2c.h" #include "esphome/components/i2c/i2c.h"
#include "esphome/core/automation.h"
#include "esphome/core/component.h" #include "esphome/core/component.h"
#include "esphome/core/hal.h" #include "esphome/core/hal.h"
#include "esphome/core/automation.h"
//#include "esphome/core/helpers.h" //#include "esphome/core/helpers.h"
/* /*

View File

@ -1,6 +1,7 @@
#include "growatt_solar.h" #include "growatt_solar.h"
#include "esphome/core/log.h"
#include "esphome/core/application.h" #include "esphome/core/application.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace growatt_solar { namespace growatt_solar {

View File

@ -1,5 +1,6 @@
#include "havells_solar.h" #include "havells_solar.h"
#include "havells_solar_registers.h" #include "havells_solar_registers.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h" #include "esphome/core/log.h"
namespace esphome { namespace esphome {

View File

@ -1,6 +1,6 @@
#include "honeywellabp2.h" #include "honeywellabp2.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace honeywellabp2_i2c { namespace honeywellabp2_i2c {

View File

@ -1,4 +1,5 @@
#include "hte501.h" #include "hte501.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h" #include "esphome/core/log.h"
namespace esphome { namespace esphome {

View File

@ -1,6 +1,6 @@
#include "hx711.h" #include "hx711.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace hx711 { namespace hx711 {

View File

@ -1,9 +1,9 @@
#ifdef USE_ARDUINO #ifdef USE_ARDUINO
#include "i2c_bus_arduino.h" #include "i2c_bus_arduino.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h"
#include "esphome/core/application.h" #include "esphome/core/application.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#include <Arduino.h> #include <Arduino.h>
#include <cstring> #include <cstring>

View File

@ -3,8 +3,8 @@
#ifdef USE_ESP32 #ifdef USE_ESP32
#include "esphome/core/component.h" #include "esphome/core/component.h"
#include "esphome/core/helpers.h"
#include "esphome/core/defines.h" #include "esphome/core/defines.h"
#include "esphome/core/helpers.h"
#ifdef USE_I2S_LEGACY #ifdef USE_I2S_LEGACY
#include <driver/i2s.h> #include <driver/i2s.h>
#else #else

View File

@ -1,7 +1,7 @@
#include "iaqcore.h" #include "iaqcore.h"
#include "esphome/core/log.h"
#include "esphome/core/hal.h" #include "esphome/core/hal.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace iaqcore { namespace iaqcore {

View File

@ -1,6 +1,7 @@
#include "image.h" #include "image.h"
#include "esphome/core/hal.h" #include "esphome/core/hal.h"
#include "esphome/core/helpers.h"
namespace esphome { namespace esphome {
namespace image { namespace image {

View File

@ -1,7 +1,7 @@
#include "ina2xx_base.h" #include "ina2xx_base.h"
#include "esphome/core/log.h"
#include "esphome/core/hal.h" #include "esphome/core/hal.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#include <cinttypes> #include <cinttypes>
#include <cmath> #include <cmath>

View File

@ -1,7 +1,7 @@
#include "integration_sensor.h" #include "integration_sensor.h"
#include "esphome/core/hal.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h" #include "esphome/core/log.h"
#include "esphome/core/hal.h"
namespace esphome { namespace esphome {
namespace integration { namespace integration {

View File

@ -1,5 +1,6 @@
#include "kmeteriso.h" #include "kmeteriso.h"
#include "esphome/core/hal.h" #include "esphome/core/hal.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h" #include "esphome/core/log.h"
namespace esphome { namespace esphome {

View File

@ -1,7 +1,7 @@
#include "lcd_display.h" #include "lcd_display.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h"
#include "esphome/core/hal.h" #include "esphome/core/hal.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace lcd_base { namespace lcd_base {

View File

@ -1,8 +1,8 @@
#ifdef USE_LIBRETINY #ifdef USE_LIBRETINY
#include "esphome/core/preferences.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h" #include "esphome/core/log.h"
#include "esphome/core/preferences.h"
#include <flashdb.h> #include <flashdb.h>
#include <cstring> #include <cstring>
#include <vector> #include <vector>

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
#include "esphome/core/helpers.h"
#include "esphome/core/color.h" #include "esphome/core/color.h"
#include "esphome/core/helpers.h"
namespace esphome { namespace esphome {
namespace light { namespace light {

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
#include "esphome/core/helpers.h"
#include "esphome/core/hal.h" #include "esphome/core/hal.h"
#include "esphome/core/helpers.h"
#include "light_color_values.h" #include "light_color_values.h"
namespace esphome { namespace esphome {

View File

@ -8,8 +8,8 @@
#include "LwTx.h" #include "LwTx.h"
#include <cstring> #include <cstring>
#include <Arduino.h> #include <Arduino.h>
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace lightwaverf { namespace lightwaverf {

View File

@ -2,9 +2,9 @@
#include "esphome/core/component.h" #include "esphome/core/component.h"
#include "esphome/core/entity_base.h" #include "esphome/core/entity_base.h"
#include "esphome/core/preferences.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h" #include "esphome/core/log.h"
#include "esphome/core/preferences.h"
#include <set> #include <set>
namespace esphome { namespace esphome {

View File

@ -1,7 +1,7 @@
#include "ltr501.h" #include "ltr501.h"
#include "esphome/core/application.h" #include "esphome/core/application.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
using esphome::i2c::ErrorCode; using esphome::i2c::ErrorCode;

View File

@ -1,7 +1,7 @@
#include "ltr_als_ps.h" #include "ltr_als_ps.h"
#include "esphome/core/application.h" #include "esphome/core/application.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
using esphome::i2c::ErrorCode; using esphome::i2c::ErrorCode;

View File

@ -1,7 +1,7 @@
#include "esphome/core/defines.h" #include "esphome/core/defines.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h"
#include "esphome/core/hal.h" #include "esphome/core/hal.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#include "lvgl_hal.h" #include "lvgl_hal.h"
#include "lvgl_esphome.h" #include "lvgl_esphome.h"

View File

@ -1,5 +1,6 @@
#include "max31855.h" #include "max31855.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h" #include "esphome/core/log.h"
namespace esphome { namespace esphome {

View File

@ -1,7 +1,7 @@
#include "max7219.h" #include "max7219.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h"
#include "esphome/core/hal.h" #include "esphome/core/hal.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace max7219 { namespace max7219 {

View File

@ -1,8 +1,8 @@
#include "max7219digit.h" #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/application.h"
#include "esphome/core/hal.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#include "max7219font.h" #include "max7219font.h"
#include <algorithm> #include <algorithm>

View File

@ -1,7 +1,7 @@
#include "mcp4461.h" #include "mcp4461.h"
#include "esphome/core/helpers.h"
#include "esphome/core/hal.h" #include "esphome/core/hal.h"
#include "esphome/core/helpers.h"
namespace esphome { namespace esphome {
namespace mcp4461 { namespace mcp4461 {

View File

@ -1,10 +1,10 @@
#pragma once #pragma once
#include "esphome/core/component.h"
#include "esphome/components/uart/uart.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/defines.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#include <vector> #include <vector>

View File

@ -1,7 +1,7 @@
#ifdef USE_ARDUINO #ifdef USE_ARDUINO
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#include "air_conditioner.h" #include "air_conditioner.h"
#include "ac_adapter.h" #include "ac_adapter.h"
#include <cmath> #include <cmath>

View File

@ -1,7 +1,7 @@
#include "midea_ir.h" #include "midea_ir.h"
#include "midea_data.h" #include "midea_data.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#include "esphome/components/coolix/coolix.h" #include "esphome/components/coolix/coolix.h"
namespace esphome { namespace esphome {

View File

@ -1,6 +1,7 @@
#include "mlx90614.h" #include "mlx90614.h"
#include "esphome/core/hal.h" #include "esphome/core/hal.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h" #include "esphome/core/log.h"
namespace esphome { namespace esphome {

View File

@ -1,7 +1,7 @@
#include "modbus.h" #include "modbus.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h"
#include "esphome/core/application.h" #include "esphome/core/application.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace modbus { namespace modbus {

View File

@ -1,5 +1,6 @@
#include "mpl3115a2.h" #include "mpl3115a2.h"
#include "esphome/core/hal.h" #include "esphome/core/hal.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h" #include "esphome/core/log.h"
namespace esphome { namespace esphome {

View File

@ -4,8 +4,8 @@
#ifdef USE_ESP32 #ifdef USE_ESP32
#include <string> #include <string>
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace mqtt { namespace mqtt {

View File

@ -1,7 +1,7 @@
#include "msa3xx.h" #include "msa3xx.h"
#include "esphome/core/log.h"
#include "esphome/core/hal.h" #include "esphome/core/hal.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace msa3xx { namespace msa3xx {

View File

@ -1,6 +1,6 @@
#include "my9231.h" #include "my9231.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace my9231 { namespace my9231 {

View File

@ -2,10 +2,10 @@
#ifdef USE_ARDUINO #ifdef USE_ARDUINO
#include "esphome/core/macros.h" #include "esphome/core/color.h"
#include "esphome/core/component.h" #include "esphome/core/component.h"
#include "esphome/core/helpers.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/light_output.h"
#include "esphome/components/light/addressable_light.h" #include "esphome/components/light/addressable_light.h"

View File

@ -5,8 +5,8 @@
#include <string> #include <string>
#include <cstdio> #include <cstdio>
#include <array> #include <array>
#include "esphome/core/macros.h"
#include "esphome/core/helpers.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) #if defined(USE_ESP_IDF) || defined(USE_LIBRETINY) || USE_ARDUINO_VERSION_CODE > VERSION_CODE(3, 0, 0)
#include <lwip/ip_addr.h> #include <lwip/ip_addr.h>

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#include <vector> #include <vector>

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#include <vector> #include <vector>

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#include "ndef_record.h" #include "ndef_record.h"
#include <vector> #include <vector>

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#include "ndef_record.h" #include "ndef_record.h"
#include <vector> #include <vector>

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#include "ndef_record.h" #include "ndef_record.h"
#include "ndef_message.h" #include "ndef_message.h"
#include "nfc_tag.h" #include "nfc_tag.h"

View File

@ -3,8 +3,8 @@
#include <memory> #include <memory>
#include <vector> #include <vector>
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#include "ndef_message.h" #include "ndef_message.h"
namespace esphome { namespace esphome {

View File

@ -1,6 +1,6 @@
#include "noblex.h" #include "noblex.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace noblex { namespace noblex {

View File

@ -1,7 +1,7 @@
#include "npi19.h" #include "npi19.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h"
#include "esphome/core/hal.h" #include "esphome/core/hal.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace npi19 { namespace npi19 {

View File

@ -9,8 +9,8 @@
#include <string> #include <string>
#include "esphome/core/hal.h" #include "esphome/core/hal.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#if defined(ESP32) || defined(USE_ESP_IDF) #if defined(ESP32) || defined(USE_ESP_IDF)
#include "driver/timer.h" #include "driver/timer.h"

View File

@ -1,6 +1,6 @@
#include "float_output.h" #include "float_output.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace output { namespace output {

View File

@ -1,7 +1,7 @@
#include "pca9685_output.h" #include "pca9685_output.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h"
#include "esphome/core/hal.h" #include "esphome/core/hal.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace pca9685 { namespace pca9685 {

View File

@ -1,7 +1,7 @@
#include "pcd_8544.h" #include "pcd_8544.h"
#include "esphome/core/log.h"
#include "esphome/core/application.h" #include "esphome/core/application.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace pcd8544 { namespace pcd8544 {

View File

@ -1,8 +1,8 @@
#pragma once #pragma once
#include "esphome/core/automation.h"
#include "esphome/core/component.h" #include "esphome/core/component.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/automation.h"
#include "esphome/components/climate/climate.h" #include "esphome/components/climate/climate.h"
#include "esphome/components/sensor/sensor.h" #include "esphome/components/sensor/sensor.h"
#include "esphome/components/output/float_output.h" #include "esphome/components/output/float_output.h"

View File

@ -1,6 +1,6 @@
#include "pid_climate_sensor.h" #include "pid_climate_sensor.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace pid { namespace pid {

View File

@ -1,6 +1,6 @@
#include "pipsolar_output.h" #include "pipsolar_output.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace pipsolar { namespace pipsolar {

View File

@ -1,6 +1,6 @@
#include "pipsolar.h" #include "pipsolar.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace pipsolar { namespace pipsolar {

View File

@ -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 pm1006
} // namespace esphome } // namespace esphome

View File

@ -1,6 +1,7 @@
#pragma once #pragma once
#include "esphome/core/component.h" #include "esphome/core/component.h"
#include "esphome/core/helpers.h"
#include "esphome/components/sensor/sensor.h" #include "esphome/components/sensor/sensor.h"
#include "esphome/components/uart/uart.h" #include "esphome/components/uart/uart.h"
@ -22,8 +23,10 @@ class PM1006Component : public PollingComponent, public uart::UARTDevice {
protected: protected:
optional<bool> check_byte_() const; optional<bool> check_byte_() const;
void parse_data_(); 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; 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}; sensor::Sensor *pm_2_5_sensor_{nullptr};

View File

@ -1,6 +1,6 @@
#include "pmsa003i.h" #include "pmsa003i.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#include <cstring> #include <cstring>
namespace esphome { namespace esphome {

View File

@ -314,9 +314,5 @@ void PMSX003Component::parse_data_() {
this->status_clear_warning(); 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 pmsx003
} // namespace esphome } // namespace esphome

View File

@ -1,8 +1,9 @@
#pragma once #pragma once
#include "esphome/core/component.h"
#include "esphome/core/helpers.h"
#include "esphome/components/sensor/sensor.h" #include "esphome/components/sensor/sensor.h"
#include "esphome/components/uart/uart.h" #include "esphome/components/uart/uart.h"
#include "esphome/core/component.h"
namespace esphome { namespace esphome {
namespace pmsx003 { namespace pmsx003 {
@ -77,7 +78,9 @@ class PMSX003Component : public uart::UARTDevice, public Component {
void parse_data_(); void parse_data_();
bool check_payload_length_(uint16_t payload_length); bool check_payload_length_(uint16_t payload_length);
void send_command_(PMSX0003Command cmd, uint16_t data); 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_[64];
uint8_t data_index_{0}; uint8_t data_index_{0};

View File

@ -1,6 +1,6 @@
#include "pylontech.h" #include "pylontech.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace pylontech { namespace pylontech {

View File

@ -1,9 +1,9 @@
#pragma once #pragma once
#include "esphome/core/log.h"
#include "esphome/core/component.h" #include "esphome/core/component.h"
#include "esphome/core/hal.h" #include "esphome/core/hal.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#include "esphome/components/sensor/sensor.h" #include "esphome/components/sensor/sensor.h"
#include "esphome/components/i2c/i2c.h" #include "esphome/components/i2c/i2c.h"

View File

@ -1,4 +1,5 @@
#include "rdm6300.h" #include "rdm6300.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h" #include "esphome/core/log.h"
namespace esphome { namespace esphome {

View File

@ -1,7 +1,7 @@
#include "remote_receiver.h" #include "remote_receiver.h"
#include "esphome/core/hal.h" #include "esphome/core/hal.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#ifdef USE_ESP8266 #ifdef USE_ESP8266

View File

@ -1,7 +1,7 @@
#include "remote_receiver.h" #include "remote_receiver.h"
#include "esphome/core/hal.h" #include "esphome/core/hal.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#ifdef USE_LIBRETINY #ifdef USE_LIBRETINY

View File

@ -1,6 +1,6 @@
#include "rotary_encoder.h" #include "rotary_encoder.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace rotary_encoder { namespace rotary_encoder {

View File

@ -1,5 +1,6 @@
#include "sdm_meter.h" #include "sdm_meter.h"
#include "sdm_meter_registers.h" #include "sdm_meter_registers.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h" #include "esphome/core/log.h"
namespace esphome { namespace esphome {

Some files were not shown because too many files have changed in this diff Show More