signalk-polar-performance-plugin 0.0.52 → 0.0.54

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/plugin/index.js +11 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "signalk-polar-performance-plugin",
3
- "version": "0.0.52",
3
+ "version": "0.0.54",
4
4
  "description": "A plugin that calculates performance information based on a (CSV) polar diagram.",
5
5
  "main": "plugin/index.js",
6
6
  "scripts": {
package/plugin/index.js CHANGED
@@ -19,10 +19,10 @@ module.exports = function (app) {
19
19
  var schema = {
20
20
  // The plugin schema
21
21
  properties: {
22
- trueWindSpeedPath: {
22
+ useTWSsource: {
23
23
  type: 'string',
24
- default: 'environment.wind.speedTrue',
25
- title: 'Wind speed path to use'
24
+ default: '',
25
+ title: 'Source (name.id) to filter TWS on'
26
26
  },
27
27
  beatAngle: {
28
28
  type: 'boolean',
@@ -139,7 +139,7 @@ module.exports = function (app) {
139
139
  minPeriod: 500
140
140
  },
141
141
  {
142
- path: trueWindSpeedPath,
142
+ path: 'environment.wind.speedTrue',
143
143
  policy: 'instant',
144
144
  minPeriod: 500
145
145
  },
@@ -205,11 +205,13 @@ module.exports = function (app) {
205
205
  } else if (delta.path == 'navigation.headingTrue') {
206
206
  HDG = delta.value
207
207
  // app.debug('heading (HDG): %d', HDG)
208
- } else if (delta.path == trueWindSpeedPath) {
209
- TWS = applyDamping(delta.value, 'TWS', options.dampingTWS || 0)
210
- // app.debug('%s (TWS): %d applyDamping: %d', trueWindSpeedPath, delta.value, TWS)
211
- // app.debug('TWS: %d TWA: %d BSP: %d', msToKts(TWS), radToDeg(TWA)*port, msToKts(BSP))
212
- sendUpdates(getPerformanceData(TWS, TWA, BSP))
208
+ } else if (delta.path == 'environment.wind.speedTrue') {
209
+ if (options.useTWSsource == '' || source == options.useTWSsource) {
210
+ TWS = applyDamping(delta.value, 'TWS', options.dampingTWS || 0)
211
+ // app.debug('(TWS): %d applyDamping: %d', delta.value, TWS)
212
+ // app.debug('TWS: %d TWA: %d BSP: %d', msToKts(TWS), radToDeg(TWA)*port, msToKts(BSP))
213
+ sendUpdates(getPerformanceData(TWS, TWA, BSP))
214
+ }
213
215
  } else if (delta.path == 'environment.wind.angleTrueWater') {
214
216
  let TWAtmp = applyDamping(delta.value, 'TWA', options.dampingTWA || 0)
215
217
  if (TWAtmp < 0) {