diff options
| author | Your Name <you@example.com> | 2026-05-19 04:21:14 +0530 |
|---|---|---|
| committer | Your Name <you@example.com> | 2026-05-19 04:21:14 +0530 |
| commit | aa58b47996083f36e3587b8e10f9bbb681610491 (patch) | |
| tree | 4c845da2ee4b217a2c77deea3b10dd8d288d1b09 /WEB_WIFI_SETUP_PLAN.md | |
| parent | 9f7dd94029c8dc12117494548f5f32221a729307 (diff) | |
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
Diffstat (limited to 'WEB_WIFI_SETUP_PLAN.md')
| -rw-r--r-- | WEB_WIFI_SETUP_PLAN.md | 72 |
1 files changed, 72 insertions, 0 deletions
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 @@ | |||
| 1 | # Web WiFi Setup Plan | ||
| 2 | |||
| 3 | ## Overview | ||
| 4 | |||
| 5 | Move WiFi configuration from on-display touchscreen UI to a web-based setup page | ||
| 6 | served by the captive portal. The display becomes portrait-only, showing QR codes | ||
| 7 | and status info. No more landscape rotation, on-screen keyboard, or touch-driven | ||
| 8 | WiFi setup. | ||
| 9 | |||
| 10 | ## Architecture | ||
| 11 | |||
| 12 | ### Display (portrait 320x480 only) | ||
| 13 | |||
| 14 | | State | When | Content | | ||
| 15 | |-------|------|---------| | ||
| 16 | | BOOT | Startup | "TollGate" title + "starting..." | | ||
| 17 | | READY (unconfigured) | No STA network | AP WiFi QR + SSID + "http://AP_IP/setup" | | ||
| 18 | | READY (configured) | STA connected | QR cycling (WiFi↔Portal) + balance/clients/price | | ||
| 19 | | PAYMENT_RECEIVED | After payment | "ACCESS GRANTED" + amount + time (3s then→READY) | | ||
| 20 | | ERROR | No upstream | "NO UPSTREAM" + "http://AP_IP/setup" | | ||
| 21 | |||
| 22 | ### Captive Portal (new endpoints) | ||
| 23 | |||
| 24 | | Endpoint | Method | Purpose | | ||
| 25 | |----------|--------|---------| | ||
| 26 | | `/setup` | GET | WiFi setup HTML page (only when unconfigured) | | ||
| 27 | | `/wifi/scan` | GET | Trigger scan, return `[{ssid,rssi,secured}]` JSON | | ||
| 28 | | `/wifi/connect` | POST | Take `{ssid,password}`, save config, connect | | ||
| 29 | | `/wifi/status` | GET | Return `{connected,ip,ssid}` | | ||
| 30 | |||
| 31 | ### Files Removed from Build (kept on disk) | ||
| 32 | |||
| 33 | - `main/touch.c` / `touch.h` | ||
| 34 | - `main/keyboard.c` / `keyboard.h` | ||
| 35 | - `main/wifi_setup.c` / `wifi_setup.h` | ||
| 36 | |||
| 37 | ### Files Modified | ||
| 38 | |||
| 39 | - `main/display.c` — Strip WiFi setup state, rotation, offscreen; add setup URL text | ||
| 40 | - `main/display.h` — Remove `DISPLAY_WIFI_SETUP`, `display_enter_wifi_setup()` | ||
| 41 | - `main/tollgate_main.c` — Remove WiFi setup auto-enter, add display state for unconfigured | ||
| 42 | - `main/captive_portal.c` — Add WiFi scan/connect/status endpoints + `/setup` HTML | ||
| 43 | - `main/captive_portal.h` — Expose captive_portal_is_setup_available() | ||
| 44 | - `components/axs15231b/axs15231b.c` — Remove offscreen buffer | ||
| 45 | - `components/axs15231b/include/axs15231b.h` — Remove `axs15231b_set_offscreen()` | ||
| 46 | - `main/CMakeLists.txt` — Remove touch/keyboard/wifi_setup sources | ||
| 47 | |||
| 48 | ## Checklist | ||
| 49 | |||
| 50 | ### Phase 1: Strip display and driver | ||
| 51 | - [x] Remove offscreen buffer from `axs15231b.c` and `axs15231b.h` | ||
| 52 | - [x] Strip `display.c` — remove WiFi setup state, rotation, keyboard/touch imports | ||
| 53 | - [x] Update `display.h` — remove `DISPLAY_WIFI_SETUP`, `display_enter_wifi_setup()` | ||
| 54 | - [x] Add setup URL text to READY (unconfigured) and ERROR screens | ||
| 55 | - [x] Remove WiFi setup auto-enter from `tollgate_main.c` | ||
| 56 | |||
| 57 | ### Phase 2: Add web WiFi setup | ||
| 58 | - [x] Add `/wifi/scan` endpoint to `captive_portal.c` | ||
| 59 | - [x] Add `/wifi/connect` endpoint to `captive_portal.c` | ||
| 60 | - [x] Add `/wifi/status` endpoint to `captive_portal.c` | ||
| 61 | - [x] Add `/setup` HTML page with scan list + connect form | ||
| 62 | - [x] Gate `/setup` behind `network_count == 0` | ||
| 63 | |||
| 64 | ### Phase 3: Build configuration | ||
| 65 | - [x] Remove touch.c, keyboard.c, wifi_setup.c from `main/CMakeLists.txt` | ||
| 66 | |||
| 67 | ### Phase 4: Testing | ||
| 68 | - [x] `make test-unit` passes | ||
| 69 | - [x] Build succeeds (`idf.py build`) | ||
| 70 | - [x] Flash to Board C, verify portrait display shows setup URL | ||
| 71 | - [ ] Test `/setup` page from phone browser | ||
| 72 | - [x] Write integration test `tests/integration/wifi_setup.mjs` | ||