Skip to content

Commit

Permalink
fix: Fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
hutcheb committed Jul 7, 2024
1 parent 7c02ca6 commit d0aaa95
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions acd/l5x/elements.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def build(self) -> MapDevice:

self._cur.execute(
"SELECT tag_reference, record_string FROM comments WHERE parent=" + str(
(r.cip_type * 0x0100) + r.comment_id))
(r.comment_id * 0x10000) + r.cip_type))
comment_results = self._cur.fetchall()

extended_records: Dict[int, List[int]] = {}
Expand Down Expand Up @@ -201,7 +201,10 @@ def build(self) -> Tag:
self._object_id))
results = self._cur.fetchall()

r = RxGeneric.from_bytes(results[0][3])
try:
r = RxGeneric.from_bytes(results[0][3])
except Exception as e:
return Tag(results[0][0], results[0][0], 0, "", [])

if r.cip_type != 0x6B:
return Tag(results[0][0], results[0][0], 0, "", [])
Expand All @@ -216,7 +219,7 @@ def build(self) -> Tag:

self._cur.execute(
"SELECT tag_reference, record_string FROM comments WHERE parent=" + str(
(r.cip_type * 0x0100) + r.comment_id))
(r.comment_id * 0x10000) + r.cip_type))
comment_results = self._cur.fetchall()

extended_records: Dict[int, List[int]] = {}
Expand Down Expand Up @@ -372,7 +375,7 @@ def build(self) -> Controller:
r = RxGeneric.from_bytes(results[0][4])
self._cur.execute(
"SELECT tag_reference, record_string FROM comments WHERE parent=" + str(
(r.cip_type * 0x0100) + r.comment_id))
(r.comment_id * 0x10000) + r.cip_type))
comment_results = self._cur.fetchall()

extended_records: Dict[int, List[int]] = {}
Expand Down

0 comments on commit d0aaa95

Please sign in to comment.