diff options
Diffstat (limited to 'TOUCH_WIFI_SETUP_PLAN.md')
| -rw-r--r-- | TOUCH_WIFI_SETUP_PLAN.md | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/TOUCH_WIFI_SETUP_PLAN.md b/TOUCH_WIFI_SETUP_PLAN.md new file mode 100644 index 0000000..afbc0b3 --- /dev/null +++ b/TOUCH_WIFI_SETUP_PLAN.md | |||
| @@ -0,0 +1,92 @@ | |||
| 1 | # Touchscreen WiFi Setup Plan | ||
| 2 | |||
| 3 | ## Overview | ||
| 4 | Add touchscreen WiFi configuration to the TollGate display so users can select a gateway network and enter a password directly on the device. | ||
| 5 | |||
| 6 | ## Hardware | ||
| 7 | |||
| 8 | ### Touch Controller | ||
| 9 | - **IC:** AXS15231B built-in touch (same chip as display, separate I2C interface) | ||
| 10 | - **Bus:** I2C, address `0x3B` | ||
| 11 | - **Pins:** SDA=GPIO4, SCL=GPIO8, RST=GPIO12, INT=GPIO11 | ||
| 12 | - **Protocol:** Write 11 bytes `[0xb5,0xab,0xa5,0x5a,0x00,0x00,0x00,0x08,0x00,0x00,0x00]`, read 8 bytes | ||
| 13 | - **Coordinates:** X/Y from data bytes [2..5], 12-bit | ||
| 14 | - **RST sequence:** LOW 200ms -> HIGH 200ms | ||
| 15 | |||
| 16 | ### No Pin Conflicts | ||
| 17 | | Pin | Display | Touch | Conflict? | | ||
| 18 | |-----|---------|-------|-----------| | ||
| 19 | | 4 | -- | SDA | No | | ||
| 20 | | 8 | -- | SCL | No | | ||
| 21 | | 11 | -- | INT | No | | ||
| 22 | | 12 | -- | RST | No | | ||
| 23 | | 1,21,39,40,45,47,48 | Display QSPI | -- | No | | ||
| 24 | |||
| 25 | ## Trigger Points (all three) | ||
| 26 | |||
| 27 | | Trigger | How | When | | ||
| 28 | |---------|-----|------| | ||
| 29 | | A) Tap on ERROR screen | "Setup WiFi" button | Any time upstream is down | | ||
| 30 | | B) Auto-show on first boot | Check wifi_networks empty | Fresh device with no credentials | | ||
| 31 | | C) Setup button on READY/ERROR | Small gear icon in corner | Always accessible | | ||
| 32 | |||
| 33 | ## UI Screens | ||
| 34 | |||
| 35 | ### 1. Scanning | ||
| 36 | Title + "Scanning..." spinner | ||
| 37 | |||
| 38 | ### 2. Network List | ||
| 39 | Top 8 by RSSI, sorted strongest first, scrollable. Lock icon for secured networks. | ||
| 40 | |||
| 41 | ### 3. Password Entry | ||
| 42 | SSID name, masked password field with eye reveal toggle, QWERTY keyboard. | ||
| 43 | |||
| 44 | ### 4. Connecting | ||
| 45 | "Connecting to SSID..." spinner | ||
| 46 | |||
| 47 | ### 5. Result | ||
| 48 | Green "Connected!" with IP, or red "Failed" with retry options. | ||
| 49 | |||
| 50 | ## New Files | ||
| 51 | |||
| 52 | | File | Purpose | Testable Logic | | ||
| 53 | |------|---------|----------------| | ||
| 54 | | `main/touch.h/c` | AXS15231B I2C touch driver | Coordinate parsing | | ||
| 55 | | `main/keyboard.h/c` | On-screen keyboard rendering + hit detection | Layout, key lookup | | ||
| 56 | | `main/wifi_setup.h/c` | WiFi scan/select/connect flow | State machine | | ||
| 57 | | `tests/unit/test_touch.c` | Touch coordinate decode | Pure math | | ||
| 58 | | `tests/unit/test_keyboard.c` | Key layout + hit detection | Pure logic | | ||
| 59 | | `tests/unit/test_wifi_setup.c` | Setup state machine | State transitions | | ||
| 60 | |||
| 61 | ## Config Extension | ||
| 62 | Add `tollgate_config_add_wifi(const char *ssid, const char *password)` to `config.c` - rewrites `/spiffs/config.json`. | ||
| 63 | |||
| 64 | ## Display Extension | ||
| 65 | Add `DISPLAY_WIFI_SETUP` to `display_state_t`. | ||
| 66 | |||
| 67 | ## Implementation Checklist | ||
| 68 | |||
| 69 | ### Phase 1: Touch Driver | ||
| 70 | - [ ] Create `main/touch.h` with API | ||
| 71 | - [ ] Create `main/touch.c` with ESP-IDF I2C v5 implementation | ||
| 72 | - [ ] Create `tests/unit/test_touch.c` with coordinate parsing tests | ||
| 73 | - [ ] Run `make test-unit`, verify all pass | ||
| 74 | |||
| 75 | ### Phase 2: On-Screen Keyboard | ||
| 76 | - [ ] Create `main/keyboard.h` with API | ||
| 77 | - [ ] Create `main/keyboard.c` with QWERTY layout + hit detection | ||
| 78 | - [ ] Create `tests/unit/test_keyboard.c` with layout + key lookup tests | ||
| 79 | - [ ] Run `make test-unit`, verify all pass | ||
| 80 | |||
| 81 | ### Phase 3: WiFi Setup Flow | ||
| 82 | - [ ] Create `main/wifi_setup.h` with API | ||
| 83 | - [ ] Create `main/wifi_setup.c` with scan/list/connect state machine | ||
| 84 | - [ ] Add `tollgate_config_add_wifi()` to config.c + config.h | ||
| 85 | - [ ] Create `tests/unit/test_wifi_setup.c` with state machine tests | ||
| 86 | - [ ] Run `make test-unit`, verify all pass | ||
| 87 | |||
| 88 | ### Phase 4: Integration | ||
| 89 | - [ ] Add `DISPLAY_WIFI_SETUP` to display.h | ||
| 90 | - [ ] Update display.c with WiFi setup rendering + touch input | ||
| 91 | - [ ] Update `main/CMakeLists.txt` with new source files | ||
| 92 | - [ ] Build, flash to Board C, verify full flow | ||