signalk-polar-performance-plugin 0.0.37 → 0.0.39
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 +5 -1
- package/plugin/index.js +3 -3
- package/public/index.html +11 -4
- package/public/logo.png +0 -0
- package/public/signalk-logo.png +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "signalk-polar-performance-plugin",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.39",
|
|
4
4
|
"description": "A plugin that calculates performance information based on a (CSV) polar diagram.",
|
|
5
5
|
"main": "plugin/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -16,6 +16,10 @@
|
|
|
16
16
|
"url": "https://github.com/htool/signalk-polar-performance-plugin/issues"
|
|
17
17
|
},
|
|
18
18
|
"homepage": "https://github.com/htool/signalk-polar-performance-plugin#readme",
|
|
19
|
+
"signalk": {
|
|
20
|
+
"appIcon": "./signalk-logo.png",
|
|
21
|
+
"displayName": "Polar Performance"
|
|
22
|
+
},
|
|
19
23
|
"keywords": [
|
|
20
24
|
"signalk-webapp",
|
|
21
25
|
"signalk-node-server-plugin",
|
package/plugin/index.js
CHANGED
|
@@ -163,14 +163,14 @@ module.exports = function (app) {
|
|
|
163
163
|
function handleDelta (deltas) {
|
|
164
164
|
deltas.forEach(delta => {
|
|
165
165
|
// app.debug('handleData: %s', JSON.stringify(delta))
|
|
166
|
-
if (delta.path == 'navigation.speedThroughWater') {
|
|
166
|
+
if (delta.path == 'navigation.speedThroughWater' && options.useSOG == false) {
|
|
167
167
|
STW = applyDamping (delta.value, 'STW', options.dampingBSP || 0)
|
|
168
168
|
BSP = STW
|
|
169
169
|
// app.debug('speedThroughWater (STW): %d', STW)
|
|
170
|
-
} else if (delta.path == 'navigation.speedOverGround') {
|
|
170
|
+
} else if (delta.path == 'navigation.speedOverGround' && options.useSOG == true) {
|
|
171
171
|
SOG = applyDamping (delta.value, 'SOG', options.dampingBSP || 0)
|
|
172
172
|
BSP = SOG
|
|
173
|
-
// app.debug('
|
|
173
|
+
// app.debug('speedOverGround (SOG): %d', SOG)
|
|
174
174
|
} else if (delta.path == 'navigation.headingTrue') {
|
|
175
175
|
HDG = delta.value
|
|
176
176
|
// app.debug('heading (HDG): %d', HDG)
|
package/public/index.html
CHANGED
|
@@ -195,16 +195,16 @@ function handleData (data) {
|
|
|
195
195
|
var value = data.updates[0].values[0].value
|
|
196
196
|
|
|
197
197
|
if (path == 'performance.polarSpeed') {
|
|
198
|
-
polarSpeed = msToKts(value)
|
|
198
|
+
polarSpeed = roundDec(msToKts(value), 1)
|
|
199
199
|
// console.log('polarSpeed set to %s', polarSpeed)
|
|
200
200
|
chartData.datasets[0].data[0].y = polarSpeed
|
|
201
201
|
} else if (path == 'environment.wind.angleTrueWaterDamped') {
|
|
202
|
-
TWA = radToDeg(value)
|
|
202
|
+
TWA = roundDec(radToDeg(value),1)
|
|
203
203
|
// console.log('TWA set to %s', TWA)
|
|
204
204
|
chartData.datasets[0].data[0].x = TWA
|
|
205
205
|
chartData.datasets[1].data[0].x = TWA
|
|
206
206
|
} else if (path == 'performance.boatSpeedDamped') {
|
|
207
|
-
boatSpeed = msToKts(value)
|
|
207
|
+
boatSpeed = roundDec(msToKts(value),1)
|
|
208
208
|
// console.log('boatSpeed set to %s', boatSpeed)
|
|
209
209
|
chartData.datasets[1].data[0].y = boatSpeed
|
|
210
210
|
}
|
|
@@ -227,7 +227,14 @@ function msToKts(ms) {
|
|
|
227
227
|
return ms * 1.94384
|
|
228
228
|
}
|
|
229
229
|
|
|
230
|
-
|
|
230
|
+
function roundDec (value, decimals) {
|
|
231
|
+
if (typeof value == 'undefined') {
|
|
232
|
+
return undefined
|
|
233
|
+
} else {
|
|
234
|
+
value = Number(value.toFixed(decimals))
|
|
235
|
+
return value
|
|
236
|
+
}
|
|
237
|
+
}
|
|
231
238
|
|
|
232
239
|
</script>
|
|
233
240
|
|
package/public/logo.png
ADDED
|
Binary file
|
|
Binary file
|