@sailingrotevista/rotevista-dash 7.0.24 → 7.0.26
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 +18 -2
- package/package.json +1 -1
package/app.js
CHANGED
|
@@ -514,11 +514,27 @@ function updateWindTrend() {
|
|
|
514
514
|
// Abbiamo eseguito una vera strambata stabile e siamo usciti dalla zona di poppa secca!
|
|
515
515
|
lastGybeSide = currentTack;
|
|
516
516
|
|
|
517
|
+
// Estraggo i dati correnti di vento reale (TWS), velocità (SOG) e l'angolo TWA smorzato
|
|
518
|
+
const twsKts = store.raw["environment.wind.speedTrue"] ? msToKts(store.raw["environment.wind.speedTrue"]) : 0;
|
|
519
|
+
const sogKts = msToKts(store.raw["navigation.speedOverGround"] || 0);
|
|
520
|
+
const twaDeg = Math.abs(smoothedTwaDeg);
|
|
521
|
+
|
|
522
|
+
// RILEVAMENTO AERODINAMICO MOTORE IN POPPA:
|
|
523
|
+
// Se siamo di poppa (TWA > 135°) e la velocità della barca supera il 75% della velocità del vento reale,
|
|
524
|
+
// è fisicamente impossibile essere a vela pura. Siamo a motore o in motorsailing.
|
|
525
|
+
const isMotoringDownwind = (twaDeg > 135) && (sogKts > (twsKts * 0.75));
|
|
526
|
+
|
|
527
|
+
// L'allarme strambata acustico è reale e attivo solo se:
|
|
528
|
+
// 1. C'è vento significativo (> 7.0 nodi)
|
|
529
|
+
// 2. La barca è in movimento (> 1.0 nodi)
|
|
530
|
+
// 3. NON siamo a motore/motorsailing (isMotoringDownwind è falso)
|
|
531
|
+
const isGybeDangerous = twsKts > 7.0 && sogKts > 1.0 && !isMotoringDownwind;
|
|
532
|
+
|
|
517
533
|
// Attivazione allarme acustico con blocco temporale di sicurezza (60 secondi)
|
|
518
|
-
if (
|
|
534
|
+
if (isGybeDangerous && (now - lastGybeAlarmTime > 60000)) {
|
|
519
535
|
lastGybeAlarmTime = now;
|
|
520
536
|
playGybeAlarm();
|
|
521
|
-
console.log(`⚠️ GYBE ALARM TRIGGERED: Tack switched to ${currentTack} (TWA: ${
|
|
537
|
+
console.log(`⚠️ GYBE ALARM TRIGGERED: Tack switched to ${currentTack} (TWA: ${twaDeg.toFixed(1)}°, TWS: ${twsKts.toFixed(1)}kts, SOG: ${sogKts.toFixed(1)}kts)`);
|
|
522
538
|
}
|
|
523
539
|
}
|
|
524
540
|
}
|