From ad4a1fcd38a22c364f8d29a515a986d9306d7259 Mon Sep 17 00:00:00 2001 From: Sven Sager Date: Fri, 1 Dec 2023 15:48:57 +0100 Subject: [PATCH 1/3] fix: Error of loop management in the context manager When leaving the IO context manager, the loop flag was not reset properly. The context manager could therefore only be traversed once. Signed-off-by: Sven Sager --- src/revpimodio2/io.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/revpimodio2/io.py b/src/revpimodio2/io.py index 847339b..10ae93e 100644 --- a/src/revpimodio2/io.py +++ b/src/revpimodio2/io.py @@ -121,7 +121,7 @@ class IOList(object): # Wait until imgwriter has written outputs self.__modio._imgwriter.newdata.wait(2.5) - if self.__modio._context_manager: + if not self.__modio._context_manager: # Do not reset if ModIO is in a context manager itself, it will handle that flag self.__modio._looprunning = False From 41a09c4f1707ffddcd5d4ed637f8285886606ebf Mon Sep 17 00:00:00 2001 From: Sven Sager Date: Fri, 1 Dec 2023 15:58:28 +0100 Subject: [PATCH 2/3] fix: Context manager crashes in monitoring mode The context managers tried to write to the process image in monitoring=True mode. This is not allowed and the application crashed with an error. Signed-off-by: Sven Sager --- src/revpimodio2/io.py | 3 ++- src/revpimodio2/modio.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/revpimodio2/io.py b/src/revpimodio2/io.py index 10ae93e..5aa46b8 100644 --- a/src/revpimodio2/io.py +++ b/src/revpimodio2/io.py @@ -115,7 +115,8 @@ class IOList(object): self.__modio._imgwriter.newdata.clear() # Write outputs on devices without autorefresh - self.__modio.writeprocimg() + if not self.__modio._monitoring: + self.__modio.writeprocimg() if self.__modio._imgwriter.is_alive(): # Wait until imgwriter has written outputs diff --git a/src/revpimodio2/modio.py b/src/revpimodio2/modio.py index ff37f3a..cde5e22 100644 --- a/src/revpimodio2/modio.py +++ b/src/revpimodio2/modio.py @@ -218,7 +218,8 @@ class RevPiModIO(object): return self def __exit__(self, exc_type, exc_val, exc_tb): - self.writeprocimg() + if not self._monitoring: + self.writeprocimg() self.exit(full=True) self._looprunning = False self._context_manager = False From 9741d13514b437b11299c4b8c4a889efc0aa8650 Mon Sep 17 00:00:00 2001 From: Sven Sager Date: Mon, 4 Dec 2023 16:01:51 +0100 Subject: [PATCH 3/3] chore: Release 2.7.1 Signed-off-by: Sven Sager --- src/revpimodio2/__about__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/revpimodio2/__about__.py b/src/revpimodio2/__about__.py index 56794c5..bbe1c74 100644 --- a/src/revpimodio2/__about__.py +++ b/src/revpimodio2/__about__.py @@ -3,4 +3,4 @@ __author__ = "Sven Sager " __copyright__ = "Copyright (C) 2023 Sven Sager" __license__ = "LGPLv2" -__version__ = "2.7.0" +__version__ = "2.7.1"