From 5f254e94cd552ce3654708847627448c91ac258a Mon Sep 17 00:00:00 2001 From: NeilClack Date: Fri, 13 Mar 2026 21:13:21 -0500 Subject: [PATCH] Fix WiFi page update --- internal/page/wifiSetupPage.go | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/internal/page/wifiSetupPage.go b/internal/page/wifiSetupPage.go index ad621f4..435c07e 100644 --- a/internal/page/wifiSetupPage.go +++ b/internal/page/wifiSetupPage.go @@ -394,22 +394,33 @@ func (p *WiFiSetupPage) handleConnectionStatusUpdate(status *network.ConnectionS return } - // NEW LOGIC: Any "Connected" status should clear the "isConnecting" flag - // so the user knows the password worked and the hardware is associated. + // milestone 1: We are associated with an AP (even if internet is still pending) isConnected := status.StatusCode == network.StatusWifiConnectedInternetUp || status.StatusCode == network.StatusWifiConnectedNoInternet if isConnected { activeSSID := p.getActiveSSID() - - // We check if the SSID matches, OR if we've been trying long enough - // that any active connection is likely ours. + // If we see our SSID, OR if we're connected to anything while trying, call it a win. 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.pendingSSID = "" p.connectionError = "" 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() } } }