Skip to content

Commit

Permalink
fixes a problem that prevented session recording from working
Browse files Browse the repository at this point in the history
  • Loading branch information
laberning committed Jan 30, 2022
1 parent 56c016d commit fc00c01
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion app/engine/WorkoutRecorder.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions app/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
})
Expand Down Expand Up @@ -136,7 +136,7 @@ webServer.on('clientConnected', () => {
/*
replayRowingSession(handleRotationImpulse, {
filename: 'recordings/WRX700_2magnets.csv',
realtime: false,
loop: false
realtime: true,
loop: true
})
*/
2 changes: 1 addition & 1 deletion config/default.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit fc00c01

Please sign in to comment.