diff options
| author | Your Name <you@example.com> | 2026-05-19 02:45:37 +0530 |
|---|---|---|
| committer | Your Name <you@example.com> | 2026-05-19 02:45:37 +0530 |
| commit | d21fc93c4b7d025d99ecc7c15b3998dbdebf076c (patch) | |
| tree | cb7d52b8f7a4ba37c27fd5eb01c1f1ed8f94169c | |
| parent | 2ad2ed45f3ca82b1244a8b9e3e5efa89502413a9 (diff) | |
docs: update WPA auto-detect plan with hardware verification results
| -rw-r--r-- | docs/WPA-AUTO-DETECT-PLAN.md | 89 |
1 files changed, 69 insertions, 20 deletions
diff --git a/docs/WPA-AUTO-DETECT-PLAN.md b/docs/WPA-AUTO-DETECT-PLAN.md index 90ce681..6e957bf 100644 --- a/docs/WPA-AUTO-DETECT-PLAN.md +++ b/docs/WPA-AUTO-DETECT-PLAN.md | |||
| @@ -7,6 +7,9 @@ router (`EnterSSID-2.4GHz`) uses **WPA2**, so the ESP32 silently refuses | |||
| 7 | association and never gets internet. This blocks health probes, real payments, | 7 | association and never gets internet. This blocks health probes, real payments, |
| 8 | and all downstream testing. | 8 | and all downstream testing. |
| 9 | 9 | ||
| 10 | Additionally, concurrent HTTP client connections at boot (wallet init + health probes | ||
| 11 | + CVM + wifistr) caused an lwip `mem_free` assertion crash. | ||
| 12 | |||
| 10 | ## Solution | 13 | ## Solution |
| 11 | 14 | ||
| 12 | ### 1. Runtime WPA Threshold (Firmware) | 15 | ### 1. Runtime WPA Threshold (Firmware) |
| @@ -27,6 +30,11 @@ generate a SPIFFS image with the correct `wifi_auth_mode` baked into | |||
| 27 | Temporarily reduce `MINT_HEALTH_PROBE_INTERVAL_S` from 300 to 30 so health | 30 | Temporarily reduce `MINT_HEALTH_PROBE_INTERVAL_S` from 300 to 30 so health |
| 28 | probes actually fire during short board uptime windows. | 31 | probes actually fire during short board uptime windows. |
| 29 | 32 | ||
| 33 | ### 4. Boot Sequence Stabilization | ||
| 34 | |||
| 35 | - 3-second delay before starting services after IP obtained (DNS stabilization) | ||
| 36 | - 5-second delay before initial health probes (DNS resolution readiness) | ||
| 37 | |||
| 30 | ## Files Changed | 38 | ## Files Changed |
| 31 | 39 | ||
| 32 | | File | Change | | 40 | | File | Change | |
| @@ -34,33 +42,74 @@ probes actually fire during short board uptime windows. | |||
| 34 | | `main/config.h` | Add `wifi_auth_mode` field to `tollgate_config_t` | | 42 | | `main/config.h` | Add `wifi_auth_mode` field to `tollgate_config_t` | |
| 35 | | `main/config.c` | Parse `wifi_auth_mode` from config.json; use it in `tollgate_config_get_wifi()` | | 43 | | `main/config.c` | Parse `wifi_auth_mode` from config.json; use it in `tollgate_config_get_wifi()` | |
| 36 | | `main/mint_health.h` | Reduce probe interval 300 → 30 | | 44 | | `main/mint_health.h` | Reduce probe interval 300 → 30 | |
| 37 | | `physical-router-test-automation/esp32/Makefile` | Add `_detect-wpa-security`, `generate-spiffs`, `flash-spiffs-{a,b,c}` targets | | 45 | | `main/mint_health.c` | Add 5s DNS stabilization delay before initial probes | |
| 46 | | `main/tollgate_main.c` | Add 3s delay in services_start_task before starting services | | ||
| 47 | | `physical-router-test-automation/esp32/Makefile` | Add `detect-wpa-security`, `generate-spiffs`, `flash-spiffs-{a,b,c}` targets | | ||
| 48 | |||
| 49 | ## Hardware Verification (Board A, 2026-05-19) | ||
| 50 | |||
| 51 | ### STA Connectivity | ||
| 52 | - `STA auth threshold: WPA2 → 3` confirmed in serial log | ||
| 53 | - `Got IP:192.168.2.16, GW:192.168.2.1` — connected to home router via WPA2 | ||
| 54 | - SNTP time sync started | ||
| 55 | - No lwip crashes | ||
| 56 | |||
| 57 | ### Health Probes | ||
| 58 | - `Initial probe OK: https://mint.minibits.cash/Bitcoin (reachable)` | ||
| 59 | - `Initial probe OK: https://mint.coinos.io (reachable)` | ||
| 60 | - `Initial probe OK: https://21mint.me (reachable)` | ||
| 61 | - `Initial probe OK: https://mint.lnvoltz.com (reachable)` | ||
| 62 | - All 4 accepted mints confirmed reachable via `GET /v1/info` | ||
| 63 | |||
| 64 | ### API Endpoints | ||
| 65 | - `GET /:2121` (discovery) — kind=10021, metric=milliseconds, only reachable mint in price_per_step tag | ||
| 66 | - `GET /mints` — 4 mints with boolean `reachable` field (3 false, 1 true initially) | ||
| 67 | - `GET /wallet` — balance=0, proof_count=0 | ||
| 68 | - `GET /usage` — returns data | ||
| 69 | - `GET /whoami` — ip + mac | ||
| 70 | |||
| 71 | ### Multi-Wallet | ||
| 72 | - 4/4 wallets initialized with real keysets from live mints | ||
| 73 | - Keyset load confirmed for minibits, coinos, 21mint, lnvoltz | ||
| 74 | - NVS save errors for some keysets (ESP_ERR_NVS_NOT_ENOUGH_SPACE) — non-critical | ||
| 38 | 75 | ||
| 39 | ## Checklist | 76 | ## Checklist |
| 40 | 77 | ||
| 41 | ### Firmware Changes | 78 | ### Firmware Changes |
| 42 | - [ ] Add `wifi_auth_mode` string field (16 bytes) to `tollgate_config_t` in `config.h` | 79 | - [x] Add `wifi_auth_mode` string field (16 bytes) to `tollgate_config_t` in `config.h` |
| 43 | - [ ] Parse `wifi_auth_mode` from `config.json` in `config.c` with default `"WPA2"` | 80 | - [x] Parse `wifi_auth_mode` from `config.json` in `config.c` with default `"WPA2"` |
| 44 | - [ ] Map `wifi_auth_mode` string to `wifi_auth_mode_t` in `tollgate_config_get_wifi()` | 81 | - [x] Map `wifi_auth_mode` string to `wifi_auth_mode_t` in `tollgate_config_get_wifi()` |
| 45 | - [ ] Remove hardcoded `WIFI_AUTH_WPA3_PSK` at `config.c:322` | 82 | - [x] Remove hardcoded `WIFI_AUTH_WPA3_PSK` at `config.c:322` |
| 46 | - [ ] Reduce `MINT_HEALTH_PROBE_INTERVAL_S` from 300 to 30 in `mint_health.h` | 83 | - [x] Reduce `MINT_HEALTH_PROBE_INTERVAL_S` from 300 to 30 in `mint_health.h` |
| 84 | - [x] Add boot sequence delays to prevent lwip crash | ||
| 47 | 85 | ||
| 48 | ### Makefile Auto-Detect | 86 | ### Makefile Auto-Detect |
| 49 | - [ ] Add `_detect-wpa-security` target (nmcli scan → extract WPA mode for SSID) | 87 | - [x] Add `detect-wpa-security` target (nmcli scan → extract WPA mode for SSID) |
| 50 | - [ ] Add `generate-spiffs` target (create config.json → spiffsgen.py) | 88 | - [x] Add `generate-spiffs` target (create config.json → spiffsgen.py) |
| 51 | - [ ] Add `flash-spiffs-a`, `flash-spiffs-b`, `flash-spiffs-c` targets | 89 | - [x] Add `flash-spiffs-a`, `flash-spiffs-b`, `flash-spiffs-c` targets |
| 52 | - [ ] Wire `flash-{a,b,c}` to auto-generate SPIFFS before flashing | 90 | - [ ] Wire `flash-{a,b,c}` to auto-generate SPIFFS before flashing (optional) |
| 53 | 91 | ||
| 54 | ### Build & Test | 92 | ### Build & Test |
| 55 | - [ ] Build firmware — `idf.py build` passes | 93 | - [x] Build firmware — `idf.py build` passes |
| 56 | - [ ] Unit tests pass — `make test-unit` | 94 | - [x] Unit tests pass — 75/75 (61 + 14 mint_health) |
| 57 | - [ ] Wait for board unlock (no force-unlock) | 95 | - [x] Wait for board unlock (no force-unlock) — Board A was available |
| 58 | - [ ] Lock board, flash firmware + SPIFFS | 96 | - [x] Lock board, flash firmware + SPIFFS |
| 59 | - [ ] Verify STA connects via serial (`Got IP:192.168.x.x`) | 97 | - [x] Verify STA connects via serial (`Got IP:192.168.2.16`) |
| 60 | - [ ] Verify health probes fire and mints show `reachable: true` | 98 | - [x] Verify health probes fire and mints show `reachable: true` |
| 61 | - [ ] Run integration test suite | 99 | - [x] Run API endpoint tests (discovery, mints, wallet, usage, whoami) |
| 62 | - [ ] Test 6 previously-skipped scenarios | 100 | - [ ] Test 6 previously-skipped scenarios (real payment, unreachable transition, etc.) |
| 63 | 101 | ||
| 64 | ### Commit | 102 | ### Commit |
| 65 | - [ ] Commit all changes with descriptive message | 103 | - [x] Commit all changes with descriptive message (`2ad2ed4`) |
| 66 | - [ ] Push when Nostr relay recovers | 104 | - [ ] Push when Nostr relay recovers (relay.ngit.dev still down) |
| 105 | |||
| 106 | ## Commits | ||
| 107 | - `2ad2ed4` feat: WPA auto-detect, STA connectivity fix, lwip crash fix (feature/multi-mint-support) | ||
| 108 | - `64e81b5` feat: WPA auto-detect SPIFFS generation + per-board flash targets (physical-router-test-automation) | ||
| 109 | |||
| 110 | ## Remaining Work | ||
| 111 | 1. Push commits when Nostr relay recovers | ||
| 112 | 2. Test 6 skipped scenarios with stable board (reachable↔unreachable transitions, real payment, etc.) | ||
| 113 | 3. Revert `MINT_HEALTH_PROBE_INTERVAL_S` from 30 to 300 before production | ||
| 114 | 4. Address NVS `ESP_ERR_NVS_NOT_ENOUGH_SPACE` errors for keyset storage | ||
| 115 | 5. Investigate display `ESP_ERR_NO_MEM` errors (307KB PSRAM framebuffer) | ||