fix(gen5): arm and decode Maverick live IMU for step calibration - #195
fix(gen5): arm and decode Maverick live IMU for step calibration#195Brackyt wants to merge 1 commit into
Conversation
WHOOP 5 rejects bare toggleImuMode (Invalid rev 0); arm with [revision1, on] and skip unhandled R10/R11 realtime. Live accel arrives as 0x2B rec 0x15 (100 Hz planar), not gen4 0x33 — decode that layout so calibration counts. Gen4 0x33/R10 still use frameAccel unchanged.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR updates the Gen5 (WHOOP 5 / Maverick) live IMU stream handling so step calibration can consume the correct live accelerometer format while preserving Gen4 behavior.
Changes:
- Add a Gen5-specific decoder for live IMU frames carried in
0x2Bsubtype0x15(100 Hz planar accel) and route step-count ingestion through a band-aware decoder. - Update BLE live-stream arming/disarming to send the Gen5-required
toggleImuModepayload[revision1, on/off]and skip unsupportedsendR10R11Realtimeon Gen5. - Add unit tests for Gen5 live IMU decode and IMU mode payload construction.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/gen5_live_imu_test.dart | Adds decode coverage for captured Gen5 0x2B/0x15 live IMU frames and ensures Gen4 paths remain unchanged. |
| test/gen5_imu_mode_payload_test.dart | Verifies Gen4 vs Gen5 payload shape for toggleImuMode (0x6A). |
| lib/state/app_state.dart | Switches live step ingest to use a band-aware IMU frame decoder (Gen5 0x2B/0x15 first, then Gen4 legacy). |
| lib/ble/gen5_live_imu.dart | Introduces Gen5 live IMU frame parsing and a frameAccelForBand shim. |
| lib/ble/ble_engine.dart | Updates live-stream arming/disarming to handle Gen5 IMU revision payload and avoid unsupported realtime R10/R11 command on Gen5. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| test('abstains on gen4-shaped short 0x33', () { | ||
| expect(frameAccelGen5Live('33' + ('00' * 80)), isNull); | ||
| }); |
Summary
toggleImuMode(0x6A) needs[revision1, on/off](bare[0x01]→Invalid rev (0)); skip unhandled R10/R11 realtime (0x3F) on Maverick.0x2B+0x15+count@14==100;frameAccelstill handles gen40x33/ R10 (0x0A).Hardware evidence
samplesclimbing and non-zeroliveStepsafter decode.Test plan
flutter test test/gen5_live_imu_test.dart test/gen5_imu_mode_payload_test.dartgen5 IMU rev1/IMU data stream enabled