From 872598de9393e98a1af91f08c21fd9e465b341f9 Mon Sep 17 00:00:00 2001 From: Andrea Parenti <andrea.parenti@xfel.eu> Date: Wed, 22 Jan 2025 10:43:27 +0100 Subject: [PATCH] Fix initial state --- src/tempus/Tempus.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/tempus/Tempus.py b/src/tempus/Tempus.py index 6e86404..da9ba47 100644 --- a/src/tempus/Tempus.py +++ b/src/tempus/Tempus.py @@ -19,7 +19,7 @@ from psutil import net_io_counters from karabo.middlelayer import ( AccessMode, Bool, Configurable, Device, Double, MetricPrefix, Node, Slot, - State, String, UInt16, UInt64, Unit, background, get_property, isSet, + State, String, UInt16, UInt64, Unit, background, get_property, set_property, sleep) from ._version import version as deviceVersion @@ -166,13 +166,13 @@ class Tempus(Device): @Slot( displayedName="Initialize", description="Run the initialization sequence. This will take about " - "45 s.", + "40 s.", allowedStates={State.INIT, State.ON}) async def initialize(self): self.state = State.CHANGING self.status = "Initializing TEMPUS" self.commandLog = ( - "Initializing TEMPUS:\nThis will take about 45 s.\n\n") + "Initializing TEMPUS:\nThis will take about 40 s.\n\n") self.background_task = background(self._initialize()) async def _initialize(self): @@ -363,7 +363,7 @@ class Tempus(Device): allowedStates={State.INIT, State.ON}) async def equalisationFile(self, value): self.equalisationFile = value - if isSet(value): + if self.state not in (State.UNKNOWN, State.ERROR): self.state = State.INIT # force re-initialization @String( @@ -372,7 +372,7 @@ class Tempus(Device): allowedStates={State.INIT, State.ON}) async def maskFile(self, value): self.maskFile = value - if isSet(value): + if self.state not in (State.UNKNOWN, State.ERROR): self.state = State.INIT # force re-initialization externalSync = Bool( @@ -418,7 +418,6 @@ class Tempus(Device): await self.send_command( "mytpx4 = Timepix4control(1)", sleep_time=5) - self.state = State.INIT except Exception as e: self.client = None self.channel = None -- GitLab