upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorYour Name <you@example.com>2026-05-19 02:44:17 +0530
committerYour Name <you@example.com>2026-05-19 02:44:17 +0530
commit2ad2ed45f3ca82b1244a8b9e3e5efa89502413a9 (patch)
tree0f423dce2c22f8483b0c9f3c1bb642bf9ea5b01b /docs
parenta09be62cfab9a1d7f37c697c44c71aed70536e8c (diff)
feat: WPA auto-detect, STA connectivity fix, lwip crash fix
- Add wifi_auth_mode config field (WPA2/WPA3) parsed from config.json - Default to WPA2 (accepts both WPA2 and WPA3 networks) - Replace hardcoded WIFI_AUTH_WPA3_PSK with runtime threshold mapping - Reduce MINT_HEALTH_PROBE_INTERVAL_S from 300 to 30 for testing - Add 3s delay before service start + 5s DNS stabilization for health probes - Fixes lwip mem_free crash caused by concurrent HTTP at boot Verified on hardware: - STA connects to WPA2 home router (Got IP:192.168.2.16) - All 4 mint health probes complete successfully - API endpoints return correct data with reachable mint filtering - 4/4 wallets initialized with real keysets from live mints
Diffstat (limited to 'docs')
-rw-r--r--docs/WPA-AUTO-DETECT-PLAN.md66
1 files changed, 66 insertions, 0 deletions
diff --git a/docs/WPA-AUTO-DETECT-PLAN.md b/docs/WPA-AUTO-DETECT-PLAN.md
new file mode 100644
index 0000000..90ce681
--- /dev/null
+++ b/docs/WPA-AUTO-DETECT-PLAN.md
@@ -0,0 +1,66 @@
1# WPA Auto-Detect + STA Connectivity Fix
2
3## Problem
4
5`config.c:322` hardcodes `WIFI_AUTH_WPA3_PSK` as the STA auth threshold. The home
6router (`EnterSSID-2.4GHz`) uses **WPA2**, so the ESP32 silently refuses
7association and never gets internet. This blocks health probes, real payments,
8and all downstream testing.
9
10## Solution
11
12### 1. Runtime WPA Threshold (Firmware)
13
14Add `wifi_auth_mode` field to `tollgate_config_t`. Parse it from `config.json`
15as a string (`"WPA2"`, `"WPA3"`, `"WPA2_WPA3"`). Map to ESP-IDF
16`wifi_auth_mode_t` enum at runtime. Default to `WIFI_AUTH_WPA2_PSK` which
17accepts both WPA2 and WPA3 networks.
18
19### 2. Makefile Auto-Detect (Build Time)
20
21Add Makefile targets that scan WiFi with `nmcli`, detect WPA2 vs WPA3, and
22generate a SPIFFS image with the correct `wifi_auth_mode` baked into
23`config.json`.
24
25### 3. Reduced Probe Interval (Testing)
26
27Temporarily reduce `MINT_HEALTH_PROBE_INTERVAL_S` from 300 to 30 so health
28probes actually fire during short board uptime windows.
29
30## Files Changed
31
32| File | Change |
33|------|--------|
34| `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()` |
36| `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 |
38
39## Checklist
40
41### Firmware Changes
42- [ ] 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"`
44- [ ] 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`
46- [ ] Reduce `MINT_HEALTH_PROBE_INTERVAL_S` from 300 to 30 in `mint_health.h`
47
48### Makefile Auto-Detect
49- [ ] Add `_detect-wpa-security` target (nmcli scan → extract WPA mode for SSID)
50- [ ] Add `generate-spiffs` target (create config.json → spiffsgen.py)
51- [ ] Add `flash-spiffs-a`, `flash-spiffs-b`, `flash-spiffs-c` targets
52- [ ] Wire `flash-{a,b,c}` to auto-generate SPIFFS before flashing
53
54### Build & Test
55- [ ] Build firmware — `idf.py build` passes
56- [ ] Unit tests pass — `make test-unit`
57- [ ] Wait for board unlock (no force-unlock)
58- [ ] Lock board, flash firmware + SPIFFS
59- [ ] Verify STA connects via serial (`Got IP:192.168.x.x`)
60- [ ] Verify health probes fire and mints show `reachable: true`
61- [ ] Run integration test suite
62- [ ] Test 6 previously-skipped scenarios
63
64### Commit
65- [ ] Commit all changes with descriptive message
66- [ ] Push when Nostr relay recovers