@sailingrotevista/rotevista-dash 4.0.17 → 4.0.18
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 +3 -3
- package/index.js +27 -7
- package/package.json +1 -1
package/app.js
CHANGED
|
@@ -670,16 +670,16 @@ function drawGraph(d, id, min, max, isTws, isHercules) {
|
|
|
670
670
|
|
|
671
671
|
// Assegnazione specifica di Opacità e Spessore Linea
|
|
672
672
|
let fillOpacity = "0.15"; // Default per valori base
|
|
673
|
-
let strokeWidth = "1
|
|
673
|
+
let strokeWidth = "1";
|
|
674
674
|
|
|
675
675
|
if (color === "#ff3b30") {
|
|
676
676
|
// ROSSO (Danger / Reef 2): Molto solido
|
|
677
677
|
fillOpacity = "0.85";
|
|
678
|
-
strokeWidth = "
|
|
678
|
+
strokeWidth = "1.5";
|
|
679
679
|
} else if (color === "#ff9800") {
|
|
680
680
|
// ARANCIONE (Warning / Reef 1): Più trasparente (Velo)
|
|
681
681
|
fillOpacity = "0.45";
|
|
682
|
-
strokeWidth = "
|
|
682
|
+
strokeWidth = "1"; // Manteniamo la linea spessa per leggerla bene
|
|
683
683
|
}
|
|
684
684
|
|
|
685
685
|
// GRADIENTE: Due stop alla stessa percentuale per creare uno stacco di colore netto (no sfumature)
|
package/index.js
CHANGED
|
@@ -12,20 +12,40 @@ module.exports = function (app) {
|
|
|
12
12
|
plugin.name = 'Rotevista Dash Configuration';
|
|
13
13
|
plugin.description = 'Configure boat-specific tactical and safety parameters for the Dashboard';
|
|
14
14
|
|
|
15
|
+
let currentConfig = {};
|
|
16
|
+
let routeRegistered = false;
|
|
17
|
+
|
|
15
18
|
/**
|
|
16
|
-
* plugin.start: Inizializza il plugin
|
|
19
|
+
* plugin.start: Inizializza il plugin.
|
|
20
|
+
* Viene chiamato all'avvio e OGNI VOLTA che clicchi "Save" nelle impostazioni.
|
|
17
21
|
*/
|
|
18
22
|
plugin.start = function (options) {
|
|
19
|
-
//
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
+
// 1. Aggiorna la configurazione in memoria (per l'endpoint pubblico)
|
|
24
|
+
currentConfig = options;
|
|
25
|
+
|
|
26
|
+
// 2. Log di debug nel server Signal K
|
|
27
|
+
app.debug(`${plugin.name} started/updated with new options`);
|
|
23
28
|
|
|
24
|
-
|
|
29
|
+
// 3. Registra la rotta API solo la prima volta
|
|
30
|
+
if (!routeRegistered) {
|
|
31
|
+
app.get('/rotevista-config', (req, res) => {
|
|
32
|
+
res.json(currentConfig);
|
|
33
|
+
});
|
|
34
|
+
routeRegistered = true;
|
|
35
|
+
app.debug('Public API endpoint registered at /rotevista-config');
|
|
36
|
+
}
|
|
25
37
|
};
|
|
26
38
|
|
|
39
|
+
/**
|
|
40
|
+
* plugin.stop: Chiamato quando il plugin viene disattivato o prima di un aggiornamento.
|
|
41
|
+
*/
|
|
27
42
|
plugin.stop = function () {
|
|
28
|
-
|
|
43
|
+
app.debug(`${plugin.name} stopped`);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
// Se desideri avere una funzione plugin.debug personalizzata (opzionale)
|
|
47
|
+
plugin.debug = function(msg) {
|
|
48
|
+
app.debug(msg);
|
|
29
49
|
};
|
|
30
50
|
|
|
31
51
|
/**
|