1
0
mirror of https://github.com/esphome/esphome.git synced 2025-11-17 15:26:01 +00:00

reduce complexity

This commit is contained in:
J. Nick Koston
2025-11-06 16:30:12 -06:00
parent 645820304f
commit df1ffbaf5d

View File

@@ -344,9 +344,13 @@ void WiFiComponent::clear_sta() {
} }
void WiFiComponent::start_connecting_to_selected_(bool two) { void WiFiComponent::start_connecting_to_selected_(bool two) {
WiFiAP params; const WiFiAP *config = this->get_selected_sta_();
if (!config) {
ESP_LOGE(TAG, "No config selected");
return;
}
if (const WiFiAP *config = this->get_selected_sta_()) { WiFiAP params;
// Copy config data that's never overridden (password, manual IP, priority, EAP) // Copy config data that's never overridden (password, manual IP, priority, EAP)
params.set_password(config->get_password()); params.set_password(config->get_password());
params.set_manual_ip(config->get_manual_ip()); params.set_manual_ip(config->get_manual_ip());
@@ -382,7 +386,6 @@ void WiFiComponent::start_connecting_to_selected_(bool two) {
params.set_channel(config->get_channel()); params.set_channel(config->get_channel());
} }
} }
}
this->start_connecting(params, two); this->start_connecting(params, two);
} }