@sailingrotevista/rotevista-dash 7.0.29 → 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 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
- 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)`);
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.29",
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 ((now - item.time) > windowMs) break;
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;