SignalK / sailgauge

Sailgauge html page to show sailing-related data on one screen
MIT License
6 stars 2 forks source link

SOG units #9

Closed dannybek closed 8 years ago

dannybek commented 8 years ago

I'm experimenting with sailgauge as distributed with the openplotter project for rpi. I assume the figure in the middle of the gauge represents SOG? In my case this figure appears to be representing the boat speed in meters/second instead of Knots! For example: if the boat speed is 5.22 Kn the sailgauge shows 2.7. What am I doing wrong?

tkurki commented 8 years ago

Nothing - 5.22 knots is 2.7 meters per second. The real fix naturally would be to have configurable units #10.

A quick fix is to change the displayed value on the fly like so

diff --git a/lib/sailgauge.js b/lib/sailgauge.js
index 6da134c..b6017be 100644
--- a/lib/sailgauge.js
+++ b/lib/sailgauge.js
@@ -75,7 +75,7 @@ SailGauge.prototype = {
   },
   updateSpeedOverGround: function(speed) {
     if (speed != null) {
-      d3.select('#speed').text(speed.toFixed(1));
+      d3.select('#speed').text((speed / 0.51444444444).toFixed(1));
     }
   },
   updateApparentWindAngle: function (angle) {

In addition to this actually change you need to run first npm install in the Sailgauge directory and then npm run build to make the change take effect. I haven't used openplotter myself, so I can't help you find the file easily.

Let me know if you get this working.

Help with implementing the configurable units would be appreciated, this is not very high on my personal backlog right now.

Btw the wind speeds are in meters per second as well.

dannybek commented 8 years ago

Thanks tkurki. That explains it! What fooled me was the sailgauge project information specifically states that the SOG is in Knots whereas the wind speeds and depth are in SI.

tkurki commented 8 years ago

Oops, thanks for pointing that out. Fixed now.

dannybek commented 8 years ago

Thanks for the patch. I just directly edited the sailgauge.js in the .../dist/ directory with the replacement line you suggested and that works fine. I'll probably do the same for the wind speed as well eventually.