Skip to content

Commit

Permalink
Corrected YAMCAN handling of signed numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshLafleur committed Feb 5, 2025
1 parent a309921 commit 8738c91
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions network/NetworkGen/classes/Can.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,12 +304,10 @@ def calc_signal_params(self):
self.is_valid = False
return

if nat_rep.range.min >= 0:
if nat_rep.signedness == Signedness.unsigned:
self.offset = nat_rep.range.min
nat_rep.signedness = Signedness.unsigned
elif nat_rep.range.min < 0:
self.offset = -nat_rep.range.min
nat_rep.signedness = Signedness.signed
elif nat_rep.signedness == Signedness.signed:
self.offset = 0
sig_range = nat_rep.range.max - nat_rep.range.min

if nat_rep.resolution:
Expand Down

0 comments on commit 8738c91

Please sign in to comment.