@sailingrotevista/rotevista-dash 7.0.40 → 7.0.41

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/gauge.js +14 -6
  2. package/package.json +1 -1
package/gauge.js CHANGED
@@ -70,13 +70,21 @@ function updateCentralGauge(store, ui, now, isNavigating, sogKts, stwKts, rawAws
70
70
  updateLeewayDisplay(Math.max(-20, Math.min(20, smoothedLeeway)));
71
71
  }
72
72
 
73
- // D. Orientamento delle icone della barca e del vento nel Mini-Compass (TWD) con passaggio di timestamp "now"
74
- const smHdgIcons = getCircularAverageFromBuffer(store.smoothBuf.hdg, 2000, false, now);
75
- const smTwdIcons = getCircularAverageFromBuffer(store.smoothBuf.twd, 2000, false, now);
76
- if (smHdgIcons && smTwdIcons) {
77
- curWindCompassRot = getShortestRotation(curWindCompassRot, radToDeg(smTwdIcons.val));
73
+ // D. Orientamento delle icone della barca e del vento nel Mini-Compass (TWD)
74
+ // Sincronizzato con la media a 30s (longBuf) e fallback istantaneo su store.raw per allineamento al testo
75
+ const longWindow = CONFIG.averaging.longWindow || 30000;
76
+ const smHdgIcons = getCircularAverageFromBuffer(store.longBuf.hdg, longWindow * 2, false, now);
77
+ const smTwdIcons = getCircularAverageFromBuffer(store.longBuf.twd, longWindow, false, now);
78
+
79
+ const twdAngleRad = smTwdIcons ? smTwdIcons.val : store.raw["environment.wind.directionTrue"];
80
+ if (twdAngleRad !== undefined && twdAngleRad !== null) {
81
+ curWindCompassRot = getShortestRotation(curWindCompassRot, radToDeg(twdAngleRad));
78
82
  ui.twdArrow.setAttribute('transform', `rotate(${curWindCompassRot}, 20, 20)`);
79
- curBoatCompassRot = getShortestRotation(curBoatCompassRot, radToDeg(smHdgIcons.val));
83
+ }
84
+
85
+ const hdgAngleRad = smHdgIcons ? smHdgIcons.val : store.raw["navigation.headingTrue"];
86
+ if (hdgAngleRad !== undefined && hdgAngleRad !== null) {
87
+ curBoatCompassRot = getShortestRotation(curBoatCompassRot, radToDeg(hdgAngleRad));
80
88
  ui.twdBoat.setAttribute('transform', `rotate(${curBoatCompassRot}, 20, 20)`);
81
89
  }
82
90
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sailingrotevista/rotevista-dash",
3
- "version": "7.0.40",
3
+ "version": "7.0.41",
4
4
  "description": "Wind Dashboard with navigation and course aids",
5
5
  "main": "index.js",
6
6
  "publishConfig": {