mirror of
https://github.com/esphome/esphome.git
synced 2025-07-28 14:16:40 +00:00
Streamline setup() logging (k, l, m) (#8928)
This commit is contained in:
parent
0ce03ae26b
commit
d9a9e0aea3
@ -13,7 +13,7 @@ static const uint8_t KMETER_INTERNAL_TEMP_VAL_REG = 0x10;
|
|||||||
static const uint8_t KMETER_FIRMWARE_VERSION_REG = 0xFE;
|
static const uint8_t KMETER_FIRMWARE_VERSION_REG = 0xFE;
|
||||||
|
|
||||||
void KMeterISOComponent::setup() {
|
void KMeterISOComponent::setup() {
|
||||||
ESP_LOGCONFIG(TAG, "Setting up KMeterISO...");
|
ESP_LOGCONFIG(TAG, "Running setup");
|
||||||
this->error_code_ = NONE;
|
this->error_code_ = NONE;
|
||||||
|
|
||||||
// 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
|
||||||
|
@ -7,7 +7,7 @@ namespace lcd_gpio {
|
|||||||
static const char *const TAG = "lcd_gpio";
|
static const char *const TAG = "lcd_gpio";
|
||||||
|
|
||||||
void GPIOLCDDisplay::setup() {
|
void GPIOLCDDisplay::setup() {
|
||||||
ESP_LOGCONFIG(TAG, "Setting up GPIO LCD Display...");
|
ESP_LOGCONFIG(TAG, "Running setup");
|
||||||
this->rs_pin_->setup(); // OUTPUT
|
this->rs_pin_->setup(); // OUTPUT
|
||||||
this->rs_pin_->digital_write(false);
|
this->rs_pin_->digital_write(false);
|
||||||
if (this->rw_pin_ != nullptr) {
|
if (this->rw_pin_ != nullptr) {
|
||||||
|
@ -11,7 +11,7 @@ static const uint8_t LCD_DISPLAY_BACKLIGHT_ON = 0x08;
|
|||||||
static const uint8_t LCD_DISPLAY_BACKLIGHT_OFF = 0x00;
|
static const uint8_t LCD_DISPLAY_BACKLIGHT_OFF = 0x00;
|
||||||
|
|
||||||
void PCF8574LCDDisplay::setup() {
|
void PCF8574LCDDisplay::setup() {
|
||||||
ESP_LOGCONFIG(TAG, "Setting up PCF8574 LCD Display...");
|
ESP_LOGCONFIG(TAG, "Running setup");
|
||||||
this->backlight_value_ = LCD_DISPLAY_BACKLIGHT_ON;
|
this->backlight_value_ = LCD_DISPLAY_BACKLIGHT_ON;
|
||||||
if (!this->write_bytes(this->backlight_value_, nullptr, 0)) {
|
if (!this->write_bytes(this->backlight_value_, nullptr, 0)) {
|
||||||
this->mark_failed();
|
this->mark_failed();
|
||||||
|
@ -78,11 +78,8 @@ void LD2410Component::dump_config() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void LD2410Component::setup() {
|
void LD2410Component::setup() {
|
||||||
ESP_LOGCONFIG(TAG, "Setting up LD2410...");
|
ESP_LOGCONFIG(TAG, "Running setup");
|
||||||
this->read_all_info();
|
this->read_all_info();
|
||||||
ESP_LOGCONFIG(TAG, "Mac Address : %s", const_cast<char *>(this->mac_.c_str()));
|
|
||||||
ESP_LOGCONFIG(TAG, "Firmware Version : %s", const_cast<char *>(this->version_.c_str()));
|
|
||||||
ESP_LOGCONFIG(TAG, "LD2410 setup complete.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LD2410Component::read_all_info() {
|
void LD2410Component::read_all_info() {
|
||||||
|
@ -111,7 +111,7 @@ int LD2420Component::get_firmware_int_(const char *version_string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void LD2420Component::setup() {
|
void LD2420Component::setup() {
|
||||||
ESP_LOGCONFIG(TAG, "Setting up LD2420...");
|
ESP_LOGCONFIG(TAG, "Running setup");
|
||||||
if (this->set_config_mode(true) == LD2420_ERROR_TIMEOUT) {
|
if (this->set_config_mode(true) == LD2420_ERROR_TIMEOUT) {
|
||||||
ESP_LOGE(TAG, "LD2420 module has failed to respond, check baud rate and serial connections.");
|
ESP_LOGE(TAG, "LD2420 module has failed to respond, check baud rate and serial connections.");
|
||||||
this->mark_failed();
|
this->mark_failed();
|
||||||
|
@ -109,7 +109,7 @@ static inline std::string format_version(uint8_t *buffer) {
|
|||||||
LD2450Component::LD2450Component() {}
|
LD2450Component::LD2450Component() {}
|
||||||
|
|
||||||
void LD2450Component::setup() {
|
void LD2450Component::setup() {
|
||||||
ESP_LOGCONFIG(TAG, "Setting up HLK-LD2450...");
|
ESP_LOGCONFIG(TAG, "Running setup");
|
||||||
#ifdef USE_NUMBER
|
#ifdef USE_NUMBER
|
||||||
if (this->presence_timeout_number_ != nullptr) {
|
if (this->presence_timeout_number_ != nullptr) {
|
||||||
this->pref_ = global_preferences->make_preference<float>(this->presence_timeout_number_->get_object_id_hash());
|
this->pref_ = global_preferences->make_preference<float>(this->presence_timeout_number_->get_object_id_hash());
|
||||||
|
@ -18,7 +18,7 @@ LightCall LightState::toggle() { return this->make_call().set_state(!this->remot
|
|||||||
LightCall LightState::make_call() { return LightCall(this); }
|
LightCall LightState::make_call() { return LightCall(this); }
|
||||||
|
|
||||||
void LightState::setup() {
|
void LightState::setup() {
|
||||||
ESP_LOGCONFIG(TAG, "Setting up light '%s'...", this->get_name().c_str());
|
ESP_LOGCONFIG(TAG, "Running setup for '%s'", this->get_name().c_str());
|
||||||
|
|
||||||
this->output_->setup_state(this);
|
this->output_->setup_state(this);
|
||||||
for (auto *effect : this->effects_) {
|
for (auto *effect : this->effects_) {
|
||||||
|
@ -14,7 +14,7 @@ static const bool DEFAULT_INVERT = false;
|
|||||||
static const uint32_t DEFAULT_TICK = 330;
|
static const uint32_t DEFAULT_TICK = 330;
|
||||||
|
|
||||||
void LightWaveRF::setup() {
|
void LightWaveRF::setup() {
|
||||||
ESP_LOGCONFIG(TAG, "Setting up Lightwave RF...");
|
ESP_LOGCONFIG(TAG, "Running setup");
|
||||||
|
|
||||||
this->lwtx_.lwtx_setup(pin_tx_, DEFAULT_REPEAT, DEFAULT_INVERT, DEFAULT_TICK);
|
this->lwtx_.lwtx_setup(pin_tx_, DEFAULT_REPEAT, DEFAULT_INVERT, DEFAULT_TICK);
|
||||||
this->lwrx_.lwrx_setup(pin_rx_);
|
this->lwrx_.lwrx_setup(pin_rx_);
|
||||||
|
@ -24,7 +24,7 @@ static const uint8_t READ_TOUCH[1] = {0x07};
|
|||||||
}
|
}
|
||||||
|
|
||||||
void LilygoT547Touchscreen::setup() {
|
void LilygoT547Touchscreen::setup() {
|
||||||
ESP_LOGCONFIG(TAG, "Setting up Lilygo T5 4.7 Touchscreen...");
|
ESP_LOGCONFIG(TAG, "Running setup");
|
||||||
this->interrupt_pin_->pin_mode(gpio::FLAG_INPUT | gpio::FLAG_PULLUP);
|
this->interrupt_pin_->pin_mode(gpio::FLAG_INPUT | gpio::FLAG_PULLUP);
|
||||||
this->interrupt_pin_->setup();
|
this->interrupt_pin_->setup();
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ void LTR390Component::read_mode_(int mode_index) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void LTR390Component::setup() {
|
void LTR390Component::setup() {
|
||||||
ESP_LOGCONFIG(TAG, "Setting up ltr390...");
|
ESP_LOGCONFIG(TAG, "Running setup");
|
||||||
|
|
||||||
// reset
|
// reset
|
||||||
std::bitset<8> ctrl = this->reg(LTR390_MAIN_CTRL).get();
|
std::bitset<8> ctrl = this->reg(LTR390_MAIN_CTRL).get();
|
||||||
|
@ -74,7 +74,7 @@ static float get_ps_gain_coeff(PsGain501 gain) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void LTRAlsPs501Component::setup() {
|
void LTRAlsPs501Component::setup() {
|
||||||
ESP_LOGCONFIG(TAG, "Setting up LTR-501/301/558");
|
ESP_LOGCONFIG(TAG, "Running setup");
|
||||||
// As per datasheet we need to wait at least 100ms after power on to get ALS chip responsive
|
// As per datasheet we need to wait at least 100ms after power on to get ALS chip responsive
|
||||||
this->set_timeout(100, [this]() { this->state_ = State::DELAYED_SETUP; });
|
this->set_timeout(100, [this]() { this->state_ = State::DELAYED_SETUP; });
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ static float get_ps_gain_coeff(PsGain gain) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void LTRAlsPsComponent::setup() {
|
void LTRAlsPsComponent::setup() {
|
||||||
ESP_LOGCONFIG(TAG, "Setting up LTR-303/329/55x/659");
|
ESP_LOGCONFIG(TAG, "Running setup");
|
||||||
// As per datasheet we need to wait at least 100ms after power on to get ALS chip responsive
|
// As per datasheet we need to wait at least 100ms after power on to get ALS chip responsive
|
||||||
this->set_timeout(100, [this]() { this->state_ = State::DELAYED_SETUP; });
|
this->set_timeout(100, [this]() { this->state_ = State::DELAYED_SETUP; });
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ namespace m5stack_8angle {
|
|||||||
static const char *const TAG = "m5stack_8angle";
|
static const char *const TAG = "m5stack_8angle";
|
||||||
|
|
||||||
void M5Stack8AngleComponent::setup() {
|
void M5Stack8AngleComponent::setup() {
|
||||||
ESP_LOGCONFIG(TAG, "Setting up M5STACK_8ANGLE...");
|
ESP_LOGCONFIG(TAG, "Running setup");
|
||||||
i2c::ErrorCode err;
|
i2c::ErrorCode err;
|
||||||
|
|
||||||
err = this->read(nullptr, 0);
|
err = this->read(nullptr, 0);
|
||||||
|
@ -41,7 +41,7 @@ void MAX17043Component::update() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MAX17043Component::setup() {
|
void MAX17043Component::setup() {
|
||||||
ESP_LOGCONFIG(TAG, "Setting up MAX17043...");
|
ESP_LOGCONFIG(TAG, "Running setup");
|
||||||
|
|
||||||
uint16_t config_reg;
|
uint16_t config_reg;
|
||||||
if (this->write(&MAX17043_CONFIG, 1) != i2c::ERROR_OK) {
|
if (this->write(&MAX17043_CONFIG, 1) != i2c::ERROR_OK) {
|
||||||
|
@ -19,7 +19,7 @@ void MAX31855Sensor::update() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MAX31855Sensor::setup() {
|
void MAX31855Sensor::setup() {
|
||||||
ESP_LOGCONFIG(TAG, "Setting up MAX31855Sensor '%s'...", this->name_.c_str());
|
ESP_LOGCONFIG(TAG, "Running setup for '%s'", this->name_.c_str());
|
||||||
this->spi_setup();
|
this->spi_setup();
|
||||||
}
|
}
|
||||||
void MAX31855Sensor::dump_config() {
|
void MAX31855Sensor::dump_config() {
|
||||||
|
@ -11,7 +11,7 @@ static const char *const TAG = "max31856";
|
|||||||
// Based on Adafruit's library: https://github.com/adafruit/Adafruit_MAX31856
|
// Based on Adafruit's library: https://github.com/adafruit/Adafruit_MAX31856
|
||||||
|
|
||||||
void MAX31856Sensor::setup() {
|
void MAX31856Sensor::setup() {
|
||||||
ESP_LOGCONFIG(TAG, "Setting up MAX31856Sensor '%s'...", this->name_.c_str());
|
ESP_LOGCONFIG(TAG, "Running setup for '%s'", this->name_.c_str());
|
||||||
this->spi_setup();
|
this->spi_setup();
|
||||||
|
|
||||||
// assert on any fault
|
// assert on any fault
|
||||||
@ -23,8 +23,6 @@ void MAX31856Sensor::setup() {
|
|||||||
|
|
||||||
this->set_thermocouple_type_();
|
this->set_thermocouple_type_();
|
||||||
this->set_noise_filter_();
|
this->set_noise_filter_();
|
||||||
|
|
||||||
ESP_LOGCONFIG(TAG, "Completed setting up MAX31856Sensor '%s'...", this->name_.c_str());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MAX31856Sensor::dump_config() {
|
void MAX31856Sensor::dump_config() {
|
||||||
|
@ -65,7 +65,7 @@ void MAX31865Sensor::update() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MAX31865Sensor::setup() {
|
void MAX31865Sensor::setup() {
|
||||||
ESP_LOGCONFIG(TAG, "Setting up MAX31865Sensor '%s'...", this->name_.c_str());
|
ESP_LOGCONFIG(TAG, "Running setup for '%s'", this->name_.c_str());
|
||||||
this->spi_setup();
|
this->spi_setup();
|
||||||
|
|
||||||
// Build base configuration
|
// Build base configuration
|
||||||
|
@ -21,7 +21,7 @@ static const uint8_t MAX44009_ERROR_HIGH_BYTE = -30;
|
|||||||
static const uint8_t MAX44009_ERROR_LOW_BYTE = -31;
|
static const uint8_t MAX44009_ERROR_LOW_BYTE = -31;
|
||||||
|
|
||||||
void MAX44009Sensor::setup() {
|
void MAX44009Sensor::setup() {
|
||||||
ESP_LOGCONFIG(TAG, "Setting up MAX44009...");
|
ESP_LOGCONFIG(TAG, "Running setup");
|
||||||
bool state_ok = false;
|
bool state_ok = false;
|
||||||
if (this->mode_ == MAX44009Mode::MAX44009_MODE_LOW_POWER) {
|
if (this->mode_ == MAX44009Mode::MAX44009_MODE_LOW_POWER) {
|
||||||
state_ok = this->set_low_power_mode();
|
state_ok = this->set_low_power_mode();
|
||||||
|
@ -18,7 +18,7 @@ void MAX6675Sensor::update() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MAX6675Sensor::setup() {
|
void MAX6675Sensor::setup() {
|
||||||
ESP_LOGCONFIG(TAG, "Setting up MAX6675Sensor '%s'...", this->name_.c_str());
|
ESP_LOGCONFIG(TAG, "Running setup for '%s'", this->name_.c_str());
|
||||||
this->spi_setup();
|
this->spi_setup();
|
||||||
}
|
}
|
||||||
void MAX6675Sensor::dump_config() {
|
void MAX6675Sensor::dump_config() {
|
||||||
|
@ -20,7 +20,7 @@ const uint8_t MASK_CURRENT_PIN = 0x0F;
|
|||||||
* MAX6956 *
|
* MAX6956 *
|
||||||
**************************************/
|
**************************************/
|
||||||
void MAX6956::setup() {
|
void MAX6956::setup() {
|
||||||
ESP_LOGCONFIG(TAG, "Setting up MAX6956...");
|
ESP_LOGCONFIG(TAG, "Running setup");
|
||||||
uint8_t configuration;
|
uint8_t configuration;
|
||||||
if (!this->read_reg_(MAX6956_CONFIGURATION, &configuration)) {
|
if (!this->read_reg_(MAX6956_CONFIGURATION, &configuration)) {
|
||||||
this->mark_failed();
|
this->mark_failed();
|
||||||
|
@ -116,7 +116,7 @@ const uint8_t MAX7219_ASCII_TO_RAW[95] PROGMEM = {
|
|||||||
|
|
||||||
float MAX7219Component::get_setup_priority() const { return setup_priority::PROCESSOR; }
|
float MAX7219Component::get_setup_priority() const { return setup_priority::PROCESSOR; }
|
||||||
void MAX7219Component::setup() {
|
void MAX7219Component::setup() {
|
||||||
ESP_LOGCONFIG(TAG, "Setting up MAX7219...");
|
ESP_LOGCONFIG(TAG, "Running setup");
|
||||||
this->spi_setup();
|
this->spi_setup();
|
||||||
this->buffer_ = new uint8_t[this->num_chips_ * 8]; // NOLINT
|
this->buffer_ = new uint8_t[this->num_chips_ * 8]; // NOLINT
|
||||||
for (uint8_t i = 0; i < this->num_chips_ * 8; i++)
|
for (uint8_t i = 0; i < this->num_chips_ * 8; i++)
|
||||||
|
@ -26,7 +26,7 @@ constexpr uint8_t MAX7219_DISPLAY_TEST = 0x01;
|
|||||||
float MAX7219Component::get_setup_priority() const { return setup_priority::PROCESSOR; }
|
float MAX7219Component::get_setup_priority() const { return setup_priority::PROCESSOR; }
|
||||||
|
|
||||||
void MAX7219Component::setup() {
|
void MAX7219Component::setup() {
|
||||||
ESP_LOGCONFIG(TAG, "Setting up MAX7219_DIGITS...");
|
ESP_LOGCONFIG(TAG, "Running setup");
|
||||||
this->spi_setup();
|
this->spi_setup();
|
||||||
this->stepsleft_ = 0;
|
this->stepsleft_ = 0;
|
||||||
for (int chip_line = 0; chip_line < this->num_chip_lines_; chip_line++) {
|
for (int chip_line = 0; chip_line < this->num_chip_lines_; chip_line++) {
|
||||||
|
@ -29,8 +29,9 @@ static const uint8_t SETUP_DELAY = 4; // Wait 2 integration periods.
|
|||||||
static const float VOUT_LSB = 14.0 / 1000.0; // 14mV/LSB
|
static const float VOUT_LSB = 14.0 / 1000.0; // 14mV/LSB
|
||||||
static const float TEMP_LSB = 0.48; // 0.48C/LSB
|
static const float TEMP_LSB = 0.48; // 0.48C/LSB
|
||||||
static const float MICRO_VOLTS_PER_VOLT = 1000000.0;
|
static const float MICRO_VOLTS_PER_VOLT = 1000000.0;
|
||||||
|
|
||||||
void MAX9611Component::setup() {
|
void MAX9611Component::setup() {
|
||||||
ESP_LOGCONFIG(TAG, "Setting up max9611...");
|
ESP_LOGCONFIG(TAG, "Running setup");
|
||||||
// Perform dummy-read
|
// Perform dummy-read
|
||||||
uint8_t value;
|
uint8_t value;
|
||||||
this->read(&value, 1);
|
this->read(&value, 1);
|
||||||
|
@ -7,7 +7,7 @@ namespace mcp23008 {
|
|||||||
static const char *const TAG = "mcp23008";
|
static const char *const TAG = "mcp23008";
|
||||||
|
|
||||||
void MCP23008::setup() {
|
void MCP23008::setup() {
|
||||||
ESP_LOGCONFIG(TAG, "Setting up MCP23008...");
|
ESP_LOGCONFIG(TAG, "Running setup");
|
||||||
uint8_t iocon;
|
uint8_t iocon;
|
||||||
if (!this->read_reg(mcp23x08_base::MCP23X08_IOCON, &iocon)) {
|
if (!this->read_reg(mcp23x08_base::MCP23X08_IOCON, &iocon)) {
|
||||||
this->mark_failed();
|
this->mark_failed();
|
||||||
|
@ -8,7 +8,7 @@ namespace mcp23016 {
|
|||||||
static const char *const TAG = "mcp23016";
|
static const char *const TAG = "mcp23016";
|
||||||
|
|
||||||
void MCP23016::setup() {
|
void MCP23016::setup() {
|
||||||
ESP_LOGCONFIG(TAG, "Setting up MCP23016...");
|
ESP_LOGCONFIG(TAG, "Running setup");
|
||||||
uint8_t iocon;
|
uint8_t iocon;
|
||||||
if (!this->read_reg_(MCP23016_IOCON0, &iocon)) {
|
if (!this->read_reg_(MCP23016_IOCON0, &iocon)) {
|
||||||
this->mark_failed();
|
this->mark_failed();
|
||||||
|
@ -7,7 +7,7 @@ namespace mcp23017 {
|
|||||||
static const char *const TAG = "mcp23017";
|
static const char *const TAG = "mcp23017";
|
||||||
|
|
||||||
void MCP23017::setup() {
|
void MCP23017::setup() {
|
||||||
ESP_LOGCONFIG(TAG, "Setting up MCP23017...");
|
ESP_LOGCONFIG(TAG, "Running setup");
|
||||||
uint8_t iocon;
|
uint8_t iocon;
|
||||||
if (!this->read_reg(mcp23x17_base::MCP23X17_IOCONA, &iocon)) {
|
if (!this->read_reg(mcp23x17_base::MCP23X17_IOCONA, &iocon)) {
|
||||||
this->mark_failed();
|
this->mark_failed();
|
||||||
|
@ -13,7 +13,7 @@ void MCP23S08::set_device_address(uint8_t device_addr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MCP23S08::setup() {
|
void MCP23S08::setup() {
|
||||||
ESP_LOGCONFIG(TAG, "Setting up MCP23S08...");
|
ESP_LOGCONFIG(TAG, "Running setup");
|
||||||
this->spi_setup();
|
this->spi_setup();
|
||||||
|
|
||||||
this->enable();
|
this->enable();
|
||||||
|
@ -13,7 +13,7 @@ void MCP23S17::set_device_address(uint8_t device_addr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MCP23S17::setup() {
|
void MCP23S17::setup() {
|
||||||
ESP_LOGCONFIG(TAG, "Setting up MCP23S17...");
|
ESP_LOGCONFIG(TAG, "Running setup");
|
||||||
this->spi_setup();
|
this->spi_setup();
|
||||||
|
|
||||||
this->enable();
|
this->enable();
|
||||||
|
@ -11,7 +11,7 @@ static const char *const TAG = "mcp3008";
|
|||||||
float MCP3008::get_setup_priority() const { return setup_priority::HARDWARE; }
|
float MCP3008::get_setup_priority() const { return setup_priority::HARDWARE; }
|
||||||
|
|
||||||
void MCP3008::setup() {
|
void MCP3008::setup() {
|
||||||
ESP_LOGCONFIG(TAG, "Setting up mcp3008");
|
ESP_LOGCONFIG(TAG, "Running setup");
|
||||||
this->spi_setup();
|
this->spi_setup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ static const char *const TAG = "mcp3204";
|
|||||||
float MCP3204::get_setup_priority() const { return setup_priority::HARDWARE; }
|
float MCP3204::get_setup_priority() const { return setup_priority::HARDWARE; }
|
||||||
|
|
||||||
void MCP3204::setup() {
|
void MCP3204::setup() {
|
||||||
ESP_LOGCONFIG(TAG, "Setting up mcp3204");
|
ESP_LOGCONFIG(TAG, "Running setup");
|
||||||
this->spi_setup();
|
this->spi_setup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ static const char *const TAG = "mcp4461";
|
|||||||
constexpr uint8_t EEPROM_WRITE_TIMEOUT_MS = 10;
|
constexpr uint8_t EEPROM_WRITE_TIMEOUT_MS = 10;
|
||||||
|
|
||||||
void Mcp4461Component::setup() {
|
void Mcp4461Component::setup() {
|
||||||
ESP_LOGCONFIG(TAG, "Setting up mcp4461 using address (0x%02X)...", this->address_);
|
ESP_LOGCONFIG(TAG, "Running setup for address 0x%02X", this->address_);
|
||||||
auto err = this->write(nullptr, 0);
|
auto err = this->write(nullptr, 0);
|
||||||
if (err != i2c::ERROR_OK) {
|
if (err != i2c::ERROR_OK) {
|
||||||
this->error_code_ = MCP4461_STATUS_I2C_ERROR;
|
this->error_code_ = MCP4461_STATUS_I2C_ERROR;
|
||||||
|
@ -7,7 +7,7 @@ namespace mcp4725 {
|
|||||||
static const char *const TAG = "mcp4725";
|
static const char *const TAG = "mcp4725";
|
||||||
|
|
||||||
void MCP4725::setup() {
|
void MCP4725::setup() {
|
||||||
ESP_LOGCONFIG(TAG, "Setting up MCP4725 (0x%02X)...", this->address_);
|
ESP_LOGCONFIG(TAG, "Running setup for address 0x%02X", this->address_);
|
||||||
auto err = this->write(nullptr, 0);
|
auto err = this->write(nullptr, 0);
|
||||||
if (err != i2c::ERROR_OK) {
|
if (err != i2c::ERROR_OK) {
|
||||||
this->error_code_ = COMMUNICATION_FAILED;
|
this->error_code_ = COMMUNICATION_FAILED;
|
||||||
|
@ -9,7 +9,7 @@ namespace mcp4728 {
|
|||||||
static const char *const TAG = "mcp4728";
|
static const char *const TAG = "mcp4728";
|
||||||
|
|
||||||
void MCP4728Component::setup() {
|
void MCP4728Component::setup() {
|
||||||
ESP_LOGCONFIG(TAG, "Setting up MCP4728 (0x%02X)...", this->address_);
|
ESP_LOGCONFIG(TAG, "Running setup for address 0x%02X", this->address_);
|
||||||
auto err = this->write(nullptr, 0);
|
auto err = this->write(nullptr, 0);
|
||||||
if (err != i2c::ERROR_OK) {
|
if (err != i2c::ERROR_OK) {
|
||||||
this->mark_failed();
|
this->mark_failed();
|
||||||
|
@ -28,7 +28,7 @@ static const uint8_t MCP9600_REGISTER_ALERT4_LIMIT = 0x13;
|
|||||||
static const uint8_t MCP9600_REGISTER_DEVICE_ID = 0x20;
|
static const uint8_t MCP9600_REGISTER_DEVICE_ID = 0x20;
|
||||||
|
|
||||||
void MCP9600Component::setup() {
|
void MCP9600Component::setup() {
|
||||||
ESP_LOGCONFIG(TAG, "Setting up MCP9600...");
|
ESP_LOGCONFIG(TAG, "Running setup");
|
||||||
|
|
||||||
uint16_t dev_id = 0;
|
uint16_t dev_id = 0;
|
||||||
this->read_byte_16(MCP9600_REGISTER_DEVICE_ID, &dev_id);
|
this->read_byte_16(MCP9600_REGISTER_DEVICE_ID, &dev_id);
|
||||||
|
@ -18,7 +18,7 @@ static const uint8_t MCP9808_AMBIENT_TEMP_NEGATIVE = 0x10;
|
|||||||
static const char *const TAG = "mcp9808";
|
static const char *const TAG = "mcp9808";
|
||||||
|
|
||||||
void MCP9808Sensor::setup() {
|
void MCP9808Sensor::setup() {
|
||||||
ESP_LOGCONFIG(TAG, "Setting up %s...", this->name_.c_str());
|
ESP_LOGCONFIG(TAG, "Running setup for '%s'", this->name_.c_str());
|
||||||
|
|
||||||
uint16_t manu = 0;
|
uint16_t manu = 0;
|
||||||
if (!this->read_byte_16(MCP9808_REG_MANUF_ID, &manu) || manu != MCP9808_MANUF_ID) {
|
if (!this->read_byte_16(MCP9808_REG_MANUF_ID, &manu) || manu != MCP9808_MANUF_ID) {
|
||||||
|
@ -72,7 +72,7 @@ void MicroWakeWord::dump_config() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MicroWakeWord::setup() {
|
void MicroWakeWord::setup() {
|
||||||
ESP_LOGCONFIG(TAG, "Setting up microWakeWord...");
|
ESP_LOGCONFIG(TAG, "Running setup");
|
||||||
|
|
||||||
this->frontend_config_.window.size_ms = FEATURE_DURATION_MS;
|
this->frontend_config_.window.size_ms = FEATURE_DURATION_MS;
|
||||||
this->frontend_config_.window.step_size_ms = this->features_step_size_;
|
this->frontend_config_.window.step_size_ms = this->features_step_size_;
|
||||||
|
@ -12,7 +12,7 @@ static const uint8_t SENSOR_REGISTER = 0x04;
|
|||||||
static const uint8_t POWER_MODE_REGISTER = 0x0a;
|
static const uint8_t POWER_MODE_REGISTER = 0x0a;
|
||||||
|
|
||||||
void MICS4514Component::setup() {
|
void MICS4514Component::setup() {
|
||||||
ESP_LOGCONFIG(TAG, "Setting up MICS 4514...");
|
ESP_LOGCONFIG(TAG, "Running setup");
|
||||||
uint8_t power_mode;
|
uint8_t power_mode;
|
||||||
this->read_register(POWER_MODE_REGISTER, &power_mode, 1);
|
this->read_register(POWER_MODE_REGISTER, &power_mode, 1);
|
||||||
if (power_mode == 0x00) {
|
if (power_mode == 0x00) {
|
||||||
|
@ -5,7 +5,7 @@ namespace esphome {
|
|||||||
namespace mipi_spi {
|
namespace mipi_spi {
|
||||||
|
|
||||||
void MipiSpi::setup() {
|
void MipiSpi::setup() {
|
||||||
ESP_LOGCONFIG(TAG, "Setting up MIPI SPI");
|
ESP_LOGCONFIG(TAG, "Running setup");
|
||||||
this->spi_setup();
|
this->spi_setup();
|
||||||
if (this->dc_pin_ != nullptr) {
|
if (this->dc_pin_ != nullptr) {
|
||||||
this->dc_pin_->setup();
|
this->dc_pin_->setup();
|
||||||
|
@ -103,7 +103,7 @@ bool MLX90393Cls::apply_all_settings_() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MLX90393Cls::setup() {
|
void MLX90393Cls::setup() {
|
||||||
ESP_LOGCONFIG(TAG, "Setting up MLX90393...");
|
ESP_LOGCONFIG(TAG, "Running setup");
|
||||||
// note the two arguments A0 and A1 which are used to construct an i2c address
|
// note the two arguments A0 and A1 which are used to construct an i2c address
|
||||||
// we can hard-code these because we never actually use the constructed address
|
// we can hard-code these because we never actually use the constructed address
|
||||||
// see the transceive function above, which uses the address from I2CComponent
|
// see the transceive function above, which uses the address from I2CComponent
|
||||||
|
@ -27,7 +27,7 @@ static const uint8_t MLX90614_ID4 = 0x3F;
|
|||||||
static const char *const TAG = "mlx90614";
|
static const char *const TAG = "mlx90614";
|
||||||
|
|
||||||
void MLX90614Component::setup() {
|
void MLX90614Component::setup() {
|
||||||
ESP_LOGCONFIG(TAG, "Setting up MLX90614...");
|
ESP_LOGCONFIG(TAG, "Running setup");
|
||||||
if (!this->write_emissivity_()) {
|
if (!this->write_emissivity_()) {
|
||||||
ESP_LOGE(TAG, "Communication with MLX90614 failed!");
|
ESP_LOGE(TAG, "Communication with MLX90614 failed!");
|
||||||
this->mark_failed();
|
this->mark_failed();
|
||||||
|
@ -31,7 +31,7 @@ static const uint8_t MMC56X3_CTRL2_REG = 0x1D;
|
|||||||
static const uint8_t MMC5603_ODR_REG = 0x1A;
|
static const uint8_t MMC5603_ODR_REG = 0x1A;
|
||||||
|
|
||||||
void MMC5603Component::setup() {
|
void MMC5603Component::setup() {
|
||||||
ESP_LOGCONFIG(TAG, "Setting up MMC5603...");
|
ESP_LOGCONFIG(TAG, "Running setup");
|
||||||
uint8_t id = 0;
|
uint8_t id = 0;
|
||||||
if (!this->read_byte(MMC56X3_PRODUCT_ID, &id)) {
|
if (!this->read_byte(MMC56X3_PRODUCT_ID, &id)) {
|
||||||
this->error_code_ = COMMUNICATION_FAILED;
|
this->error_code_ = COMMUNICATION_FAILED;
|
||||||
|
@ -67,7 +67,7 @@ void MMC5983Component::update() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MMC5983Component::setup() {
|
void MMC5983Component::setup() {
|
||||||
ESP_LOGCONFIG(TAG, "Setting up MMC5983...");
|
ESP_LOGCONFIG(TAG, "Running setup");
|
||||||
|
|
||||||
// Verify product id.
|
// Verify product id.
|
||||||
const uint8_t mmc5983_product_id = 0x30;
|
const uint8_t mmc5983_product_id = 0x30;
|
||||||
|
@ -8,7 +8,7 @@ namespace mpl3115a2 {
|
|||||||
static const char *const TAG = "mpl3115a2";
|
static const char *const TAG = "mpl3115a2";
|
||||||
|
|
||||||
void MPL3115A2Component::setup() {
|
void MPL3115A2Component::setup() {
|
||||||
ESP_LOGCONFIG(TAG, "Setting up MPL3115A2...");
|
ESP_LOGCONFIG(TAG, "Running setup");
|
||||||
|
|
||||||
uint8_t whoami = 0xFF;
|
uint8_t whoami = 0xFF;
|
||||||
if (!this->read_byte(MPL3115A2_WHOAMI, &whoami, false)) {
|
if (!this->read_byte(MPL3115A2_WHOAMI, &whoami, false)) {
|
||||||
|
@ -11,7 +11,7 @@ namespace mpr121 {
|
|||||||
static const char *const TAG = "mpr121";
|
static const char *const TAG = "mpr121";
|
||||||
|
|
||||||
void MPR121Component::setup() {
|
void MPR121Component::setup() {
|
||||||
ESP_LOGCONFIG(TAG, "Setting up MPR121...");
|
ESP_LOGCONFIG(TAG, "Running setup");
|
||||||
// soft reset device
|
// soft reset device
|
||||||
this->write_byte(MPR121_SOFTRESET, 0x63);
|
this->write_byte(MPR121_SOFTRESET, 0x63);
|
||||||
delay(100); // NOLINT
|
delay(100); // NOLINT
|
||||||
|
@ -21,7 +21,7 @@ const uint8_t MPU6050_BIT_TEMPERATURE_DISABLED = 3;
|
|||||||
const float GRAVITY_EARTH = 9.80665f;
|
const float GRAVITY_EARTH = 9.80665f;
|
||||||
|
|
||||||
void MPU6050Component::setup() {
|
void MPU6050Component::setup() {
|
||||||
ESP_LOGCONFIG(TAG, "Setting up MPU6050...");
|
ESP_LOGCONFIG(TAG, "Running setup");
|
||||||
uint8_t who_am_i;
|
uint8_t who_am_i;
|
||||||
if (!this->read_byte(MPU6050_REGISTER_WHO_AM_I, &who_am_i) ||
|
if (!this->read_byte(MPU6050_REGISTER_WHO_AM_I, &who_am_i) ||
|
||||||
(who_am_i != 0x68 && who_am_i != 0x70 && who_am_i != 0x98)) {
|
(who_am_i != 0x68 && who_am_i != 0x70 && who_am_i != 0x98)) {
|
||||||
|
@ -26,7 +26,7 @@ const float TEMPERATURE_SENSITIVITY = 326.8;
|
|||||||
const float TEMPERATURE_OFFSET = 25.0;
|
const float TEMPERATURE_OFFSET = 25.0;
|
||||||
|
|
||||||
void MPU6886Component::setup() {
|
void MPU6886Component::setup() {
|
||||||
ESP_LOGCONFIG(TAG, "Setting up MPU6886...");
|
ESP_LOGCONFIG(TAG, "Running setup");
|
||||||
uint8_t who_am_i;
|
uint8_t who_am_i;
|
||||||
if (!this->read_byte(MPU6886_REGISTER_WHO_AM_I, &who_am_i) || who_am_i != MPU6886_WHO_AM_I_IDENTIFIER) {
|
if (!this->read_byte(MPU6886_REGISTER_WHO_AM_I, &who_am_i) || who_am_i != MPU6886_WHO_AM_I_IDENTIFIER) {
|
||||||
this->mark_failed();
|
this->mark_failed();
|
||||||
|
@ -34,7 +34,7 @@ MQTTClientComponent::MQTTClientComponent() {
|
|||||||
|
|
||||||
// Connection
|
// Connection
|
||||||
void MQTTClientComponent::setup() {
|
void MQTTClientComponent::setup() {
|
||||||
ESP_LOGCONFIG(TAG, "Setting up MQTT...");
|
ESP_LOGCONFIG(TAG, "Running setup");
|
||||||
this->mqtt_backend_.set_on_message(
|
this->mqtt_backend_.set_on_message(
|
||||||
[this](const char *topic, const char *payload, size_t len, size_t index, size_t total) {
|
[this](const char *topic, const char *payload, size_t len, size_t index, size_t total) {
|
||||||
if (index == 0)
|
if (index == 0)
|
||||||
|
@ -15,7 +15,7 @@ static const uint8_t MS5611_CMD_CONV_D2 = 0x50;
|
|||||||
static const uint8_t MS5611_CMD_READ_PROM = 0xA2;
|
static const uint8_t MS5611_CMD_READ_PROM = 0xA2;
|
||||||
|
|
||||||
void MS5611Component::setup() {
|
void MS5611Component::setup() {
|
||||||
ESP_LOGCONFIG(TAG, "Setting up MS5611...");
|
ESP_LOGCONFIG(TAG, "Running setup");
|
||||||
if (!this->write_bytes(MS5611_CMD_RESET, nullptr, 0)) {
|
if (!this->write_bytes(MS5611_CMD_RESET, nullptr, 0)) {
|
||||||
this->mark_failed();
|
this->mark_failed();
|
||||||
return;
|
return;
|
||||||
|
@ -67,7 +67,7 @@ static uint8_t crc4(uint16_t *buffer, size_t length);
|
|||||||
static uint8_t hsensor_crc_check(uint16_t value);
|
static uint8_t hsensor_crc_check(uint16_t value);
|
||||||
|
|
||||||
void MS8607Component::setup() {
|
void MS8607Component::setup() {
|
||||||
ESP_LOGCONFIG(TAG, "Setting up MS8607...");
|
ESP_LOGCONFIG(TAG, "Running setup");
|
||||||
this->error_code_ = ErrorCode::NONE;
|
this->error_code_ = ErrorCode::NONE;
|
||||||
this->setup_status_ = SetupStatus::NEEDS_RESET;
|
this->setup_status_ = SetupStatus::NEEDS_RESET;
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ const char *orientation_xy_to_string(OrientationXY orientation) {
|
|||||||
const char *orientation_z_to_string(bool orientation) { return orientation ? "Downwards looking" : "Upwards looking"; }
|
const char *orientation_z_to_string(bool orientation) { return orientation ? "Downwards looking" : "Upwards looking"; }
|
||||||
|
|
||||||
void MSA3xxComponent::setup() {
|
void MSA3xxComponent::setup() {
|
||||||
ESP_LOGCONFIG(TAG, "Setting up MSA3xx...");
|
ESP_LOGCONFIG(TAG, "Running setup");
|
||||||
|
|
||||||
uint8_t part_id{0xff};
|
uint8_t part_id{0xff};
|
||||||
if (!this->read_byte(static_cast<uint8_t>(RegisterMap::PART_ID), &part_id) || (part_id != MSA_3XX_PART_ID)) {
|
if (!this->read_byte(static_cast<uint8_t>(RegisterMap::PART_ID), &part_id) || (part_id != MSA_3XX_PART_ID)) {
|
||||||
|
@ -28,7 +28,7 @@ static const uint8_t MY9231_CMD_SCATTER_APDM = 0x0 << 0;
|
|||||||
static const uint8_t MY9231_CMD_SCATTER_PWM = 0x1 << 0;
|
static const uint8_t MY9231_CMD_SCATTER_PWM = 0x1 << 0;
|
||||||
|
|
||||||
void MY9231OutputComponent::setup() {
|
void MY9231OutputComponent::setup() {
|
||||||
ESP_LOGCONFIG(TAG, "Setting up MY9231OutputComponent...");
|
ESP_LOGCONFIG(TAG, "Running setup");
|
||||||
this->pin_di_->setup();
|
this->pin_di_->setup();
|
||||||
this->pin_di_->digital_write(false);
|
this->pin_di_->digital_write(false);
|
||||||
this->pin_dcki_->setup();
|
this->pin_dcki_->setup();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user