Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions lib/src/commands.dart
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,9 @@ Uint8List cmdSelectWrist(int seq, WristSelection selection,
// That puts [cmdEnableOptical] (0x6B) next to the 0x99 persistent-save family
// rather than next to a live stream. Unconfirmed for gen4, so the opcodes are
// left pointed where they are — only the description is corrected.
Uint8List cmdToggleHr(int seq, bool on) =>
buildCommand(seq, Cmd.toggleRealtimeHr, [on ? 0x01 : 0x00]);
Uint8List cmdToggleHr(int seq, bool on,
{BandProfile profile = BandProfile.gen4}) =>
buildCommand(seq, Cmd.toggleRealtimeHr, [on ? 0x01 : 0x00], profile);

/// Toggle the realtime raw (R10/R11) stream (SEND_R10_R11_REALTIME = 0x3F).
///
Expand Down Expand Up @@ -258,8 +259,10 @@ Uint8List cmdToggleImu(int seq, bool on,
: <int>[on ? 0x01 : 0x00],
profile,
);
Uint8List cmdEnableOptical(int seq, bool on) =>
buildCommand(seq, Cmd.enableOpticalData, [revision1, on ? 0x01 : 0x00]);
Uint8List cmdEnableOptical(int seq, bool on,
{BandProfile profile = BandProfile.gen4}) =>
buildCommand(
seq, Cmd.enableOpticalData, [revision1, on ? 0x01 : 0x00], profile);

/// Play a haptic waveform effect (RUN_HAPTICS_PATTERN = 0x4F).
///
Expand Down
9 changes: 9 additions & 0 deletions test/doc_conformance_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,15 @@ void main() {
test('toggles — 3 bare bool; 106/107 rev+bool; labrador ops', () {
final hr = parseFrame(cmdToggleHr(1, true), profile: BandProfile.gen4)!;
expect(hr.inner.sublist(2, 4), [3, 0x01], reason: 'opcode 3 takes bare 01');
final hr5 = parseFrame(cmdToggleHr(1, true, profile: BandProfile.gen5),
profile: BandProfile.gen5)!;
expect(hr5.inner.sublist(2, 4), [3, 0x01],
reason: 'gen5 toggle HR must parse as crc16 framing, same body');
final opt5 = parseFrame(
cmdEnableOptical(1, true, profile: BandProfile.gen5),
profile: BandProfile.gen5)!;
expect(opt5.inner.sublist(3, 5), [revision1, 0x01],
reason: 'gen5 enable optical must parse as crc16 framing');
final imu = parseFrame(cmdToggleImu(1, true, profile: BandProfile.gen5),
profile: BandProfile.gen5)!;
expect(imu.inner.sublist(3, 5), [0x01, 0x01]);
Expand Down
Loading