signalk-fixedstation 0.5.0 → 0.5.1

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/fixedstation.js CHANGED
@@ -61,9 +61,10 @@ function prepareFixed() {
61
61
  return { "update": update, "meta": meta }
62
62
  }
63
63
 
64
- function prepareMeta() {
64
+ function prepareMeta(alt) {
65
65
  let update = []
66
66
  let meta = []
67
+ update.push(buildDelta(navigationElevation, alt && typeof alt==="number" ? alt : 0 ))
67
68
  meta.push(buildDelta(navigationElevation, { "units": "m", "description": "Altitude above sealevel", "pgn":129029 } ))
68
69
  return { "update": update, "meta": meta }
69
70
  }
@@ -85,7 +86,7 @@ async function prepareDynamic (callback) {
85
86
  if (e && typeof e==='number')
86
87
  {
87
88
  log(`Elevation determined for [${latest.position.lat},${latest.position.lon}] to ${e}m`)
88
- onAltitudeUpdated(e)
89
+ onAltitudeUpdated(Math.round(e*1000)/1000)
89
90
  } else {
90
91
  log(`Failed to determin elevation: ${e}`)
91
92
  }
@@ -133,7 +134,7 @@ module.exports = {
133
134
  if (calc) // throw new Error("Cannot add null value");
134
135
  {
135
136
  prepareDynamic();
136
- return prepareMeta();
137
+ return prepareMeta(elev);
137
138
  }
138
139
  else
139
140
  {
package/index.js CHANGED
@@ -15,9 +15,9 @@ module.exports = function (app) {
15
15
  fs.init(options, log, sendDelta);
16
16
  let delta = fs.onLoad(options["latitude"], options["longitude"], options["elevation"], options["dynamic"]);
17
17
  app.debug('Plugin started.');
18
- if (delta) {
19
- if (delta.update && delta.update.length>0)
20
- sendDelta(delta.update);
18
+
19
+ if (delta && delta.update && delta.update.length>0) {
20
+ sendDelta(delta.update);
21
21
  if (delta.meta && delta.meta.length>0)
22
22
  sendMeta(delta.meta);
23
23
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "signalk-fixedstation",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "SignalK plugin to provide fixed navigation data",
5
5
  "main": "index.js",
6
6
  "scripts": {