From aa58b47996083f36e3587b8e10f9bbb681610491 Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 19 May 2026 04:21:14 +0530 Subject: feat: web-based WiFi setup via captive portal, portrait-only display - Remove touchscreen WiFi setup (touch.c, keyboard.c, wifi_setup.c from build) - Remove offscreen buffer and landscape rotation from axs15231b driver - Add /setup HTML page with WiFi scan/connect via captive portal - Add /wifi/scan, /wifi/connect, /wifi/status HTTP endpoints - Display shows SETUP_PENDING (QR + SSID + setup URL) when unconfigured - Display shows ERROR with setup URL when upstream is down - All 101 unit tests pass, builds and flashes to Board C --- WEB_WIFI_SETUP_PLAN.md | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 WEB_WIFI_SETUP_PLAN.md (limited to 'WEB_WIFI_SETUP_PLAN.md') diff --git a/WEB_WIFI_SETUP_PLAN.md b/WEB_WIFI_SETUP_PLAN.md new file mode 100644 index 0000000..1a3f742 --- /dev/null +++ b/WEB_WIFI_SETUP_PLAN.md @@ -0,0 +1,72 @@ +# Web WiFi Setup Plan + +## Overview + +Move WiFi configuration from on-display touchscreen UI to a web-based setup page +served by the captive portal. The display becomes portrait-only, showing QR codes +and status info. No more landscape rotation, on-screen keyboard, or touch-driven +WiFi setup. + +## Architecture + +### Display (portrait 320x480 only) + +| State | When | Content | +|-------|------|---------| +| BOOT | Startup | "TollGate" title + "starting..." | +| READY (unconfigured) | No STA network | AP WiFi QR + SSID + "http://AP_IP/setup" | +| READY (configured) | STA connected | QR cycling (WiFi↔Portal) + balance/clients/price | +| PAYMENT_RECEIVED | After payment | "ACCESS GRANTED" + amount + time (3s then→READY) | +| ERROR | No upstream | "NO UPSTREAM" + "http://AP_IP/setup" | + +### Captive Portal (new endpoints) + +| Endpoint | Method | Purpose | +|----------|--------|---------| +| `/setup` | GET | WiFi setup HTML page (only when unconfigured) | +| `/wifi/scan` | GET | Trigger scan, return `[{ssid,rssi,secured}]` JSON | +| `/wifi/connect` | POST | Take `{ssid,password}`, save config, connect | +| `/wifi/status` | GET | Return `{connected,ip,ssid}` | + +### Files Removed from Build (kept on disk) + +- `main/touch.c` / `touch.h` +- `main/keyboard.c` / `keyboard.h` +- `main/wifi_setup.c` / `wifi_setup.h` + +### Files Modified + +- `main/display.c` — Strip WiFi setup state, rotation, offscreen; add setup URL text +- `main/display.h` — Remove `DISPLAY_WIFI_SETUP`, `display_enter_wifi_setup()` +- `main/tollgate_main.c` — Remove WiFi setup auto-enter, add display state for unconfigured +- `main/captive_portal.c` — Add WiFi scan/connect/status endpoints + `/setup` HTML +- `main/captive_portal.h` — Expose captive_portal_is_setup_available() +- `components/axs15231b/axs15231b.c` — Remove offscreen buffer +- `components/axs15231b/include/axs15231b.h` — Remove `axs15231b_set_offscreen()` +- `main/CMakeLists.txt` — Remove touch/keyboard/wifi_setup sources + +## Checklist + +### Phase 1: Strip display and driver +- [x] Remove offscreen buffer from `axs15231b.c` and `axs15231b.h` +- [x] Strip `display.c` — remove WiFi setup state, rotation, keyboard/touch imports +- [x] Update `display.h` — remove `DISPLAY_WIFI_SETUP`, `display_enter_wifi_setup()` +- [x] Add setup URL text to READY (unconfigured) and ERROR screens +- [x] Remove WiFi setup auto-enter from `tollgate_main.c` + +### Phase 2: Add web WiFi setup +- [x] Add `/wifi/scan` endpoint to `captive_portal.c` +- [x] Add `/wifi/connect` endpoint to `captive_portal.c` +- [x] Add `/wifi/status` endpoint to `captive_portal.c` +- [x] Add `/setup` HTML page with scan list + connect form +- [x] Gate `/setup` behind `network_count == 0` + +### Phase 3: Build configuration +- [x] Remove touch.c, keyboard.c, wifi_setup.c from `main/CMakeLists.txt` + +### Phase 4: Testing +- [x] `make test-unit` passes +- [x] Build succeeds (`idf.py build`) +- [x] Flash to Board C, verify portrait display shows setup URL +- [ ] Test `/setup` page from phone browser +- [x] Write integration test `tests/integration/wifi_setup.mjs` -- cgit v1.2.3