Skip to content

Commit

Permalink
fix symbol info for function block properties with monitoring = call s…
Browse files Browse the repository at this point in the history
  • Loading branch information
dgl-cw committed Aug 24, 2021
1 parent 4bdfef5 commit fd78232
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion pyads/symbol.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit fd78232

Please sign in to comment.