Fix WiFi page update
This commit is contained in:
@@ -394,22 +394,33 @@ func (p *WiFiSetupPage) handleConnectionStatusUpdate(status *network.ConnectionS
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// NEW LOGIC: Any "Connected" status should clear the "isConnecting" flag
|
// milestone 1: We are associated with an AP (even if internet is still pending)
|
||||||
// so the user knows the password worked and the hardware is associated.
|
|
||||||
isConnected := status.StatusCode == network.StatusWifiConnectedInternetUp ||
|
isConnected := status.StatusCode == network.StatusWifiConnectedInternetUp ||
|
||||||
status.StatusCode == network.StatusWifiConnectedNoInternet
|
status.StatusCode == network.StatusWifiConnectedNoInternet
|
||||||
|
|
||||||
if isConnected {
|
if isConnected {
|
||||||
activeSSID := p.getActiveSSID()
|
activeSSID := p.getActiveSSID()
|
||||||
|
// If we see our SSID, OR if we're connected to anything while trying, call it a win.
|
||||||
// We check if the SSID matches, OR if we've been trying long enough
|
|
||||||
// that any active connection is likely ours.
|
|
||||||
if activeSSID == p.pendingSSID || activeSSID != "" {
|
if activeSSID == p.pendingSSID || activeSSID != "" {
|
||||||
logger.Info("WiFi successfully associated with %s", activeSSID)
|
logger.Info("UI synced: Connected to %s", activeSSID)
|
||||||
p.isConnecting = false
|
p.isConnecting = false
|
||||||
p.pendingSSID = ""
|
p.pendingSSID = ""
|
||||||
p.connectionError = ""
|
p.connectionError = ""
|
||||||
p.refreshNetworkColors()
|
p.refreshNetworkColors()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// milestone 2: Handle the "Not Connected" state during the handshake
|
||||||
|
if status.StatusCode == network.StatusWifiAvailableNotConnected {
|
||||||
|
// INCREASE THIS: 5 seconds is way too aggressive.
|
||||||
|
// Give it at least 20 seconds before assuming the password was wrong.
|
||||||
|
if time.Since(p.connectionAttemptTime) > 20*time.Second {
|
||||||
|
p.isConnecting = false
|
||||||
|
p.connectionError = "Connection failed - Check password or signal"
|
||||||
|
p.isEnteringPassword = true
|
||||||
|
p.enterPasswordMode()
|
||||||
|
p.updatePasswordErrorTexture()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user