Skip to content

fix(gen5): arm and decode Maverick live IMU for step calibration - #195

Open
Brackyt wants to merge 1 commit into
OpenStrap:feat/multiband-whoop5from
Brackyt:fix/whoop5-gen5-live-steps
Open

fix(gen5): arm and decode Maverick live IMU for step calibration#195
Brackyt wants to merge 1 commit into
OpenStrap:feat/multiband-whoop5from
Brackyt:fix/whoop5-gen5-live-steps

Conversation

@Brackyt

@Brackyt Brackyt commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Gen5 toggleImuMode (0x6A) needs [revision1, on/off] (bare [0x01]Invalid rev (0)); skip unhandled R10/R11 realtime (0x3F) on Maverick.
  • Live accel on WHOOP 5 is 0x2B rec 0x15 (100 Hz planar @ offset 20), not gen4's 0x33 — decode that layout so step calibration / live workout steps count.
  • WHOOP 4 unchanged: gen5 decoder abstains unless 0x2B+0x15+count@14==100; frameAccel still handles gen4 0x33 / R10 (0x0A).

Hardware evidence

  • fw 50.40.1.0 console + HCI snoop; calibration walk showed samples climbing and non-zero liveSteps after decode.

Test plan

  • flutter test test/gen5_live_imu_test.dart test/gen5_imu_mode_payload_test.dart
  • WHOOP 5: Calibrate steps — counter climbs while walking (app foreground)
  • WHOOP 4: live steps / calibration still work (0x33 path)
  • Gen5 reconnect keepalive still logs gen5 IMU rev1 / IMU data stream enabled

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.
Copilot AI lite review requested due to automatic review settings August 5, 2026 11:16
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: cd8208c5-1aad-4ff9-b94c-89b551dad276

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 0x2B subtype 0x15 (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 toggleImuMode payload [revision1, on/off] and skip unsupported sendR10R11Realtime on 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.

Comment on lines +34 to +36
test('abstains on gen4-shaped short 0x33', () {
expect(frameAccelGen5Live('33' + ('00' * 80)), isNull);
});
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.

2 participants