Skip to content

fix(gen5): WHOOP 5 wake alarm (slot index 1 + Maverick test buzz) - #194

Open
Brackyt wants to merge 2 commits into
OpenStrap:feat/multiband-whoop5from
Brackyt:fix/whoop5-gen5-alarm
Open

fix(gen5): WHOOP 5 wake alarm (slot index 1 + Maverick test buzz)#194
Brackyt wants to merge 2 commits into
OpenStrap:feat/multiband-whoop5from
Brackyt:fix/whoop5-gen5-alarm

Conversation

@Brackyt

@Brackyt Brackyt commented Aug 5, 2026

Copy link
Copy Markdown

Summary

  • WHOOP 5 SET_ALARM_TIME uses rich 20-byte form with alarm slot index 1 (official-app HCI capture on fw 50.40.1.0). Index 0 is rejected with arm info is invalid, error 0xb and never emits event 56.
  • Gen5 refreshes SET_CLOCK before arming (matches official app). Gen4 still arms rich index 0; RTC-frame drift shift unchanged.
  • Gen5 Test buzz uses Maverick 0x13 short pulse (gen5MaverickBuzz) — gen4 RUN_ALARM 0x44 stays as-is. Do not STOP_HAPTICS before the buzz.
  • Profile device sheet selects alarm confirmation flags so the caption leaves “Setting alarm…” after grace / event 56.

Test plan

  • Connect → Profile → Test buzz → feel short Maverick pulse
  • Set alarm ~2 min ahead → expect event 56 / “Alarm set ✓”, then buzz at fire
  • Logcat: SET_ALARM_TIME (gen5 rich index1 with idx=1, write=ok
  • Gen4 (if available): set alarm + test buzz still use index 0 / RUN_ALARM
  • flutter test test/alarm_test.dart test/sleep_alarm_caption_test.dart

WHOOP 5 rejects rich SET_ALARM at slot 0 (`arm info is invalid, 0xb`);
HCI capture of the official app uses index 1 and emits event 56. Gen5
test buzz uses Maverick 0x13 (RUN_ALARM is a no-op on-wrist). Gen4 path
unchanged. Profile sheet now rebuilds on confirmation flags.
Copilot AI lite review requested due to automatic review settings August 5, 2026 09:18
@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: d2325dee-a926-4e57-8a1d-fd6d255d396c

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

Updates the Gen5 (WHOOP 5) wake-alarm and “test buzz” behavior to match observed official-app traffic, ensuring alarms arm successfully on Gen5 hardware while preserving Gen4 behavior. This touches the BLE command payload construction, BLE engine alarm/buzz commands, and the Profile UI’s alarm confirmation caption refresh.

Changes:

  • Add generation-aware alarm arming payload helper (setPayloadForBand) to enforce Gen5 slot index 1 and keep Gen4 slot index 0.
  • Update BLE engine alarm arming to refresh clock before arming on Gen5, and update “test buzz” on Gen5 to use Maverick (0x13) short pulse instead of RUN_ALARM.
  • Ensure Profile device sheet rebuilds when alarm confirmation flags change, and add/extend unit tests for new Gen4/Gen5 payload expectations.

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/alarm_test.dart Adds unit tests covering Gen4 vs Gen5 alarm slot payloads and Gen5 Maverick buzz body.
lib/ui/profile/profile_screen.dart Extends context.select dependencies to include alarm confirmation state flags so captions update after grace/confirmation.
lib/state/app_state.dart Adjusts alarm arming flow to persist only after the engine reports a successful write (non-null result).
lib/ble/ble_state.dart Introduces generation-specific alarm payload builder and Gen5 Maverick buzz payload helper.
lib/ble/ble_engine.dart Implements Gen5-specific clock refresh before arming, uses generation-correct alarm slot payload, and routes Gen5 “test buzz” through Maverick.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/ble/ble_state.dart
int.clamp returns num; toInt() keeps the List<int> payload type-safe.
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