@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.
- package/gauge.js +14 -6
- 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
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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
|
-
|
|
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
|
}
|