@sailingrotevista/rotevista-dash 7.0.33 → 7.0.34
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 +12 -4
- package/package.json +1 -1
package/app.js
CHANGED
|
@@ -377,17 +377,25 @@ function processIncomingData(path, val, source, timeMs) {
|
|
|
377
377
|
store.timestamps[path] = now;
|
|
378
378
|
store.raw[path] = val;
|
|
379
379
|
|
|
380
|
+
// Converte e aggiorna istantaneamente store.raw["navigation.headingTrue"] prima del rate limiter per evitare ritardi UI
|
|
381
|
+
if (path === "navigation.headingMagnetic") {
|
|
382
|
+
const hasNativeTrueHdg = store.timestamps["navigation.headingTrueNative"] && (now - store.timestamps["navigation.headingTrueNative"] < 5000);
|
|
383
|
+
if (!hasNativeTrueHdg) {
|
|
384
|
+
const variation = store.raw["navigation.magneticVariation"] || 0;
|
|
385
|
+
store.raw["navigation.headingTrue"] = (val + variation + 2 * Math.PI) % (2 * Math.PI);
|
|
386
|
+
store.timestamps["navigation.headingTrue"] = now;
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
|
|
380
390
|
// Le coordinate GPS e la posizione non sono soggette alla limitazione a 1Hz
|
|
381
391
|
if (path === "navigation.position") {
|
|
382
|
-
return; // Esce subito
|
|
392
|
+
return; // Esce subito
|
|
383
393
|
}
|
|
384
394
|
|
|
385
395
|
// 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
396
|
if (!lastPathProcessTimes[path]) lastPathProcessTimes[path] = 0;
|
|
389
397
|
if (now - lastPathProcessTimes[path] < 800) {
|
|
390
|
-
return; // Esce subito risparmiando cicli di calcolo
|
|
398
|
+
return; // Esce subito risparmiando cicli di calcolo
|
|
391
399
|
}
|
|
392
400
|
lastPathProcessTimes[path] = now;
|
|
393
401
|
|