Files
frame/poc/apps/m1_hardware/README.md
T
lainandSisyphus 5f7c60c899 feat(m1): hardware status firmware with wifi web provisioning
Add the M1 milestone tree under poc/ (m1_hardware + poc_a apps,
shared common components, evidence schema). Merges the plan's
'm1 baseline+fixes' and 'wifi provisioning' batches: the poc/ tree is
entirely untracked and both concerns share files.

M1 hardware baseline:
- landscape ST7305 RIP display via LVGL I1 driver
- TF-card status log: JSONL telemetry with CRC32C per line; append
  buffer widened to line[640] after the 512-byte truncation defect
  (payload ~550B with real values) was root-caused on-device
- PCF85063 RTC read, SHTC3 temperature/humidity with plausibility
  checks, KEY input with short/long/portal press thresholds
- boot-time partition identity check and M1-002 boot record fields
  (device_id, image_sha256, reset_reason, services status)

WiFi web provisioning:
- softAP portal Frame-Setup-xxxx with HTTP endpoints /scan, /connect,
  /clear; httpd handlers never call httpd_stop (deadlock hazard) — a
  1s monitor task executes stop/start/connect actions
- credentials persist to system_fs wifi.json (littlefs) per the
  SEC-010 development exception (plaintext, documented in _doc)
- fallback: 5 disconnects without IP or 60s no-IP -> stop retry,
  portal returns; GOT_IP tears the AP down
- KEY >=3s hold requests the portal; prov start/stop/status console
  commands; ap_active/ap_mode_requested surfaces in status JSON/text

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <[email protected]>
2026-08-31 08:01:37 +08:00

2.3 KiB

Frame M1 Hardware Firmware

This isolated ESP-IDF application implements the 0.1.0-dev.1 hardware-status vertical slice for the Waveshare ESP32-S3-RLCD-4.2 N16R8 board. It does not load dynamic plugins.

It checks the ESP32-S3 target, 16 MiB flash, 8 MiB PSRAM, ST7305 display, shared I2C RTC/SHTC3, active-low KEY, SDMMC TF card transitions, Wi-Fi STA configuration with softAP web provisioning, native landscape 400x300 display output, and USB Serial/JTAG console output.

Wi-Fi provisioning persists the last credentials as plaintext JSON at /system/wifi.json on the internal system_fs partition. This is a user-approved development-board exception (SEC-010, recorded in _doc/requirements-v4.2.md under M1-007): ESP-IDF v6.0.2 requires Flash Encryption or an HMAC eFuse key to protect NVS encryption keys, and both provisioning steps are irreversible on the single development board. Production boards must switch to NVS-encrypted credential storage before shipping. The password never appears in UART output, logs, or status.

On boot the device auto-connects with the saved credentials. When no valid configuration exists, or after 5 disconnects without an IP address or 60 seconds without obtaining one, it starts an open setup hotspot Frame-Setup-XXXX at 192.168.4.1. The portal's network list is populated from a live scan; hidden networks cannot be typed into the browser form — configure those through the console with wifi set <ssid> hidden. Holding KEY for 3 seconds or longer also requests the setup hotspot; such a hold is a portal command and does not count as a button press.

Build with the exact IDF tag:

. "$IDF_PATH/export.sh"
cmake --preset default --fresh
cmake --build --preset default

The console is available through USB Serial/JTAG at 115200 baud. Useful commands:

status [--json]
wifi set <ssid> [hidden]
wifi clear
wifi reconnect
wifi status
prov status
prov start
prov scan
storage probe
storage status
selftest

Do not place real credentials in command transcripts or committed evidence. wifi set asks for the password after parsing the command so it is not stored in command history; terminal software must also keep local echo disabled. The password is persisted only inside /system/wifi.json under the SEC-010 development-board exception and is never echoed back.