Commit Graph
5 Commits
Author SHA1 Message Date
swaitsandClaude Opus 4.7 334666b6e7 chore: bump hsmc 0.5.1 → 0.6.0
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-04 15:53:11 -06:00
swaits 8cb071b132 feat: defmt-over-RTT debug build + probe-rs flow
Add an opt-in `defmt` feature that swaps panic-reset for panic-probe,
links defmt-rtt, and enables hsmc's `trace-defmt` so chart transitions
print over RTT. Default builds are unchanged (still panic-reset, no
defmt overhead).

- Cargo.toml: `defmt` feature pulls defmt + defmt-rtt + panic-probe
  and forwards `trace-defmt` to hsmc; mirror-flag pattern matches
  the existing `embassy` feature.
- build.rs: link `defmt.x` only when the feature is on.
- src/main.rs: cfg-gate the panic handler swap, log boot, USB
  serial, kbd/mouse wake completion vs. deadline, and jiggle dx/dy.
- main.rs: watchdog.pause_on_debug(true) so probe-rs halts don't
  trip the 8 s reset.
- justfile: build-debug, debug, attach, probes recipes
  (release mode — debug builds overflow flash with defmt+panic-probe).
- mise.toml: add cargo:probe-rs-tools.
2026-05-04 12:57:31 -06:00
swaitsandClaude Opus 4.7 d0d9c451aa chore: cut 0.2.0 — README, LICENSE, publish metadata, runtime tune, USB identity, F13
Release-prep work for a publish-worthy 0.2.0:

- LICENSE: MIT, © 2026 Stephen Waits.
- README.md: tagline, what-it-does, hardware, build/flash recipes,
  ASCII statechart overview, "Why four hours…" runtime-tuning rationale,
  USB identity section.
- Cargo.toml: 0.1.0 → 0.2.0; description, license, repository, readme,
  keywords, categories; publish = false (firmware, not a library);
  release profile tightened (lto = "fat", opt-level = "z", panic =
  "abort"). Flashed binary stays 47 KB; the size knobs are explicit
  rather than relying on defaults.
- CHANGELOG.md: collapse Unreleased → [0.2.0] - 2026-05-01.
- scripts/tune_runtime.py: 4-D Monte Carlo over (RUN_DURATION, YELLOW_AT,
  RED_AT, FAST_RED_AT). PEP 723 inline deps so `uv run` just works.

Runtime + LED thresholds re-derived from a typical office workday
distribution with a per-minute press-on-warning user model. Joint
optimum:

  RUN_DURATION:                                          4h00m
  YELLOW_AT  / RED_AT  / FAST_RED_AT  (min remaining):   30 / 25 / 20

USB identity:

  VID/PID:      046d:c07d (G502)  →  1209:b0b0 (pid.codes)
  manufacturer: "Logitech"        →  "swaits.com"
  product:      "G502 Mouse"      →  "jiggly"
  bcdDevice:    default 0x0010    →  0x0200 (matches firmware version)
  serial:       (none)            →  RP2040 chip ID as 16 hex chars

Bug fix in the descriptor change: an interim version spoofed the
Logitech Unifying Receiver (046d:c52b). On Linux, `hid-logitech-dj`
matches that exact PID and tries to talk Logitech's HID++ protocol to
enumerate paired wireless devices. The firmware doesn't speak HID++,
so the driver waits through ~10–20 s of control-transfer timeouts on
every plug before unbinding and letting `hid-generic` actually start
polling. macOS has no such driver and was always fast. Moving to a
pid.codes VID routes the device straight to `hid-generic`.

Wake key: tapped Left Shift in early versions to wake the host. In
practice that turned out to be exactly the nightmare scenario it
sounds like — if the deadline preempted the loop between a Shift-down
report and its Shift-up, the host would silently capitalise every
keystroke from the user's real keyboard until the device was unplugged.
Switched to F13: still wakes any modern OS, but no mainstream OS maps
F13 by default, so a stuck F13 has zero visible effect. Also added an
unconditional all-keys-released cleanup report at the end of the wake
action, bounded by KBD_RELEASE_DEADLINE = 100 ms, so even a deadline
that fires mid-press can't leave anything held.

Wake refactor: WakingWithKeyboard and WakingWithMouse use oneshot
`entry:` actions that race their work against an internal deadline via
`embassy_futures::select`; the chart timer (`on(after KBD_PHASE_DURATION)`
/ `on(after MOUSE_PHASE_DURATION)`) advances. Removes a class of "slow
USB ⇒ chart stalls" failure modes from the wake path.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-01 22:32:17 -06:00
swaitsandClaude Opus 4.7 3f75514d9c feat: hsmc statechart rewrite with wake/run/shutdown animations
- Pull the entire device lifecycle into a single hsmc 0.5.1 statechart;
  remove JIGGLE_FLAG, the Phase enum, the imperative main loop, and the
  separate led_task.
- Add wake-up (horizontal shake), running (3 fast circles), and
  pre-shutdown (inward spiral) mouse animations as during: activities.
- Tighten reset → wake-shake latency from ~2s to ~240ms; HID poll_ms
  60 → 8 so the host actually samples animation frames.
- Set RUN_DURATION = 3h50m, the math-optimum under the user's workday
  distribution for "screen sleeps during lunch on most days."

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-29 11:35:00 -06:00
swaitsandClaude Opus 4.7 0032d01638 feat: initial Xiao RP2040 mouse jiggler firmware
Embassy-based no_std firmware for the Seeed Studio Xiao RP2040 that
masquerades as a Dell MS116 USB HID Boot Mouse. Each cycle picks a
random axis from the RP2040 ROSC RANDOMBIT register, nudges +1 px,
dwells 25 ms, nudges -1 px, then sleeps 4.5 minutes. After 8 hours
elapsed from boot or RESET press the device idles silently (watchdog
still fed) until the user taps RESET (R) again, aligning a single
press with one workday.

Tooling:
- mise.toml pins rust 1.95.0 with explicit components and the
  thumbv6m-none-eabi target, plus cargo-binutils / uf2conv helpers.
- justfile shell is set to "mise exec -- sh -eu -c" so every recipe
  uses the pinned toolchain without any shell activation.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-27 14:59:30 -06:00