From 08357ae7328ea12e3c87c7c605142bb4eefbb62c Mon Sep 17 00:00:00 2001
From: Bjoern Senfftleben <bjoern.senfftleben@xfel.eu>
Date: Thu, 6 Feb 2025 20:11:17 +0100
Subject: [PATCH] change state workflow / behaviour

---
 src/tempus/Tempus.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/tempus/Tempus.py b/src/tempus/Tempus.py
index 6aee7cf..d9ae375 100644
--- a/src/tempus/Tempus.py
+++ b/src/tempus/Tempus.py
@@ -196,12 +196,13 @@ class Tempus(Device):
         description="Reset fast-links. This will take about 30 s.",
         allowedStates={State.ON, State.ACTIVE})
     async def resetFastLinks(self):
+        initial_state = self.State
         self.state = State.CHANGING
         self.commandLog = (
             "#### Resetting fast-links ####\nThis will take about 30 s.")
-        self.background_task = background(self._reset_fast_links())
+        self.background_task = background(self._reset_fast_links(initial_state))
 
-    async def _reset_fast_links(self):
+    async def _reset_fast_links(self, initial_state):
         try:
             await self.send_command(
                 f"os.system('{self.APP_DIR}/sc_set_gwt_link_up.py -i 0x0 "
@@ -211,7 +212,7 @@ class Tempus(Device):
                 "-l 0x0 -s 0x2')", sleep_time=15)
 
             self.status = "Fast-links reset done"
-            self.state = State.INIT
+            self.state = initial_state
 
         except Exception as e:
             self.handle_execption(e)
@@ -220,7 +221,7 @@ class Tempus(Device):
         displayedName="Configure",
         description="Run the configuration sequence. This will take about "
                     "30 s.",
-        allowedStates={State.ON})
+        allowedStates={State.ON, State.ACTIVE})
     async def configure(self):
         self.state = State.CHANGING
         self.status = "Configuring TEMPUS"
-- 
GitLab