From c96101b194e7e357f5776abc1b3acfe11e0c9875 Mon Sep 17 00:00:00 2001 From: ISA Date: Sun, 27 Oct 2024 14:33:39 +0100 Subject: [PATCH] =?UTF-8?q?fest:=20Aderbruch=20anzeigen=20in=20Iso-Display?= =?UTF-8?q?=20-=20Schriftgr=C3=B6=C3=9Fe=20und=20Farbe=20f=C3=BCr=20"Aderb?= =?UTF-8?q?ruch"=20angepasst=20(kleiner=20und=20in=20Rot)=20-=20Breite=20d?= =?UTF-8?q?es=20isoDisplay-Bereichs=20erweitert=20f=C3=BCr=20bessere=20Les?= =?UTF-8?q?barkeit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/modules/Kue705FO.jsx | 52 ++++++++++++++++++++++----- public/CPLmockData/SERVICE/kueData.js | 4 +-- 2 files changed, 45 insertions(+), 11 deletions(-) diff --git a/components/modules/Kue705FO.jsx b/components/modules/Kue705FO.jsx index 11b978a..886f46e 100644 --- a/components/modules/Kue705FO.jsx +++ b/components/modules/Kue705FO.jsx @@ -18,7 +18,10 @@ function Kue705FO({ const [currentAlarmStatus, setCurrentAlarmStatus] = useState(false); const [currentModulName, setCurrentModulName] = useState(modulName); const [activeButton, setActiveButton] = useState("Schleife"); - const [displayText, setDisplayText] = useState("Schleifenwiderstand [kOhm]"); + const [loopDisplayText, setloopDisplayText] = useState( + "Schleifenwiderstand [kOhm]" + ); + const [isoDisplayText, setIsoDisplayText] = useState("Aderbruch"); const [loading, setLoading] = useState(false); const [currentDisplayValue, setCurrentDisplayValue] = useState( schleifenwiderstand || "0" @@ -269,11 +272,11 @@ function Kue705FO({ const handleButtonClick = (button) => { if (button === "Schleife") { setActiveButton("Schleife"); - setDisplayText("Schleifenwiderstand [kOhm]"); + setloopDisplayText("Schleifenwiderstand [kOhm]"); setCurrentDisplayValue(schleifenwiderstand || "0"); } else if (button === "TDR") { setActiveButton("TDR"); - setDisplayText("Entfernung [Km]"); + setloopDisplayText("Entfernung [Km]"); setCurrentDisplayValue(tdrLocation || "0"); } }; @@ -311,6 +314,24 @@ function Kue705FO({ return () => clearInterval(interval); // Bereinigung bei Entladen der Komponente }, [slotIndex]); + //------------------------------------------------- + + // Intervall für den Wechsel der Anzeige zwischen "Aderbruch" und ">200 MOhm" + useEffect(() => { + if (window.kueCableBreak[slotIndex] === 1) { + const intervalId = setInterval(() => { + setIsoDisplayText((prevText) => + prevText === "Aderbruch" ? ">200 MOhm" : "Aderbruch" + ); + }, 2000); + + return () => clearInterval(intervalId); + } else { + setIsoDisplayText(isolationswert || ">200"); + } + }, [slotIndex, isolationswert]); + //------------------------------------------------- + return (
{isModulPresent ? ( @@ -354,11 +375,24 @@ function Kue705FO({ Alarm
- -
+ {/* isoDisplay: Zeigt den Isolationswiderstand oder Aderbruch an */} +
- {isolationswert || ">200"} -
ISO MOhm
+ + {/* Aderbruch anzeigen, wenn Aderbruch vorhanden ist isoDisplayText*/} + {window.kueCableBreak[slotIndex] === 1 + ? "Aderbruch" + : isolationswert || ">200"} + + {window.kueCableBreak[slotIndex] !== 1 && ( +
ISO MOhm
+ )}
@@ -373,10 +407,10 @@ function Kue705FO({ {kueVersion}
- + {/* loopDisplay: Zeigt Schleifenwiderstand oder TDR-Distanz an, je nach Modus */}
- {displayText} + {loopDisplayText}
diff --git a/public/CPLmockData/SERVICE/kueData.js b/public/CPLmockData/SERVICE/kueData.js index 37f3cbe..d13880b 100644 --- a/public/CPLmockData/SERVICE/kueData.js +++ b/public/CPLmockData/SERVICE/kueData.js @@ -1,5 +1,5 @@ var kueOnline = [ - 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ]; var kueIso = [ @@ -25,7 +25,7 @@ var kueRes = [ 0.615, 0.494, 1.217, 65.0, 65.0, 65.0, 65.0, ]; var kueCableBreak = [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, ]; var kueGroundFault = [