Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
294 commits
Select commit Hold shift + click to select a range
54cd300
Fix Lint errors
JaapvanEkris Feb 23, 2025
88c9da8
Fixed Lint errors
JaapvanEkris Feb 23, 2025
567baa4
Fixed Lint errors
JaapvanEkris Feb 23, 2025
6ffd0f5
Fixed Lint errors
JaapvanEkris Feb 23, 2025
da6dba3
Fixed Lint errors
JaapvanEkris Feb 23, 2025
94aa508
Removed a lot of clutter
JaapvanEkris Feb 27, 2025
0792d70
Further removal of clutter
JaapvanEkris Feb 27, 2025
b8fad9e
Fixed typo
JaapvanEkris Feb 27, 2025
7f4aa9d
Fixed typo
JaapvanEkris Feb 27, 2025
5abcdc0
Fixed typo
JaapvanEkris Feb 27, 2025
e7b7e1d
Updated backlog
JaapvanEkris Feb 27, 2025
5d4f3ed
Update Release_Notes.md
JaapvanEkris Feb 27, 2025
dc6519d
Added mqtt configuration
JaapvanEkris Feb 27, 2025
65f8cc3
Added MQTT connector
JaapvanEkris Feb 27, 2025
55e43b5
Added MQTT connector
JaapvanEkris Feb 27, 2025
f50d942
Added mqtt library
JaapvanEkris Feb 27, 2025
5c316c7
Update package-lock.json
JaapvanEkris Feb 27, 2025
e453e44
Added mqtt configuration
JaapvanEkris Feb 27, 2025
9f758af
Added mqtt configuration
JaapvanEkris Feb 27, 2025
40822d8
Added mqtt configuration
JaapvanEkris Feb 27, 2025
7d43f3c
Fix in MQTT startup behaviour
JaapvanEkris Feb 28, 2025
ec68d0c
Fixed too many slashes in the topicname
JaapvanEkris Feb 28, 2025
37df8b0
Update Integrations.md
JaapvanEkris Feb 28, 2025
5688e49
Update Integrations.md
JaapvanEkris Feb 28, 2025
b99b533
Update Integrations.md
JaapvanEkris Feb 28, 2025
2546061
Fix version number
JaapvanEkris Mar 1, 2025
a8c80cf
Added workoutplan push
JaapvanEkris Mar 2, 2025
f33d4c9
Added MQTT workoutplan push
JaapvanEkris Mar 2, 2025
9a6154d
Added Note
JaapvanEkris Mar 2, 2025
6d4e401
Fixed JSON errors
JaapvanEkris Mar 2, 2025
94baca1
Fixed Lint errors
JaapvanEkris Mar 2, 2025
f79177b
Added MQTT workout subscriber
JaapvanEkris Mar 2, 2025
4409f05
Removed unneeded marker
JaapvanEkris Mar 2, 2025
19de597
Added pushing WorkoutSettings via MQTT
JaapvanEkris Mar 2, 2025
371f19d
Improved logging
JaapvanEkris Mar 2, 2025
9440d95
Improved logging
JaapvanEkris Mar 2, 2025
b85abf1
Update due to MQTT progress
JaapvanEkris Mar 2, 2025
3429b3d
Added MQTT Uploader
JaapvanEkris Mar 2, 2025
19e79dd
Improveent of coding style
JaapvanEkris Mar 2, 2025
44e2aa3
Added functionality and defensive programming
JaapvanEkris Mar 2, 2025
99cb40d
Update SessionManager.js
JaapvanEkris Mar 2, 2025
970089f
Removed bug
JaapvanEkris Mar 2, 2025
7a1807b
Fixed Lint error
JaapvanEkris Mar 2, 2025
406a228
Update workoutSegment.test.js
JaapvanEkris Mar 2, 2025
8cae1e9
Added bugfix
JaapvanEkris Mar 2, 2025
7172cf4
Update Integrations.md
JaapvanEkris Mar 2, 2025
cafdd71
Update Integrations.md
JaapvanEkris Mar 2, 2025
b803891
Added comment
JaapvanEkris Mar 2, 2025
9a3adb7
Improved consistency
JaapvanEkris Mar 3, 2025
11e740d
Update of config settings
JaapvanEkris Mar 3, 2025
e094aed
Improvement of the manual
JaapvanEkris Mar 3, 2025
e66928c
Fixed a typo
JaapvanEkris Mar 3, 2025
ccb4b35
Fixed error in example
JaapvanEkris Mar 5, 2025
7efec04
Added error handling on JSON parsing
JaapvanEkris Mar 5, 2025
a9efc9f
Bugfix for showing labels when turning them off
JaapvanEkris Mar 5, 2025
d26de3a
Added GPIO settings
JaapvanEkris Mar 5, 2025
d68858b
Added index
JaapvanEkris Mar 5, 2025
b1f05a5
Fixed Lint errors
JaapvanEkris Mar 5, 2025
d6fbe9d
Improved description
JaapvanEkris Mar 7, 2025
718bb52
Fixed typo in comments
JaapvanEkris Mar 7, 2025
093e267
Update installation with reporting parameters
JaapvanEkris Mar 7, 2025
76b0a5d
Improved readability
JaapvanEkris Mar 7, 2025
65cb313
Improved readability
JaapvanEkris Mar 7, 2025
a3dea94
Added automated integrations
JaapvanEkris Mar 7, 2025
23eaccc
Added file creation options
JaapvanEkris Mar 7, 2025
2982d95
Update Integrations.md
JaapvanEkris Mar 7, 2025
642e597
Improved the VO2Max decorator
JaapvanEkris Mar 8, 2025
a6c1b67
Fix app shutdown process
Mar 9, 2025
868cf45
Improved logging
JaapvanEkris Mar 10, 2025
606aa21
Added sudo to installer
JaapvanEkris Mar 10, 2025
39410a8
Update README.md
JaapvanEkris Mar 12, 2025
5132499
Update installation.md
JaapvanEkris Mar 12, 2025
a8758d4
Fixed Lint error
JaapvanEkris Mar 12, 2025
389306a
Fixed Lint error
JaapvanEkris Mar 12, 2025
5066c66
Removes unused variables
JaapvanEkris Mar 12, 2025
012daf5
Removes unused variables
JaapvanEkris Mar 12, 2025
6a13e0e
Removes unused variables
JaapvanEkris Mar 12, 2025
9c25e11
Removes unused variables
JaapvanEkris Mar 12, 2025
ed1af87
Removes unused variables
JaapvanEkris Mar 12, 2025
94e3301
Removed unnecessary variables
JaapvanEkris Mar 12, 2025
617eedc
Removed unnecessary variables
JaapvanEkris Mar 12, 2025
a1b4831
Removes unused variables
JaapvanEkris Mar 12, 2025
ac5f56e
Removed unnecessary function
JaapvanEkris Mar 12, 2025
518e0db
Removes unused variables
JaapvanEkris Mar 12, 2025
8573dca
Fix Lint error
JaapvanEkris Mar 12, 2025
59d2fe6
Fixes lint error
JaapvanEkris Mar 12, 2025
33378a2
Fix lint error
JaapvanEkris Mar 12, 2025
af1f7dd
Added new RecordingManager structure
JaapvanEkris Mar 13, 2025
69c9cd5
Fixed typo
JaapvanEkris Mar 13, 2025
111ab4f
ESLint configuration update
JaapvanEkris Mar 14, 2025
352d4da
ESLint configuration update
JaapvanEkris Mar 14, 2025
f673089
ESLint configuration update
JaapvanEkris Mar 14, 2025
90e25af
ESLint configuration update
JaapvanEkris Mar 14, 2025
863c173
ESLint configuration update
JaapvanEkris Mar 14, 2025
d71defa
Update Flywheel.test.js
JaapvanEkris Mar 15, 2025
c2ce553
ESLint configuration update
JaapvanEkris Mar 15, 2025
b5a5dbb
ESLint configuration update
JaapvanEkris Mar 15, 2025
d989382
ESLint configuration update
JaapvanEkris Mar 15, 2025
6665dab
ESLint configuration update
JaapvanEkris Mar 15, 2025
c1d567b
ESLint configuration update
JaapvanEkris Mar 15, 2025
fbba85b
ESLint configuration update
JaapvanEkris Mar 15, 2025
b470b84
ESLint configuration update
JaapvanEkris Mar 15, 2025
7fc754d
ESLint configuration update
JaapvanEkris Mar 15, 2025
d0a7abd
ESLint configuration update
JaapvanEkris Mar 15, 2025
25df199
ESLint configuration update
JaapvanEkris Mar 16, 2025
e653c1d
Bugfix
JaapvanEkris Mar 16, 2025
ead1f6c
Added defensive programming
JaapvanEkris Mar 16, 2025
dc0e43e
Added defensive programming
JaapvanEkris Mar 16, 2025
8d3b735
Added defensive programming
JaapvanEkris Mar 16, 2025
cc79d33
Added decent closure to lap and workout if ORM Crashes
JaapvanEkris Mar 17, 2025
03ccaa7
Delete eslint.config.js
JaapvanEkris Mar 17, 2025
6070eca
More nuanced time behaviour around rest intervals
JaapvanEkris Mar 17, 2025
ae62323
Fixed reset behaviour
JaapvanEkris Mar 17, 2025
e8bca1d
Fixed reset behaviour
JaapvanEkris Mar 17, 2025
af48fa6
Fixed reset behaviour
JaapvanEkris Mar 17, 2025
f8e214f
Fixed reset behaviour
JaapvanEkris Mar 17, 2025
7eb6d9c
Fixed reset behaviour
JaapvanEkris Mar 17, 2025
6b1e28c
Reduced code duplication
JaapvanEkris Mar 17, 2025
db46130
Reduced code duplication
JaapvanEkris Mar 17, 2025
c2e9ef5
Reduced code duplication
JaapvanEkris Mar 17, 2025
9c2c4b3
Reduced code duplication
JaapvanEkris Mar 17, 2025
c28face
ESLint configuration update
JaapvanEkris Mar 17, 2025
cffb600
Improved power naming
JaapvanEkris Mar 18, 2025
5314708
Code refactoring
JaapvanEkris Mar 19, 2025
0a17418
Code refactoring
JaapvanEkris Mar 19, 2025
dcaee8c
Code refactoring
JaapvanEkris Mar 19, 2025
4e58b43
Added BLE improvements
JaapvanEkris Mar 20, 2025
52d895a
Added more thanks to Abasz
JaapvanEkris Mar 20, 2025
3ea5ef5
New BLE Api, completed PM5 interface and revamped recorders (#104)
JaapvanEkris May 3, 2025
fd91b99
Added Virtufit
JaapvanEkris May 3, 2025
86f8cbc
Removed scafold code
JaapvanEkris May 4, 2025
2a84de9
Removed scafold code
JaapvanEkris May 4, 2025
0b5aecd
Removed dependency on sessiontype
JaapvanEkris May 4, 2025
5e93e73
Removed dependency on sessiontype
JaapvanEkris May 4, 2025
180346e
Corrected URL
JaapvanEkris May 4, 2025
27f6827
Updated field description
JaapvanEkris May 4, 2025
7dfddfa
Removed unnecessary parameters
JaapvanEkris May 4, 2025
0e0142d
Removal of unneeded parameters
JaapvanEkris May 4, 2025
5e2c7fc
Removed unnecessary parameters
JaapvanEkris May 4, 2025
c1d15a5
Removed unnecessary parameter
JaapvanEkris May 4, 2025
844adcf
Removed unnecessary parameter
JaapvanEkris May 4, 2025
31fbe63
Removed unnecessary parameter
JaapvanEkris May 4, 2025
3fab537
Fixed bug in Min and Max calculation
JaapvanEkris May 4, 2025
e3f6b43
Fixed security warning
JaapvanEkris May 5, 2025
68e15d2
Fix of minimum and maximum functions
JaapvanEkris May 5, 2025
39ff311
Added test for minimum and maximum functions
JaapvanEkris May 5, 2025
dce0843
Robustness improvement
JaapvanEkris May 5, 2025
fc0284b
Improved testing of the workout segment metrics
JaapvanEkris May 5, 2025
28bbb51
Improved reset behaviour
JaapvanEkris May 5, 2025
7dc575f
Improved ErgZone compatibility
JaapvanEkris May 5, 2025
b9fb556
Resolved AthleteId error on intervals.icu
JaapvanEkris May 6, 2025
096a4fd
Fix for incorrect rollover after pause
JaapvanEkris May 9, 2025
ffafcc5
Inproved startup behaviour
JaapvanEkris May 11, 2025
846f51e
Improved commandHandler to prevent recorder crash upon upload
JaapvanEkris May 11, 2025
fddb4f0
Improved logging
JaapvanEkris May 11, 2025
5358bfe
Improved robustness
JaapvanEkris May 11, 2025
ed5bac7
Improved robustness
JaapvanEkris May 11, 2025
28d303d
Update tcxRecorder.js
JaapvanEkris May 11, 2025
1b47f0c
Update GeneralStatusCharacteristic.js
JaapvanEkris May 11, 2025
9b37aa3
Fixed typo in command
JaapvanEkris May 14, 2025
6c4d763
Removed unguarded pace calculation
JaapvanEkris May 14, 2025
c8bcc16
Improvement of startup behaviour
JaapvanEkris May 14, 2025
e5d84fb
Replacement of Chromium with Firefox (#111)
JaapvanEkris May 14, 2025
4dffa17
Updated Release_Notes
JaapvanEkris May 14, 2025
dbf018d
Improved startup behaviour
JaapvanEkris May 14, 2025
a96330d
New insights
JaapvanEkris May 14, 2025
8caa3a4
Trying to prevent a race-condition
JaapvanEkris May 16, 2025
455bb59
Improvement of reset behaviour
JaapvanEkris May 18, 2025
c53e77c
Improved command handling
JaapvanEkris May 18, 2025
ed756cd
Fixed specification bug
JaapvanEkris May 18, 2025
55dffca
Improvement based on PM5 traces
JaapvanEkris May 18, 2025
1c446fd
Added more subtle initialisation
JaapvanEkris May 18, 2025
a689cbe
Fixed resume behaviour
JaapvanEkris May 18, 2025
2952b78
Improved resume behaviour
JaapvanEkris May 18, 2025
cdf2c31
Add resume behaviour
JaapvanEkris May 18, 2025
b9c3c26
Update CsafeManagerService.js
JaapvanEkris May 19, 2025
eeafd89
Fixed a typo
JaapvanEkris May 19, 2025
e5f33d2
Improved resume behaviour
JaapvanEkris May 19, 2025
13f5476
Improvement of the PM5 behaviour for ErgZone and EXR (#113)
JaapvanEkris May 23, 2025
20c95a4
Fix for ghost data recordings
JaapvanEkris May 24, 2025
1d1b045
Fix for ghost data recordings
JaapvanEkris May 24, 2025
9bce6b1
Fix for ghost data recordings
JaapvanEkris May 24, 2025
e63a013
Fix for ghost data recordings
JaapvanEkris May 24, 2025
890cd3b
Fixes typo in parameter name
JaapvanEkris May 24, 2025
80043b5
Fix for split issues (#116)
JaapvanEkris May 25, 2025
d3cdc3d
Update based on testing
JaapvanEkris May 26, 2025
7dc77d0
Fixes lint error
JaapvanEkris May 26, 2025
b024ff7
Added PM5 issues to the issue list
JaapvanEkris May 26, 2025
422c1a4
Updated description of 0.9.6 limitations
JaapvanEkris May 26, 2025
d520921
Added known limitations
JaapvanEkris May 26, 2025
5c89dd8
Improved wording
JaapvanEkris May 26, 2025
a164f18
Added issue numbers to 'Known Issues'
JaapvanEkris May 27, 2025
dee6b0d
Added issue numbers to 'Known Issues'
JaapvanEkris May 27, 2025
caca940
Fix for crash at split rollover
JaapvanEkris May 27, 2025
5501fa0
Code cleanup
JaapvanEkris May 28, 2025
0b6e412
Added CSafe mapping
JaapvanEkris May 28, 2025
05dcea2
With footnotes
JaapvanEkris May 28, 2025
4a49fbd
Removed unnecessary import
JaapvanEkris May 28, 2025
cb0c94b
Fixed Lint error
JaapvanEkris May 28, 2025
ecd6065
Fix checksum errors in CsafeRequestFrame
Abasz May 28, 2025
a763bc7
Add styling to the install script
Abasz May 29, 2025
c5bb2fb
Minor tweaks and improvements (#119)
JaapvanEkris May 29, 2025
9f236c9
Refactoring based on bugreport
JaapvanEkris May 29, 2025
dd3c278
Fixed lint errors
JaapvanEkris May 29, 2025
6ad4754
Update based on betatesting
JaapvanEkris May 30, 2025
942aa16
Improvement for fixed interval parsing
JaapvanEkris May 30, 2025
fd61d3b
Improvement of the CSAFE handling
JaapvanEkris May 30, 2025
786a1fc
Added a nicer nice-level, optimizing engine performance
JaapvanEkris May 30, 2025
26bd1e6
Additional info about unplanned rest behaviour
JaapvanEkris May 30, 2025
f587353
Fix for crash on PM5 disconnect
JaapvanEkris May 31, 2025
4d5c4bf
Added approach for unplanned pauses
JaapvanEkris Jun 3, 2025
7588099
Fixed lint errors
JaapvanEkris Jun 3, 2025
148b7df
Additional insights
JaapvanEkris Jun 4, 2025
21ba199
Improved initialisation
JaapvanEkris Jun 4, 2025
32d2865
Fixed Lint errors
JaapvanEkris Jun 4, 2025
776fc37
Improvement of the unplanned pause behaviour (#124)
JaapvanEkris Jun 8, 2025
59ad7f0
Improvement of unplanned pause behaviour
JaapvanEkris Jun 8, 2025
887a2ad
Updated design target list
JaapvanEkris Jun 9, 2025
5f05bda
Added description of message 0x0032
JaapvanEkris Jun 9, 2025
79190d7
Added C2Number
JaapvanEkris Jun 9, 2025
eedb369
Fixed typo's
JaapvanEkris Jun 9, 2025
8d41a8e
Improved robustness during startup
JaapvanEkris Jun 10, 2025
f602f82
Added defensive programming
JaapvanEkris Jun 10, 2025
b1030f7
Add more defensive coding
Abasz Jun 11, 2025
2e12858
Clearer instructions
JaapvanEkris Jun 12, 2025
04c32dd
Update of all packages
JaapvanEkris Jun 12, 2025
5f22227
Update of packages
JaapvanEkris Jun 12, 2025
29a0b42
Added ErgZone to the list of apps
JaapvanEkris Jun 14, 2025
9bf15db
Removed unneccessary info
JaapvanEkris Jun 14, 2025
504f344
Made naming consistent
JaapvanEkris Jun 14, 2025
06ee793
Add standard BLE Device Information Service
Abasz Jun 20, 2025
d8d09f2
Security update
JaapvanEkris Jun 22, 2025
4f57a2d
Security update
JaapvanEkris Jun 22, 2025
50b1eab
Updated release notes
JaapvanEkris Jun 22, 2025
24ca890
Added highlight
JaapvanEkris Jun 22, 2025
77ca260
Fixes Lint error
JaapvanEkris Jun 22, 2025
edbc11b
Update Release_Notes.md
JaapvanEkris Jun 22, 2025
f538da5
Improved ErgZone compatibility
JaapvanEkris Jun 23, 2025
125204a
Improved ErgZone compatibility
JaapvanEkris Jun 24, 2025
1467095
Update Release_Notes.md
JaapvanEkris Jun 27, 2025
02ebbe2
Routine packages update
JaapvanEkris Jun 29, 2025
e884d52
Routine packages update
JaapvanEkris Jun 29, 2025
2a7543c
Bugfix for recording issues
JaapvanEkris Jun 30, 2025
27b6927
Added MQTT
JaapvanEkris Jul 3, 2025
be719ed
Fix parsing error
JaapvanEkris Jul 3, 2025
5339a57
Update Architecture.md
JaapvanEkris Jul 3, 2025
13a1f9c
Update Architecture.md
JaapvanEkris Jul 3, 2025
a3275d9
Added isUnplannedPause to the flag list
JaapvanEkris Jul 3, 2025
3be5aa8
Update Architecture.md
JaapvanEkris Jul 3, 2025
d658796
Improved wording
JaapvanEkris Jul 4, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions .eslintrc.json

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:

strategy:
matrix:
node-version: [20.x]
node-version: [22.x]

steps:
- name: Checkout repository
Expand Down
3 changes: 2 additions & 1 deletion .markdownlint.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"default": true,
"MD013": false,
"MD049": { "style": "asterisk" }
"MD049": { "style": "asterisk" },
"MD059": false
}
83 changes: 52 additions & 31 deletions app/WebServer.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
'use strict'
/*
Open Rowing Monitor, https://github.com/JaapvanEkris/openrowingmonitor

Creates the WebServer which serves the static assets and communicates with the clients
via WebSockets
*/
/**
* Creates the WebServer which serves the static assets and communicates with the clients via WebSockets
*/
import { WebSocket, WebSocketServer } from 'ws'
import finalhandler from 'finalhandler'
import http from 'http'
Expand All @@ -17,27 +17,17 @@ export function createWebServer (config) {
const port = process.env.PORT || 80
const serve = serveStatic('./build', { index: ['index.html'] })
let timer = setTimeout(timeBasedPresenter, config.webUpdateInterval)
let lastKnownMetrics = {
strokeState: 'WaitingForDrive',
sessionStatus: 'WaitingForStart',
totalMovingTime: 0,
totalNumberOfStrokes: 0,
totalLinearDistance: 0,
cyclePace: Infinity,
cyclePower: 0,
driveLength: 0,
driveDistance: 0,
dragFactor: undefined
}
let lastKnownMetrics
let heartRate
let heartRateBatteryLevel
resetLastKnownMetrics()

const server = http.createServer((req, res) => {
serve(req, res, finalhandler(req, res))
})

server.listen(port, (err) => {
if (err) throw err
if (err) { throw err }
log.info(`webserver running on port ${port}`)
})

Expand All @@ -46,27 +36,29 @@ export function createWebServer (config) {
wss.on('connection', function connection (client) {
log.debug('websocket client connected')
notifyClient(client, 'config', getConfig())
notifyClient(client, 'metrics', lastKnownMetrics)
client.on('message', function incoming (data) {
try {
const message = JSON.parse(data)
if (message) {
emitter.emit('messageReceived', message, client)
emitter.emit('messageReceived', message)
} else {
log.warn(`invalid message received: ${data}`)
}
} catch (err) {
log.error(err)
}
})
client.on('close', function () {
client.on('close', function close () {
log.debug('websocket client disconnected')
})
})

// This function handles all incomming commands. As all commands are broadasted to all application parts,
// we need to filter here what the webserver will react to and what it will ignore
// The start...reset commands are handled by the RowingEngine and the result will be reported by the metrics update, so we ignore them here
function handleCommand (commandName, data, client) {
/* eslint-disable-next-line no-unused-vars -- this is part of the standardised handleCommand interface */
function handleCommand (commandName, data) {
switch (commandName) {
case ('updateIntervalSettings'):
break
Expand All @@ -78,9 +70,9 @@ export function createWebServer (config) {
break
case ('stop'):
break
case ('requestControl'):
break
case ('reset'):
resetLastKnownMetrics()
notifyClients('metrics', lastKnownMetrics)
break
case 'switchBlePeripheralMode':
break
Expand All @@ -91,12 +83,7 @@ export function createWebServer (config) {
case 'refreshPeripheralConfig':
notifyClients('config', getConfig())
break
case 'authorizeStrava':
notifyClient(client, 'authorizeStrava', data)
break
case 'uploadTraining':
break
case 'stravaAuthorizationCode':
case 'upload':
break
case 'shutdown':
break
Expand All @@ -106,15 +93,15 @@ export function createWebServer (config) {
}

function presentRowingMetrics (metrics) {
if (metrics.metricsContext === undefined) return
if (metrics.metricsContext === undefined) { return }
switch (true) {
case (metrics.metricsContext.isSessionStart):
notifyClients('metrics', metrics)
break
case (metrics.metricsContext.isSessionStop):
notifyClients('metrics', metrics)
break
case (metrics.metricsContext.isIntervalStart):
case (metrics.metricsContext.isIntervalEnd):
notifyClients('metrics', metrics)
break
case (metrics.metricsContext.isPauseStart):
Expand All @@ -129,6 +116,7 @@ export function createWebServer (config) {
case (metrics.metricsContext.isRecoveryStart):
notifyClients('metrics', metrics)
break
// no default
}
lastKnownMetrics = metrics
}
Expand All @@ -144,6 +132,9 @@ export function createWebServer (config) {
notifyClients('metrics', lastKnownMetrics)
}

/**
* @param {Metrics} metrics
*/
function addHeartRateToMetrics (metrics) {
if (heartRate !== undefined) {
metrics.heartrate = heartRate
Expand Down Expand Up @@ -185,13 +176,43 @@ export function createWebServer (config) {
blePeripheralMode: config.bluetoothMode,
antPeripheralMode: config.antPlusMode,
hrmPeripheralMode: config.heartRateMode,
stravaUploadEnabled: !!config.stravaClientId && !!config.stravaClientSecret,
uploadEnabled: ((config.userSettings.strava.allowUpload && !config.userSettings.strava.autoUpload) || (config.userSettings.intervals.allowUpload && !config.userSettings.intervals.autoUpload) || (config.userSettings.rowsAndAll.allowUpload && !config.userSettings.rowsAndAll.autoUpload)),
shutdownEnabled: !!config.shutdownCommand
}
}

function resetLastKnownMetrics () {
lastKnownMetrics = {
strokeState: 'WaitingForDrive',
sessionState: 'WaitingForStart',
totalMovingTime: 0,
pauseCountdownTime: 0,
totalNumberOfStrokes: 0,
totalLinearDistance: 0,
cyclePace: Infinity,
cyclePower: 0,
cycleStrokeRate: 0,
driveLength: 0,
driveDuration: 0,
driveHandleForceCurve: [],
driveDistance: 0,
recoveryDuration: 0,
dragFactor: undefined,
interval: {
type: 'justrow',
movingTime: {
sinceStart: 0,
toEnd: 0
},
distance: {
fromStart: 0,
toEnd: 0
}
}
}
}

return Object.assign(emitter, {
notifyClient,
presentRowingMetrics,
presentHeartRate,
handleCommand
Expand Down
1 change: 0 additions & 1 deletion app/client/components/AppDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

Component that renders a html dialog
*/

import { AppElement, html, css } from './AppElement.js'
import { customElement, property } from 'lit/decorators.js'
import { ref, createRef } from 'lit/directives/ref.js'
Expand Down
28 changes: 14 additions & 14 deletions app/client/components/DashboardActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import { AppElement, html, css } from './AppElement.js'
import { customElement, property, state } from 'lit/decorators.js'
import { icon_undo, icon_expand, icon_compress, icon_poweroff, icon_bluetooth, icon_upload, icon_heartbeat, icon_antplus } from '../lib/icons.js'
import { iconUndo, iconExpand, iconCompress, iconPoweroff, iconBluetooth, iconUpload, iconHeartbeat, iconAntplus } from '../lib/icons.js'
import './AppDialog.js'

@customElement('dashboard-actions')
Expand Down Expand Up @@ -86,19 +86,19 @@ export class DashboardActions extends AppElement {
render () {
return html`
<div class="top-button-group">
<button @click=${this.reset}>${icon_undo}</button>
<button @click=${this.reset}>${iconUndo}</button>
${this.renderOptionalButtons()}
<button @click=${this.switchHrmPeripheralMode}>
${icon_heartbeat}
${iconHeartbeat}
<div class="text">${this.config?.hrmPeripheralMode}</div>
</button>
<button @click=${this.switchAntPeripheralMode}>
${icon_antplus}
${iconAntplus}
<div class="text">${this.config?.antPeripheralMode}</div>
</button>
</div>
<div class="text-button">
<button @click=${this.switchBlePeripheralMode}>${icon_bluetooth}</button>
<button @click=${this.switchBlePeripheralMode}>${iconBluetooth}</button>
<div class="peripheral-mode">${this.blePeripheralMode()}</div>
</div>
${this._dialog ? this._dialog : ''}
Expand Down Expand Up @@ -126,8 +126,8 @@ export class DashboardActions extends AppElement {
if (this._appMode === 'BROWSER' && document.documentElement.requestFullscreen) {
buttons.push(html`
<button @click=${this.toggleFullscreen}>
<div id="fullscreen-icon">${icon_expand}</div>
<div id="windowed-icon">${icon_compress}</div>
<div id="fullscreen-icon">${iconExpand}</div>
<div id="windowed-icon">${iconCompress}</div>
</button>
`)
}
Expand All @@ -136,13 +136,13 @@ export class DashboardActions extends AppElement {
// (might also make sence to enable this for all clients but then we would need visual feedback)
if (this._appMode === 'KIOSK' && this.config?.shutdownEnabled) {
buttons.push(html`
<button @click=${this.shutdown}>${icon_poweroff}</button>
<button @click=${this.shutdown}>${iconPoweroff}</button>
`)
}

if (this.config?.stravaUploadEnabled) {
if (this.config?.uploadEnabled) {
buttons.push(html`
<button @click=${this.uploadTraining}>${icon_upload}</button>
<button @click=${this.uploadTraining}>${iconUpload}</button>
`)
}
return buttons
Expand Down Expand Up @@ -196,22 +196,22 @@ export class DashboardActions extends AppElement {
uploadTraining () {
this._dialog = html`
<app-dialog @close=${dialogClosed}>
<legend>${icon_upload}<br/>Upload to Strava?</legend>
<p>Do you want to finish your workout and upload it to Strava?</p>
<legend>${iconUpload}<br/>Upload training?</legend>
<p>Do you want to finish your workout and upload it to webservices (Strava, Intervals.icu and RowsAndAll)?</p>
</app-dialog>
`
function dialogClosed (event) {
this._dialog = undefined
if (event.detail === 'confirm') {
this.sendEvent('triggerAction', { command: 'uploadTraining' })
this.sendEvent('triggerAction', { command: 'upload' })
}
}
}

shutdown () {
this._dialog = html`
<app-dialog @close=${dialogClosed}>
<legend>${icon_poweroff}<br/>Shutdown Open Rowing Monitor?</legend>
<legend>${iconPoweroff}<br/>Shutdown Open Rowing Monitor?</legend>
<p>Do you want to shutdown the device?</p>
</app-dialog>
`
Expand Down
4 changes: 3 additions & 1 deletion app/client/components/DashboardMetric.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ export class DashboardMetric extends AppElement {

render () {
return html`
<div class="label"><div class="icon">${this.icon}</div></div>
<div class="${this.icon === '' ? '' : 'label'}">
<div class=${this.icon === '' ? '' : 'icon'}>${this.icon}</div>
</div>
<div class="content">
<span class="metric-value" style="${this.icon === '' ? 'font-size: 200%;' : ''}">${this.value !== undefined ? this.value : '--'}</span>
<span class="metric-unit">${this.unit}</span>
Expand Down
5 changes: 3 additions & 2 deletions app/client/components/PerformanceDashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import { AppElement, html, css } from './AppElement.js'
import { customElement, property, state } from 'lit/decorators.js'
import './SettingsDialog.js'
import { icon_settings } from '../lib/icons.js'
import { iconSettings } from '../lib/icons.js'
import { DASHBOARD_METRICS } from '../store/dashboardMetrics.js'

@customElement('performance-dashboard')
Expand Down Expand Up @@ -90,7 +90,7 @@ export class PerformanceDashboard extends AppElement {
}
</style>
<div class="settings" @click=${this.openSettings}>
${icon_settings}
${iconSettings}
${this._dialog ? this._dialog : ''}
</div>

Expand All @@ -101,6 +101,7 @@ export class PerformanceDashboard extends AppElement {
openSettings () {
this._dialog = html`<settings-dialog .config=${this.appState.config.guiConfigs} @close=${dialogClosed}></settings-dialog>`

/* eslint-disable-next-line no-unused-vars -- Standard construct?? */
function dialogClosed (event) {
this._dialog = undefined
}
Expand Down
Loading
Loading