Lainandlain 5bbd2fe6cc fix(m1): drive wifi reconnect through the disconnect event (#4)
## Fix

The M1 soak (m1-20260831, PR #3) found console `wifi reconnect` never
returns to CONNECTED: **0/5 soak cycles + 0/1 controlled repro = 0/6**.
Root cause: `wifi_service.cc reconnect()` called `esp_wifi_connect()`
while the STA was still associated — IDF v6 rejects it (`sta is
connected, disconnect before connecting to new ap`), no
`WIFI_EVENT_STA_DISCONNECTED` fires, so the event-driven retry never
engaged and the app stayed CONNECTING indefinitely.

`reconnect()` now calls `esp_wifi_disconnect()`; the existing disconnect
handler drives `esp_wifi_connect()` while `configured_`. Already-idle
(`ESP_ERR_WIFI_NOT_CONNECT`) keeps a direct connect.
`connect_sta`/`initialize`/portal paths unchanged (already disconnect
first).

## On-device re-verify (fixed build, /dev/ttyACM0)

- **3/3 cycles** `wifi reconnect` → CONNECTED again in **~10s**, same IP
restored (192.168.50.178); telemetry `CONNECTED→DISCONNECTED→CONNECTED`
per cycle proves the handler path (DISCONNECTED state is only set by the
event handler); IDF log shows `state: init→auth→assoc→run` → `connected`
→ `sta ip:`; zero `Reconnect failed:` warnings. [PASS-fix-cycle-1..3]
- Boot regression: auto-connect GOT_IP, JSONL `ap_setup:false`,
`tf_logging:true`. [PASS-fix-boot]

## Evidence amendment

`poc/evidence/m1-20260831/manifest.json`: verdict FAIL → **PASS** with
the fix commit recorded (`d084276`) and re-verify stats added to
metrics; soak artifacts and the historical FAIL notes kept unchanged.
`frame-evidence` green.

Diff: 5 insertions / 1 deletion in `wifi_service.cc` + manifest note.

---------

Co-authored-by: ania-lain <[email protected]>
2026-08-31 11:45:42 +08:00

Frame

CI Nightly CodeQL

Draft / PoC: the v4.2 architecture and hardware gates are not signed off. Green cloud CI does not mean M1, PoC-A through PoC-E, power-cut durability, or production security has passed.

Frame is an ESP32-S3 firmware project exploring an embedded plugin architecture. The repository contains the product firmware skeleton, isolated architecture proofs of concept, host-side contract tests, and repository validation tools.

The firmware currently targets the Waveshare ESP32-S3-RLCD-4.2 (N16R8) with ESP-IDF v6.0.2 and requires a toolchain that provides C++26 mode. The custom 16 MiB flash layout contains two OTA slots, core-dump storage, encrypted NVS, internal plugin storage, and system storage. Signed plugin resources live on a dedicated FAT32 TF card; dynamic plugins do not start without it.

Repository Layout

  • main/ contains the firmware entry point.
  • components/ contains product firmware components.
  • poc/ contains isolated architecture proofs of concept and host contract tests.
  • plugins/ is reserved for plugin build inputs; installed code is content-addressed at runtime.
  • tools/frame_tools/ contains local repository gate commands.

Firmware Build

Install CMake 3.25 or newer and Ninja, then export an ESP-IDF checkout at the exact v6.0.2 tag. The checked-in presets target esp32s3 and keep generated configuration under .build/.

. "$IDF_PATH/export.sh"
cmake --preset dev
cmake --build --preset dev

Use the production defaults with:

. "$IDF_PATH/export.sh"
cmake --preset prod
cmake --build --preset prod

Production builds are build artifacts, not release attestations. Hardware validation and signing remain separate release concerns.

Host Tests

The host project is a plain CMake/CTest suite. It does not build ESP32 firmware.

cmake -S poc/host -B .build/poc-host -DENABLE_SANITIZERS=ON
cmake --build .build/poc-host
ctest --test-dir .build/poc-host --output-on-failure

Repository Gates

Python 3.11 or newer and uv are required.

uv sync --frozen
uv run ruff format --check tools tests
uv run ruff check tools tests
uv run pyright
uv run pytest
uv run frame-partitions
uv run frame-evidence
uv run frame-doc-links
uv run frame-sbom --output .build/reports/sbom.cdx.json

CI also runs an independent ThreadSanitizer build and enforces at least 90% LLVM branch coverage for the shared ABI, handle, and lifecycle contract headers.

Evidence manifests placed in poc/evidence/ are validated against the existing poc/evidence/schema.json. The schema itself is always checked, including when no manifests have been collected yet.

Contributing And Security

Read CONTRIBUTING.md before submitting a change. Report security issues through GitHub private vulnerability reporting as described in SECURITY.md. Community participation is governed by CODE_OF_CONDUCT.md.

License

Except where a file or third-party component states otherwise, this project is licensed under the GNU General Public License, version 3 or later. See LICENSE and NOTICE.

S
Description
ESP32-S3 plugin-architecture firmware research: M1 hardware-status slice, host contract tests, and gated PoCs (Waveshare ESP32-S3-RLCD-4.2)
Readme GPL-3.0
7.4 MiB
Languages
C++ 46.1%
Python 26.3%
C 18.6%
CMake 8%
Pawn 1%