Skip to content

Commit

Permalink
Merge pull request #376 from andlaus/fix_issue375_and_pr373
Browse files Browse the repository at this point in the history
Fix issue #375 and PR #373
  • Loading branch information
andlaus authored Dec 17, 2024
2 parents 7225cd9 + 4e676bf commit fa67369
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
3 changes: 1 addition & 2 deletions odxtools/parameters/lengthkeyparameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,8 @@ def encode_placeholder_into_pdu(self, physical_value: Optional[ParameterValue],
# emplace a value of zero into the encode state, but pretend the bits not to be used
n = odxrequire(self.dop.get_static_bit_length()) + encode_state.cursor_bit_position
tmp_val = b'\x00' * ((n + 7) // 8)
encode_state.emplace_bytes(tmp_val, obj_used_mask=tmp_val)

encode_state.cursor_bit_position = 0
encode_state.emplace_bytes(tmp_val, obj_used_mask=tmp_val)

def encode_value_into_pdu(self, encode_state: EncodeState) -> None:

Expand Down
17 changes: 9 additions & 8 deletions odxtools/parameters/tablekeyparameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,23 @@ def _resolve_odxlinks(self, odxlinks: OdxLinkDatabase) -> None:
super()._resolve_odxlinks(odxlinks)

# Either table_ref or table_row_ref will be defined
if self.table_ref:
if self.table_ref is not None:
if TYPE_CHECKING:
self._table = odxlinks.resolve(self.table_ref, Table)
else:
self._table = odxlinks.resolve(self.table_ref)

if self.table_row_ref:
if self.table_row_ref is not None:
if TYPE_CHECKING:
self._table_row = odxlinks.resolve(self.table_row_ref, TableRow)
else:
self._table_row = odxlinks.resolve(self.table_row_ref)
self._table = self._table_row.table

if self.table_ref is None and self.table_snref is None:
if TYPE_CHECKING:
self._table = odxlinks.resolve(self._table_row.table_ref, Table)
else:
self._table = odxlinks.resolve(self._table_row.table_ref)

@override
def _resolve_snrefs(self, context: SnRefContext) -> None:
Expand All @@ -116,11 +121,7 @@ def _resolve_snrefs(self, context: SnRefContext) -> None:

@property
def table(self) -> "Table":
if self._table is not None:
return self._table
if self._table_row is not None:
return self._table_row.table
odxraise(f'Could not resolve the table of {self.short_name}')
return self._table

@property
def table_row(self) -> Optional["TableRow"]:
Expand Down

0 comments on commit fa67369

Please sign in to comment.