@sailingrotevista/rotevista-dash 7.0.28 → 7.0.30
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 +4 -4
- package/package.json +3 -2
- package/style.css +26 -0
- package/utils.js +5 -2
- package/weather-radar.js +22 -11
package/gauge.js
CHANGED
|
@@ -55,10 +55,10 @@ function updateCentralGauge(store, ui, now, isNavigating, sogKts, stwKts, rawAws
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
// B. Rotazione dei puntatori analogici di AWA (Apparent) e TWA (True)
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
const smAwa = getCircularAverageFromBuffer(store.smoothBuf.awa, 2000, true);
|
|
59
|
+
const smTwa = getCircularAverageFromBuffer(store.smoothBuf.twa, 2000, true);
|
|
60
|
+
if (smAwa) ui.awa.setAttribute('transform', `rotate(${curAwaRot = getShortestRotation(curAwaRot, radToDeg(smAwa.val))}, 200, 200)`);
|
|
61
|
+
if (smTwa) ui.twa.setAttribute('transform', `rotate(${curTwaRot = getShortestRotation(curTwaRot, radToDeg(smTwa.val))}, 200, 200)`);
|
|
62
62
|
|
|
63
63
|
// C. Calcolo dello Scarroccio (Leeway) e orientamento del vettore Track
|
|
64
64
|
if (store.raw["navigation.courseOverGroundTrue"] !== undefined && store.raw["navigation.headingTrue"] !== undefined) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sailingrotevista/rotevista-dash",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.30",
|
|
4
4
|
"description": "Wind Dashboard with navigation and course aids",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"publishConfig": {
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"author": "Sailing Rotevista",
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"signalk": {
|
|
16
|
-
"displayName": "Rotevista Wind Dashboard"
|
|
16
|
+
"displayName": "Rotevista Wind Dashboard",
|
|
17
|
+
"appIcon": "icons/dash.png"
|
|
17
18
|
}
|
|
18
19
|
}
|
package/style.css
CHANGED
|
@@ -612,3 +612,29 @@ body.night-mode {
|
|
|
612
612
|
}
|
|
613
613
|
|
|
614
614
|
*/
|
|
615
|
+
|
|
616
|
+
/* ==========================================================================
|
|
617
|
+
14. POSIZIONAMENTO SOVRAPPOSTO LAYERED COMPASS (0% CARICO CPU)
|
|
618
|
+
========================================================================== */
|
|
619
|
+
|
|
620
|
+
/* Contenitore padre relativo */
|
|
621
|
+
.wind-gauge-container {
|
|
622
|
+
position: relative;
|
|
623
|
+
width: 100%;
|
|
624
|
+
height: 100%;
|
|
625
|
+
max-height: 100%;
|
|
626
|
+
display: flex;
|
|
627
|
+
align-items: center;
|
|
628
|
+
justify-content: center;
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
/* Sovrapposizione assoluta perfetta del livello lancette sopra lo sfondo */
|
|
632
|
+
#wind-gauge-pointers {
|
|
633
|
+
position: absolute;
|
|
634
|
+
top: 0;
|
|
635
|
+
left: 0;
|
|
636
|
+
width: 100%;
|
|
637
|
+
height: 100%;
|
|
638
|
+
object-fit: contain;
|
|
639
|
+
pointer-events: none; /* Permette al tocco del mouse di passare sotto al centro interattivo */
|
|
640
|
+
}
|
package/utils.js
CHANGED
|
@@ -33,10 +33,13 @@ function safeSetText(el, text) {
|
|
|
33
33
|
|
|
34
34
|
// --- 2. MOTORE MATEMATICO: MEDIA CIRCOLARE VETTORIALE ---
|
|
35
35
|
function getCircularAverageFromBuffer(bufferArray, windowMs, signed = false, now, stabilityThreshold = 0.95, stabilityBreakout = 15) {
|
|
36
|
-
now = now || Date.now();
|
|
37
36
|
const len = bufferArray.length;
|
|
38
37
|
if (len === 0) return null;
|
|
39
38
|
|
|
39
|
+
// RIFERIMENTO TEMPORALE IMMUNE DA DESINCRONIZZAZIONE:
|
|
40
|
+
// Usiamo come 'ora attuale' l'ultimo timestamp presente nel buffer stesso,
|
|
41
|
+
// garantendo che la finestra di 2s sia sempre calcolata sui dati NMEA reali arrivati.
|
|
42
|
+
const referenceTime = bufferArray[len - 1].time;
|
|
40
43
|
let sSin = 0, sCos = 0, count = 0;
|
|
41
44
|
let newestTime = 0, oldestTime = 0;
|
|
42
45
|
|
|
@@ -51,7 +54,7 @@ function getCircularAverageFromBuffer(bufferArray, windowMs, signed = false, now
|
|
|
51
54
|
|
|
52
55
|
for (let i = len - 1; i >= 0; i--) {
|
|
53
56
|
const item = bufferArray[i];
|
|
54
|
-
if ((
|
|
57
|
+
if ((referenceTime - item.time) > windowMs) break; // Usa referenceTime invece di 'now'
|
|
55
58
|
|
|
56
59
|
let diffRad = Math.atan2(Math.sin(item.val - pilotRad), Math.cos(item.val - pilotRad));
|
|
57
60
|
let finalSin, finalCos;
|
package/weather-radar.js
CHANGED
|
@@ -279,14 +279,25 @@ function renderRadar() {
|
|
|
279
279
|
const pt = polarToCartesian(200, 200, radiusAnello1, angleTarget);
|
|
280
280
|
|
|
281
281
|
const led = document.createElementNS("http://www.w3.org/2000/svg", "circle");
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
282
|
+
led.setAttribute("cx", pt.x.toFixed(1));
|
|
283
|
+
led.setAttribute("cy", pt.y.toFixed(1));
|
|
284
|
+
led.setAttribute("r", "5.5");
|
|
285
|
+
led.setAttribute("fill", meteoColor);
|
|
286
|
+
led.setAttribute("class", "is-trending");
|
|
287
|
+
led.setAttribute("filter", "url(#radar-center-glow)");
|
|
288
|
+
ringsContainer.appendChild(led);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
// ROTAZIONE TATTICA BARCA (North-Up Alignment)
|
|
294
|
+
// Orientiamo l'icona della barca in base alla Prua Vera (HDG)
|
|
295
|
+
const boatIcon = document.getElementById('radar-boat-icon');
|
|
296
|
+
if (boatIcon && typeof store !== 'undefined' && store.raw) {
|
|
297
|
+
const hdgRad = store.raw["navigation.headingTrue"] !== undefined ? store.raw["navigation.headingTrue"] : 0;
|
|
298
|
+
const hdgDeg = Math.round(radToDeg(hdgRad));
|
|
299
|
+
|
|
300
|
+
// Applicazione della rotazione centrata sull'asse (200, 200) dell'SVG
|
|
301
|
+
boatIcon.setAttribute("transform", `rotate(${hdgDeg}, 200, 200) translate(0, 5)`);
|
|
302
|
+
}
|
|
303
|
+
}
|