From fd78232c1e14c9ba6e3fea8332403b93dbf03d87 Mon Sep 17 00:00:00 2001 From: David Glenck Date: Tue, 24 Aug 2021 09:19:37 +0200 Subject: [PATCH] fix symbol info for function block properties with monitoring = call #261 --- pyads/symbol.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pyads/symbol.py b/pyads/symbol.py index 56939f2c..68aed6fb 100644 --- a/pyads/symbol.py +++ b/pyads/symbol.py @@ -162,7 +162,14 @@ def _create_symbol_from_info(self) -> None: info = adsGetSymbolInfo(self._plc._port, self._plc._adr, self.name) self.index_group = info.iGroup - self.index_offset = info.iOffs + if self.index_group == 0xF019: + # For function block properties with monitoring = call + # get symbol using handle instead + self.index_group = constants.ADSIGRP_SYM_VALBYHND + self.index_offset = self._plc.get_handle(self.name) + else: + self.index_offset = info.iOffs + if info.comment: self.comment = info.comment @@ -230,6 +237,8 @@ def __repr__(self) -> str: def __del__(self) -> None: """Destructor""" self.clear_device_notifications() + if self.index_group == constants.ADSIGRP_SYM_VALBYHND: + self._plc.release_handle(self.index_offset) def add_device_notification( self,