adds simulated heart rate

This commit is contained in:
Lars Berning 2021-03-26 22:35:17 +00:00
parent 1ce1a2136a
commit f358d06247
2 changed files with 5 additions and 9 deletions

View File

@ -117,13 +117,7 @@ function createRowingStatistics () {
// clear the displayed metrics in case the user pauses rowing // clear the displayed metrics in case the user pauses rowing
function pauseRowing () { function pauseRowing () {
emitter.emit('rowingPaused', { emitter.emit('rowingPaused', getMetrics())
durationTotal,
durationTotalFormatted: secondsToTimeString(durationTotal),
strokesTotal: strokesTotal,
distanceTotal: Math.round(distanceTotal),
caloriesTotal: Math.round(caloriesTotal)
})
} }
function startDurationTimer () { function startDurationTimer () {

View File

@ -87,7 +87,8 @@ rowingStatistics.on('strokeFinished', (data) => {
split: data.split, split: data.split,
strokesPerMinute: data.strokesPerMinute, strokesPerMinute: data.strokesPerMinute,
speed: data.speed, speed: data.speed,
heartRate: 0, // todo: no real measurement of heartRate yet
heartRate: Math.max(data.caloriesPerMinute * 7, 50),
strokeState: data.strokeState strokeState: data.strokeState
} }
webServer.notifyClients(metrics) webServer.notifyClients(metrics)
@ -108,7 +109,8 @@ rowingStatistics.on('rowingPaused', (data) => {
splitFormatted: '∞', splitFormatted: '∞',
split: Infinity, split: Infinity,
speed: 0, speed: 0,
heartRate: 0, // todo: no real measurement of heartRate yet
heartRate: Math.max(data.caloriesPerMinute * 7, 50),
strokeState: 'RECOVERY' strokeState: 'RECOVERY'
} }
webServer.notifyClients(metrics) webServer.notifyClients(metrics)