signalk-fixedstation 0.5.0 → 0.6.0
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/README.md +1 -1
- package/fixedstation.js +4 -3
- package/index.js +3 -3
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# signalk-fixedstation-plugin
|
|
2
2
|
SignalK Plugin to inject fixed station data in absence of GPS input (eg. for weather-station or marina use)
|
|
3
3
|
# Install & Use
|
|
4
|
-
Note: This plugin can be used to calculate elevation via '@googlemaps/google-maps-services-js', but requires a google API subscription - hence, the feature is deactivated by design.<br><br>
|
|
4
|
+
Note: This plugin can be used to calculate elevation via '@googlemaps/google-maps-services-js', but requires a google API subscription - hence, the feature is deactivated by design, but can be activated with a proper api key in the plugin config post install.<br><br>
|
|
5
5
|
<p>Install the plugin through the SignalK plugin interface. After installation you can either enter the fixed position / elevation or you may want to 'Activate' automatic updates through the SignalK Plugin Config interface - nearest position will be determined based on public IP assgined to the SignalK server.</p>
|
|
6
6
|
<br>
|
|
7
7
|
<p>The plugin will output 2 new SignalK-values:<br>
|
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
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "SignalK plugin to provide fixed navigation data",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
},
|
|
24
24
|
"homepage": "https://github.com/inspired-technologies/signalk-fixedstation-plugin#readme",
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@googlemaps/google-maps-services-js": "^3.
|
|
27
|
-
"debug": "^4.
|
|
26
|
+
"@googlemaps/google-maps-services-js": "^3.4.0",
|
|
27
|
+
"debug": "^4.4.0",
|
|
28
28
|
"geoip-lite": "^1.4.10",
|
|
29
|
-
"public-ip": "^
|
|
29
|
+
"public-ip": "^7.0.1"
|
|
30
30
|
}
|
|
31
31
|
}
|