fix(ble): carry the buzz repeat count into the 5/MG haptic body - #6
Open
c0dingnoobi wants to merge 1 commit into
Open
c0dingnoobi wants to merge 1 commit into
c0dingnoobi wants to merge 1 commit into
Conversation
RustCodec.buzzFrame takes only a seq, so overallLoop went out as 0 and every BuzzPattern gave a single identical pulse on a 5/MG. Build the body here and send it through the generic command builder instead. Verified on a WHOOP 5/MG: double, triple and long now differ.
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.
What this PR does
On a WHOOP 5/MG every
BuzzPatternproduced a single identical pulse — Single, Double, Triple and Long all felt the same, and the Breathe and live-session cues with them.WhoopBleClient.send()routed 5/MG haptics throughRustCodec.buzzFrame(seq), which takes only a sequence number. The caller's repeat count had nowhere to go, so the maverick body'soverallLoopbyte always went out as0— "no repeats" — which is exactly the one-buzz behaviour. The count was being discarded at the Kotlin/FFI boundary, not by the strap.This builds the haptic body in
WhoopBleClientand sends it through the genericcommandFramewith opcode0x13, soloopsreaches the wire.overallLoopcounts the repeats that follow the first pulse, so it is written asloops - 1.No
.sorebuild and no uniffi signature change: the generic builder already accepts an arbitrary opcode and payload, and pads the inner body to a 4-byte boundary, which this 12-byte body already satisfies.RustCodec.buzzFrameis left in place as the single-pulse byte reference.loops = 1reproduces the previously shipped constant byte for byte, so this only moves byte 11, and only when the caller asked for more than one pulse.Type of change
How it was tested
On a real WHOOP 5/MG: the notification patterns now differ from one another — Double gives two pulses, Triple three, Long a longer train. Before this change all four were a single identical buzz.
Unit tests:
MaverickHapticBodyTest(new, 5 cases, pure Kotlin — no FFI, so it runs without the hostlibwhoop_ffi) locks the body bytes:loops = 1reproduces the shipped constant012f98000000000000000000exactly, 2 → 1 repeat, 3 → 2, 5 → 4, clamping at 7, and a short payload falling back to a single pulse.WHOOP 4.0 is untouched — it keeps
RUN_HAPTICS_PATTERN(79) with[patternId, loops, 0, 0, 0].Checklist
swift testinPackages/<name>) — n/a, no Swift on this branchandroid/(./gradlew testFullDebugUnitTest) — see note belowStrandDesigntokens — no hardcoded colors, fonts, or spacing — n/a, no UI changedocs/CONTRIBUTING.mdStrand.xcodeproj/) or any secrets/keystoresOn the unit-test box: I cannot run the full suite here.
buildRustHostDllneeds a siblingwhoop-rscheckout with cargo, which this machine does not have, so every FFI-backed test fails at class init withNoClassDefFoundError: uniffi.whoop_ffi. That is environmental and unrelated to this change — the tests added here are deliberately FFI-free and pass.Separately:
app/build.gradle.ktssays the parity test "self-skips" when the host library is absent. It does not —SendFrameParityTesthard-fails all 15 cases. Worth a follow-up, not fixed here.Related issues