feat(train): rowing on the WP 5000 over FTMS (ADR 0030, D28)
Rowing indoors is offered again, with the rower chosen on the Record sheet: a sheet looks for Fitness Machine Service rowers, and the one chosen is remembered in the person's folder. The recorder service connects to it as to the strap (one NotifyLink for both), parses FTMS's Rower Data in Kotlin (tested on the JVM on frames written from the specification and D8's), counts its totals from its first frame, pauses 5 s after the last stroke, and gets the connectedDevice type. A row's screen shows its metres, split per 500 m, stroke rate and watts; its page its average split, stroke rate and power, the highest power, its strokes, splits per 500 m and charts of the split, stroke rate and power. Not yet tried on the WP 5000. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
de5fd43e06
commit
f3d08e4e69
1 changed files with 2266 additions and 514 deletions
|
|
@ -10,9 +10,9 @@ import 'package:halkyon_train_flutter/src/app/train_app.dart';
|
|||
import 'package:halkyon_train_flutter/src/app/train_dependencies.dart';
|
||||
import 'package:halkyon_train_flutter/src/core/privacy/train_keys.dart';
|
||||
import 'package:halkyon_train_flutter/src/feature/map/data/map_source_repository.dart';
|
||||
import 'package:halkyon_train_flutter/src/feature/recording/data/device_store.dart';
|
||||
import 'package:halkyon_train_flutter/src/feature/recording/data/recorded_workout.dart';
|
||||
import 'package:halkyon_train_flutter/src/feature/recording/data/recorder_platform.dart';
|
||||
import 'package:halkyon_train_flutter/src/feature/recording/data/strap_store.dart';
|
||||
import 'package:halkyon_train_flutter/src/feature/recording/model/recording.dart';
|
||||
import 'package:halkyon_train_flutter/src/feature/workout/data/workout_repository.dart';
|
||||
import 'package:halkyon_train_flutter/src/feature/workout/model/workout.dart';
|
||||
|
|
@ -327,7 +327,8 @@ void main() {
|
|||
recording: (
|
||||
platform: platform,
|
||||
file: file(),
|
||||
straps: StrapStore(File('${folder.path}/strap.json')),
|
||||
straps: DeviceStore(File('${folder.path}/strap.json')),
|
||||
rowers: DeviceStore(File('${folder.path}/rower.json')),
|
||||
),
|
||||
workouts: workouts,
|
||||
);
|
||||
|
|
@ -495,18 +496,18 @@ void main() {
|
|||
});
|
||||
});
|
||||
group('with a strap (D27)', () {
|
||||
const polar = FoundStrap(
|
||||
const polar = FoundDevice(
|
||||
address: 'A0:9E:1A:00:00:01',
|
||||
name: 'Polar H10 1234',
|
||||
rssi: -50,
|
||||
);
|
||||
|
||||
StrapStore straps() => StrapStore(File('${folder.path}/strap.json'));
|
||||
DeviceStore straps() => DeviceStore(File('${folder.path}/strap.json'));
|
||||
|
||||
testWidgets('one is chosen from the Record sheet, nearby devices asked '
|
||||
'first, and used from then on', (tester) async {
|
||||
platform.nearby = [
|
||||
const FoundStrap(address: 'B', name: 'HRM-Dual', rssi: -80),
|
||||
const FoundDevice(address: 'B', name: 'HRM-Dual', rssi: -80),
|
||||
polar,
|
||||
];
|
||||
await withClock(Clock.fixed(at), () async {
|
||||
|
|
@ -538,7 +539,7 @@ void main() {
|
|||
testWidgets('switched off on the sheet, a workout records without it', (
|
||||
tester,
|
||||
) async {
|
||||
straps().save(Strap(address: polar.address, name: polar.name));
|
||||
straps().save(KnownDevice(address: polar.address, name: polar.name));
|
||||
await withClock(Clock.fixed(at), () async {
|
||||
await startRecording(tester);
|
||||
await tester.tap(find.text('Record'));
|
||||
|
|
@ -560,7 +561,7 @@ void main() {
|
|||
});
|
||||
|
||||
testWidgets('forgotten on its sheet, none is used', (tester) async {
|
||||
straps().save(Strap(address: polar.address, name: polar.name));
|
||||
straps().save(KnownDevice(address: polar.address, name: polar.name));
|
||||
await withClock(Clock.fixed(at), () async {
|
||||
await startRecording(tester);
|
||||
await tester.tap(find.text('Record'));
|
||||
|
|
@ -594,7 +595,7 @@ void main() {
|
|||
|
||||
testWidgets('the recording shows the heart rate, and says when the '
|
||||
'strap is lost', (tester) async {
|
||||
straps().save(Strap(address: polar.address, name: polar.name));
|
||||
straps().save(KnownDevice(address: polar.address, name: polar.name));
|
||||
var now = at;
|
||||
await withClock(Clock(() => now), () async {
|
||||
await startRecording(tester);
|
||||
|
|
@ -625,6 +626,85 @@ void main() {
|
|||
});
|
||||
});
|
||||
});
|
||||
group('on the rower (D28)', () {
|
||||
const rower = FoundDevice(
|
||||
address: 'C4:00:00:00:00:01',
|
||||
name: 'MRK-950R-8021',
|
||||
rssi: -60,
|
||||
);
|
||||
|
||||
testWidgets('a row needs its rower, chosen on the Record sheet, and '
|
||||
'records with it, pausing by its strokes', (tester) async {
|
||||
platform.nearbyRowers = [rower];
|
||||
await withClock(Clock.fixed(at), () async {
|
||||
await startRecording(tester);
|
||||
await tester.tap(find.text('Record'));
|
||||
await tester.pumpAndSettle();
|
||||
await tester.ensureVisible(find.text('Rowing indoors'));
|
||||
await tester.tap(find.text('Rowing indoors'));
|
||||
await tester.pump();
|
||||
|
||||
await tester.ensureVisible(find.text('Rowing machine'));
|
||||
await tester.pump();
|
||||
expect(find.text('Choose your rowing machine'), findsOneWidget);
|
||||
expect(
|
||||
tester
|
||||
.widget<FilledButton>(
|
||||
find.widgetWithText(FilledButton, 'Start'),
|
||||
)
|
||||
.onPressed,
|
||||
isNull,
|
||||
);
|
||||
await tester.tap(find.text('Rowing machine'));
|
||||
await pass(tester, 2);
|
||||
await tester.tap(find.text('MRK-950R-8021'));
|
||||
await pass(tester, 2);
|
||||
expect(find.text('MRK-950R-8021'), findsOneWidget);
|
||||
|
||||
await tester.tap(find.text('Start'));
|
||||
await pass(tester, 2);
|
||||
expect(platform.started.single.rower, rower.address);
|
||||
expect(platform.started.single.autoPause, AutoPauseBy.strokes);
|
||||
expect(platform.scanned, [DeviceKind.rower]);
|
||||
});
|
||||
});
|
||||
|
||||
testWidgets('the recording shows the metres, the split, the stroke rate '
|
||||
'and the watts', (tester) async {
|
||||
DeviceStore(
|
||||
File('${folder.path}/rower.json'),
|
||||
).save(KnownDevice(address: rower.address, name: rower.name));
|
||||
var now = at;
|
||||
await withClock(Clock(() => now), () async {
|
||||
await startRecording(tester);
|
||||
await tester.tap(find.text('Record'));
|
||||
await tester.pumpAndSettle();
|
||||
await tester.ensureVisible(find.text('Rowing indoors'));
|
||||
await tester.tap(find.text('Rowing indoors'));
|
||||
await tester.pump();
|
||||
await tester.tap(find.text('Start'));
|
||||
await pass(tester, 2);
|
||||
|
||||
platform.write('rower @ connecting');
|
||||
await pass(tester);
|
||||
expect(find.text('Looking for the rowing machine'), findsOneWidget);
|
||||
|
||||
platform
|
||||
..write('rower @ connected')
|
||||
..write('r @ 24.0 0 0 0')
|
||||
..now = at.add(const Duration(seconds: 24))
|
||||
..write('r @ 25.5 10 100 182');
|
||||
now = at.add(const Duration(seconds: 24));
|
||||
await pass(tester);
|
||||
|
||||
expect(find.text('Looking for the rowing machine'), findsNothing);
|
||||
expect(find.text('100'), findsOneWidget);
|
||||
expect(find.text('2:00'), findsOneWidget);
|
||||
expect(find.text('25.5'), findsOneWidget);
|
||||
expect(find.text('182'), findsOneWidget);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
group('workouts (ADR 0030, D24)', () {
|
||||
|
|
@ -786,6 +866,44 @@ void main() {
|
|||
expect(find.text('Heart rate'), findsNothing);
|
||||
});
|
||||
|
||||
testWidgets("a row's page shows its split, stroke rate and power, its "
|
||||
'splits by 500 m and no map', (tester) async {
|
||||
final start = DateTime(2026, 10, 28, 18).toUtc();
|
||||
final (content, series) = recordedWorkout(
|
||||
Recording(
|
||||
activity: Activity.indoorRowing,
|
||||
startedAt: start,
|
||||
rowing: [
|
||||
for (var s = 0; s <= 300; s += 2)
|
||||
RowingSample(
|
||||
time: start.add(Duration(seconds: s)),
|
||||
strokeRate: 24,
|
||||
strokes: s * 24 ~/ 60,
|
||||
metres: (s * 500 / 120).round(),
|
||||
watts: 160,
|
||||
),
|
||||
],
|
||||
endedAt: start.add(const Duration(seconds: 300)),
|
||||
),
|
||||
);
|
||||
await workouts.save(content, series);
|
||||
await startWith(tester);
|
||||
|
||||
expect(find.text('2:00 /500 m'), findsOneWidget);
|
||||
await tester.tap(find.text('Evening row'));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.byType(FlutterMap), findsNothing);
|
||||
expect(find.text('average split'), findsOneWidget);
|
||||
await tester.scrollUntilVisible(find.text('strokes'), 100);
|
||||
expect(find.text('120'), findsOneWidget);
|
||||
expect(find.text('average power'), findsOneWidget);
|
||||
await tester.scrollUntilVisible(find.text('1000–1250 m'), 100);
|
||||
expect(find.text('0–500 m'), findsOneWidget);
|
||||
await tester.scrollUntilVisible(find.text('Power'), 200);
|
||||
expect(find.text('Stroke rate'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('a workout without GPS has no map, splits nor charts', (
|
||||
tester,
|
||||
) async {
|
||||
|
|
|
|||
Loading…
Reference in a new issue