@sailingrotevista/rotevista-dash 7.0.33 → 7.0.35
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/app.js +15 -6
- package/package.json +1 -1
package/app.js
CHANGED
|
@@ -373,21 +373,30 @@ function processIncomingData(path, val, source, timeMs) {
|
|
|
373
373
|
}
|
|
374
374
|
}
|
|
375
375
|
|
|
376
|
-
|
|
377
|
-
|
|
376
|
+
// Aggiorna lo stato raw e sincronizza il timestamp del watchdog sull'orologio locale (Date.now()) per evitare falsi timeout
|
|
377
|
+
const localNow = Date.now();
|
|
378
|
+
store.timestamps[path] = localNow;
|
|
378
379
|
store.raw[path] = val;
|
|
379
380
|
|
|
381
|
+
// Converte e aggiorna istantaneamente store.raw["navigation.headingTrue"] per la UI prima del rate limiter
|
|
382
|
+
if (path === "navigation.headingMagnetic") {
|
|
383
|
+
const hasNativeTrueHdg = store.timestamps["navigation.headingTrueNative"] && (localNow - store.timestamps["navigation.headingTrueNative"] < 5000);
|
|
384
|
+
if (!hasNativeTrueHdg) {
|
|
385
|
+
const variation = store.raw["navigation.magneticVariation"] || 0;
|
|
386
|
+
store.raw["navigation.headingTrue"] = (val + variation + 2 * Math.PI) % (2 * Math.PI);
|
|
387
|
+
store.timestamps["navigation.headingTrue"] = localNow;
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
|
|
380
391
|
// Le coordinate GPS e la posizione non sono soggette alla limitazione a 1Hz
|
|
381
392
|
if (path === "navigation.position") {
|
|
382
|
-
return; // Esce subito
|
|
393
|
+
return; // Esce subito
|
|
383
394
|
}
|
|
384
395
|
|
|
385
396
|
// LIMITATORE DI FREQUENZA (RATE LIMITER) CLIENT-SIDE A 1HZ PER PERCORSO ATTIVO:
|
|
386
|
-
// Evita di eseguire calcoli trigonometrici, allocare oggetti in memoria dinamica
|
|
387
|
-
// e popolare i buffer smoothBuf/longBuf decine di volte al secondo per singolo sensore.
|
|
388
397
|
if (!lastPathProcessTimes[path]) lastPathProcessTimes[path] = 0;
|
|
389
398
|
if (now - lastPathProcessTimes[path] < 800) {
|
|
390
|
-
return; // Esce subito risparmiando cicli di calcolo
|
|
399
|
+
return; // Esce subito risparmiando cicli di calcolo
|
|
391
400
|
}
|
|
392
401
|
lastPathProcessTimes[path] = now;
|
|
393
402
|
|