diff --git a/lib/src/commands.dart b/lib/src/commands.dart index 256ceb5..dcd63cd 100644 --- a/lib/src/commands.dart +++ b/lib/src/commands.dart @@ -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). /// @@ -258,8 +259,10 @@ Uint8List cmdToggleImu(int seq, bool on, : [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). /// diff --git a/test/doc_conformance_test.dart b/test/doc_conformance_test.dart index 388c2bc..dcce28a 100644 --- a/test/doc_conformance_test.dart +++ b/test/doc_conformance_test.dart @@ -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]);