diff options
| author | Your Name <you@example.com> | 2026-05-20 02:14:45 +0530 |
|---|---|---|
| committer | Your Name <you@example.com> | 2026-05-20 02:14:45 +0530 |
| commit | 899016795c389151e6b486ec470653f5688e5c5f (patch) | |
| tree | 64b4c732d6f585552fd14df5f47890764c66ac1a /WEB_WIFI_SETUP_PLAN.md | |
| parent | 4f713120dbedd37a3512c2ec1af0766025a59d57 (diff) | |
feat: merge display-fix — touch driver, keyboard, WiFi setup UI
Squash-merge of feature/display-fix (27 commits):
- AXS15231B touch driver with coordinate parsing (touch.c/h)
- On-screen keyboard with layout/hit detection (keyboard.c/h)
- WiFi setup state machine + config_add_wifi (wifi_setup.c/h)
- Web-based WiFi setup via captive portal
- Display rotation fix (stride=480), color fixes, DMA byte-swap
- WiFi QR code on BOOT and ERROR screens
- ERROR state transition after WiFi retries exhausted
- Unit tests: test_touch, test_keyboard, test_wifi_setup
- Integration test: wifi_setup.mjs
- E2E test: wifi-setup.spec.mjs
- Per-board hardware locks for flash targets
Conflicts resolved: took master for config/cvm/api/main (more current),
took display-fix for display/axs15231b (newer fixes).
Diffstat (limited to 'WEB_WIFI_SETUP_PLAN.md')
| -rw-r--r-- | WEB_WIFI_SETUP_PLAN.md | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/WEB_WIFI_SETUP_PLAN.md b/WEB_WIFI_SETUP_PLAN.md new file mode 100644 index 0000000..12a2fb5 --- /dev/null +++ b/WEB_WIFI_SETUP_PLAN.md | |||
| @@ -0,0 +1,100 @@ | |||
| 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 | WiFi QR + "TollGate" title + SSID + status | | ||
| 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 | WiFi QR + "NO UPSTREAM" + SSID + setup URL | | ||
| 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 | - [x] Add WiFi QR code to BOOT screen (scan to connect) | ||
| 57 | - [x] Add WiFi QR code to ERROR screen | ||
| 58 | |||
| 59 | ### Phase 2: Add web WiFi setup | ||
| 60 | - [x] Add `/wifi/scan` endpoint to `captive_portal.c` | ||
| 61 | - [x] Add `/wifi/connect` endpoint to `captive_portal.c` | ||
| 62 | - [x] Add `/wifi/status` endpoint to `captive_portal.c` | ||
| 63 | - [x] Add `/setup` HTML page with scan list + connect form | ||
| 64 | - [x] Gate `/setup` behind `network_count == 0` | ||
| 65 | |||
| 66 | ### Phase 3: Build configuration | ||
| 67 | - [x] Remove touch.c, keyboard.c, wifi_setup.c from `main/CMakeLists.txt` | ||
| 68 | |||
| 69 | ### Phase 4: Testing and fixes | ||
| 70 | - [x] `make test-unit` passes | ||
| 71 | - [x] Build succeeds (`idf.py build`) | ||
| 72 | - [x] Flash to Board C, verify portrait display shows setup URL | ||
| 73 | - [x] Fix: display stuck at BOOT when WiFi configured but unreachable | ||
| 74 | - Added `s_total_retries` counter (MAX_TOTAL_RETRIES=10) | ||
| 75 | - Transitions to DISPLAY_ERROR after all retries exhausted | ||
| 76 | - [x] WiFi QR code visible on BOOT and ERROR screens (hardware verified) | ||
| 77 | - [x] Write integration test `tests/integration/wifi_setup.mjs` | ||
| 78 | - [x] Pushed to `ngit.orangesync.tech` (commits `aa58b47`..`402f4f2`) | ||
| 79 | |||
| 80 | ### Phase 5: Playwright E2E for `/setup` page | ||
| 81 | - [ ] Plan test scenarios for `/setup` page (requires unconfigured board) | ||
| 82 | - [ ] Write `tests/e2e/wifi-setup.spec.mjs` | ||
| 83 | - Test: `/setup` returns HTML with scan button when `network_count == 0` | ||
| 84 | - Test: `/wifi/scan` returns JSON array of APs | ||
| 85 | - Test: `/wifi/connect` rejects invalid JSON | ||
| 86 | - Test: `/wifi/connect` rejects missing SSID | ||
| 87 | - Test: `/wifi/status` returns `{connected, ip, ssid}` | ||
| 88 | - Test: `/setup` redirects to `/` when WiFi already configured | ||
| 89 | - Test: full flow — scan → select AP → enter password → connect | ||
| 90 | - [ ] Add `make test-wifi-setup` target to Makefile | ||
| 91 | - [ ] Run E2E test against live board with erased SPIFFS | ||
| 92 | |||
| 93 | ## Commits | ||
| 94 | |||
| 95 | | Hash | Message | | ||
| 96 | |------|---------| | ||
| 97 | | `aa58b47` | feat: web-based WiFi setup via captive portal, portrait-only display | | ||
| 98 | | `2e65cdf` | fix: transition display to ERROR after WiFi retries exhausted | | ||
| 99 | | `cf4ac1b` | feat: add WiFi QR code to BOOT and ERROR screens | | ||
| 100 | | `402f4f2` | docs: update web WiFi setup plan checklist with progress | | ||