1
0
mirror of https://github.com/esphome/esphome.git synced 2025-06-15 14:56:59 +02:00

[max7219digit, servo, tsl2591] ESP_LOGCONFIG call reduction (Extend #9026) (#9033)

This commit is contained in:
Keith Burzinski 2025-06-08 23:19:20 -05:00 committed by GitHub
parent b98165e077
commit ff406f8e11
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 11 additions and 10 deletions

View File

@ -50,8 +50,8 @@ void MAX7219Component::setup() {
}
void MAX7219Component::dump_config() {
ESP_LOGCONFIG(TAG, "MAX7219DIGIT:");
ESP_LOGCONFIG(TAG,
"MAX7219DIGIT:\n"
" Number of Chips: %u\n"
" Number of Chips Lines: %u\n"
" Chips Lines Style : %u\n"

View File

@ -11,13 +11,13 @@ static const char *const TAG = "servo";
uint32_t global_servo_id = 1911044085ULL; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
void Servo::dump_config() {
ESP_LOGCONFIG(TAG, "Servo:");
ESP_LOGCONFIG(TAG,
"Servo:\n"
" Idle Level: %.1f%%\n"
" Min Level: %.1f%%\n"
" Max Level: %.1f%%\n"
" auto detach time: %" PRIu32 " ms\n"
" run duration: %" PRIu32 " ms",
" Auto-detach time: %" PRIu32 " ms\n"
" Run duration: %" PRIu32 " ms",
this->idle_level_ * 100.0f, this->min_level_ * 100.0f, this->max_level_ * 100.0f,
this->auto_detach_time_, this->transition_length_);
}
@ -44,7 +44,7 @@ void Servo::loop() {
if (millis() - this->start_millis_ > this->auto_detach_time_) {
this->detach();
this->start_millis_ = 0;
ESP_LOGD(TAG, "Servo detached on auto_detach_time");
ESP_LOGD(TAG, "Detached on auto_detach_time");
}
}
if (this->target_value_ != this->current_value_ && this->state_ == STATE_ATTACHED) {
@ -66,7 +66,7 @@ void Servo::loop() {
if (this->target_value_ == this->current_value_ && this->state_ == STATE_ATTACHED) {
this->state_ = STATE_TARGET_REACHED;
this->start_millis_ = millis(); // set current stamp for potential auto_detach_time_ check
ESP_LOGD(TAG, "Servo reached target");
ESP_LOGD(TAG, "Reached target");
}
}
@ -81,7 +81,7 @@ void Servo::write(float value) {
this->source_value_ = this->current_value_;
this->state_ = STATE_ATTACHED;
this->start_millis_ = millis();
ESP_LOGD(TAG, "Servo new target: %f", value);
ESP_LOGD(TAG, "New target: %f", value);
}
void Servo::internal_write(float value) {

View File

@ -119,15 +119,16 @@ void TSL2591Component::dump_config() {
gain_word = "auto";
break;
}
ESP_LOGCONFIG(TAG, " Gain: %dx (%s)", gain, gain_word.c_str());
TSL2591IntegrationTime raw_timing = this->integration_time_;
int timing_ms = (1 + raw_timing) * 100;
ESP_LOGCONFIG(TAG, " Integration Time: %d ms", timing_ms);
ESP_LOGCONFIG(TAG,
" Gain: %dx (%s)"
" Integration Time: %d ms\n"
" Power save mode enabled: %s\n"
" Device factor: %f\n"
" Glass attenuation factor: %f",
ONOFF(this->power_save_mode_enabled_), this->device_factor_, this->glass_attenuation_factor_);
gain, gain_word.c_str(), timing_ms, ONOFF(this->power_save_mode_enabled_), this->device_factor_,
this->glass_attenuation_factor_);
LOG_SENSOR(" ", "Full spectrum:", this->full_spectrum_sensor_);
LOG_SENSOR(" ", "Infrared:", this->infrared_sensor_);
LOG_SENSOR(" ", "Visible:", this->visible_sensor_);