signalk-polar-performance-plugin 0.0.51 → 0.0.53

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 +18 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "signalk-polar-performance-plugin",
3
- "version": "0.0.51",
3
+ "version": "0.0.53",
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,6 +19,16 @@ module.exports = function (app) {
19
19
  var schema = {
20
20
  // The plugin schema
21
21
  properties: {
22
+ trueWindSpeedPath: {
23
+ type: 'string',
24
+ default: 'environment.wind.speedTrue',
25
+ title: 'Wind speed path (TWS) to use'
26
+ },
27
+ useTWSsource: {
28
+ type: 'string',
29
+ default: '',
30
+ title: 'Source (name.id) to filter TWS on'
31
+ },
22
32
  beatAngle: {
23
33
  type: 'boolean',
24
34
  title:
@@ -134,7 +144,7 @@ module.exports = function (app) {
134
144
  minPeriod: 500
135
145
  },
136
146
  {
137
- path: 'environment.wind.speedTrue',
147
+ path: trueWindSpeedPath,
138
148
  policy: 'instant',
139
149
  minPeriod: 500
140
150
  },
@@ -200,11 +210,13 @@ module.exports = function (app) {
200
210
  } else if (delta.path == 'navigation.headingTrue') {
201
211
  HDG = delta.value
202
212
  // app.debug('heading (HDG): %d', HDG)
203
- } else if (delta.path == 'environment.wind.speedTrue') {
204
- TWS = applyDamping(delta.value, 'TWS', options.dampingTWS || 0)
205
- // app.debug('environment.wind.speedTrue (TWS): %d applyDamping: %d', delta.value, TWS)
206
- // app.debug('TWS: %d TWA: %d BSP: %d', msToKts(TWS), radToDeg(TWA)*port, msToKts(BSP))
207
- sendUpdates(getPerformanceData(TWS, TWA, BSP))
213
+ } else if (delta.path == trueWindSpeedPath) {
214
+ if (options.useTWSsource == '' || source == options.useTWSsource) {
215
+ TWS = applyDamping(delta.value, 'TWS', options.dampingTWS || 0)
216
+ // app.debug('%s (TWS): %d applyDamping: %d', trueWindSpeedPath, delta.value, TWS)
217
+ // app.debug('TWS: %d TWA: %d BSP: %d', msToKts(TWS), radToDeg(TWA)*port, msToKts(BSP))
218
+ sendUpdates(getPerformanceData(TWS, TWA, BSP))
219
+ }
208
220
  } else if (delta.path == 'environment.wind.angleTrueWater') {
209
221
  let TWAtmp = applyDamping(delta.value, 'TWA', options.dampingTWA || 0)
210
222
  if (TWAtmp < 0) {