@meri-imperiumi/signalk-triplogger 1.4.1 → 1.4.2

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/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [1.4.2] - 2026-10-05
6
+
7
+ ### Changed
8
+ - Bump the `where` dependency to `^0.4.3`, which fixes its bearing calculations across the antimeridian. Triplogger itself only uses `distanceTo` (already seam-safe), but the bump keeps the antimeridian-fixed upstream version pinned for any future bearing use
9
+
5
10
  ## [1.4.1] - 2026-09-10
6
11
 
7
12
  ### Fixed
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meri-imperiumi/signalk-triplogger",
3
- "version": "1.4.1",
3
+ "version": "1.4.2",
4
4
  "description": "Log the length of the current trip",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -17,7 +17,7 @@
17
17
  ],
18
18
  "signalk-plugin-enabled-by-default": true,
19
19
  "signalk": {
20
- "appIcon": "./doc/appicon.png",
20
+ "appIcon": "./doc/appicon-256.png",
21
21
  "displayName": "Automatic Trip Length Logger",
22
22
  "requires": [
23
23
  "@meri-imperiumi/signalk-autostate"
@@ -30,7 +30,7 @@
30
30
  },
31
31
  "homepage": "https://github.com/meri-imperiumi/signalk-triplogger#readme",
32
32
  "dependencies": {
33
- "where": "^0.4.1"
33
+ "where": "^0.4.3"
34
34
  },
35
35
  "devDependencies": {
36
36
  "eslint": "^8.14.0",
@@ -523,3 +523,52 @@ test('stop clears subscriptions', () => {
523
523
  plugin.stop();
524
524
  assert.strictEqual(app.subscriptionmanager.subscriptions.length, 0);
525
525
  });
526
+
527
+ test('a trip crossing the antimeridian accumulates the short-way distance', async () => {
528
+ // A boat drifting a few meters east across 180° longitude: the next
529
+ // fix reads as -179.9999 (GPS wraps to [-180, 180]). The distance
530
+ // between the fixes is ~22 m at the equator, not the ~20 000 km the
531
+ // naive longitude difference suggests — the trip total must stay small.
532
+ const app = new FakeSignalKApp();
533
+ seedLog(app, 'current', {
534
+ started: '2026-01-01T00:00:00.000Z',
535
+ ended: '2026-01-01T01:00:00.000Z',
536
+ total: 0,
537
+ states: {},
538
+ });
539
+ const plugin = makePlugin(app);
540
+ plugin.start({ totals: true });
541
+ emitDelta(app, {
542
+ context: 'vessels.self',
543
+ updates: [{ values: [{ path: 'navigation.state', value: 'sailing' }] }],
544
+ });
545
+ await waitFor(() => app.statusMessages.some((m) => /new trip/i.test(m.msg)));
546
+
547
+ // First fix just east of the seam.
548
+ emitDelta(app, {
549
+ context: 'vessels.self',
550
+ updates: [
551
+ { values: [{ path: 'navigation.position', value: { latitude: -14.2, longitude: 179.9999 } }] },
552
+ ],
553
+ });
554
+ // Second fix just west of the seam (wrapped) — ~22 m further east.
555
+ emitDelta(app, {
556
+ context: 'vessels.self',
557
+ updates: [
558
+ { values: [{ path: 'navigation.position', value: { latitude: -14.2, longitude: -179.9999 } }] },
559
+ ],
560
+ });
561
+ await waitFor(() => {
562
+ const tripValue = app.messages
563
+ .flatMap(({ message }) => message.updates.flatMap((u) => u.values))
564
+ .find((v) => v.path === 'navigation.trip.log' && v.value > 0);
565
+ return !!tripValue;
566
+ });
567
+ plugin.stop();
568
+
569
+ const current = readLog(app, 'current');
570
+ assert.ok(
571
+ current.total > 0 && current.total < 1000,
572
+ `seam crossing logged ${current.total} m; expected the short way (~22 m)`,
573
+ );
574
+ });