mirror of
https://github.com/esphome/esphome.git
synced 2026-09-17 10:08:40 +00:00
[component] Devirtualize call_dump_config
Remove virtual from Component::call_dump_config() since only MQTTComponent overrode it. The MQTT override skipped dump_config for internal entities, which unnecessarily hid useful debug info from startup logs. The is_internal flag means "don't expose to Home Assistant", not "don't log config". This also removes one vtable entry from every Component subclass and eliminates the indirect call overhead.
This commit is contained in:
@@ -405,12 +405,6 @@ void MQTTComponent::process_resend() {
|
||||
this->schedule_resend_state();
|
||||
}
|
||||
}
|
||||
void MQTTComponent::call_dump_config() {
|
||||
if (this->is_internal())
|
||||
return;
|
||||
|
||||
this->dump_config();
|
||||
}
|
||||
void MQTTComponent::schedule_resend_state() { this->resend_state_ = true; }
|
||||
bool MQTTComponent::is_connected_() const { return global_mqtt_client->is_connected(); }
|
||||
|
||||
|
||||
@@ -98,8 +98,6 @@ class MQTTComponent : public Component {
|
||||
/// Override setup_ so that we can call send_discovery() when needed.
|
||||
void call_setup() override;
|
||||
|
||||
void call_dump_config() override;
|
||||
|
||||
/// Send discovery info the Home Assistant, override this.
|
||||
virtual void send_discovery(JsonObject root, SendDiscoveryConfig &config) = 0;
|
||||
|
||||
|
||||
@@ -256,7 +256,7 @@ void Application::process_dump_config_() {
|
||||
#endif
|
||||
}
|
||||
|
||||
this->components_[this->dump_config_at_]->call_dump_config();
|
||||
this->components_[this->dump_config_at_]->call_dump_config_();
|
||||
this->dump_config_at_++;
|
||||
}
|
||||
|
||||
|
||||
@@ -211,7 +211,7 @@ bool Component::cancel_retry(uint32_t id) {
|
||||
|
||||
void Component::call_loop_() { this->loop(); }
|
||||
void Component::call_setup() { this->setup(); }
|
||||
void Component::call_dump_config() {
|
||||
void Component::call_dump_config_() {
|
||||
this->dump_config();
|
||||
if (this->is_failed()) {
|
||||
// Look up error message from global vector
|
||||
|
||||
@@ -291,7 +291,7 @@ class Component {
|
||||
|
||||
void call_loop_();
|
||||
virtual void call_setup();
|
||||
virtual void call_dump_config();
|
||||
void call_dump_config_();
|
||||
|
||||
/// Helper to set component state (clears state bits and sets new state)
|
||||
void set_component_state_(uint8_t state);
|
||||
|
||||
Reference in New Issue
Block a user