Files
football2801 05e869d190 fix(provisioning): fast-fail wifi on bad PSK / missing SSID
Match the failure path's latency to the happy path. Before: a wrong
password meant the user stared at the yellow Step 1/2 screen for the
full 30 s WIFI_TIMEOUT_MS before the red retry repaint started — total
~50 s to "Connection Failed" visible. After: WL_CONNECT_FAILED and
WL_NO_SSID_AVAIL bail attempt_wifi() immediately, so the red repaint
starts within a few seconds of the radio giving up — total ~25 s,
matching the happy-path-to-Step-2/2 timing.

Also collapse the duplicate boot-time poll loop in main.cpp onto the
shared attempt_wifi() so the same fast-fail covers boot-with-stored-
creds, not just captive-portal submission.

Tests: FW-15a (auth fail) and FW-15b (no SSID) assert millis() never
reaches WIFI_TIMEOUT_MS on those statuses. Existing FW-15 tightened
to use WL_DISCONNECTED so it actually exercises the timeout path.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-09 10:31:41 -04:00

21 lines
572 B
C

#pragma once
#include "Arduino.h"
#define WIFI_STA 0
#define WIFI_AP 1
#define WL_NO_SSID_AVAIL 1
#define WL_CONNECTED 3
#define WL_CONNECT_FAILED 4
extern int g_wifi_status;
struct WiFiClass {
String macAddress() { return String("1C:C3:AB:D1:91:F8"); }
int status() { return g_wifi_status; }
void mode(int) {}
void begin(const char*, const char*) {}
void disconnect(bool) {}
bool softAP(const char*) { return true; }
String softAPIP() { return String("192.168.4.1"); }
String localIP() { return String("192.168.1.100"); }
} WiFi;