laberning / openrowingmonitor

A free and open source performance monitor for rowing machines
https://laberning.github.io/openrowingmonitor
GNU General Public License v3.0
99 stars 19 forks source link

Implemented new flank detection and addition of some TCX-fields #11

Closed JaapvanEkris closed 3 years ago

JaapvanEkris commented 3 years ago

Hi Lars,

In this pull request you'll find four things:

  1. An implementation of the new stroke detection algorithm. Please note that you will need to add additional parameters in your settings file before it works.I limited this algorithm to the non-waterrowers, although I suspect it will work for the waterrowers as well, you can test by switching to liquidFlywheel = false (come over to the dark side ;))
  2. Added priority to the gpio and server processes. It ran as a normal user process with a low priority, which is problematic as on a high-frequency rower like the NordicTrack RX800 the impulse comes around every 20 miliseconds (and the difference between detects determines the acceleration!).
  3. A modification of the metrics to prepare the fields needed to generate a TCX-file (the stroke-rate needs to be an integer, and the speed needs to be in meters per second).
  4. Fixed the installation script, as it checked the hostname and not the OS name (which thus breaks installation when the hostname is changed from Raspberry to something more meaningful)

Jaap

laberning commented 3 years ago

There are a bunch of linter-findings in your code (mostly code formatting issues). Looks like eslint is not enabled in your IDE. You can also run the linter manually by issuing npm run lint. Also seems like your editor did not read the .editorconfig, since it added tabs instead of spaces:

/home/pi/dev/test/openrowingmonitor/app/engine/MovingFlankDetector.js
  11:43  error  Operator '+' must be spaced                    space-infix-ops
  17:12  error  There should be no space after this paren      space-in-parens
  19:35  error  Operator '-' must be spaced                    space-infix-ops
  20:13  error  Operator '-' must be spaced                    space-infix-ops
  28:12  error  There should be no space after this paren      space-in-parens
  29:1   error  Expected indentation of 6 spaces but found 7   indent
  29:40  error  Operator '-' must be spaced                    space-infix-ops
  30:1   error  Expected indentation of 8 spaces but found 10  indent
  31:1   error  Expected indentation of 6 spaces but found 7   indent
  32:1   error  Expected indentation of 8 spaces but found 10  indent
  33:1   error  Expected indentation of 6 spaces but found 7   indent
  46:12  error  There should be no space after this paren      space-in-parens
  47:1   error  Expected indentation of 6 spaces but found 7   indent
  47:40  error  Operator '-' must be spaced                    space-infix-ops
  48:1   error  Expected indentation of 8 spaces but found 10  indent
  49:1   error  Expected indentation of 6 spaces but found 7   indent
  50:1   error  Expected indentation of 8 spaces but found 10  indent
  51:1   error  Expected indentation of 6 spaces but found 7   indent

/home/pi/dev/test/openrowingmonitor/app/engine/RowingEngine.js
  147:11  error  There should be no space after this paren         space-in-parens
  147:27  error  There should be no space before this paren        space-in-parens
  148:1   error  Unexpected tab character                          no-tabs
  148:1   error  Expected indentation of 8 spaces but found 1 tab  indent
  149:1   error  Unexpected tab character                          no-tabs
  149:1   error  Expected indentation of 8 spaces but found 1 tab  indent
  150:1   error  Unexpected tab character                          no-tabs
  150:1   error  Expected indentation of 8 spaces but found 1 tab  indent
  150:6   error  There should be no space after this paren         space-in-parens
  151:1   error  Unexpected tab character                          no-tabs
  151:1   error  Mixed spaces and tabs                             no-mixed-spaces-and-tabs
  152:1   error  Unexpected tab character                          no-tabs
  152:1   error  Mixed spaces and tabs                             no-mixed-spaces-and-tabs
  153:1   error  Unexpected tab character                          no-tabs
  153:1   error  Mixed spaces and tabs                             no-mixed-spaces-and-tabs
  154:1   error  Unexpected tab character                          no-tabs
  154:1   error  Expected indentation of 8 spaces but found 1 tab  indent
  155:1   error  Unexpected tab character                          no-tabs
  155:1   error  Mixed spaces and tabs                             no-mixed-spaces-and-tabs
  156:1   error  Mixed spaces and tabs                             no-mixed-spaces-and-tabs
  156:2   error  Unexpected tab character                          no-tabs
  157:1   error  Unexpected tab character                          no-tabs
  157:1   error  Expected indentation of 8 spaces but found 1 tab  indent
  159:1   error  Unexpected tab character                          no-tabs
  159:1   error  Expected indentation of 8 spaces but found 1 tab  indent
  160:1   error  Unexpected tab character                          no-tabs
  160:1   error  Expected indentation of 8 spaces but found 1 tab  indent
  161:1   error  Unexpected tab character                          no-tabs
  161:1   error  Expected indentation of 8 spaces but found 1 tab  indent
  161:6   error  There should be no space after this paren         space-in-parens
  161:59  error  There should be no space before this paren        space-in-parens
  161:95  error  There should be no space before this paren        space-in-parens
  162:1   error  Unexpected tab character                          no-tabs
  162:1   error  Mixed spaces and tabs                             no-mixed-spaces-and-tabs
  163:1   error  Unexpected tab character                          no-tabs
  163:1   error  Mixed spaces and tabs                             no-mixed-spaces-and-tabs
  164:1   error  Unexpected tab character                          no-tabs
  164:1   error  Mixed spaces and tabs                             no-mixed-spaces-and-tabs
  165:1   error  Unexpected tab character                          no-tabs
  165:1   error  Expected indentation of 8 spaces but found 1 tab  indent
  166:1   error  Unexpected tab character                          no-tabs
  166:1   error  Mixed spaces and tabs                             no-mixed-spaces-and-tabs
  167:1   error  Unexpected tab character                          no-tabs
  167:1   error  Mixed spaces and tabs                             no-mixed-spaces-and-tabs
  168:1   error  Unexpected tab character                          no-tabs
  168:1   error  Expected indentation of 8 spaces but found 1 tab  indent
  170:1   error  Expected indentation of 6 spaces but found 4      indent

/home/pi/dev/test/openrowingmonitor/app/engine/RowingStatistics.js
  116:18  error  Extra space after key 'speedmeters'  key-spacing

/home/pi/dev/test/openrowingmonitor/app/server.js
  73:3   warning  Unexpected var, use let or const instead  no-var
  73:21  error    Extra semicolon                           semi
  74:3   warning  Unexpected var, use let or const instead  no-var
  74:34  error    Extra semicolon                           semi

✖ 70 problems (68 errors, 2 warnings)
  38 errors and 2 warnings potentially fixable with the `--fix` option.
JaapvanEkris commented 3 years ago

Can you recommend a decent IDE (I normally use nano or vim on the Pi itself, or visual studio on my laptop)?

JaapvanEkris commented 3 years ago

Hi Lars,

Inlcuded you will find a new pull request with all Lint issues resolved, as well as other improvements (as mentioned in the initial post).

Jaap