signalk-to-noforeignland 0.1.18 → 0.1.20

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.
Files changed (2) hide show
  1. package/index.js +6 -2
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -220,6 +220,9 @@ module.exports = function(app) {
220
220
  // SK sometimes messes up timestamps, when that happens we throw the update
221
221
  return;
222
222
  }
223
+ lastPosition = { pos: value.value, timestamp, currentTime: new Date().getTime() };
224
+ app.debug('Updated lastPosition:', lastPosition);
225
+
223
226
  const distance = equirectangularDistance(lastPosition.pos, value.value)
224
227
  if (options.minMove && distance < options.minMove) {
225
228
  return;
@@ -228,8 +231,9 @@ module.exports = function(app) {
228
231
  // app.debug('got error position', value.value, 'ignoring...');
229
232
  // return;
230
233
  // }
234
+ } else{
235
+ lastPosition = { pos: value.value, timestamp, currentTime: new Date().getTime() };
231
236
  }
232
- lastPosition = { pos: value.value, timestamp, currentTime: new Date().getTime() };
233
237
 
234
238
  await savePoint(lastPosition);
235
239
  if (options.minSpeed) {
@@ -391,7 +395,7 @@ module.exports = function(app) {
391
395
  return;
392
396
  }
393
397
  const url = options.apiUrl || "https://www.noforeignland.com/home/api/v1/boat/tracking/track";
394
- const timestamp = new Date(lastPosition.timestamp).getTime();
398
+ const timestamp = Date.now();//we want to trigger a refresh on NFL even if we didn't get a delta
395
399
  const lat = lastPosition.pos.latitude;
396
400
  const lon = lastPosition.pos.longitude;
397
401
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "signalk-to-noforeignland",
3
- "version": "0.1.18",
3
+ "version": "0.1.20",
4
4
  "description": "SignalK track logger to noforeignland.com ",
5
5
  "main": "index.js",
6
6
  "keywords": [