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 <akira@narux.de>
This commit is contained in:
2023-12-01 15:58:28 +01:00
parent ad4a1fcd38
commit 41a09c4f17
2 changed files with 4 additions and 2 deletions

View File

@@ -115,7 +115,8 @@ class IOList(object):
self.__modio._imgwriter.newdata.clear() self.__modio._imgwriter.newdata.clear()
# Write outputs on devices without autorefresh # Write outputs on devices without autorefresh
self.__modio.writeprocimg() if not self.__modio._monitoring:
self.__modio.writeprocimg()
if self.__modio._imgwriter.is_alive(): if self.__modio._imgwriter.is_alive():
# Wait until imgwriter has written outputs # Wait until imgwriter has written outputs

View File

@@ -218,7 +218,8 @@ class RevPiModIO(object):
return self return self
def __exit__(self, exc_type, exc_val, exc_tb): def __exit__(self, exc_type, exc_val, exc_tb):
self.writeprocimg() if not self._monitoring:
self.writeprocimg()
self.exit(full=True) self.exit(full=True)
self._looprunning = False self._looprunning = False
self._context_manager = False self._context_manager = False