Streamline setup() logging (n, o, p, q, r) (#8929)

This commit is contained in:
Keith Burzinski 2025-05-28 14:23:53 -05:00 committed by GitHub
parent d9a9e0aea3
commit d99e3237f9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
28 changed files with 31 additions and 34 deletions

View File

@ -52,8 +52,8 @@ static const uint8_t POWER_PGA_CAP_EN = 0x80;
static const uint8_t DEVICE_REV = 0x1F; static const uint8_t DEVICE_REV = 0x1F;
void NAU7802Sensor::setup() { void NAU7802Sensor::setup() {
ESP_LOGCONFIG(TAG, "Running setup for '%s'", this->name_.c_str());
i2c::I2CRegister pu_ctrl = this->reg(PU_CTRL_REG); i2c::I2CRegister pu_ctrl = this->reg(PU_CTRL_REG);
ESP_LOGCONFIG(TAG, "Setting up NAU7802 '%s'...", this->name_.c_str());
uint8_t rev; uint8_t rev;
if (this->read_register(DEVICE_REV | READ_BIT, &rev, 1)) { if (this->read_register(DEVICE_REV | READ_BIT, &rev, 1)) {

View File

@ -11,7 +11,7 @@ static const char *const TAG = "npi19";
static const uint8_t READ_COMMAND = 0xAC; static const uint8_t READ_COMMAND = 0xAC;
void NPI19Component::setup() { void NPI19Component::setup() {
ESP_LOGCONFIG(TAG, "Setting up NPI19..."); ESP_LOGCONFIG(TAG, "Running setup");
uint16_t raw_temperature(0); uint16_t raw_temperature(0);
uint16_t raw_pressure(0); uint16_t raw_pressure(0);

View File

@ -8,7 +8,7 @@ static const char *const TAG = "output.switch";
void OutputSwitch::dump_config() { LOG_SWITCH("", "Output Switch", this); } void OutputSwitch::dump_config() { LOG_SWITCH("", "Output Switch", this); }
void OutputSwitch::setup() { void OutputSwitch::setup() {
ESP_LOGCONFIG(TAG, "Setting up Output Switch '%s'...", this->name_.c_str()); ESP_LOGCONFIG(TAG, "Running setup for '%s'", this->name_.c_str());
bool initial_state = this->get_initial_state_with_restore_mode().value_or(false); bool initial_state = this->get_initial_state_with_restore_mode().value_or(false);

View File

@ -24,7 +24,7 @@ enum PCA6416AGPIORegisters {
static const char *const TAG = "pca6416a"; static const char *const TAG = "pca6416a";
void PCA6416AComponent::setup() { void PCA6416AComponent::setup() {
ESP_LOGCONFIG(TAG, "Setting up PCA6416A..."); ESP_LOGCONFIG(TAG, "Running setup");
// Test to see if device exists // Test to see if device exists
uint8_t value; uint8_t value;
if (!this->read_register_(PCA6416A_INPUT0, &value)) { if (!this->read_register_(PCA6416A_INPUT0, &value)) {

View File

@ -13,7 +13,7 @@ const uint8_t CONFIG_REG = 3;
static const char *const TAG = "pca9554"; static const char *const TAG = "pca9554";
void PCA9554Component::setup() { void PCA9554Component::setup() {
ESP_LOGCONFIG(TAG, "Setting up PCA9554/PCA9554A..."); ESP_LOGCONFIG(TAG, "Running setup");
this->reg_width_ = (this->pin_count_ + 7) / 8; this->reg_width_ = (this->pin_count_ + 7) / 8;
// Test to see if device exists // Test to see if device exists
if (!this->read_inputs_()) { if (!this->read_inputs_()) {

View File

@ -26,7 +26,7 @@ static const uint8_t PCA9685_MODE1_AUTOINC = 0b00100000;
static const uint8_t PCA9685_MODE1_SLEEP = 0b00010000; static const uint8_t PCA9685_MODE1_SLEEP = 0b00010000;
void PCA9685Output::setup() { void PCA9685Output::setup() {
ESP_LOGCONFIG(TAG, "Setting up PCA9685OutputComponent..."); ESP_LOGCONFIG(TAG, "Running setup");
ESP_LOGV(TAG, " Resetting devices..."); ESP_LOGV(TAG, " Resetting devices...");
if (!this->write_bytes(PCA9685_REGISTER_SOFTWARE_RESET, nullptr, 0)) { if (!this->write_bytes(PCA9685_REGISTER_SOFTWARE_RESET, nullptr, 0)) {

View File

@ -10,7 +10,7 @@ namespace pcf85063 {
static const char *const TAG = "pcf85063"; static const char *const TAG = "pcf85063";
void PCF85063Component::setup() { void PCF85063Component::setup() {
ESP_LOGCONFIG(TAG, "Setting up PCF85063..."); ESP_LOGCONFIG(TAG, "Running setup");
if (!this->read_rtc_()) { if (!this->read_rtc_()) {
this->mark_failed(); this->mark_failed();
} }

View File

@ -10,7 +10,7 @@ namespace pcf8563 {
static const char *const TAG = "PCF8563"; static const char *const TAG = "PCF8563";
void PCF8563Component::setup() { void PCF8563Component::setup() {
ESP_LOGCONFIG(TAG, "Setting up PCF8563..."); ESP_LOGCONFIG(TAG, "Running setup");
if (!this->read_rtc_()) { if (!this->read_rtc_()) {
this->mark_failed(); this->mark_failed();
} }

View File

@ -7,7 +7,7 @@ namespace pcf8574 {
static const char *const TAG = "pcf8574"; static const char *const TAG = "pcf8574";
void PCF8574Component::setup() { void PCF8574Component::setup() {
ESP_LOGCONFIG(TAG, "Setting up PCF8574..."); ESP_LOGCONFIG(TAG, "Running setup");
if (!this->read_gpio_()) { if (!this->read_gpio_()) {
ESP_LOGE(TAG, "PCF8574 not available under 0x%02X", this->address_); ESP_LOGE(TAG, "PCF8574 not available under 0x%02X", this->address_);
this->mark_failed(); this->mark_failed();

View File

@ -39,17 +39,14 @@ static const LogString *pm2005_get_measuring_mode_string(int status) {
static inline uint16_t get_sensor_value(const uint8_t *data, uint8_t i) { return data[i] * 0x100 + data[i + 1]; } static inline uint16_t get_sensor_value(const uint8_t *data, uint8_t i) { return data[i] * 0x100 + data[i + 1]; }
void PM2005Component::setup() { void PM2005Component::setup() {
ESP_LOGCONFIG(TAG, "Running setup");
if (this->sensor_type_ == PM2005) { if (this->sensor_type_ == PM2005) {
ESP_LOGCONFIG(TAG, "Setting up PM2005...");
this->situation_value_index_ = 3; this->situation_value_index_ = 3;
this->pm_1_0_value_index_ = 4; this->pm_1_0_value_index_ = 4;
this->pm_2_5_value_index_ = 6; this->pm_2_5_value_index_ = 6;
this->pm_10_0_value_index_ = 8; this->pm_10_0_value_index_ = 8;
this->measuring_value_index_ = 10; this->measuring_value_index_ = 10;
} else { } else {
ESP_LOGCONFIG(TAG, "Setting up PM2105...");
this->situation_value_index_ = 2; this->situation_value_index_ = 2;
this->pm_1_0_value_index_ = 3; this->pm_1_0_value_index_ = 3;
this->pm_2_5_value_index_ = 5; this->pm_2_5_value_index_ = 5;
@ -58,7 +55,7 @@ void PM2005Component::setup() {
} }
if (this->read(this->data_buffer_, 12) != i2c::ERROR_OK) { if (this->read(this->data_buffer_, 12) != i2c::ERROR_OK) {
ESP_LOGE(TAG, "Communication failed!"); ESP_LOGE(TAG, "Communication failed");
this->mark_failed(); this->mark_failed();
return; return;
} }
@ -66,7 +63,7 @@ void PM2005Component::setup() {
void PM2005Component::update() { void PM2005Component::update() {
if (this->read(this->data_buffer_, 12) != i2c::ERROR_OK) { if (this->read(this->data_buffer_, 12) != i2c::ERROR_OK) {
ESP_LOGW(TAG, "Read result failed."); ESP_LOGW(TAG, "Read result failed");
this->status_set_warning(); this->status_set_warning();
return; return;
} }
@ -111,7 +108,7 @@ void PM2005Component::dump_config() {
LOG_I2C_DEVICE(this); LOG_I2C_DEVICE(this);
if (this->is_failed()) { if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with PM2%u05 failed!", this->sensor_type_ == PM2105); ESP_LOGE(TAG, "Communication with PM2%u05 failed", this->sensor_type_ == PM2105);
} }
LOG_SENSOR(" ", "PM1.0", this->pm_1_0_sensor_); LOG_SENSOR(" ", "PM1.0", this->pm_1_0_sensor_);

View File

@ -19,7 +19,7 @@ static const uint8_t START_CHARACTER_2 = 0x4D;
static const uint8_t READ_DATA_RETRY_COUNT = 3; static const uint8_t READ_DATA_RETRY_COUNT = 3;
void PMSA003IComponent::setup() { void PMSA003IComponent::setup() {
ESP_LOGCONFIG(TAG, "Setting up pmsa003i..."); ESP_LOGCONFIG(TAG, "Running setup");
PM25AQIData data; PM25AQIData data;
bool successful_read = this->read_data_(&data); bool successful_read = this->read_data_(&data);

View File

@ -51,7 +51,7 @@ void PMWCS3Component::water_calibration() {
ESP_LOGW(TAG, "Start water calibration during the next 300s"); ESP_LOGW(TAG, "Start water calibration during the next 300s");
} }
void PMWCS3Component::setup() { ESP_LOGCONFIG(TAG, "Setting up PMWCS3..."); } void PMWCS3Component::setup() { ESP_LOGCONFIG(TAG, "Running setup"); }
void PMWCS3Component::update() { this->read_data_(); } void PMWCS3Component::update() { this->read_data_(); }

View File

@ -15,7 +15,7 @@ namespace pn532 {
static const char *const TAG = "pn532"; static const char *const TAG = "pn532";
void PN532::setup() { void PN532::setup() {
ESP_LOGCONFIG(TAG, "Setting up PN532..."); ESP_LOGCONFIG(TAG, "Running setup");
// Get version data // Get version data
if (!this->write_command_({PN532_COMMAND_VERSION_DATA})) { if (!this->write_command_({PN532_COMMAND_VERSION_DATA})) {

View File

@ -7,7 +7,7 @@ namespace power_supply {
static const char *const TAG = "power_supply"; static const char *const TAG = "power_supply";
void PowerSupply::setup() { void PowerSupply::setup() {
ESP_LOGCONFIG(TAG, "Setting up Power Supply..."); ESP_LOGCONFIG(TAG, "Running setup");
this->pin_->setup(); this->pin_->setup();
this->pin_->digital_write(false); this->pin_->digital_write(false);

View File

@ -156,7 +156,7 @@ pulse_counter_t HwPulseCounterStorage::read_raw_value() {
#endif // HAS_PCNT #endif // HAS_PCNT
void PulseCounterSensor::setup() { void PulseCounterSensor::setup() {
ESP_LOGCONFIG(TAG, "Setting up pulse counter '%s'...", this->name_.c_str()); ESP_LOGCONFIG(TAG, "Running setup for '%s'", this->name_.c_str());
if (!this->storage_.pulse_counter_setup(this->pin_)) { if (!this->storage_.pulse_counter_setup(this->pin_)) {
this->mark_failed(); this->mark_failed();
return; return;

View File

@ -26,7 +26,7 @@ void PylontechComponent::dump_config() {
} }
void PylontechComponent::setup() { void PylontechComponent::setup() {
ESP_LOGCONFIG(TAG, "Setting up pylontech..."); ESP_LOGCONFIG(TAG, "Running setup");
while (this->available() != 0) { while (this->available() != 0) {
this->read(); this->read();
} }

View File

@ -24,7 +24,7 @@ static const uint8_t QMC5883L_REGISTER_CONTROL_2 = 0x0A;
static const uint8_t QMC5883L_REGISTER_PERIOD = 0x0B; static const uint8_t QMC5883L_REGISTER_PERIOD = 0x0B;
void QMC5883LComponent::setup() { void QMC5883LComponent::setup() {
ESP_LOGCONFIG(TAG, "Setting up QMC5883L..."); ESP_LOGCONFIG(TAG, "Running setup");
// Soft Reset // Soft Reset
if (!this->write_byte(QMC5883L_REGISTER_CONTROL_2, 1 << 7)) { if (!this->write_byte(QMC5883L_REGISTER_CONTROL_2, 1 << 7)) {
this->error_code_ = COMMUNICATION_FAILED; this->error_code_ = COMMUNICATION_FAILED;

View File

@ -348,7 +348,7 @@ void QMP6988Component::calculate_pressure_() {
} }
void QMP6988Component::setup() { void QMP6988Component::setup() {
ESP_LOGCONFIG(TAG, "Setting up QMP6988"); ESP_LOGCONFIG(TAG, "Running setup");
bool ret; bool ret;
ret = this->device_check_(); ret = this->device_check_();

View File

@ -6,7 +6,7 @@ namespace esphome {
namespace qspi_dbi { namespace qspi_dbi {
void QspiDbi::setup() { void QspiDbi::setup() {
ESP_LOGCONFIG(TAG, "Setting up QSPI_DBI"); ESP_LOGCONFIG(TAG, "Running setup");
this->spi_setup(); this->spi_setup();
if (this->enable_pin_ != nullptr) { if (this->enable_pin_ != nullptr) {
this->enable_pin_->setup(); this->enable_pin_->setup();

View File

@ -7,7 +7,7 @@ namespace qwiic_pir {
static const char *const TAG = "qwiic_pir"; static const char *const TAG = "qwiic_pir";
void QwiicPIRComponent::setup() { void QwiicPIRComponent::setup() {
ESP_LOGCONFIG(TAG, "Setting up Qwiic PIR..."); ESP_LOGCONFIG(TAG, "Running setup");
// Verify I2C communcation by reading and verifying the chip ID // Verify I2C communcation by reading and verifying the chip ID
uint8_t chip_id; uint8_t chip_id;

View File

@ -40,7 +40,7 @@ static bool IRAM_ATTR HOT rmt_callback(rmt_channel_handle_t channel, const rmt_r
#endif #endif
void RemoteReceiverComponent::setup() { void RemoteReceiverComponent::setup() {
ESP_LOGCONFIG(TAG, "Setting up Remote Receiver..."); ESP_LOGCONFIG(TAG, "Running setup");
#if ESP_IDF_VERSION_MAJOR >= 5 #if ESP_IDF_VERSION_MAJOR >= 5
rmt_rx_channel_config_t channel; rmt_rx_channel_config_t channel;
memset(&channel, 0, sizeof(channel)); memset(&channel, 0, sizeof(channel));

View File

@ -31,7 +31,7 @@ void IRAM_ATTR HOT RemoteReceiverComponentStore::gpio_intr(RemoteReceiverCompone
} }
void RemoteReceiverComponent::setup() { void RemoteReceiverComponent::setup() {
ESP_LOGCONFIG(TAG, "Setting up Remote Receiver..."); ESP_LOGCONFIG(TAG, "Running setup");
this->pin_->setup(); this->pin_->setup();
auto &s = this->store_; auto &s = this->store_;
s.filter_us = this->filter_us_; s.filter_us = this->filter_us_;

View File

@ -31,7 +31,7 @@ void IRAM_ATTR HOT RemoteReceiverComponentStore::gpio_intr(RemoteReceiverCompone
} }
void RemoteReceiverComponent::setup() { void RemoteReceiverComponent::setup() {
ESP_LOGCONFIG(TAG, "Setting up Remote Receiver..."); ESP_LOGCONFIG(TAG, "Running setup");
this->pin_->setup(); this->pin_->setup();
auto &s = this->store_; auto &s = this->store_;
s.filter_us = this->filter_us_; s.filter_us = this->filter_us_;

View File

@ -11,7 +11,7 @@ namespace remote_transmitter {
static const char *const TAG = "remote_transmitter"; static const char *const TAG = "remote_transmitter";
void RemoteTransmitterComponent::setup() { void RemoteTransmitterComponent::setup() {
ESP_LOGCONFIG(TAG, "Setting up Remote Transmitter..."); ESP_LOGCONFIG(TAG, "Running setup");
this->inverted_ = this->pin_->is_inverted(); this->inverted_ = this->pin_->is_inverted();
this->configure_rmt_(); this->configure_rmt_();
} }

View File

@ -129,7 +129,7 @@ void IRAM_ATTR HOT RotaryEncoderSensorStore::gpio_intr(RotaryEncoderSensorStore
} }
void RotaryEncoderSensor::setup() { void RotaryEncoderSensor::setup() {
ESP_LOGCONFIG(TAG, "Setting up Rotary Encoder '%s'...", this->name_.c_str()); ESP_LOGCONFIG(TAG, "Running setup for '%s'", this->name_.c_str());
int32_t initial_value = 0; int32_t initial_value = 0;
switch (this->restore_mode_) { switch (this->restore_mode_) {

View File

@ -40,7 +40,7 @@ void RP2040PIOLEDStripLightOutput::dma_write_complete_handler_() {
} }
void RP2040PIOLEDStripLightOutput::setup() { void RP2040PIOLEDStripLightOutput::setup() {
ESP_LOGCONFIG(TAG, "Setting up RP2040 LED Strip..."); ESP_LOGCONFIG(TAG, "Running setup");
size_t buffer_size = this->get_buffer_size_(); size_t buffer_size = this->get_buffer_size_();

View File

@ -17,7 +17,7 @@ namespace rp2040_pwm {
static const char *const TAG = "rp2040_pwm"; static const char *const TAG = "rp2040_pwm";
void RP2040PWM::setup() { void RP2040PWM::setup() {
ESP_LOGCONFIG(TAG, "Setting up RP2040 PWM Output..."); ESP_LOGCONFIG(TAG, "Running setup");
this->setup_pwm_(); this->setup_pwm_();
} }

View File

@ -6,7 +6,7 @@ namespace esphome {
namespace rpi_dpi_rgb { namespace rpi_dpi_rgb {
void RpiDpiRgb::setup() { void RpiDpiRgb::setup() {
ESP_LOGCONFIG(TAG, "Setting up RPI_DPI_RGB"); ESP_LOGCONFIG(TAG, "Running setup");
this->reset_display_(); this->reset_display_();
esp_lcd_rgb_panel_config_t config{}; esp_lcd_rgb_panel_config_t config{};
config.flags.fb_in_psram = 1; config.flags.fb_in_psram = 1;