fix(gen5): WHOOP 5 wake alarm (slot index 1 + Maverick test buzz) - #194
fix(gen5): WHOOP 5 wake alarm (slot index 1 + Maverick test buzz)#194Brackyt wants to merge 2 commits into
Conversation
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.
|
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
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 ofRUN_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.
int.clamp returns num; toInt() keeps the List<int> payload type-safe.
Summary
SET_ALARM_TIMEuses rich 20-byte form with alarm slot index 1 (official-app HCI capture on fw 50.40.1.0). Index 0 is rejected witharm info is invalid, error 0xband never emits event 56.SET_CLOCKbefore arming (matches official app). Gen4 still arms rich index 0; RTC-frame drift shift unchanged.0x13short pulse (gen5MaverickBuzz) — gen4RUN_ALARM 0x44stays as-is. Do notSTOP_HAPTICSbefore the buzz.Test plan
SET_ALARM_TIME (gen5 rich index1withidx=1,write=okRUN_ALARMflutter test test/alarm_test.dart test/sleep_alarm_caption_test.dart