mirror of
https://github.com/esphome/esphome.git
synced 2025-07-29 22:56:37 +00:00
preen
This commit is contained in:
parent
05d1c0300f
commit
a418e8df48
@ -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;
|
||||
}
|
||||
|
||||
void AT581XComponent::setup() { ESP_LOGCONFIG(TAG, "Running setup"); }
|
||||
void AT581XComponent::setup() {}
|
||||
void AT581XComponent::dump_config() { LOG_I2C_DEVICE(this); }
|
||||
#define ARRAY_SIZE(X) (sizeof(X) / sizeof((X)[0]))
|
||||
bool AT581XComponent::i2c_write_config() {
|
||||
|
@ -38,7 +38,6 @@ MTreg:
|
||||
*/
|
||||
|
||||
void BH1750Sensor::setup() {
|
||||
ESP_LOGCONFIG(TAG, "Running setup for '%s'", this->name_.c_str());
|
||||
uint8_t turn_on = BH1750_COMMAND_POWER_ON;
|
||||
if (this->write(&turn_on, 1) != i2c::ERROR_OK) {
|
||||
this->mark_failed();
|
||||
|
@ -17,7 +17,6 @@ static const uint8_t RESTART_CMD2 = 0xA5;
|
||||
static const uint8_t READ_DELAY = 40; // minimum milliseconds from datasheet to safely read measurement result
|
||||
|
||||
void GLR01I2CComponent::setup() {
|
||||
ESP_LOGCONFIG(TAG, "Setting up GL-R01 I2C...");
|
||||
// Verify sensor presence
|
||||
if (!this->read_byte_16(REG_VERSION, &this->version_)) {
|
||||
ESP_LOGE(TAG, "Failed to communicate with GL-R01 I2C sensor!");
|
||||
|
@ -8,8 +8,6 @@ static const char *const TAG = "switch.gpio";
|
||||
|
||||
float GPIOSwitch::get_setup_priority() const { return setup_priority::HARDWARE; }
|
||||
void GPIOSwitch::setup() {
|
||||
ESP_LOGCONFIG(TAG, "Running setup for '%s'", this->name_.c_str());
|
||||
|
||||
bool initial_state = this->get_initial_state_with_restore_mode().value_or(false);
|
||||
|
||||
// write state before setup
|
||||
|
@ -10,8 +10,6 @@ static const char *const TAG = "switch.hbridge";
|
||||
|
||||
float HBridgeSwitch::get_setup_priority() const { return setup_priority::HARDWARE; }
|
||||
void HBridgeSwitch::setup() {
|
||||
ESP_LOGCONFIG(TAG, "Running setup for '%s'", this->name_.c_str());
|
||||
|
||||
optional<bool> initial_state = this->get_initial_state_with_restore_mode();
|
||||
|
||||
// Like GPIOSwitch does, set the pin state both before and after pin setup()
|
||||
|
@ -9,10 +9,7 @@ static const char *const TAG = "honeywellabp";
|
||||
const float MIN_COUNT = 1638.4; // 1638 counts (10% of 2^14 counts or 0x0666)
|
||||
const float MAX_COUNT = 14745.6; // 14745 counts (90% of 2^14 counts or 0x3999)
|
||||
|
||||
void HONEYWELLABPSensor::setup() {
|
||||
ESP_LOGD(TAG, "Setting up Honeywell ABP Sensor ");
|
||||
this->spi_setup();
|
||||
}
|
||||
void HONEYWELLABPSensor::setup() { this->spi_setup(); }
|
||||
|
||||
uint8_t HONEYWELLABPSensor::readsensor_() {
|
||||
// Polls the sensor for new data.
|
||||
|
@ -8,7 +8,6 @@ namespace hx711 {
|
||||
static const char *const TAG = "hx711";
|
||||
|
||||
void HX711Sensor::setup() {
|
||||
ESP_LOGCONFIG(TAG, "Running setup for '%s'", this->name_.c_str());
|
||||
this->sck_pin_->setup();
|
||||
this->dout_pin_->setup();
|
||||
this->sck_pin_->digital_write(false);
|
||||
|
@ -31,8 +31,6 @@ void ILI9XXXDisplay::set_madctl() {
|
||||
}
|
||||
|
||||
void ILI9XXXDisplay::setup() {
|
||||
ESP_LOGD(TAG, "Setting up ILI9xxx");
|
||||
|
||||
this->setup_pins_();
|
||||
this->init_lcd_(this->init_sequence_);
|
||||
this->init_lcd_(this->extra_init_sequence_.data());
|
||||
|
@ -19,10 +19,7 @@ void MAX31855Sensor::update() {
|
||||
this->set_timeout("value", 220, f);
|
||||
}
|
||||
|
||||
void MAX31855Sensor::setup() {
|
||||
ESP_LOGCONFIG(TAG, "Running setup for '%s'", this->name_.c_str());
|
||||
this->spi_setup();
|
||||
}
|
||||
void MAX31855Sensor::setup() { this->spi_setup(); }
|
||||
void MAX31855Sensor::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "MAX31855:");
|
||||
LOG_PIN(" CS Pin: ", this->cs_);
|
||||
|
@ -11,14 +11,10 @@ static const char *const TAG = "max31856";
|
||||
// Based on Adafruit's library: https://github.com/adafruit/Adafruit_MAX31856
|
||||
|
||||
void MAX31856Sensor::setup() {
|
||||
ESP_LOGCONFIG(TAG, "Running setup for '%s'", this->name_.c_str());
|
||||
this->spi_setup();
|
||||
|
||||
// assert on any fault
|
||||
ESP_LOGCONFIG(TAG, "Setting up assertion on all faults");
|
||||
this->write_register_(MAX31856_MASK_REG, 0x0);
|
||||
|
||||
ESP_LOGCONFIG(TAG, "Setting up open circuit fault detection");
|
||||
this->write_register_(MAX31856_CR0_REG, MAX31856_CR0_OCFAULT01);
|
||||
|
||||
this->set_thermocouple_type_();
|
||||
|
@ -65,7 +65,6 @@ void MAX31865Sensor::update() {
|
||||
}
|
||||
|
||||
void MAX31865Sensor::setup() {
|
||||
ESP_LOGCONFIG(TAG, "Running setup for '%s'", this->name_.c_str());
|
||||
this->spi_setup();
|
||||
|
||||
// Build base configuration
|
||||
|
@ -17,10 +17,7 @@ void MAX6675Sensor::update() {
|
||||
this->set_timeout("value", 250, f);
|
||||
}
|
||||
|
||||
void MAX6675Sensor::setup() {
|
||||
ESP_LOGCONFIG(TAG, "Running setup for '%s'", this->name_.c_str());
|
||||
this->spi_setup();
|
||||
}
|
||||
void MAX6675Sensor::setup() { this->spi_setup(); }
|
||||
void MAX6675Sensor::dump_config() {
|
||||
LOG_SENSOR("", "MAX6675", this);
|
||||
LOG_PIN(" CS Pin: ", this->cs_);
|
||||
|
@ -18,8 +18,6 @@ static const uint8_t MCP9808_AMBIENT_TEMP_NEGATIVE = 0x10;
|
||||
static const char *const TAG = "mcp9808";
|
||||
|
||||
void MCP9808Sensor::setup() {
|
||||
ESP_LOGCONFIG(TAG, "Running setup for '%s'", this->name_.c_str());
|
||||
|
||||
uint16_t manu = 0;
|
||||
if (!this->read_byte_16(MCP9808_REG_MANUF_ID, &manu) || manu != MCP9808_MANUF_ID) {
|
||||
this->mark_failed();
|
||||
|
@ -52,7 +52,6 @@ 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);
|
||||
uint8_t rev;
|
||||
|
||||
|
@ -145,7 +145,6 @@ void OpenthermHub::process_response(OpenthermData &data) {
|
||||
}
|
||||
|
||||
void OpenthermHub::setup() {
|
||||
ESP_LOGD(TAG, "Setting up OpenTherm component");
|
||||
this->opentherm_ = make_unique<OpenTherm>(this->in_pin_, this->out_pin_);
|
||||
if (!this->opentherm_->initialize()) {
|
||||
ESP_LOGE(TAG, "Failed to initialize OpenTherm protocol. See previous log messages for details.");
|
||||
|
@ -8,8 +8,6 @@ static const char *const TAG = "output.switch";
|
||||
|
||||
void OutputSwitch::dump_config() { LOG_SWITCH("", "Output Switch", this); }
|
||||
void OutputSwitch::setup() {
|
||||
ESP_LOGCONFIG(TAG, "Running setup for '%s'", this->name_.c_str());
|
||||
|
||||
bool initial_state = this->get_initial_state_with_restore_mode().value_or(false);
|
||||
|
||||
if (initial_state) {
|
||||
|
@ -156,7 +156,6 @@ pulse_counter_t HwPulseCounterStorage::read_raw_value() {
|
||||
#endif // HAS_PCNT
|
||||
|
||||
void PulseCounterSensor::setup() {
|
||||
ESP_LOGCONFIG(TAG, "Running setup for '%s'", this->name_.c_str());
|
||||
if (!this->storage_.pulse_counter_setup(this->pin_)) {
|
||||
this->mark_failed();
|
||||
return;
|
||||
|
@ -129,8 +129,6 @@ void IRAM_ATTR HOT RotaryEncoderSensorStore::gpio_intr(RotaryEncoderSensorStore
|
||||
}
|
||||
|
||||
void RotaryEncoderSensor::setup() {
|
||||
ESP_LOGCONFIG(TAG, "Running setup for '%s'", this->name_.c_str());
|
||||
|
||||
int32_t initial_value = 0;
|
||||
switch (this->restore_mode_) {
|
||||
case ROTARY_ENCODER_RESTORE_DEFAULT_ZERO:
|
||||
|
@ -60,7 +60,6 @@ void SHT3XDComponent::dump_config() {
|
||||
ESP_LOGE(TAG, " Communication with SHT3xD failed!");
|
||||
return;
|
||||
}
|
||||
ESP_LOGD(TAG, " Setup successful");
|
||||
ESP_LOGD(TAG, " Serial Number: 0x%08" PRIX32, this->serial_number_);
|
||||
ESP_LOGD(TAG, " Heater Enabled: %s", this->heater_enabled_ ? "true" : "false");
|
||||
|
||||
|
@ -6,7 +6,6 @@ namespace esphome {
|
||||
namespace st7701s {
|
||||
|
||||
void ST7701S::setup() {
|
||||
esph_log_config(TAG, "Setting up ST7701S");
|
||||
this->spi_setup();
|
||||
this->write_init_sequence_();
|
||||
|
||||
|
@ -80,7 +80,6 @@ void TemplateAlarmControlPanel::dump_config() {
|
||||
}
|
||||
|
||||
void TemplateAlarmControlPanel::setup() {
|
||||
ESP_LOGCONFIG(TAG, "Running setup for '%s'", this->name_.c_str());
|
||||
switch (this->restore_mode_) {
|
||||
case ALARM_CONTROL_PANEL_ALWAYS_DISARMED:
|
||||
this->current_state_ = ACP_STATE_DISARMED;
|
||||
|
@ -16,7 +16,6 @@ TemplateCover::TemplateCover()
|
||||
position_trigger_(new Trigger<float>()),
|
||||
tilt_trigger_(new Trigger<float>()) {}
|
||||
void TemplateCover::setup() {
|
||||
ESP_LOGCONFIG(TAG, "Running setup for '%s'", this->name_.c_str());
|
||||
switch (this->restore_mode_) {
|
||||
case COVER_NO_RESTORE:
|
||||
break;
|
||||
|
@ -11,7 +11,6 @@ void TemplateSelect::setup() {
|
||||
return;
|
||||
|
||||
std::string value;
|
||||
ESP_LOGD(TAG, "Setting up");
|
||||
if (!this->restore_value_) {
|
||||
value = this->initial_option_;
|
||||
ESP_LOGD(TAG, "State from initial: %s", value.c_str());
|
||||
|
@ -11,8 +11,6 @@ void TemplateText::setup() {
|
||||
if (this->f_.has_value())
|
||||
return;
|
||||
}
|
||||
|
||||
ESP_LOGCONFIG(TAG, "Running setup for '%s'", this->name_.c_str());
|
||||
std::string value = this->initial_value_;
|
||||
if (!this->pref_) {
|
||||
ESP_LOGD(TAG, "State from initial: %s", value.c_str());
|
||||
|
@ -16,7 +16,6 @@ TemplateValve::TemplateValve()
|
||||
position_trigger_(new Trigger<float>()) {}
|
||||
|
||||
void TemplateValve::setup() {
|
||||
ESP_LOGCONFIG(TAG, "Running setup for '%s'", this->name_.c_str());
|
||||
switch (this->restore_mode_) {
|
||||
case VALVE_NO_RESTORE:
|
||||
break;
|
||||
|
@ -86,8 +86,6 @@ void IDFUARTComponent::setup() {
|
||||
return;
|
||||
}
|
||||
this->uart_num_ = static_cast<uart_port_t>(next_uart_num++);
|
||||
ESP_LOGCONFIG(TAG, "Running setup for UART %u", this->uart_num_);
|
||||
|
||||
this->lock_ = xSemaphoreCreateMutex();
|
||||
|
||||
xSemaphoreTake(this->lock_, portMAX_DELAY);
|
||||
|
@ -9,9 +9,6 @@ static const char *const TAG = "veml3235.sensor";
|
||||
|
||||
void VEML3235Sensor::setup() {
|
||||
uint8_t device_id[] = {0, 0};
|
||||
|
||||
ESP_LOGCONFIG(TAG, "Running setup for '%s'", this->name_.c_str());
|
||||
|
||||
if (!this->refresh_config_reg()) {
|
||||
ESP_LOGE(TAG, "Unable to write configuration");
|
||||
this->mark_failed();
|
||||
|
@ -32,8 +32,6 @@ void VL53L0XSensor::dump_config() {
|
||||
}
|
||||
|
||||
void VL53L0XSensor::setup() {
|
||||
ESP_LOGD(TAG, "'%s' - setup BEGIN", this->name_.c_str());
|
||||
|
||||
if (!esphome::vl53l0x::VL53L0XSensor::enable_pin_setup_complete) {
|
||||
for (auto &vl53_sensor : vl53_sensors) {
|
||||
if (vl53_sensor->enable_pin_ != nullptr) {
|
||||
@ -258,8 +256,6 @@ void VL53L0XSensor::setup() {
|
||||
// I2C_SXXXX__DEVICE_ADDRESS = 0x0001 for VL53L1X
|
||||
reg(0x8A) = final_address & 0x7F;
|
||||
this->set_i2c_address(final_address);
|
||||
|
||||
ESP_LOGD(TAG, "'%s' - setup END", this->name_.c_str());
|
||||
}
|
||||
|
||||
void VL53L0XSensor::update() {
|
||||
|
@ -156,7 +156,7 @@ void WeikaiRegisterSPI::write_fifo(uint8_t *data, size_t length) {
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
void WeikaiComponentSPI::setup() {
|
||||
using namespace weikai;
|
||||
ESP_LOGCONFIG(TAG, "Running setup for '%s' with %d UARTs", this->get_name(), this->children_.size());
|
||||
ESP_LOGCONFIG(TAG, "Setup %s (%d UARTs)", this->get_name(), this->children_.size());
|
||||
this->spi_setup();
|
||||
// enable all channels
|
||||
this->reg(WKREG_GENA, 0) = GENA_C1EN | GENA_C2EN | GENA_C3EN | GENA_C4EN;
|
||||
|
@ -260,9 +260,6 @@ void WiFiComponent::setup_ap_config_() {
|
||||
}
|
||||
this->ap_.set_ssid(name);
|
||||
}
|
||||
|
||||
ESP_LOGCONFIG(TAG, "Setting up AP");
|
||||
|
||||
ESP_LOGCONFIG(TAG,
|
||||
" AP SSID: '%s'\n"
|
||||
" AP Password: '%s'",
|
||||
|
Loading…
x
Reference in New Issue
Block a user