Skip to content

Hardware variants and Soft-AP programming mode - #2

Merged
keskad merged 5 commits into
mainfrom
feat/hardware-variants-programming
Aug 10, 2026
Merged

Hardware variants and Soft-AP programming mode#2
keskad merged 5 commits into
mainfrom
feat/hardware-variants-programming

Conversation

@keskad

@keskad keskad commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Build-time hardware variants (longfred-standard, longfred-mini, markwtech, heiko-wifred) with shared ControlSurface / UiShell / Presenter separation; LongFred standard and mini share one family module and differ only by OLED geometry.
  • Soft-AP programming mode (longfred_prog_XXXXXX, 192.168.0.1) with HTTP API (GET /, GET|PUT /api/v1/settings, POST /api/v1/programming-mode/off) and static pairing page; heiko auto-pairs when Wi-Fi NVS is empty.
  • Hardware docs, provisioning guide, and CI matrix producing per-variant firmware artifacts.

Test plan

  • cargo test -p longfred-proto --target x86_64-unknown-linux-gnu
  • cargo check -p longfred-firmware (default / standard)
  • cargo check -p longfred-firmware --no-default-features --features variant-longfred-mini
  • cargo check -p longfred-firmware --no-default-features --features variant-markwtech
  • cargo check -p longfred-firmware --no-default-features --features variant-heiko-wifred
  • CI builds all four variant artifacts
  • On hardware: Shift1+Stop (or variant chord) enters pairing AP; phone/static IP can load http://192.168.0.1/

Made with Cursor

keskad and others added 5 commits August 10, 2026 10:19
Separate ControlSurface / UiShell / Presenter per board family (LongFred
standard+mini, markwtech, heiko-wifred), add Shift+Stop pairing over
longfred_prog_* with HTTP settings API and config page, and build all
variants in CI.

Co-authored-by: Cursor <cursoragent@cursor.com>
- Add `[workspace.lints]` (rust + clippy) with `unsafe_code = warn`,
  `missing_docs = warn`, `unused_must_use = deny`, and deny lints for
  `unwrap_used`/`expect_used`/`panic`/`dbg_macro`/`todo`/`unimplemented`.
  Both crates adopt the policy via `[lints] workspace = true`.
- Add a `clippy` CI job that runs per-variant (mutually exclusive features
  cannot use `--all-features`); rustfmt check added to the `test` job.
- Replace `expect("WifiController::new")` in `main.rs` with a typed
  error path that logs and hangs instead of panicking.
- Add `SAFETY:` justification to each `unsafe { AnyPin::steal(...) }`
  block in `led_presenter.rs` (single-owner invariant established in
  `main` before any other task runs).
- Replace `apply_settings_put`'s `bool` return with a typed
  `ApplyError` enum; HTTP 400 now reports the offending field.
- Remove the no-op `UiShell` impl from `HeadlessShell` (the domain task
  uses `HeadlessShell::handle`, which returns `Intent`).
- Fix `MarkwtechNav`: `*` now maps to `Cancel` inside menus (previously
  `MenuEnter`), and to `MenuEnter` only on the throttle screen. Adds an
  `on_throttle: bool` parameter to `NavProfile::map`.
- Document `map_fn_key` `# Panics` and simplify the shift offset logic.
- Validate `LocoSlot(slot, ...)` at the `ControlSurface` boundary
  (ignore `slot == 0`) so downstream code does not repeat the check.
- Check `fmt::Write` result in `respond()` instead of `let _ =`.
- Add negative tests for `bigfred.login` and `roster.mode` mismatches
  in the wireless-programmer `longfred` driver.
- Document the `Content-Length` requirement and 1536-byte body limit
  in `docs/provisioning.md`.
- Apply `cargo fmt --all` to fix pre-existing formatting drift.

Co-authored-by: Cursor <cursoragent@cursor.com>
Makefile can build one or all hardware variants; CI verifies flash/RAM
against the C6 budget from uploaded artifacts without rebuilding.

Co-authored-by: Cursor <cursoragent@cursor.com>
Allow incremental missing_docs (matching CI), document crate roots, gate
test-only imports, and justify AnyPin::steal with SAFETY + allow(unsafe_code).

Co-authored-by: Cursor <cursoragent@cursor.com>
Add missing docs and SAFETY comments, gate test-only imports, and use
grep instead of rg in the size script so GitHub Actions has no extra deps.

Co-authored-by: Cursor <cursoragent@cursor.com>
@keskad
keskad merged commit 6a94c04 into main Aug 10, 2026
3 of 4 checks passed
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