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 (