fixes a problem that prevented session recording from working

This commit is contained in:
Lars Berning 2022-01-30 13:52:17 +01:00
parent 56c016d17e
commit fc00c01e61
No known key found for this signature in database
GPG Key ID: 028E73C9E1D8A0B3
3 changed files with 6 additions and 5 deletions

View File

@ -32,7 +32,7 @@ function createWorkoutRecorder () {
if (startTime === undefined) { if (startTime === undefined) {
startTime = new Date() 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 tcx file creation is disabled
if (config.createTcxFiles) { if (config.createTcxFiles) {
strokes.push(stroke) strokes.push(stroke)
@ -186,6 +186,7 @@ function createWorkoutRecorder () {
const minimumRecordingTimeInSeconds = 10 const minimumRecordingTimeInSeconds = 10
const rotationImpulseTimeTotal = rotationImpulses.reduce((acc, impulse) => acc + impulse, 0) const rotationImpulseTimeTotal = rotationImpulses.reduce((acc, impulse) => acc + impulse, 0)
const strokeTimeTotal = strokes.reduce((acc, stroke) => acc + stroke.strokeTime, 0) const strokeTimeTotal = strokes.reduce((acc, stroke) => acc + stroke.strokeTime, 0)
console.log(`strokeTimeTotal: ${strokeTimeTotal} rotationImpulseTimeTotal: ${rotationImpulseTimeTotal} `)
if (rotationImpulseTimeTotal < minimumRecordingTimeInSeconds || strokeTimeTotal < minimumRecordingTimeInSeconds) { if (rotationImpulseTimeTotal < minimumRecordingTimeInSeconds || strokeTimeTotal < minimumRecordingTimeInSeconds) {
log.debug(`recording time is less than ${minimumRecordingTimeInSeconds}s, skipping creation of recording files...`) log.debug(`recording time is less than ${minimumRecordingTimeInSeconds}s, skipping creation of recording files...`)
return return

View File

@ -90,7 +90,7 @@ rowingStatistics.on('recoveryFinished', (metrics) => {
`, cal/hour: ${metrics.caloriesPerHour.toFixed(1)}kcal, cal/minute: ${metrics.caloriesPerMinute.toFixed(1)}kcal`) `, cal/hour: ${metrics.caloriesPerHour.toFixed(1)}kcal, cal/minute: ${metrics.caloriesPerMinute.toFixed(1)}kcal`)
webServer.notifyClients(metrics) webServer.notifyClients(metrics)
peripheralManager.notifyMetrics('strokeFinished', metrics) peripheralManager.notifyMetrics('strokeFinished', metrics)
if (metrics.sessionStatus === 'rowing' && metrics.strokesTotal > 0) { if (metrics.sessionState === 'rowing') {
workoutRecorder.recordStroke(metrics) workoutRecorder.recordStroke(metrics)
} }
}) })
@ -136,7 +136,7 @@ webServer.on('clientConnected', () => {
/* /*
replayRowingSession(handleRotationImpulse, { replayRowingSession(handleRotationImpulse, {
filename: 'recordings/WRX700_2magnets.csv', filename: 'recordings/WRX700_2magnets.csv',
realtime: false, realtime: true,
loop: false loop: true
}) })
*/ */

View File

@ -78,7 +78,7 @@ export default {
// but for recreational rowers that might feel much too restless to be useful // but for recreational rowers that might feel much too restless to be useful
numOfPhasesForAveragingScreenData: 6, 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 // 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 // (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 // issues with your stroke detection and the rower is pausing unexpectedly