From fc00c01e61e3b436a6c08058476ac53e64c33dc0 Mon Sep 17 00:00:00 2001 From: Lars Berning <151194+laberning@users.noreply.github.com> Date: Sun, 30 Jan 2022 13:52:17 +0100 Subject: [PATCH] fixes a problem that prevented session recording from working --- app/engine/WorkoutRecorder.js | 3 ++- app/server.js | 6 +++--- config/default.config.js | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/engine/WorkoutRecorder.js b/app/engine/WorkoutRecorder.js index c281dd2..d7ea77f 100644 --- a/app/engine/WorkoutRecorder.js +++ b/app/engine/WorkoutRecorder.js @@ -32,7 +32,7 @@ function createWorkoutRecorder () { if (startTime === undefined) { startTime = new Date() } - // stroke recordings a currently only used to create tcx files, so we can skip it + // stroke recordings are currently only used to create tcx files, so we can skip it // if tcx file creation is disabled if (config.createTcxFiles) { strokes.push(stroke) @@ -186,6 +186,7 @@ function createWorkoutRecorder () { const minimumRecordingTimeInSeconds = 10 const rotationImpulseTimeTotal = rotationImpulses.reduce((acc, impulse) => acc + impulse, 0) const strokeTimeTotal = strokes.reduce((acc, stroke) => acc + stroke.strokeTime, 0) + console.log(`strokeTimeTotal: ${strokeTimeTotal} rotationImpulseTimeTotal: ${rotationImpulseTimeTotal} `) if (rotationImpulseTimeTotal < minimumRecordingTimeInSeconds || strokeTimeTotal < minimumRecordingTimeInSeconds) { log.debug(`recording time is less than ${minimumRecordingTimeInSeconds}s, skipping creation of recording files...`) return diff --git a/app/server.js b/app/server.js index fb20c64..040cc2d 100644 --- a/app/server.js +++ b/app/server.js @@ -90,7 +90,7 @@ rowingStatistics.on('recoveryFinished', (metrics) => { `, cal/hour: ${metrics.caloriesPerHour.toFixed(1)}kcal, cal/minute: ${metrics.caloriesPerMinute.toFixed(1)}kcal`) webServer.notifyClients(metrics) peripheralManager.notifyMetrics('strokeFinished', metrics) - if (metrics.sessionStatus === 'rowing' && metrics.strokesTotal > 0) { + if (metrics.sessionState === 'rowing') { workoutRecorder.recordStroke(metrics) } }) @@ -136,7 +136,7 @@ webServer.on('clientConnected', () => { /* replayRowingSession(handleRotationImpulse, { filename: 'recordings/WRX700_2magnets.csv', - realtime: false, - loop: false + realtime: true, + loop: true }) */ diff --git a/config/default.config.js b/config/default.config.js index 5bb34cb..633c8c4 100644 --- a/config/default.config.js +++ b/config/default.config.js @@ -78,7 +78,7 @@ export default { // but for recreational rowers that might feel much too restless to be useful numOfPhasesForAveragingScreenData: 6, - // The time between strokes in seconds before the rower considers it a pause. Default value is set to 6. + // The time between strokes in seconds before the rower considers it a pause. Default value is set to 10. // It is not recommended to go below this value, as not recognizing a stroke could result in a pause // (as a typical stroke is between 2 to 3 seconds for recreational rowers). Increase it when you have // issues with your stroke detection and the rower is pausing unexpectedly