@sailingrotevista/rotevista-dash 6.0.14 → 6.1.1
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 +25 -50
- package/package.json +1 -1
package/app.js
CHANGED
|
@@ -22,12 +22,12 @@ let CONFIG = {
|
|
|
22
22
|
minSpeed: 0.5,
|
|
23
23
|
stabilityBreakout: 15
|
|
24
24
|
},
|
|
25
|
-
graphs: { reef1:
|
|
25
|
+
graphs: { reef1: 5, reef2: 10, historyMinutes: 10, samples: 60 },
|
|
26
26
|
scales: {
|
|
27
27
|
stw: { stdMax: 4, hercSpan: 2, step: 1 },
|
|
28
28
|
sog: { stdMax: 4, hercSpan: 2, step: 1 },
|
|
29
29
|
tws: { stdMax: 15, hercSpan: 2, step: 1 },
|
|
30
|
-
depth: { stdMax:
|
|
30
|
+
depth: { stdMax: 5, hercSpan: 2, step: 1 }
|
|
31
31
|
},
|
|
32
32
|
server: { fallbackIp: "192.168.111.240:3000" }
|
|
33
33
|
};
|
|
@@ -1501,56 +1501,31 @@ window.addEventListener('contextmenu', e => e.preventDefault(), true);
|
|
|
1501
1501
|
async function init() {
|
|
1502
1502
|
loadDashboardState();
|
|
1503
1503
|
|
|
1504
|
-
//
|
|
1505
|
-
|
|
1506
|
-
startDisplayLoop();
|
|
1507
|
-
connect();
|
|
1508
|
-
|
|
1509
|
-
setInterval(watchConfigChanges, 10000);
|
|
1504
|
+
// Rileviamo se siamo sul Mac tramite file:// (Ambiente di sviluppo locale)
|
|
1505
|
+
const isLocalFile = (window.location.protocol === 'file:');
|
|
1510
1506
|
|
|
1511
|
-
//
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
if (document.visibilityState === 'visible') {
|
|
1518
|
-
// 1. Se la connessione è già attiva e sana, scarichiamo solo lo storico senza disconnetterci
|
|
1519
|
-
if (socket && socket.readyState === WebSocket.OPEN) {
|
|
1520
|
-
console.log("⏰ Schermo sbloccato: connessione attiva, sincronizzazione dello storico.");
|
|
1521
|
-
fetchServerHistory().then(() => {
|
|
1522
|
-
['stw', 'sog', 'depth', 'tws'].forEach(refreshGraph);
|
|
1523
|
-
}).catch(err => {});
|
|
1524
|
-
}
|
|
1525
|
-
// 2. Se la connessione è persa o morta, forzatura riconnessione rapida
|
|
1526
|
-
else {
|
|
1527
|
-
console.log("⏰ Schermo sbloccato: connessione assente, forzatura riconnessione rapida.");
|
|
1528
|
-
if (socket) {
|
|
1529
|
-
try {
|
|
1530
|
-
socket.close();
|
|
1531
|
-
} catch (e) {
|
|
1532
|
-
connect();
|
|
1533
|
-
}
|
|
1534
|
-
} else {
|
|
1535
|
-
connect();
|
|
1536
|
-
}
|
|
1537
|
-
}
|
|
1538
|
-
}
|
|
1539
|
-
});
|
|
1507
|
+
// 1. CARICAMENTO STORICO GRAFICI REALI DAL CERBO GX
|
|
1508
|
+
try {
|
|
1509
|
+
await fetchServerHistory();
|
|
1510
|
+
} catch (err) {
|
|
1511
|
+
console.warn("⚠️ Impossibile caricare lo storico reale dal server.");
|
|
1512
|
+
}
|
|
1540
1513
|
|
|
1541
|
-
//
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1514
|
+
// 2. CARICAMENTO CONFIGURAZIONI REALI (Bypassato su Mac per preservare i tuoi test!)
|
|
1515
|
+
if (!isLocalFile) {
|
|
1516
|
+
await fetchServerConfig();
|
|
1517
|
+
} else {
|
|
1518
|
+
// Mantiene la CONFIG locale di app.js per farti fare le prove delle scale sul Mac
|
|
1519
|
+
console.log("🎮 Esecuzione locale file://: utilizzo delle calibrazioni di CONFIG locali di debug.");
|
|
1520
|
+
}
|
|
1521
|
+
|
|
1522
|
+
startDisplayLoop();
|
|
1523
|
+
connect(); // Si collegherà in tempo reale al WebSocket reale della barca
|
|
1524
|
+
|
|
1525
|
+
// Controlla le modifiche di configurazione sul Cerbo solo se non siamo sul Mac via file://
|
|
1526
|
+
if (!isLocalFile) {
|
|
1527
|
+
setInterval(watchConfigChanges, 10000);
|
|
1528
|
+
}
|
|
1554
1529
|
}
|
|
1555
1530
|
|
|
1556
1531
|
|