signalk-sailboat-simulator 0.3.0 → 0.3.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.
Files changed (3) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/index.js +15 -2
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.3.1] - 2026-09-09
4
+
5
+ - Report polar loading and validation failures through the Signal K plugin error channel with their detailed cause.
6
+
3
7
  ## [0.3.0] - 2026-09-09
4
8
 
5
9
  - Calculate simulated boat speed directly from the active `signalk-polar-management` polar resource via `polar-math`.
package/index.js CHANGED
@@ -479,8 +479,13 @@ module.exports = function createPlugin (app) {
479
479
  }
480
480
 
481
481
  function setStatus () {
482
- if (!app.setPluginStatus) return
483
- if (runtime.status === 'sailing') {
482
+ if (runtime.status === 'polarError') {
483
+ setError(`Polar error: ${runtime.polar && runtime.polar.error ? runtime.polar.error : 'unable to calculate boat speed'}`)
484
+ } else if (runtime.status === 'error') {
485
+ setError(`Simulator error: ${runtime.error || 'unexpected runtime failure'}`)
486
+ } else if (!app.setPluginStatus) {
487
+ return
488
+ } else if (runtime.status === 'sailing') {
484
489
  app.setPluginStatus(`Sailing at ${runtime.speedOverGround.toFixed(2)} m/s, heading ${runtime.headingTrueDeg.toFixed(1)} deg`)
485
490
  } else if (runtime.status === 'groundingProtection') {
486
491
  app.setPluginStatus(`Stopped: distance to shore ${runtime.distanceToShore.toFixed(1)} m`)
@@ -489,6 +494,14 @@ module.exports = function createPlugin (app) {
489
494
  }
490
495
  }
491
496
 
497
+ function setError (message) {
498
+ if (typeof app.setPluginError === 'function') {
499
+ app.setPluginError(message)
500
+ } else if (typeof app.setPluginStatus === 'function') {
501
+ app.setPluginStatus(message)
502
+ }
503
+ }
504
+
492
505
  function registerWithRouter (router) {
493
506
  router.get('/api/status', (req, res) => {
494
507
  res.json({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "signalk-sailboat-simulator",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Signal K plugin that simulates a sailing boat from autopilot turn-rate output, weather and an active polar resource.",
5
5
  "main": "index.js",
6
6
  "scripts": {