mirror of
https://github.com/esphome/esphome.git
synced 2025-07-28 14:16:40 +00:00
Streamline setup() logging (n, o, p, q, r) (#8929)
This commit is contained in:
parent
d9a9e0aea3
commit
d99e3237f9
@ -52,8 +52,8 @@ static const uint8_t POWER_PGA_CAP_EN = 0x80;
|
||||
static const uint8_t DEVICE_REV = 0x1F;
|
||||
|
||||
void NAU7802Sensor::setup() {
|
||||
ESP_LOGCONFIG(TAG, "Running setup for '%s'", this->name_.c_str());
|
||||
i2c::I2CRegister pu_ctrl = this->reg(PU_CTRL_REG);
|
||||
ESP_LOGCONFIG(TAG, "Setting up NAU7802 '%s'...", this->name_.c_str());
|
||||
uint8_t rev;
|
||||
|
||||
if (this->read_register(DEVICE_REV | READ_BIT, &rev, 1)) {
|
||||
|
@ -11,7 +11,7 @@ static const char *const TAG = "npi19";
|
||||
static const uint8_t READ_COMMAND = 0xAC;
|
||||
|
||||
void NPI19Component::setup() {
|
||||
ESP_LOGCONFIG(TAG, "Setting up NPI19...");
|
||||
ESP_LOGCONFIG(TAG, "Running setup");
|
||||
|
||||
uint16_t raw_temperature(0);
|
||||
uint16_t raw_pressure(0);
|
||||
|
@ -8,7 +8,7 @@ static const char *const TAG = "output.switch";
|
||||
|
||||
void OutputSwitch::dump_config() { LOG_SWITCH("", "Output Switch", this); }
|
||||
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);
|
||||
|
||||
|
@ -24,7 +24,7 @@ enum PCA6416AGPIORegisters {
|
||||
static const char *const TAG = "pca6416a";
|
||||
|
||||
void PCA6416AComponent::setup() {
|
||||
ESP_LOGCONFIG(TAG, "Setting up PCA6416A...");
|
||||
ESP_LOGCONFIG(TAG, "Running setup");
|
||||
// Test to see if device exists
|
||||
uint8_t value;
|
||||
if (!this->read_register_(PCA6416A_INPUT0, &value)) {
|
||||
|
@ -13,7 +13,7 @@ const uint8_t CONFIG_REG = 3;
|
||||
static const char *const TAG = "pca9554";
|
||||
|
||||
void PCA9554Component::setup() {
|
||||
ESP_LOGCONFIG(TAG, "Setting up PCA9554/PCA9554A...");
|
||||
ESP_LOGCONFIG(TAG, "Running setup");
|
||||
this->reg_width_ = (this->pin_count_ + 7) / 8;
|
||||
// Test to see if device exists
|
||||
if (!this->read_inputs_()) {
|
||||
|
@ -26,7 +26,7 @@ static const uint8_t PCA9685_MODE1_AUTOINC = 0b00100000;
|
||||
static const uint8_t PCA9685_MODE1_SLEEP = 0b00010000;
|
||||
|
||||
void PCA9685Output::setup() {
|
||||
ESP_LOGCONFIG(TAG, "Setting up PCA9685OutputComponent...");
|
||||
ESP_LOGCONFIG(TAG, "Running setup");
|
||||
|
||||
ESP_LOGV(TAG, " Resetting devices...");
|
||||
if (!this->write_bytes(PCA9685_REGISTER_SOFTWARE_RESET, nullptr, 0)) {
|
||||
|
@ -10,7 +10,7 @@ namespace pcf85063 {
|
||||
static const char *const TAG = "pcf85063";
|
||||
|
||||
void PCF85063Component::setup() {
|
||||
ESP_LOGCONFIG(TAG, "Setting up PCF85063...");
|
||||
ESP_LOGCONFIG(TAG, "Running setup");
|
||||
if (!this->read_rtc_()) {
|
||||
this->mark_failed();
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ namespace pcf8563 {
|
||||
static const char *const TAG = "PCF8563";
|
||||
|
||||
void PCF8563Component::setup() {
|
||||
ESP_LOGCONFIG(TAG, "Setting up PCF8563...");
|
||||
ESP_LOGCONFIG(TAG, "Running setup");
|
||||
if (!this->read_rtc_()) {
|
||||
this->mark_failed();
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ namespace pcf8574 {
|
||||
static const char *const TAG = "pcf8574";
|
||||
|
||||
void PCF8574Component::setup() {
|
||||
ESP_LOGCONFIG(TAG, "Setting up PCF8574...");
|
||||
ESP_LOGCONFIG(TAG, "Running setup");
|
||||
if (!this->read_gpio_()) {
|
||||
ESP_LOGE(TAG, "PCF8574 not available under 0x%02X", this->address_);
|
||||
this->mark_failed();
|
||||
|
@ -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]; }
|
||||
|
||||
void PM2005Component::setup() {
|
||||
ESP_LOGCONFIG(TAG, "Running setup");
|
||||
if (this->sensor_type_ == PM2005) {
|
||||
ESP_LOGCONFIG(TAG, "Setting up PM2005...");
|
||||
|
||||
this->situation_value_index_ = 3;
|
||||
this->pm_1_0_value_index_ = 4;
|
||||
this->pm_2_5_value_index_ = 6;
|
||||
this->pm_10_0_value_index_ = 8;
|
||||
this->measuring_value_index_ = 10;
|
||||
} else {
|
||||
ESP_LOGCONFIG(TAG, "Setting up PM2105...");
|
||||
|
||||
this->situation_value_index_ = 2;
|
||||
this->pm_1_0_value_index_ = 3;
|
||||
this->pm_2_5_value_index_ = 5;
|
||||
@ -58,7 +55,7 @@ void PM2005Component::setup() {
|
||||
}
|
||||
|
||||
if (this->read(this->data_buffer_, 12) != i2c::ERROR_OK) {
|
||||
ESP_LOGE(TAG, "Communication failed!");
|
||||
ESP_LOGE(TAG, "Communication failed");
|
||||
this->mark_failed();
|
||||
return;
|
||||
}
|
||||
@ -66,7 +63,7 @@ void PM2005Component::setup() {
|
||||
|
||||
void PM2005Component::update() {
|
||||
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();
|
||||
return;
|
||||
}
|
||||
@ -111,7 +108,7 @@ void PM2005Component::dump_config() {
|
||||
|
||||
LOG_I2C_DEVICE(this);
|
||||
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_);
|
||||
|
@ -19,7 +19,7 @@ static const uint8_t START_CHARACTER_2 = 0x4D;
|
||||
static const uint8_t READ_DATA_RETRY_COUNT = 3;
|
||||
|
||||
void PMSA003IComponent::setup() {
|
||||
ESP_LOGCONFIG(TAG, "Setting up pmsa003i...");
|
||||
ESP_LOGCONFIG(TAG, "Running setup");
|
||||
|
||||
PM25AQIData data;
|
||||
bool successful_read = this->read_data_(&data);
|
||||
|
@ -51,7 +51,7 @@ void PMWCS3Component::water_calibration() {
|
||||
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_(); }
|
||||
|
||||
|
@ -15,7 +15,7 @@ namespace pn532 {
|
||||
static const char *const TAG = "pn532";
|
||||
|
||||
void PN532::setup() {
|
||||
ESP_LOGCONFIG(TAG, "Setting up PN532...");
|
||||
ESP_LOGCONFIG(TAG, "Running setup");
|
||||
|
||||
// Get version data
|
||||
if (!this->write_command_({PN532_COMMAND_VERSION_DATA})) {
|
||||
|
@ -7,7 +7,7 @@ namespace power_supply {
|
||||
static const char *const TAG = "power_supply";
|
||||
|
||||
void PowerSupply::setup() {
|
||||
ESP_LOGCONFIG(TAG, "Setting up Power Supply...");
|
||||
ESP_LOGCONFIG(TAG, "Running setup");
|
||||
|
||||
this->pin_->setup();
|
||||
this->pin_->digital_write(false);
|
||||
|
@ -156,7 +156,7 @@ pulse_counter_t HwPulseCounterStorage::read_raw_value() {
|
||||
#endif // HAS_PCNT
|
||||
|
||||
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_)) {
|
||||
this->mark_failed();
|
||||
return;
|
||||
|
@ -26,7 +26,7 @@ void PylontechComponent::dump_config() {
|
||||
}
|
||||
|
||||
void PylontechComponent::setup() {
|
||||
ESP_LOGCONFIG(TAG, "Setting up pylontech...");
|
||||
ESP_LOGCONFIG(TAG, "Running setup");
|
||||
while (this->available() != 0) {
|
||||
this->read();
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ static const uint8_t QMC5883L_REGISTER_CONTROL_2 = 0x0A;
|
||||
static const uint8_t QMC5883L_REGISTER_PERIOD = 0x0B;
|
||||
|
||||
void QMC5883LComponent::setup() {
|
||||
ESP_LOGCONFIG(TAG, "Setting up QMC5883L...");
|
||||
ESP_LOGCONFIG(TAG, "Running setup");
|
||||
// Soft Reset
|
||||
if (!this->write_byte(QMC5883L_REGISTER_CONTROL_2, 1 << 7)) {
|
||||
this->error_code_ = COMMUNICATION_FAILED;
|
||||
|
@ -348,7 +348,7 @@ void QMP6988Component::calculate_pressure_() {
|
||||
}
|
||||
|
||||
void QMP6988Component::setup() {
|
||||
ESP_LOGCONFIG(TAG, "Setting up QMP6988");
|
||||
ESP_LOGCONFIG(TAG, "Running setup");
|
||||
|
||||
bool ret;
|
||||
ret = this->device_check_();
|
||||
|
@ -6,7 +6,7 @@ namespace esphome {
|
||||
namespace qspi_dbi {
|
||||
|
||||
void QspiDbi::setup() {
|
||||
ESP_LOGCONFIG(TAG, "Setting up QSPI_DBI");
|
||||
ESP_LOGCONFIG(TAG, "Running setup");
|
||||
this->spi_setup();
|
||||
if (this->enable_pin_ != nullptr) {
|
||||
this->enable_pin_->setup();
|
||||
|
@ -7,7 +7,7 @@ namespace qwiic_pir {
|
||||
static const char *const TAG = "qwiic_pir";
|
||||
|
||||
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
|
||||
uint8_t chip_id;
|
||||
|
@ -40,7 +40,7 @@ static bool IRAM_ATTR HOT rmt_callback(rmt_channel_handle_t channel, const rmt_r
|
||||
#endif
|
||||
|
||||
void RemoteReceiverComponent::setup() {
|
||||
ESP_LOGCONFIG(TAG, "Setting up Remote Receiver...");
|
||||
ESP_LOGCONFIG(TAG, "Running setup");
|
||||
#if ESP_IDF_VERSION_MAJOR >= 5
|
||||
rmt_rx_channel_config_t channel;
|
||||
memset(&channel, 0, sizeof(channel));
|
||||
|
@ -31,7 +31,7 @@ void IRAM_ATTR HOT RemoteReceiverComponentStore::gpio_intr(RemoteReceiverCompone
|
||||
}
|
||||
|
||||
void RemoteReceiverComponent::setup() {
|
||||
ESP_LOGCONFIG(TAG, "Setting up Remote Receiver...");
|
||||
ESP_LOGCONFIG(TAG, "Running setup");
|
||||
this->pin_->setup();
|
||||
auto &s = this->store_;
|
||||
s.filter_us = this->filter_us_;
|
||||
|
@ -31,7 +31,7 @@ void IRAM_ATTR HOT RemoteReceiverComponentStore::gpio_intr(RemoteReceiverCompone
|
||||
}
|
||||
|
||||
void RemoteReceiverComponent::setup() {
|
||||
ESP_LOGCONFIG(TAG, "Setting up Remote Receiver...");
|
||||
ESP_LOGCONFIG(TAG, "Running setup");
|
||||
this->pin_->setup();
|
||||
auto &s = this->store_;
|
||||
s.filter_us = this->filter_us_;
|
||||
|
@ -11,7 +11,7 @@ namespace remote_transmitter {
|
||||
static const char *const TAG = "remote_transmitter";
|
||||
|
||||
void RemoteTransmitterComponent::setup() {
|
||||
ESP_LOGCONFIG(TAG, "Setting up Remote Transmitter...");
|
||||
ESP_LOGCONFIG(TAG, "Running setup");
|
||||
this->inverted_ = this->pin_->is_inverted();
|
||||
this->configure_rmt_();
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ void IRAM_ATTR HOT RotaryEncoderSensorStore::gpio_intr(RotaryEncoderSensorStore
|
||||
}
|
||||
|
||||
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;
|
||||
switch (this->restore_mode_) {
|
||||
|
@ -40,7 +40,7 @@ void RP2040PIOLEDStripLightOutput::dma_write_complete_handler_() {
|
||||
}
|
||||
|
||||
void RP2040PIOLEDStripLightOutput::setup() {
|
||||
ESP_LOGCONFIG(TAG, "Setting up RP2040 LED Strip...");
|
||||
ESP_LOGCONFIG(TAG, "Running setup");
|
||||
|
||||
size_t buffer_size = this->get_buffer_size_();
|
||||
|
||||
|
@ -17,7 +17,7 @@ namespace rp2040_pwm {
|
||||
static const char *const TAG = "rp2040_pwm";
|
||||
|
||||
void RP2040PWM::setup() {
|
||||
ESP_LOGCONFIG(TAG, "Setting up RP2040 PWM Output...");
|
||||
ESP_LOGCONFIG(TAG, "Running setup");
|
||||
|
||||
this->setup_pwm_();
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ namespace esphome {
|
||||
namespace rpi_dpi_rgb {
|
||||
|
||||
void RpiDpiRgb::setup() {
|
||||
ESP_LOGCONFIG(TAG, "Setting up RPI_DPI_RGB");
|
||||
ESP_LOGCONFIG(TAG, "Running setup");
|
||||
this->reset_display_();
|
||||
esp_lcd_rgb_panel_config_t config{};
|
||||
config.flags.fb_in_psram = 1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user