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.
- package/CHANGELOG.md +4 -0
- package/index.js +15 -2
- 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 (
|
|
483
|
-
|
|
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