signalk-polar-performance-plugin 0.0.40 → 0.0.41
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.
- package/package.json +1 -1
- package/plugin/index.js +7 -7
package/package.json
CHANGED
package/plugin/index.js
CHANGED
|
@@ -196,14 +196,14 @@ module.exports = function (app) {
|
|
|
196
196
|
let metas = []
|
|
197
197
|
values.push({path: 'performance.boatSpeedDamped', value: roundDec(BSP)})
|
|
198
198
|
metas.push({path: 'performance.boatSpeedDamped', value: {"units": "m/s"}})
|
|
199
|
-
values.push({path: 'environment.wind.angleTrueWaterDamped', value: roundDec(TWA)})
|
|
199
|
+
values.push({path: 'environment.wind.angleTrueWaterDamped', value: roundDec(TWA) * port})
|
|
200
200
|
metas.push({path: 'environment.wind.angleTrueWaterDamped', value: {"units": "rad"}})
|
|
201
201
|
if (typeof perfObj.beatAngle != 'undefined') {
|
|
202
202
|
if (options.beatAngle == true) {
|
|
203
|
-
values.push({path: 'performance.beatAngle', value: roundDec(perfObj.beatAngle)})
|
|
203
|
+
values.push({path: 'performance.beatAngle', value: roundDec(perfObj.beatAngle * port)})
|
|
204
204
|
}
|
|
205
205
|
if (options.targetTWA == true) {
|
|
206
|
-
values.push({path: 'performance.targetAngle', value: roundDec(perfObj.beatAngle)})
|
|
206
|
+
values.push({path: 'performance.targetAngle', value: roundDec(perfObj.beatAngle * port)})
|
|
207
207
|
}
|
|
208
208
|
}
|
|
209
209
|
if (typeof perfObj.beatVMG != 'undefined') {
|
|
@@ -215,10 +215,10 @@ module.exports = function (app) {
|
|
|
215
215
|
}
|
|
216
216
|
if (typeof perfObj.runAngle != 'undefined') {
|
|
217
217
|
if (options.beatAngle == true) {
|
|
218
|
-
values.push({path: 'performance.gybeAngle', value: roundDec(perfObj.runAngle)})
|
|
218
|
+
values.push({path: 'performance.gybeAngle', value: roundDec(perfObj.runAngle * port)})
|
|
219
219
|
}
|
|
220
220
|
if (options.targetTWA == true) {
|
|
221
|
-
values.push({path: 'performance.targetAngle', value: roundDec(perfObj.runAngle)})
|
|
221
|
+
values.push({path: 'performance.targetAngle', value: roundDec(perfObj.runAngle * port)})
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
224
|
if (typeof perfObj.runVMG != 'undefined') {
|
|
@@ -309,6 +309,7 @@ module.exports = function (app) {
|
|
|
309
309
|
//app.debug('VMGLower: %s VMGUpper: %s', VMGLower, VMGUpper)
|
|
310
310
|
performance.beatVMG = VMGLower + ((VMGUpper - VMGLower) * twsGapRatio)
|
|
311
311
|
performance.targetVMG = performance.beatVMG
|
|
312
|
+
performance.targetSpeed = performance.beatVMG / Math.cos(targetTWA)
|
|
312
313
|
}
|
|
313
314
|
} else {
|
|
314
315
|
// app.debug('Downwind')
|
|
@@ -333,6 +334,7 @@ module.exports = function (app) {
|
|
|
333
334
|
//app.debug('VMGLower: %s VMGUpper: %s', VMGLower, VMGUpper)
|
|
334
335
|
performance.runVMG = VMGLower + ((VMGUpper - VMGLower) * twsGapRatio)
|
|
335
336
|
performance.targetVMG = performance.runVMG
|
|
337
|
+
performance.targetSpeed = performance.runVMG / Math.abs(Math.cos(targetTWA))
|
|
336
338
|
}
|
|
337
339
|
}
|
|
338
340
|
// Calculate opposite Tack True
|
|
@@ -728,10 +730,8 @@ module.exports = function (app) {
|
|
|
728
730
|
plugin.stop = function () {
|
|
729
731
|
// Here we put logic we need when the plugin stops
|
|
730
732
|
app.debug('Plugin stopped')
|
|
731
|
-
app.debug('unsubscribes before: %s', JSON.stringify(unsubscribes))
|
|
732
733
|
unsubscribes.forEach(f => f())
|
|
733
734
|
unsubscribes = []
|
|
734
|
-
app.debug('unsubscribes after: %s', JSON.stringify(unsubscribes))
|
|
735
735
|
timers.forEach(timer => {
|
|
736
736
|
clearInterval(timer)
|
|
737
737
|
})
|