fix: transfer-mode exit bugs + refresh wasm sim harness (4.0.1) - #141
Merged
Conversation
…n manual BLE exit Two 4.0.0 transfer-mode exit bugs, slated for 4.0.1: USB: USB_MSC_DISABLE() raced the USBD task. setUnitReady(false) only refuses NEW SCSI commands, and the exit quiesce tracked write-callback ENTRY times only — so an in-flight READ10/WRITE10 (reads were never tracked at all, and a writeSectors() can stall 100 ms–2 s on SD garbage collection) was still driving SdFat on the USBD task while the main loop ran syncDevice() on the same SPI bus. The wedge came back via the ~4 s watchdog instead of the clean reset. Now the exit detaches USB first (so host traffic actually stops), tracks in-flight state + completion time around all three block callbacks, and drains WDT-fed for up to 4 s before syncing and resetting. BLE: only a phone disconnect triggered the transfer auto-reboot; the on-device Exit button just BLE_STOP()'d back to the menu, so settings written over BLE silently didn't apply until the next power cycle. New bleExitTransferMode() (BLE_STOP + the same 100 ms-delay reset) makes both ways out of transfer mode reboot, matching USB. The SIM stub returns after stopping so the golden menu walk still exits the Bluetooth page. Both fixes are TinyUSB/Bluefruit-bound (no host-testable pure logic); goldens, boot soak, and lap oracles verified unchanged. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014rqEnPQUqhMj98sgkefJkz
…ggle The browser test harness (wasm/test.html) had fallen behind the firmware: - dovex playback filtered rows to exactly 13 columns, so 4.0.0 logs (16 columns after Temp1/Junction1/Temp2) injected nothing. Accept >=13 and read the stable first 13. - Nothing could satisfy the course creator's fix + time-lock entry gate interactively. New "GPS fix" toggle + mph field: a deterministic synthetic 25 Hz fix parked on the bundled OKC track's start line, injected one PVT per <=40 ms step slice (a burst before one big step collapses into a single fix and starves the creator's >=8-fix averaging hold). Loading a dovex unchecks the toggle — playback owns the GPS feed. Verified against a fresh emsdk 3.1.61 wasm build (DovesLapTimer BETA, matching this PR's CI): node smoke passes, and a scripted walk using the harness's exact injection pattern reaches the creator through the OKC track prompt and commits a real 3 s point-averaging hold. Also ignore build-wasm/ (the emcmake build dir CI uses). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014rqEnPQUqhMj98sgkefJkz
Coverage — host-testable units📂 Overall coverage
📄 File coverage
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two 4.0.0 transfer-mode exit bugs plus a browser-sim harness refresh, slated for 4.0.1 (see the new
[Unreleased]CHANGELOG section):USB_MSC_DISABLE()raced the USBD task:setUnitReady(false)only refuses new SCSI commands, and the pre-reset quiesce stamped write-callback entry times only — reads were never tracked at all. An in-flightREAD10/WRITE10(a singlewriteSectors()can stall 100 ms–2 s inside SD garbage collection, blowing past both the 100 ms quiet window and the 1 s cap) was still driving SdFat on the USBD task while the main loop ransyncDevice()on the same SPI bus — two tasks in SdFat wedged the card, and the ~4 s WDT fired. The exit now detaches USB first (so host traffic actually stops), tracks an in-flight flag + completion time around all three block callbacks (reads and flush included), and drains WDT-fed for up to 4 s before syncing and resetting.BLE_STOP()'d back to the menu, so settings written over BLE silently didn't apply until the next power cycle. NewbleExitTransferMode()(BLE_STOP()+ the same 100 ms-delayNVIC_SystemReset()) is wired into both exit sites, so both ways out of both transfer modes reboot. The SIM stub returns after stopping the radio so the golden menu walk still exits the Bluetooth page.sim/wasm/test.html, no firmware code): dovex playback filtered rows to exactly 13 columns, so 4.0.0 logs (16 columns afterTemp1/Junction1/Temp2) injected nothing — now accepts ≥13. And a new "GPS fix" toggle + mph field streams a deterministic synthetic 25 Hz fix parked on the bundled OKC track's start line (one PVT per ≤40 ms step slice — a burst would starve the creator's ≥8-fix averaging hold), making fix-gated flows reachable in the browser — most usefully the course creator, which previously couldn't be entered in the sim at all.FIRMWARE_VERSIONstays at 4.0.0 — the version stamp happens at release cut per convention.Type of change
build-wasm/gitignore)How it was verified
ctest --test-dir tests/build)clang-tidyclean — left to CI (no local toolchain in this session)Also verified: all 16 sim golden fixtures (the walk exits the Bluetooth page through the changed handler), the 60 s boot soak, and both lap oracles (synthetic + hardware
.dovex) pass unchanged. The wasm artifact was rebuilt locally with CI's exact toolchain (emsdk 3.1.61, DovesLapTimerBETA): node smoke passes, and a scripted walk using the harness's exact injection pattern reaches the course creator through the OKC track prompt and commits a real 3 s point-averaging hold.Checklist
CHANGELOG.mdupdated under[Unreleased](if user-visible)ARCHITECTURE.md/CLAUDE.mdupdated (if a module or interface changed)tests/— none feasible: the firmware fixes are TinyUSB/Bluefruit-bound glue (matching the existing "no pure unit test" posture for these modules) and the harness is browser-side JSsim/wasm/test.html+ docsRelated issues
Field reports: USB-exit crash recovered by watchdog; BLE settings not applying after manual Exit.
🤖 Generated with Claude Code
https://claude.ai/code/session_014rqEnPQUqhMj98sgkefJkz