Improve logging for humans

This commit is contained in:
Michael Doppler 2024-07-07 13:21:24 +02:00
parent 160ba51041
commit 8d8bd42588
2 changed files with 5 additions and 3 deletions

View file

@ -12,6 +12,7 @@ void MCP3428Component::setup() {
uint8_t anwser[3];
if (this->read(anwser, 3) != i2c::ErrorCode::NO_ERROR) {
this->mark_failed();
ESP_LOGE(TAG, "Communication with MCP3426/7/8 failed while reading device register!");
return;
}
@ -41,6 +42,7 @@ void MCP3428Component::setup() {
if (this->write(&config, 1) != i2c::ErrorCode::NO_ERROR) {
this->mark_failed();
ESP_LOGE(TAG, "Communication with MCP3426/7/8 failed while writing config!");
return;
}
this->prev_config_ = config;

View file

@ -55,9 +55,9 @@ void MCP3428Sensor::update() {
void MCP3428Sensor::dump_config() {
LOG_SENSOR(" ", "MCP3426/7/8 Sensor", this);
ESP_LOGCONFIG(TAG, " Multiplexer: %u", this->multiplexer_);
ESP_LOGCONFIG(TAG, " Gain: %u", this->gain_);
ESP_LOGCONFIG(TAG, " Resolution: %u", this->resolution_);
ESP_LOGCONFIG(TAG, " Multiplexer: Channel %u", this->multiplexer_ + 1);
ESP_LOGCONFIG(TAG, " Gain: %u", 0b0001 << this->gain_);
ESP_LOGCONFIG(TAG, " Resolution: %u", 12 + 2 * this->resolution_);
}
} // namespace mcp3428