mirror of
https://github.com/esphome/esphome.git
synced 2025-11-18 07:45:56 +00:00
tweaks
This commit is contained in:
@@ -1062,8 +1062,8 @@ void WiFiComponent::check_connecting_finished() {
|
||||
this->state_ = WIFI_COMPONENT_STATE_STA_CONNECTED;
|
||||
this->num_retried_ = 0;
|
||||
|
||||
// Reset all priorities if they're all the same (can't differentiate)
|
||||
this->reset_priorities_if_all_same_();
|
||||
// Clear priority tracking if all priorities are identical
|
||||
this->clear_priorities_if_all_same_();
|
||||
|
||||
#ifdef USE_WIFI_FAST_CONNECT
|
||||
this->save_fast_connect_settings_();
|
||||
@@ -1293,9 +1293,9 @@ bool WiFiComponent::transition_to_phase_(WiFiRetryPhase new_phase) {
|
||||
return false; // Did not start scan, can proceed with connection
|
||||
}
|
||||
|
||||
/// Reset all BSSID priorities if they're all identical (can't differentiate)
|
||||
/// Clear BSSID priority tracking if all priorities are identical (can't differentiate, saves memory)
|
||||
/// Called when starting a fresh connection attempt or after successful connection
|
||||
void WiFiComponent::reset_priorities_if_all_same_() {
|
||||
void WiFiComponent::clear_priorities_if_all_same_() {
|
||||
if (this->sta_priorities_.empty()) {
|
||||
return;
|
||||
}
|
||||
@@ -1360,8 +1360,8 @@ void WiFiComponent::log_and_adjust_priority_for_failed_connect_() {
|
||||
format_mac_address_pretty(failed_bssid.value().data()).c_str(), old_priority, new_priority);
|
||||
|
||||
// After adjusting priority, check if all priorities are now identical
|
||||
// If so, reset them all to 0 to start fresh
|
||||
this->reset_priorities_if_all_same_();
|
||||
// If so, clear the vector to save memory
|
||||
this->clear_priorities_if_all_same_();
|
||||
}
|
||||
|
||||
/// Handle target advancement or retry counter increment when staying in the same phase
|
||||
|
||||
@@ -383,8 +383,8 @@ class WiFiComponent : public Component {
|
||||
int8_t find_next_hidden_sta_(int8_t start_index, bool include_explicit_hidden = true);
|
||||
/// Log failed connection and decrease BSSID priority to avoid repeated attempts
|
||||
void log_and_adjust_priority_for_failed_connect_();
|
||||
/// Reset all BSSID priorities to 0 if they're all identical (can't differentiate)
|
||||
void reset_priorities_if_all_same_();
|
||||
/// Clear BSSID priority tracking if all priorities are identical (saves memory)
|
||||
void clear_priorities_if_all_same_();
|
||||
/// Advance to next target (AP/SSID) within current phase, or increment retry counter
|
||||
/// Called when staying in the same phase after a failed connection attempt
|
||||
void advance_to_next_target_or_increment_retry_();
|
||||
|
||||
@@ -15,5 +15,10 @@ wifi:
|
||||
networks:
|
||||
- ssid: MySSID
|
||||
password: password1
|
||||
priority: 10
|
||||
- ssid: MySSID2
|
||||
password: password2
|
||||
priority: 5
|
||||
- ssid: MySSID3
|
||||
password: password3
|
||||
priority: 0
|
||||
|
||||
Reference in New Issue
Block a user