mirror of
https://github.com/esphome/esphome.git
synced 2024-11-21 22:48:10 +01:00
Avoid non-const globals and enable clang-tidy check (#1892)
This commit is contained in:
parent
360effcb72
commit
501f88ca86
376 changed files with 466 additions and 468 deletions
|
@ -18,7 +18,6 @@ Checks: >-
|
|||
-cppcoreguidelines-avoid-c-arrays,
|
||||
-cppcoreguidelines-avoid-goto,
|
||||
-cppcoreguidelines-avoid-magic-numbers,
|
||||
-cppcoreguidelines-avoid-non-const-global-variables,
|
||||
-cppcoreguidelines-init-variables,
|
||||
-cppcoreguidelines-macro-usage,
|
||||
-cppcoreguidelines-narrowing-conversions,
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
namespace esphome {
|
||||
namespace a4988 {
|
||||
|
||||
static const char *TAG = "a4988.stepper";
|
||||
static const char *const TAG = "a4988.stepper";
|
||||
|
||||
void A4988::setup() {
|
||||
ESP_LOGCONFIG(TAG, "Setting up A4988...");
|
||||
|
|
|
@ -9,15 +9,15 @@
|
|||
namespace esphome {
|
||||
namespace ac_dimmer {
|
||||
|
||||
static const char *TAG = "ac_dimmer";
|
||||
static const char *const TAG = "ac_dimmer";
|
||||
|
||||
// Global array to store dimmer objects
|
||||
static AcDimmerDataStore *all_dimmers[32];
|
||||
static AcDimmerDataStore *all_dimmers[32]; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
|
||||
|
||||
/// Time in microseconds the gate should be held high
|
||||
/// 10µs should be long enough for most triacs
|
||||
/// For reference: BT136 datasheet says 2µs nominal (page 7)
|
||||
static uint32_t GATE_ENABLE_TIME = 10;
|
||||
static const uint32_t GATE_ENABLE_TIME = 10;
|
||||
|
||||
/// Function called from timer interrupt
|
||||
/// Input is current time in microseconds (micros())
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
namespace esphome {
|
||||
namespace adalight {
|
||||
|
||||
static const char *TAG = "adalight_light_effect";
|
||||
static const char *const TAG = "adalight_light_effect";
|
||||
|
||||
static const uint32_t ADALIGHT_ACK_INTERVAL = 1000;
|
||||
static const uint32_t ADALIGHT_RECEIVE_TIMEOUT = 1000;
|
||||
|
|
|
@ -8,7 +8,7 @@ ADC_MODE(ADC_VCC)
|
|||
namespace esphome {
|
||||
namespace adc {
|
||||
|
||||
static const char *TAG = "adc";
|
||||
static const char *const TAG = "adc";
|
||||
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
void ADCSensor::set_attenuation(adc_attenuation_t attenuation) { this->attenuation_ = attenuation; }
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
namespace esphome {
|
||||
namespace addressable_light {
|
||||
|
||||
static const char *TAG = "addressable_light.display";
|
||||
static const char *const TAG = "addressable_light.display";
|
||||
|
||||
int AddressableLightDisplay::get_width_internal() { return this->width_; }
|
||||
int AddressableLightDisplay::get_height_internal() { return this->height_; }
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
namespace esphome {
|
||||
namespace ade7953 {
|
||||
|
||||
static const char *TAG = "ade7953";
|
||||
static const char *const TAG = "ade7953";
|
||||
|
||||
void ADE7953::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "ADE7953:");
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
namespace esphome {
|
||||
namespace ads1115 {
|
||||
|
||||
static const char *TAG = "ads1115";
|
||||
static const char *const TAG = "ads1115";
|
||||
static const uint8_t ADS1115_REGISTER_CONVERSION = 0x00;
|
||||
static const uint8_t ADS1115_REGISTER_CONFIG = 0x01;
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
namespace esphome {
|
||||
namespace aht10 {
|
||||
|
||||
static const char *TAG = "aht10";
|
||||
static const char *const TAG = "aht10";
|
||||
static const uint8_t AHT10_CALIBRATE_CMD[] = {0xE1};
|
||||
static const uint8_t AHT10_MEASURE_CMD[] = {0xAC, 0x33, 0x00};
|
||||
static const uint8_t AHT10_DEFAULT_DELAY = 5; // ms, for calibration and temperature measurement
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
namespace esphome {
|
||||
namespace am2320 {
|
||||
|
||||
static const char *TAG = "am2320";
|
||||
static const char *const TAG = "am2320";
|
||||
|
||||
// ---=== Calc CRC16 ===---
|
||||
uint16_t crc_16(uint8_t *ptr, uint8_t length) {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
namespace esphome {
|
||||
namespace apds9960 {
|
||||
|
||||
static const char *TAG = "apds9960";
|
||||
static const char *const TAG = "apds9960";
|
||||
|
||||
#define APDS9960_ERROR_CHECK(func) \
|
||||
if (!(func)) { \
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
namespace esphome {
|
||||
namespace api {
|
||||
|
||||
static const char *TAG = "api.connection";
|
||||
static const char *const TAG = "api.connection";
|
||||
|
||||
APIConnection::APIConnection(AsyncClient *client, APIServer *parent)
|
||||
: client_(client), parent_(parent), initial_state_iterator_(parent, this), list_entities_iterator_(parent, this) {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
namespace esphome {
|
||||
namespace api {
|
||||
|
||||
static const char *TAG = "api.service";
|
||||
static const char *const TAG = "api.service";
|
||||
|
||||
bool APIServerConnectionBase::send_hello_response(const HelloResponse &msg) {
|
||||
ESP_LOGVV(TAG, "send_hello_response: %s", msg.dump().c_str());
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
namespace esphome {
|
||||
namespace api {
|
||||
|
||||
static const char *TAG = "api";
|
||||
static const char *const TAG = "api";
|
||||
|
||||
// APIServer
|
||||
void APIServer::setup() {
|
||||
|
@ -199,7 +199,7 @@ void APIServer::on_climate_update(climate::Climate *obj) {
|
|||
|
||||
float APIServer::get_setup_priority() const { return setup_priority::AFTER_WIFI; }
|
||||
void APIServer::set_port(uint16_t port) { this->port_ = port; }
|
||||
APIServer *global_api_server = nullptr;
|
||||
APIServer *global_api_server = nullptr; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
|
||||
|
||||
void APIServer::set_password(const std::string &password) { this->password_ = password; }
|
||||
void APIServer::send_homeassistant_service_call(const HomeassistantServiceResponse &call) {
|
||||
|
|
|
@ -91,7 +91,7 @@ class APIServer : public Component, public Controller {
|
|||
std::vector<UserServiceDescriptor *> user_services_;
|
||||
};
|
||||
|
||||
extern APIServer *global_api_server;
|
||||
extern APIServer *global_api_server; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
|
||||
|
||||
template<typename... Ts> class APIConnectedCondition : public Condition<Ts...> {
|
||||
public:
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
namespace esphome {
|
||||
namespace api {
|
||||
|
||||
static const char *TAG = "api.proto";
|
||||
static const char *const TAG = "api.proto";
|
||||
|
||||
void ProtoMessage::decode(const uint8_t *buffer, size_t length) {
|
||||
uint32_t i = 0;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
namespace esphome {
|
||||
namespace as3935 {
|
||||
|
||||
static const char *TAG = "as3935";
|
||||
static const char *const TAG = "as3935";
|
||||
|
||||
void AS3935Component::setup() {
|
||||
ESP_LOGCONFIG(TAG, "Setting up AS3935...");
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
namespace esphome {
|
||||
namespace as3935_i2c {
|
||||
|
||||
static const char *TAG = "as3935_i2c";
|
||||
static const char *const TAG = "as3935_i2c";
|
||||
|
||||
void I2CAS3935Component::write_register(uint8_t reg, uint8_t mask, uint8_t bits, uint8_t start_pos) {
|
||||
uint8_t write_reg;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
namespace esphome {
|
||||
namespace as3935_spi {
|
||||
|
||||
static const char *TAG = "as3935_spi";
|
||||
static const char *const TAG = "as3935_spi";
|
||||
|
||||
void SPIAS3935Component::setup() {
|
||||
ESP_LOGI(TAG, "SPIAS3935Component setup started!");
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
namespace esphome {
|
||||
namespace atc_mithermometer {
|
||||
|
||||
static const char *TAG = "atc_mithermometer";
|
||||
static const char *const TAG = "atc_mithermometer";
|
||||
|
||||
void ATCMiThermometer::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "ATC MiThermometer");
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
namespace esphome {
|
||||
namespace atm90e32 {
|
||||
|
||||
static const char *TAG = "atm90e32";
|
||||
static const char *const TAG = "atm90e32";
|
||||
|
||||
void ATM90E32Component::update() {
|
||||
if (this->read16_(ATM90E32_REGISTER_METEREN) != 1) {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
namespace esphome {
|
||||
namespace b_parasite {
|
||||
|
||||
static const char *TAG = "b_parasite";
|
||||
static const char *const TAG = "b_parasite";
|
||||
|
||||
void BParasite::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "b_parasite");
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
namespace esphome {
|
||||
namespace bang_bang {
|
||||
|
||||
static const char *TAG = "bang_bang.climate";
|
||||
static const char *const TAG = "bang_bang.climate";
|
||||
|
||||
void BangBangClimate::setup() {
|
||||
this->sensor_->add_on_state_callback([this](float state) {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
namespace esphome {
|
||||
namespace bh1750 {
|
||||
|
||||
static const char *TAG = "bh1750.sensor";
|
||||
static const char *const TAG = "bh1750.sensor";
|
||||
|
||||
static const uint8_t BH1750_COMMAND_POWER_ON = 0b00000001;
|
||||
static const uint8_t BH1750_COMMAND_MT_REG_HI = 0b01000000; // last 3 bits
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
namespace esphome {
|
||||
namespace binary {
|
||||
|
||||
static const char *TAG = "binary.fan";
|
||||
static const char *const TAG = "binary.fan";
|
||||
|
||||
void binary::BinaryFan::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "Fan '%s':", this->fan_->get_name().c_str());
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
namespace esphome {
|
||||
namespace binary_sensor {
|
||||
|
||||
static const char *TAG = "binary_sensor.automation";
|
||||
static const char *const TAG = "binary_sensor.automation";
|
||||
|
||||
void binary_sensor::MultiClickTrigger::on_state_(bool state) {
|
||||
// Handle duplicate events
|
||||
|
|
|
@ -5,7 +5,7 @@ namespace esphome {
|
|||
|
||||
namespace binary_sensor {
|
||||
|
||||
static const char *TAG = "binary_sensor";
|
||||
static const char *const TAG = "binary_sensor";
|
||||
|
||||
void BinarySensor::add_on_state_callback(std::function<void(bool)> &&callback) {
|
||||
this->state_callback_.add(std::move(callback));
|
||||
|
|
|
@ -7,7 +7,7 @@ namespace esphome {
|
|||
|
||||
namespace binary_sensor {
|
||||
|
||||
static const char *TAG = "sensor.filter";
|
||||
static const char *const TAG = "sensor.filter";
|
||||
|
||||
void Filter::output(bool value, bool is_initial) {
|
||||
if (!this->dedup_.next(value))
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
namespace esphome {
|
||||
namespace binary_sensor_map {
|
||||
|
||||
static const char *TAG = "binary_sensor_map";
|
||||
static const char *const TAG = "binary_sensor_map";
|
||||
|
||||
void BinarySensorMap::dump_config() { LOG_SENSOR(" ", "binary_sensor_map", this); }
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
namespace esphome {
|
||||
namespace ble_client {
|
||||
|
||||
static const char *TAG = "ble_client";
|
||||
static const char *const TAG = "ble_client";
|
||||
|
||||
void BLEClient::setup() {
|
||||
auto ret = esp_ble_gattc_app_register(this->app_id);
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
namespace esphome {
|
||||
namespace ble_client {
|
||||
|
||||
static const char *TAG = "ble_sensor";
|
||||
static const char *const TAG = "ble_sensor";
|
||||
|
||||
uint32_t BLESensor::hash_base() { return 343459825UL; }
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
namespace esphome {
|
||||
namespace ble_client {
|
||||
|
||||
static const char *TAG = "ble_switch";
|
||||
static const char *const TAG = "ble_switch";
|
||||
|
||||
void BLEClientSwitch::write_state(bool state) {
|
||||
this->parent_->set_enabled(state);
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
namespace esphome {
|
||||
namespace ble_presence {
|
||||
|
||||
static const char *TAG = "ble_presence";
|
||||
static const char *const TAG = "ble_presence";
|
||||
|
||||
void BLEPresenceDevice::dump_config() { LOG_BINARY_SENSOR("", "BLE Presence", this); }
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
namespace esphome {
|
||||
namespace ble_rssi {
|
||||
|
||||
static const char *TAG = "ble_rssi";
|
||||
static const char *const TAG = "ble_rssi";
|
||||
|
||||
void BLERSSISensor::dump_config() { LOG_SENSOR("", "BLE RSSI Sensor", this); }
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
namespace esphome {
|
||||
namespace ble_scanner {
|
||||
|
||||
static const char *TAG = "ble_scanner";
|
||||
static const char *const TAG = "ble_scanner";
|
||||
|
||||
void BLEScanner::dump_config() { LOG_TEXT_SENSOR("", "BLE Scanner", this); }
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
namespace esphome {
|
||||
namespace bme280 {
|
||||
|
||||
static const char *TAG = "bme280.sensor";
|
||||
static const char *const TAG = "bme280.sensor";
|
||||
|
||||
static const uint8_t BME280_REGISTER_DIG_T1 = 0x88;
|
||||
static const uint8_t BME280_REGISTER_DIG_T2 = 0x8A;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
namespace esphome {
|
||||
namespace bme680 {
|
||||
|
||||
static const char *TAG = "bme680.sensor";
|
||||
static const char *const TAG = "bme680.sensor";
|
||||
|
||||
static const uint8_t BME680_REGISTER_COEFF1 = 0x89;
|
||||
static const uint8_t BME680_REGISTER_COEFF2 = 0xE1;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
namespace esphome {
|
||||
namespace bme680_bsec {
|
||||
#ifdef USE_BSEC
|
||||
static const char *TAG = "bme680_bsec.sensor";
|
||||
static const char *const TAG = "bme680_bsec.sensor";
|
||||
|
||||
static const std::string IAQ_ACCURACY_STATES[4] = {"Stabilizing", "Uncertain", "Calibrating", "Calibrated"};
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
namespace esphome {
|
||||
namespace bmp085 {
|
||||
|
||||
static const char *TAG = "bmp085.sensor";
|
||||
static const char *const TAG = "bmp085.sensor";
|
||||
|
||||
static const uint8_t BMP085_ADDRESS = 0x77;
|
||||
static const uint8_t BMP085_REGISTER_AC1_H = 0xAA;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
namespace esphome {
|
||||
namespace bmp280 {
|
||||
|
||||
static const char *TAG = "bmp280.sensor";
|
||||
static const char *const TAG = "bmp280.sensor";
|
||||
|
||||
static const uint8_t BMP280_REGISTER_STATUS = 0xF3;
|
||||
static const uint8_t BMP280_REGISTER_CONTROL = 0xF4;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
namespace esphome {
|
||||
namespace canbus {
|
||||
|
||||
static const char *TAG = "canbus";
|
||||
static const char *const TAG = "canbus";
|
||||
|
||||
void Canbus::setup() {
|
||||
ESP_LOGCONFIG(TAG, "Setting up Canbus...");
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
namespace esphome {
|
||||
namespace captive_portal {
|
||||
|
||||
static const char *TAG = "captive_portal";
|
||||
static const char *const TAG = "captive_portal";
|
||||
|
||||
void CaptivePortal::handle_index(AsyncWebServerRequest *request) {
|
||||
AsyncResponseStream *stream = request->beginResponseStream("text/html");
|
||||
|
@ -147,7 +147,7 @@ float CaptivePortal::get_setup_priority() const {
|
|||
}
|
||||
void CaptivePortal::dump_config() { ESP_LOGCONFIG(TAG, "Captive Portal:"); }
|
||||
|
||||
CaptivePortal *global_captive_portal = nullptr;
|
||||
CaptivePortal *global_captive_portal = nullptr; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
|
||||
|
||||
} // namespace captive_portal
|
||||
} // namespace esphome
|
||||
|
|
|
@ -68,7 +68,7 @@ class CaptivePortal : public AsyncWebHandler, public Component {
|
|||
DNSServer *dns_server_{nullptr};
|
||||
};
|
||||
|
||||
extern CaptivePortal *global_captive_portal;
|
||||
extern CaptivePortal *global_captive_portal; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
|
||||
|
||||
} // namespace captive_portal
|
||||
} // namespace esphome
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
namespace esphome {
|
||||
namespace ccs811 {
|
||||
|
||||
static const char *TAG = "ccs811";
|
||||
static const char *const TAG = "ccs811";
|
||||
|
||||
// based on
|
||||
// - https://cdn.sparkfun.com/datasheets/BreakoutBoards/CCS811_Programming_Guide.pdf
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace esphome {
|
||||
namespace climate {
|
||||
|
||||
static const char *TAG = "climate";
|
||||
static const char *const TAG = "climate";
|
||||
|
||||
void ClimateCall::perform() {
|
||||
ESP_LOGD(TAG, "'%s' - Setting", this->parent_->get_name().c_str());
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
namespace esphome {
|
||||
namespace climate_ir {
|
||||
|
||||
static const char *TAG = "climate_ir";
|
||||
static const char *const TAG = "climate_ir";
|
||||
|
||||
climate::ClimateTraits ClimateIR::traits() {
|
||||
auto traits = climate::ClimateTraits();
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
namespace esphome {
|
||||
namespace climate_ir_lg {
|
||||
|
||||
static const char *TAG = "climate.climate_ir_lg";
|
||||
static const char *const TAG = "climate.climate_ir_lg";
|
||||
|
||||
const uint32_t COMMAND_ON = 0x00000;
|
||||
const uint32_t COMMAND_ON_AI = 0x03000;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
namespace esphome {
|
||||
namespace coolix {
|
||||
|
||||
static const char *TAG = "coolix.climate";
|
||||
static const char *const TAG = "coolix.climate";
|
||||
|
||||
const uint32_t COOLIX_OFF = 0xB27BE0;
|
||||
const uint32_t COOLIX_SWING = 0xB26BE0;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
namespace esphome {
|
||||
namespace cover {
|
||||
|
||||
static const char *TAG = "cover";
|
||||
static const char *const TAG = "cover";
|
||||
|
||||
const float COVER_OPEN = 1.0f;
|
||||
const float COVER_CLOSED = 0.0f;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
namespace esphome {
|
||||
namespace cs5460a {
|
||||
|
||||
static const char *TAG = "cs5460a";
|
||||
static const char *const TAG = "cs5460a";
|
||||
|
||||
void CS5460AComponent::write_register_(enum CS5460ARegister addr, uint32_t value) {
|
||||
this->write_byte(CMD_WRITE | (addr << 1));
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
namespace esphome {
|
||||
namespace cse7766 {
|
||||
|
||||
static const char *TAG = "cse7766";
|
||||
static const char *const TAG = "cse7766";
|
||||
|
||||
void CSE7766Component::loop() {
|
||||
const uint32_t now = millis();
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
namespace esphome {
|
||||
namespace ct_clamp {
|
||||
|
||||
static const char *TAG = "ct_clamp";
|
||||
static const char *const TAG = "ct_clamp";
|
||||
|
||||
void CTClampSensor::setup() {
|
||||
this->is_calibrating_offset_ = true;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
namespace esphome {
|
||||
namespace custom {
|
||||
|
||||
static const char *TAG = "custom.binary_sensor";
|
||||
static const char *const TAG = "custom.binary_sensor";
|
||||
|
||||
void CustomBinarySensorConstructor::dump_config() {
|
||||
for (auto *child : this->binary_sensors_) {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
namespace esphome {
|
||||
namespace custom {
|
||||
|
||||
static const char *TAG = "custom.sensor";
|
||||
static const char *const TAG = "custom.sensor";
|
||||
|
||||
void CustomSensorConstructor::dump_config() {
|
||||
for (auto *child : this->sensors_) {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
namespace esphome {
|
||||
namespace custom {
|
||||
|
||||
static const char *TAG = "custom.switch";
|
||||
static const char *const TAG = "custom.switch";
|
||||
|
||||
void CustomSwitchConstructor::dump_config() {
|
||||
for (auto *child : this->switches_) {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
namespace esphome {
|
||||
namespace custom {
|
||||
|
||||
static const char *TAG = "custom.text_sensor";
|
||||
static const char *const TAG = "custom.text_sensor";
|
||||
|
||||
void CustomTextSensorConstructor::dump_config() {
|
||||
for (auto *child : this->text_sensors_) {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
namespace esphome {
|
||||
namespace daikin {
|
||||
|
||||
static const char *TAG = "daikin.climate";
|
||||
static const char *const TAG = "daikin.climate";
|
||||
|
||||
void DaikinClimate::transmit_state() {
|
||||
uint8_t remote_state[35] = {0x11, 0xDA, 0x27, 0x00, 0xC5, 0x00, 0x00, 0xD7, 0x11, 0xDA, 0x27, 0x00,
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
namespace esphome {
|
||||
namespace dallas {
|
||||
|
||||
static const char *TAG = "dallas.sensor";
|
||||
static const char *const TAG = "dallas.sensor";
|
||||
|
||||
static const uint8_t DALLAS_MODEL_DS18S20 = 0x10;
|
||||
static const uint8_t DALLAS_MODEL_DS1822 = 0x22;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
namespace esphome {
|
||||
namespace dallas {
|
||||
|
||||
static const char *TAG = "dallas.one_wire";
|
||||
static const char *const TAG = "dallas.one_wire";
|
||||
|
||||
const uint8_t ONE_WIRE_ROM_SELECT = 0x55;
|
||||
const int ONE_WIRE_ROM_SEARCH = 0xF0;
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
namespace esphome {
|
||||
namespace debug {
|
||||
|
||||
static const char *TAG = "debug";
|
||||
static const char *const TAG = "debug";
|
||||
|
||||
void DebugComponent::dump_config() {
|
||||
#ifndef ESPHOME_LOG_HAS_DEBUG
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
namespace esphome {
|
||||
namespace deep_sleep {
|
||||
|
||||
static const char *TAG = "deep_sleep";
|
||||
static const char *const TAG = "deep_sleep";
|
||||
|
||||
bool global_has_deep_sleep = false;
|
||||
bool global_has_deep_sleep = false; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
|
||||
|
||||
void DeepSleepComponent::setup() {
|
||||
ESP_LOGCONFIG(TAG, "Setting up Deep Sleep...");
|
||||
|
|
|
@ -79,7 +79,7 @@ class DeepSleepComponent : public Component {
|
|||
bool prevent_{false};
|
||||
};
|
||||
|
||||
extern bool global_has_deep_sleep;
|
||||
extern bool global_has_deep_sleep; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
|
||||
|
||||
template<typename... Ts> class EnterDeepSleepAction : public Action<Ts...> {
|
||||
public:
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
namespace esphome {
|
||||
namespace dfplayer {
|
||||
|
||||
static const char *TAG = "dfplayer";
|
||||
static const char *const TAG = "dfplayer";
|
||||
|
||||
void DFPlayer::play_folder(uint16_t folder, uint16_t file) {
|
||||
if (folder < 100 && file < 256) {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
namespace esphome {
|
||||
namespace dht {
|
||||
|
||||
static const char *TAG = "dht";
|
||||
static const char *const TAG = "dht";
|
||||
|
||||
void DHT::setup() {
|
||||
ESP_LOGCONFIG(TAG, "Setting up DHT...");
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
namespace esphome {
|
||||
namespace dht12 {
|
||||
|
||||
static const char *TAG = "dht12";
|
||||
static const char *const TAG = "dht12";
|
||||
|
||||
void DHT12Component::update() {
|
||||
uint8_t data[5];
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
namespace esphome {
|
||||
namespace display {
|
||||
|
||||
static const char *TAG = "display";
|
||||
static const char *const TAG = "display";
|
||||
|
||||
const Color COLOR_OFF(0, 0, 0, 0);
|
||||
const Color COLOR_ON(255, 255, 255, 255);
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
namespace esphome {
|
||||
namespace ds1307 {
|
||||
|
||||
static const char *TAG = "ds1307";
|
||||
static const char *const TAG = "ds1307";
|
||||
|
||||
void DS1307Component::setup() {
|
||||
ESP_LOGCONFIG(TAG, "Setting up DS1307...");
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
namespace esphome {
|
||||
namespace duty_cycle {
|
||||
|
||||
static const char *TAG = "duty_cycle";
|
||||
static const char *const TAG = "duty_cycle";
|
||||
|
||||
void DutyCycleSensor::setup() {
|
||||
ESP_LOGCONFIG(TAG, "Setting up Duty Cycle Sensor '%s'...", this->get_name().c_str());
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
namespace esphome {
|
||||
namespace e131 {
|
||||
|
||||
static const char *TAG = "e131";
|
||||
static const char *const TAG = "e131";
|
||||
static const int PORT = 5568;
|
||||
|
||||
E131Component::E131Component() {}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
namespace esphome {
|
||||
namespace e131 {
|
||||
|
||||
static const char *TAG = "e131_addressable_light_effect";
|
||||
static const char *const TAG = "e131_addressable_light_effect";
|
||||
static const int MAX_DATA_SIZE = (sizeof(E131Packet::values) - 1);
|
||||
|
||||
E131AddressableLightEffect::E131AddressableLightEffect(const std::string &name) : AddressableLightEffect(name) {}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
namespace esphome {
|
||||
namespace e131 {
|
||||
|
||||
static const char *TAG = "e131";
|
||||
static const char *const TAG = "e131";
|
||||
|
||||
static const uint8_t ACN_ID[12] = {0x41, 0x53, 0x43, 0x2d, 0x45, 0x31, 0x2e, 0x31, 0x37, 0x00, 0x00, 0x00};
|
||||
static const uint32_t VECTOR_ROOT = 4;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
namespace esphome {
|
||||
namespace endstop {
|
||||
|
||||
static const char *TAG = "endstop.cover";
|
||||
static const char *const TAG = "endstop.cover";
|
||||
|
||||
using namespace esphome::cover;
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
namespace esphome {
|
||||
namespace esp32_ble {
|
||||
|
||||
static const char *TAG = "esp32_ble";
|
||||
static const char *const TAG = "esp32_ble";
|
||||
|
||||
void ESP32BLE::setup() {
|
||||
global_ble = this;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
namespace esphome {
|
||||
namespace esp32_ble {
|
||||
|
||||
static const char *TAG = "esp32_ble.characteristic";
|
||||
static const char *const TAG = "esp32_ble.characteristic";
|
||||
|
||||
BLECharacteristic::BLECharacteristic(const ESPBTUUID uuid, uint32_t properties) : uuid_(uuid) {
|
||||
this->set_value_lock_ = xSemaphoreCreateBinary();
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
namespace esphome {
|
||||
namespace esp32_ble {
|
||||
|
||||
static const char *TAG = "esp32_ble.descriptor";
|
||||
static const char *const TAG = "esp32_ble.descriptor";
|
||||
|
||||
BLEDescriptor::BLEDescriptor(ESPBTUUID uuid, uint16_t max_len) {
|
||||
this->uuid_ = uuid;
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
namespace esphome {
|
||||
namespace esp32_ble {
|
||||
|
||||
static const char *TAG = "esp32_ble.server";
|
||||
static const char *const TAG = "esp32_ble.server";
|
||||
|
||||
static const uint16_t device_information_service__UUID = 0x180A;
|
||||
static const uint16_t MODEL_UUID = 0x2A24;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
namespace esphome {
|
||||
namespace esp32_ble {
|
||||
|
||||
static const char *TAG = "esp32_ble.service";
|
||||
static const char *const TAG = "esp32_ble.service";
|
||||
|
||||
BLEService::BLEService(ESPBTUUID uuid, uint16_t num_handles, uint8_t inst_id)
|
||||
: uuid_(uuid), num_handles_(num_handles), inst_id_(inst_id) {}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
namespace esphome {
|
||||
namespace esp32_ble_beacon {
|
||||
|
||||
static const char *TAG = "esp32_ble_beacon";
|
||||
static const char *const TAG = "esp32_ble_beacon";
|
||||
|
||||
static esp_ble_adv_params_t ble_adv_params = {
|
||||
.adv_int_min = 0x20,
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
namespace esphome {
|
||||
namespace esp32_ble_tracker {
|
||||
|
||||
static const char *TAG = "esp32_ble_tracker";
|
||||
static const char *const TAG = "esp32_ble_tracker";
|
||||
|
||||
ESP32BLETracker *global_esp32_ble_tracker = nullptr;
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
namespace esphome {
|
||||
namespace esp32_camera {
|
||||
|
||||
static const char *TAG = "esp32_camera";
|
||||
static const char *const TAG = "esp32_camera";
|
||||
|
||||
void ESP32Camera::setup() {
|
||||
global_esp32_camera = this;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
namespace esphome {
|
||||
namespace esp32_dac {
|
||||
|
||||
static const char *TAG = "esp32_dac";
|
||||
static const char *const TAG = "esp32_dac";
|
||||
|
||||
void ESP32DAC::setup() {
|
||||
ESP_LOGCONFIG(TAG, "Setting up ESP32 DAC Output...");
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
namespace esphome {
|
||||
namespace esp32_hall {
|
||||
|
||||
static const char *TAG = "esp32_hall";
|
||||
static const char *const TAG = "esp32_hall";
|
||||
|
||||
void ESP32HallSensor::update() {
|
||||
float value = (hallRead() / 4095.0f) * 10000.0f;
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
namespace esphome {
|
||||
namespace esp32_improv {
|
||||
|
||||
static const char *TAG = "esp32_improv.component";
|
||||
static const char *const TAG = "esp32_improv.component";
|
||||
|
||||
ESP32ImprovComponent::ESP32ImprovComponent() { global_improv_component = this; }
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
namespace esphome {
|
||||
namespace esp32_touch {
|
||||
|
||||
static const char *TAG = "esp32_touch";
|
||||
static const char *const TAG = "esp32_touch";
|
||||
|
||||
void ESP32TouchComponent::setup() {
|
||||
ESP_LOGCONFIG(TAG, "Setting up ESP32 Touch Hub...");
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
namespace esphome {
|
||||
namespace esp8266_pwm {
|
||||
|
||||
static const char *TAG = "esp8266_pwm";
|
||||
static const char *const TAG = "esp8266_pwm";
|
||||
|
||||
void ESP8266PWM::setup() {
|
||||
ESP_LOGCONFIG(TAG, "Setting up ESP8266 PWM Output...");
|
||||
|
|
|
@ -21,7 +21,7 @@ extern void tcpipInit();
|
|||
namespace esphome {
|
||||
namespace ethernet {
|
||||
|
||||
static const char *TAG = "ethernet";
|
||||
static const char *const TAG = "ethernet";
|
||||
|
||||
EthernetComponent *global_eth_component;
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ namespace exposure_notifications {
|
|||
|
||||
using namespace esp32_ble_tracker;
|
||||
|
||||
static const char *TAG = "exposure_notifications";
|
||||
static const char *const TAG = "exposure_notifications";
|
||||
|
||||
bool ExposureNotificationTrigger::parse_device(const ESPBTDevice &device) {
|
||||
// See also https://blog.google/documents/70/Exposure_Notification_-_Bluetooth_Specification_v1.2.2.pdf
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
namespace esphome {
|
||||
namespace ezo {
|
||||
|
||||
static const char *TAG = "ezo.sensor";
|
||||
static const char *const TAG = "ezo.sensor";
|
||||
|
||||
static const uint16_t EZO_STATE_WAIT = 1;
|
||||
static const uint16_t EZO_STATE_SEND_TEMP = 2;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
namespace esphome {
|
||||
namespace fan {
|
||||
|
||||
static const char *TAG = "fan.automation";
|
||||
static const char *const TAG = "fan.automation";
|
||||
|
||||
} // namespace fan
|
||||
} // namespace esphome
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
namespace esphome {
|
||||
namespace fan {
|
||||
|
||||
static const char *TAG = "fan";
|
||||
static const char *const TAG = "fan";
|
||||
|
||||
const FanTraits &FanState::get_traits() const { return this->traits_; }
|
||||
void FanState::set_traits(const FanTraits &traits) { this->traits_ = traits; }
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
namespace esphome {
|
||||
namespace fastled_base {
|
||||
|
||||
static const char *TAG = "fastled";
|
||||
static const char *const TAG = "fastled";
|
||||
|
||||
void FastLEDLightOutput::setup() {
|
||||
ESP_LOGCONFIG(TAG, "Setting up FastLED light...");
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
namespace esphome {
|
||||
namespace fingerprint_grow {
|
||||
|
||||
static const char *TAG = "fingerprint_grow";
|
||||
static const char *const TAG = "fingerprint_grow";
|
||||
|
||||
// Based on Adafruit's library: https://github.com/adafruit/Adafruit-Fingerprint-Sensor-Library
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ namespace fujitsu_general {
|
|||
((message)[(nibble) / 2] |= ((value) &0b00001111) << (((nibble) % 2) ? 0 : 4))
|
||||
#define GET_NIBBLE(message, nibble) (((message)[(nibble) / 2] >> (((nibble) % 2) ? 0 : 4)) & 0b00001111)
|
||||
|
||||
static const char *TAG = "fujitsu_general.climate";
|
||||
static const char *const TAG = "fujitsu_general.climate";
|
||||
|
||||
// Common header
|
||||
const uint8_t FUJITSU_GENERAL_COMMON_LENGTH = 6;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
namespace esphome {
|
||||
namespace gpio {
|
||||
|
||||
static const char *TAG = "gpio.binary_sensor";
|
||||
static const char *const TAG = "gpio.binary_sensor";
|
||||
|
||||
void GPIOBinarySensor::setup() {
|
||||
this->pin_->setup();
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
namespace esphome {
|
||||
namespace gpio {
|
||||
|
||||
static const char *TAG = "gpio.output";
|
||||
static const char *const TAG = "gpio.output";
|
||||
|
||||
void GPIOBinaryOutput::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "GPIO Binary Output:");
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
namespace esphome {
|
||||
namespace gpio {
|
||||
|
||||
static const char *TAG = "switch.gpio";
|
||||
static const char *const TAG = "switch.gpio";
|
||||
|
||||
float GPIOSwitch::get_setup_priority() const { return setup_priority::HARDWARE; }
|
||||
void GPIOSwitch::setup() {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
namespace esphome {
|
||||
namespace gps {
|
||||
|
||||
static const char *TAG = "gps";
|
||||
static const char *const TAG = "gps";
|
||||
|
||||
TinyGPSPlus &GPSListener::get_tiny_gps() { return this->parent_->get_tiny_gps(); }
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
namespace esphome {
|
||||
namespace gps {
|
||||
|
||||
static const char *TAG = "gps.time";
|
||||
static const char *const TAG = "gps.time";
|
||||
|
||||
void GPSTime::from_tiny_gps_(TinyGPSPlus &tiny_gps) {
|
||||
if (!tiny_gps.time.isValid() || !tiny_gps.date.isValid())
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
namespace esphome {
|
||||
namespace hdc1080 {
|
||||
|
||||
static const char *TAG = "hdc1080";
|
||||
static const char *const TAG = "hdc1080";
|
||||
|
||||
static const uint8_t HDC1080_ADDRESS = 0x40; // 0b1000000 from datasheet
|
||||
static const uint8_t HDC1080_CMD_CONFIGURATION = 0x02;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace esphome {
|
||||
namespace hitachi_ac344 {
|
||||
|
||||
static const char *TAG = "climate.hitachi_ac344";
|
||||
static const char *const TAG = "climate.hitachi_ac344";
|
||||
|
||||
void set_bits(uint8_t *const dst, const uint8_t offset, const uint8_t nbits, const uint8_t data) {
|
||||
if (offset >= 8 || !nbits)
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue