signalk-polar-performance-plugin 0.0.41 → 0.0.43
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/public/index.html +10 -1
package/package.json
CHANGED
package/public/index.html
CHANGED
|
@@ -163,15 +163,24 @@ function connect () {
|
|
|
163
163
|
|
|
164
164
|
ws.onclose = function() {
|
|
165
165
|
console.log("WebSocket closed")
|
|
166
|
+
setTimeout(connect, 500)
|
|
166
167
|
}
|
|
167
168
|
|
|
168
169
|
ws.onerror = function(err) {
|
|
169
170
|
console.log("WebSocket connection error: " + err.message + " - closing connection");
|
|
171
|
+
setTimeout(connect, 500)
|
|
170
172
|
}
|
|
171
173
|
|
|
172
174
|
}
|
|
173
175
|
}
|
|
174
176
|
|
|
177
|
+
window.addEventListener('focus', function () {
|
|
178
|
+
if (ws.readyState == 0) {
|
|
179
|
+
console.log("Restarting websocket")
|
|
180
|
+
connect()
|
|
181
|
+
}
|
|
182
|
+
})
|
|
183
|
+
|
|
175
184
|
function startListeners () {
|
|
176
185
|
var paths = [{'path': 'environment.wind.angleTrueWaterDamped'}, {'path': 'performance.polarSpeed'}, {'path': 'performance.boatSpeedDamped'}]
|
|
177
186
|
|
|
@@ -199,7 +208,7 @@ function handleData (data) {
|
|
|
199
208
|
// console.log('polarSpeed set to %s', polarSpeed)
|
|
200
209
|
chartData.datasets[0].data[0].y = polarSpeed
|
|
201
210
|
} else if (path == 'environment.wind.angleTrueWaterDamped') {
|
|
202
|
-
TWA = roundDec(radToDeg(value),1)
|
|
211
|
+
TWA = roundDec(Math.abs(radToDeg(value)),1)
|
|
203
212
|
// console.log('TWA set to %s', TWA)
|
|
204
213
|
chartData.datasets[0].data[0].x = TWA
|
|
205
214
|
chartData.datasets[1].data[0].x = TWA
|