Streamline setup() logging (a, b) (#8924)

This commit is contained in:
Keith Burzinski 2025-05-28 05:53:51 -05:00 committed by GitHub
parent ca6295d1bd
commit b6fa4f641d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
36 changed files with 37 additions and 37 deletions

View File

@ -7,7 +7,7 @@ namespace a4988 {
static const char *const TAG = "a4988.stepper"; static const char *const TAG = "a4988.stepper";
void A4988::setup() { void A4988::setup() {
ESP_LOGCONFIG(TAG, "Setting up A4988..."); ESP_LOGCONFIG(TAG, "Running setup");
if (this->sleep_pin_ != nullptr) { if (this->sleep_pin_ != nullptr) {
this->sleep_pin_->setup(); this->sleep_pin_->setup();
this->sleep_pin_->digital_write(false); this->sleep_pin_->digital_write(false);

View File

@ -7,7 +7,7 @@ namespace absolute_humidity {
static const char *const TAG = "absolute_humidity.sensor"; static const char *const TAG = "absolute_humidity.sensor";
void AbsoluteHumidityComponent::setup() { void AbsoluteHumidityComponent::setup() {
ESP_LOGCONFIG(TAG, "Setting up absolute humidity '%s'...", this->get_name().c_str()); ESP_LOGCONFIG(TAG, "Running setup for '%s'", this->get_name().c_str());
ESP_LOGD(TAG, " Added callback for temperature '%s'", this->temperature_sensor_->get_name().c_str()); ESP_LOGD(TAG, " Added callback for temperature '%s'", this->temperature_sensor_->get_name().c_str());
this->temperature_sensor_->add_on_state_callback([this](float state) { this->temperature_callback_(state); }); this->temperature_sensor_->add_on_state_callback([this](float state) { this->temperature_callback_(state); });

View File

@ -22,7 +22,7 @@ static const int ADC_MAX = (1 << SOC_ADC_RTC_MAX_BITWIDTH) - 1;
static const int ADC_HALF = (1 << SOC_ADC_RTC_MAX_BITWIDTH) >> 1; static const int ADC_HALF = (1 << SOC_ADC_RTC_MAX_BITWIDTH) >> 1;
void ADCSensor::setup() { void ADCSensor::setup() {
ESP_LOGCONFIG(TAG, "Setting up ADC '%s'...", this->get_name().c_str()); ESP_LOGCONFIG(TAG, "Running setup for '%s'...", this->get_name().c_str());
if (this->channel1_ != ADC1_CHANNEL_MAX) { if (this->channel1_ != ADC1_CHANNEL_MAX) {
adc1_config_width(ADC_WIDTH_MAX_SOC_BITS); adc1_config_width(ADC_WIDTH_MAX_SOC_BITS);

View File

@ -17,7 +17,7 @@ namespace adc {
static const char *const TAG = "adc.esp8266"; static const char *const TAG = "adc.esp8266";
void ADCSensor::setup() { void ADCSensor::setup() {
ESP_LOGCONFIG(TAG, "Setting up ADC '%s'...", this->get_name().c_str()); ESP_LOGCONFIG(TAG, "Running setup for '%s'...", this->get_name().c_str());
#ifndef USE_ADC_SENSOR_VCC #ifndef USE_ADC_SENSOR_VCC
this->pin_->setup(); this->pin_->setup();
#endif #endif

View File

@ -9,7 +9,7 @@ namespace adc {
static const char *const TAG = "adc.libretiny"; static const char *const TAG = "adc.libretiny";
void ADCSensor::setup() { void ADCSensor::setup() {
ESP_LOGCONFIG(TAG, "Setting up ADC '%s'...", this->get_name().c_str()); ESP_LOGCONFIG(TAG, "Running setup for '%s'...", this->get_name().c_str());
#ifndef USE_ADC_SENSOR_VCC #ifndef USE_ADC_SENSOR_VCC
this->pin_->setup(); this->pin_->setup();
#endif // !USE_ADC_SENSOR_VCC #endif // !USE_ADC_SENSOR_VCC

View File

@ -14,7 +14,7 @@ namespace adc {
static const char *const TAG = "adc.rp2040"; static const char *const TAG = "adc.rp2040";
void ADCSensor::setup() { void ADCSensor::setup() {
ESP_LOGCONFIG(TAG, "Setting up ADC '%s'...", this->get_name().c_str()); ESP_LOGCONFIG(TAG, "Running setup for '%s'...", this->get_name().c_str());
static bool initialized = false; static bool initialized = false;
if (!initialized) { if (!initialized) {
adc_init(); adc_init();

View File

@ -9,7 +9,7 @@ static const char *const TAG = "adc128s102";
float ADC128S102::get_setup_priority() const { return setup_priority::HARDWARE; } float ADC128S102::get_setup_priority() const { return setup_priority::HARDWARE; }
void ADC128S102::setup() { void ADC128S102::setup() {
ESP_LOGCONFIG(TAG, "Setting up adc128s102"); ESP_LOGCONFIG(TAG, "Running setup");
this->spi_setup(); this->spi_setup();
} }

View File

@ -10,7 +10,7 @@ static const uint8_t ADS1115_REGISTER_CONVERSION = 0x00;
static const uint8_t ADS1115_REGISTER_CONFIG = 0x01; static const uint8_t ADS1115_REGISTER_CONFIG = 0x01;
void ADS1115Component::setup() { void ADS1115Component::setup() {
ESP_LOGCONFIG(TAG, "Setting up ADS1115..."); ESP_LOGCONFIG(TAG, "Running setup");
uint16_t value; uint16_t value;
if (!this->read_byte_16(ADS1115_REGISTER_CONVERSION, &value)) { if (!this->read_byte_16(ADS1115_REGISTER_CONVERSION, &value)) {
this->mark_failed(); this->mark_failed();
@ -68,7 +68,7 @@ void ADS1115Component::setup() {
this->prev_config_ = config; this->prev_config_ = config;
} }
void ADS1115Component::dump_config() { void ADS1115Component::dump_config() {
ESP_LOGCONFIG(TAG, "Setting up ADS1115..."); ESP_LOGCONFIG(TAG, "ADS1115:");
LOG_I2C_DEVICE(this); LOG_I2C_DEVICE(this);
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with ADS1115 failed!"); ESP_LOGE(TAG, "Communication with ADS1115 failed!");

View File

@ -8,7 +8,7 @@ static const char *const TAG = "ads1118";
static const uint8_t ADS1118_DATA_RATE_860_SPS = 0b111; static const uint8_t ADS1118_DATA_RATE_860_SPS = 0b111;
void ADS1118::setup() { void ADS1118::setup() {
ESP_LOGCONFIG(TAG, "Setting up ads1118"); ESP_LOGCONFIG(TAG, "Running setup");
this->spi_setup(); this->spi_setup();
this->config_ = 0; this->config_ = 0;

View File

@ -23,7 +23,7 @@ static const uint16_t ZP_CURRENT = 0x0000;
static const uint16_t ZP_DEFAULT = 0xFFFF; static const uint16_t ZP_DEFAULT = 0xFFFF;
void AGS10Component::setup() { void AGS10Component::setup() {
ESP_LOGCONFIG(TAG, "Setting up ags10..."); ESP_LOGCONFIG(TAG, "Running setup");
auto version = this->read_version_(); auto version = this->read_version_();
if (version) { if (version) {

View File

@ -17,7 +17,7 @@ static const char *const TAG = "aic3204";
} }
void AIC3204::setup() { void AIC3204::setup() {
ESP_LOGCONFIG(TAG, "Setting up AIC3204..."); ESP_LOGCONFIG(TAG, "Running setup");
// Set register page to 0 // Set register page to 0
ERROR_CHECK(this->write_byte(AIC3204_PAGE_CTRL, 0x00), "Set page 0 failed"); ERROR_CHECK(this->write_byte(AIC3204_PAGE_CTRL, 0x00), "Set page 0 failed");

View File

@ -90,7 +90,7 @@ bool AM2315C::convert_(uint8_t *data, float &humidity, float &temperature) {
} }
void AM2315C::setup() { void AM2315C::setup() {
ESP_LOGCONFIG(TAG, "Setting up AM2315C..."); ESP_LOGCONFIG(TAG, "Running setup");
// get status // get status
uint8_t status = 0; uint8_t status = 0;

View File

@ -34,7 +34,7 @@ void AM2320Component::update() {
this->status_clear_warning(); this->status_clear_warning();
} }
void AM2320Component::setup() { void AM2320Component::setup() {
ESP_LOGCONFIG(TAG, "Setting up AM2320..."); ESP_LOGCONFIG(TAG, "Running setup");
uint8_t data[8]; uint8_t data[8];
data[0] = 0; data[0] = 0;
data[1] = 4; data[1] = 4;

View File

@ -54,7 +54,7 @@ enum { // APDS9306 registers
} }
void APDS9306::setup() { void APDS9306::setup() {
ESP_LOGCONFIG(TAG, "Setting up APDS9306..."); ESP_LOGCONFIG(TAG, "Running setup");
uint8_t id; uint8_t id;
if (!this->read_byte(APDS9306_PART_ID, &id)) { // Part ID register if (!this->read_byte(APDS9306_PART_ID, &id)) { // Part ID register

View File

@ -15,7 +15,7 @@ static const char *const TAG = "apds9960";
#define APDS9960_WRITE_BYTE(reg, value) APDS9960_ERROR_CHECK(this->write_byte(reg, value)); #define APDS9960_WRITE_BYTE(reg, value) APDS9960_ERROR_CHECK(this->write_byte(reg, value));
void APDS9960::setup() { void APDS9960::setup() {
ESP_LOGCONFIG(TAG, "Setting up APDS9960..."); ESP_LOGCONFIG(TAG, "Running setup");
uint8_t id; uint8_t id;
if (!this->read_byte(0x92, &id)) { // ID register if (!this->read_byte(0x92, &id)) { // ID register
this->error_code_ = COMMUNICATION_FAILED; this->error_code_ = COMMUNICATION_FAILED;

View File

@ -27,7 +27,7 @@ APIServer *global_api_server = nullptr; // NOLINT(cppcoreguidelines-avoid-non-c
APIServer::APIServer() { global_api_server = this; } APIServer::APIServer() { global_api_server = this; }
void APIServer::setup() { void APIServer::setup() {
ESP_LOGCONFIG(TAG, "Setting up Home Assistant API server..."); ESP_LOGCONFIG(TAG, "Running setup");
this->setup_controller(); this->setup_controller();
#ifdef USE_API_NOISE #ifdef USE_API_NOISE

View File

@ -7,7 +7,7 @@ namespace as3935 {
static const char *const TAG = "as3935"; static const char *const TAG = "as3935";
void AS3935Component::setup() { void AS3935Component::setup() {
ESP_LOGCONFIG(TAG, "Setting up AS3935..."); ESP_LOGCONFIG(TAG, "Running setup");
this->irq_pin_->setup(); this->irq_pin_->setup();
LOG_PIN(" IRQ Pin: ", this->irq_pin_); LOG_PIN(" IRQ Pin: ", this->irq_pin_);

View File

@ -23,7 +23,7 @@ static const uint8_t REGISTER_AGC = 0x1A; // 8 bytes / R
static const uint8_t REGISTER_MAGNITUDE = 0x1B; // 16 bytes / R static const uint8_t REGISTER_MAGNITUDE = 0x1B; // 16 bytes / R
void AS5600Component::setup() { void AS5600Component::setup() {
ESP_LOGCONFIG(TAG, "Setting up AS5600..."); ESP_LOGCONFIG(TAG, "Running setup");
if (!this->read_byte(REGISTER_STATUS).has_value()) { if (!this->read_byte(REGISTER_STATUS).has_value()) {
this->mark_failed(); this->mark_failed();

View File

@ -8,7 +8,7 @@ namespace as7341 {
static const char *const TAG = "as7341"; static const char *const TAG = "as7341";
void AS7341Component::setup() { void AS7341Component::setup() {
ESP_LOGCONFIG(TAG, "Setting up AS7341..."); ESP_LOGCONFIG(TAG, "Running setup");
LOG_I2C_DEVICE(this); LOG_I2C_DEVICE(this);
// Verify device ID // Verify device ID

View File

@ -71,7 +71,7 @@ bool AT581XComponent::i2c_read_reg(uint8_t addr, uint8_t &data) {
return this->read_register(addr, &data, 1) == esphome::i2c::NO_ERROR; return this->read_register(addr, &data, 1) == esphome::i2c::NO_ERROR;
} }
void AT581XComponent::setup() { ESP_LOGCONFIG(TAG, "Setting up AT581X..."); } void AT581XComponent::setup() { ESP_LOGCONFIG(TAG, "Running setup"); }
void AT581XComponent::dump_config() { LOG_I2C_DEVICE(this); } void AT581XComponent::dump_config() { LOG_I2C_DEVICE(this); }
#define ARRAY_SIZE(X) (sizeof(X) / sizeof((X)[0])) #define ARRAY_SIZE(X) (sizeof(X) / sizeof((X)[0]))
bool AT581XComponent::i2c_write_config() { bool AT581XComponent::i2c_write_config() {

View File

@ -41,7 +41,7 @@ void ATM90E26Component::update() {
} }
void ATM90E26Component::setup() { void ATM90E26Component::setup() {
ESP_LOGCONFIG(TAG, "Setting up ATM90E26 Component..."); ESP_LOGCONFIG(TAG, "Running setup");
this->spi_setup(); this->spi_setup();
uint16_t mmode = 0x422; // default values for everything but L/N line current gains uint16_t mmode = 0x422; // default values for everything but L/N line current gains

View File

@ -108,7 +108,7 @@ void ATM90E32Component::update() {
} }
void ATM90E32Component::setup() { void ATM90E32Component::setup() {
ESP_LOGCONFIG(TAG, "Setting up ATM90E32 Component..."); ESP_LOGCONFIG(TAG, "Running setup");
this->spi_setup(); this->spi_setup();
uint16_t mmode0 = 0x87; // 3P4W 50Hz uint16_t mmode0 = 0x87; // 3P4W 50Hz

View File

@ -17,7 +17,7 @@ constexpr static const uint8_t AXS_READ_TOUCHPAD[11] = {0xb5, 0xab, 0xa5, 0x5a,
} }
void AXS15231Touchscreen::setup() { void AXS15231Touchscreen::setup() {
ESP_LOGCONFIG(TAG, "Setting up AXS15231 Touchscreen..."); ESP_LOGCONFIG(TAG, "Running setup");
if (this->reset_pin_ != nullptr) { if (this->reset_pin_ != nullptr) {
this->reset_pin_->setup(); this->reset_pin_->setup();
this->reset_pin_->digital_write(false); this->reset_pin_->digital_write(false);

View File

@ -119,7 +119,7 @@ void spi_dma_tx_finish_callback(unsigned int param) {
} }
void BekenSPILEDStripLightOutput::setup() { void BekenSPILEDStripLightOutput::setup() {
ESP_LOGCONFIG(TAG, "Setting up Beken SPI LED Strip..."); ESP_LOGCONFIG(TAG, "Running setup");
size_t buffer_size = this->get_buffer_size_(); size_t buffer_size = this->get_buffer_size_();
size_t dma_buffer_size = (buffer_size * 8) + (2 * 64); size_t dma_buffer_size = (buffer_size * 8) + (2 * 64);

View File

@ -38,7 +38,7 @@ MTreg:
*/ */
void BH1750Sensor::setup() { void BH1750Sensor::setup() {
ESP_LOGCONFIG(TAG, "Setting up BH1750 '%s'...", this->name_.c_str()); ESP_LOGCONFIG(TAG, "Running setup for '%s'", this->name_.c_str());
uint8_t turn_on = BH1750_COMMAND_POWER_ON; uint8_t turn_on = BH1750_COMMAND_POWER_ON;
if (this->write(&turn_on, 1) != i2c::ERROR_OK) { if (this->write(&turn_on, 1) != i2c::ERROR_OK) {
this->mark_failed(); this->mark_failed();

View File

@ -88,7 +88,7 @@ const char *oversampling_to_str(BME280Oversampling oversampling) { // NOLINT
} }
void BME280Component::setup() { void BME280Component::setup() {
ESP_LOGCONFIG(TAG, "Setting up BME280..."); ESP_LOGCONFIG(TAG, "Running setup");
uint8_t chip_id = 0; uint8_t chip_id = 0;
// Mark as not failed before initializing. Some devices will turn off sensors to save on batteries // Mark as not failed before initializing. Some devices will turn off sensors to save on batteries

View File

@ -71,7 +71,7 @@ static const char *iir_filter_to_str(BME680IIRFilter filter) {
} }
void BME680Component::setup() { void BME680Component::setup() {
ESP_LOGCONFIG(TAG, "Setting up BME680..."); ESP_LOGCONFIG(TAG, "Running setup");
uint8_t chip_id; uint8_t chip_id;
if (!this->read_byte(BME680_REGISTER_CHIPID, &chip_id) || chip_id != 0x61) { if (!this->read_byte(BME680_REGISTER_CHIPID, &chip_id) || chip_id != 0x61) {
this->mark_failed(); this->mark_failed();

View File

@ -15,7 +15,7 @@ std::vector<BME680BSECComponent *>
uint8_t BME680BSECComponent::work_buffer_[BSEC_MAX_WORKBUFFER_SIZE] = {0}; uint8_t BME680BSECComponent::work_buffer_[BSEC_MAX_WORKBUFFER_SIZE] = {0};
void BME680BSECComponent::setup() { void BME680BSECComponent::setup() {
ESP_LOGCONFIG(TAG, "Setting up BME680(%s) via BSEC...", this->device_id_.c_str()); ESP_LOGCONFIG(TAG, "Running setup for '%s'", this->device_id_.c_str());
uint8_t new_idx = BME680BSECComponent::instances.size(); uint8_t new_idx = BME680BSECComponent::instances.size();
BME680BSECComponent::instances.push_back(this); BME680BSECComponent::instances.push_back(this);

View File

@ -21,7 +21,7 @@ static const char *const TAG = "bme68x_bsec2.sensor";
static const std::string IAQ_ACCURACY_STATES[4] = {"Stabilizing", "Uncertain", "Calibrating", "Calibrated"}; static const std::string IAQ_ACCURACY_STATES[4] = {"Stabilizing", "Uncertain", "Calibrating", "Calibrated"};
void BME68xBSEC2Component::setup() { void BME68xBSEC2Component::setup() {
ESP_LOGCONFIG(TAG, "Setting up BME68X via BSEC2..."); ESP_LOGCONFIG(TAG, "Running setup");
this->bsec_status_ = bsec_init_m(&this->bsec_instance_); this->bsec_status_ = bsec_init_m(&this->bsec_instance_);
if (this->bsec_status_ != BSEC_OK) { if (this->bsec_status_ != BSEC_OK) {

View File

@ -119,7 +119,7 @@ const float GRAVITY_EARTH = 9.80665f;
void BMI160Component::internal_setup_(int stage) { void BMI160Component::internal_setup_(int stage) {
switch (stage) { switch (stage) {
case 0: case 0:
ESP_LOGCONFIG(TAG, "Setting up BMI160..."); ESP_LOGCONFIG(TAG, "Running setup");
uint8_t chipid; uint8_t chipid;
if (!this->read_byte(BMI160_REGISTER_CHIPID, &chipid) || (chipid != 0b11010001)) { if (!this->read_byte(BMI160_REGISTER_CHIPID, &chipid) || (chipid != 0b11010001)) {
this->mark_failed(); this->mark_failed();

View File

@ -20,7 +20,7 @@ void BMP085Component::update() {
this->set_timeout("temperature", 5, [this]() { this->read_temperature_(); }); this->set_timeout("temperature", 5, [this]() { this->read_temperature_(); });
} }
void BMP085Component::setup() { void BMP085Component::setup() {
ESP_LOGCONFIG(TAG, "Setting up BMP085..."); ESP_LOGCONFIG(TAG, "Running setup");
uint8_t data[22]; uint8_t data[22];
if (!this->read_bytes(BMP085_REGISTER_AC1_H, data, 22)) { if (!this->read_bytes(BMP085_REGISTER_AC1_H, data, 22)) {
this->mark_failed(); this->mark_failed();

View File

@ -57,7 +57,7 @@ static const char *iir_filter_to_str(BMP280IIRFilter filter) {
} }
void BMP280Component::setup() { void BMP280Component::setup() {
ESP_LOGCONFIG(TAG, "Setting up BMP280..."); ESP_LOGCONFIG(TAG, "Running setup");
uint8_t chip_id = 0; uint8_t chip_id = 0;
// Read the chip id twice, to work around a bug where the first read is 0. // Read the chip id twice, to work around a bug where the first read is 0.

View File

@ -70,7 +70,7 @@ static const LogString *iir_filter_to_str(IIRFilter filter) {
void BMP3XXComponent::setup() { void BMP3XXComponent::setup() {
this->error_code_ = NONE; this->error_code_ = NONE;
ESP_LOGCONFIG(TAG, "Setting up BMP3XX..."); ESP_LOGCONFIG(TAG, "Running setup");
// Call the Device base class "initialise" function // Call the Device base class "initialise" function
if (!reset()) { if (!reset()) {
ESP_LOGE(TAG, "Failed to reset BMP3XX..."); ESP_LOGE(TAG, "Failed to reset BMP3XX...");

View File

@ -122,7 +122,7 @@ void BMP581Component::setup() {
*/ */
this->error_code_ = NONE; this->error_code_ = NONE;
ESP_LOGCONFIG(TAG, "Setting up BMP581..."); ESP_LOGCONFIG(TAG, "Running setup");
//////////////////// ////////////////////
// 1) Soft reboot // // 1) Soft reboot //

View File

@ -15,7 +15,7 @@ static const uint8_t BP1658CJ_ADDR_START_5CH = 0x30;
static const uint8_t BP1658CJ_DELAY = 2; static const uint8_t BP1658CJ_DELAY = 2;
void BP1658CJ::setup() { void BP1658CJ::setup() {
ESP_LOGCONFIG(TAG, "Setting up BP1658CJ Output Component..."); ESP_LOGCONFIG(TAG, "Running setup");
this->data_pin_->setup(); this->data_pin_->setup();
this->data_pin_->digital_write(false); this->data_pin_->digital_write(false);
this->clock_pin_->setup(); this->clock_pin_->setup();

View File

@ -20,7 +20,7 @@ static const uint8_t BP5758D_ALL_DATA_CHANNEL_ENABLEMENT = 0b00011111;
static const uint8_t BP5758D_DELAY = 2; static const uint8_t BP5758D_DELAY = 2;
void BP5758D::setup() { void BP5758D::setup() {
ESP_LOGCONFIG(TAG, "Setting up BP5758D Output Component..."); ESP_LOGCONFIG(TAG, "Running setup");
this->data_pin_->setup(); this->data_pin_->setup();
this->data_pin_->digital_write(false); this->data_pin_->digital_write(false);
delayMicroseconds(BP5758D_DELAY); delayMicroseconds(BP5758D_DELAY);