Skip to content

Harden FTMS control point, restructure tests, refresh README and project docs - #3

Merged
antomanc merged 3 commits into
mainfrom
chore/hardening-and-docs
Oct 10, 2026
Merged

antomanc merged 3 commits into
mainfrom
chore/hardening-and-docs

Conversation

@antomanc

@antomanc antomanc commented Oct 10, 2026 •

Copy link
Copy Markdown
Owner

Follow-up hardening plus a README and project-docs refresh in the style of agbox/aginit.

Firmware

  • Locked Control Point state: cpTxState / pendingCp are shared by loop() and the NimBLE host task; they are now read and changed only inside a portMUX critical section, with BLE/Serial calls made after leaving it.
  • Response race: the bridge now enters WAITING_RESPONSE before writing to the trainer. Previously a trainer reply delivered before writeValue returned was dropped, and the command then timed out.
  • Start/Resume forwarded to the trainer from loop() (apps still get the immediate local response, as before).
  • Header comment corrected (+9 dBm, brownout detector disabled).

Tests, CI, tooling

  • tests/firmware_test.cpp split into 22 named tests with a CHECK macro (survives NDEBUG, prints the failing test). New: Start forwarding, response-before-write-returns. Both verified to fail on the previous firmware.
  • tests/run.sh: -Werror, SANITIZE=1 for ASan + UBSan (leak checks included).
  • Makefile: check, test, sanitize, deps, compile, upload, monitor.
  • CI renamed to ci.yml: separate sanitized host-test and firmware-compile jobs, actions/checkout@v7, push runs only on main (no duplicate PR runs).

Docs

  • README rewritten: pitch, Why, What you get, Quick start, Configure table, Serial console, Design, Development.
  • Technical details moved to docs/how-it-works.md; tests/VALIDATION.md → docs/testing.md with coverage and the hardware checklist.
  • Added AGENTS.md, CONTRIBUTING.md, CHANGELOG.md.

Validation

  • make sanitize: PASS (22 tests). CI: host tests + firmware compile pass, no warnings. Flash 628,308 B (47%), RAM 37,188 B (11%).
  • Hardware not tested. See the checklist in docs/testing.md.

https://claude.ai/code/session_01Dgkv5W86Zhd8Rv27uCE3rj

Antonio Mancini added 2 commits October 10, 2026 12:44
…art/Resume

- Guard the Control Point transaction state shared by loop() and the NimBLE
  host task with a portMUX; BLE and Serial calls stay outside the lock.
- Enter WAITING_RESPONSE before writing to the trainer, so a response that
  arrives before writeValue returns is no longer dropped (then timed out).
- Forward Start/Resume to the trainer from loop(); apps still get the
  immediate local response.
- Restructure host tests into named cases with a CHECK macro that survives
  NDEBUG; add a Makefile (make check/test/compile/upload) and split CI into
  sanitized host tests and the firmware compile.

Claude-Session: https://claude.ai/code/session_01Dgkv5W86Zhd8Rv27uCE3rj
@antomanc
antomanc marked this pull request as ready for review October 10, 2026 10:47
@antomanc
antomanc merged commit 6d2b33a into main Oct 10, 2026
2 checks passed
@antomanc
antomanc deleted the chore/hardening-and-docs branch October 10, 2026 10:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant