fix: autorefresch with shared_procimg writes all outputs automatic

Fixes the bug that with automatic process image update and
shared_procimg, outputs of devices are also written without automatic
update enabled.

Signed-off-by: Sven Sager <akira@narux.de>
This commit is contained in:
2023-08-17 07:45:39 +02:00
parent 70a0721680
commit 596658d656
3 changed files with 3 additions and 7 deletions

View File

@@ -531,10 +531,6 @@ class Device(object):
with self._filelock:
self._shared_write.clear()
self._shared_procimg = True if activate else False
if self._shared_procimg and self not in self._modio._lst_shared:
self._modio._lst_shared.append(self)
elif not self._shared_procimg and self in self._modio._lst_shared:
self._modio._lst_shared.remove(self)
def syncoutputs(self) -> bool:
"""

View File

@@ -531,7 +531,9 @@ class ProcimgWriter(Thread):
continue
try:
for dev in self._modio._lst_shared:
for dev in self._modio._lst_refresh:
if not dev._shared_procimg:
continue
# Set shared outputs before reading process image
for io in dev._shared_write:
if not io._write_to_procimg():

View File

@@ -69,7 +69,6 @@ class RevPiModIO(object):
"_autorefresh", "_buffedwrite", "_configrsc", "_debug", "_devselect", \
"_exit", "_exit_level", "_imgwriter", "_ioerror", \
"_length", "_looprunning", "_lst_devselect", "_lst_refresh", \
"_lst_shared", \
"_maxioerrors", "_monitoring", "_myfh", "_myfh_lck", \
"_procimg", "_replace_io_file", "_run_on_pi", \
"_set_device_based_cycle_time", "_simulator", "_shared_procimg", \
@@ -135,7 +134,6 @@ class RevPiModIO(object):
self._length = 0
self._looprunning = False
self._lst_refresh = []
self._lst_shared = []
self._maxioerrors = 0
self._myfh = None
self._myfh_lck = Lock()