Skip to content

Commit

Permalink
I made a bug in can unpack maybe its fixed now oops (#1316)
Browse files Browse the repository at this point in the history
### Changelist 
<!-- Give a list of the changes covered in this PR. This will help both
you and the reviewer keep this PR within scope. -->

### Testing Done
<!-- Outline the testing that was done to demonstrate the changes are
solid. This could be unit tests, integration tests, testing on the car,
etc. Include relevant code snippets, screenshots, etc as needed. -->

### Resolved Tickets
<!-- Link any tickets that this PR resolves. -->
  • Loading branch information
gtaharaedmonds authored Jun 14, 2024
1 parent 02c5eb0 commit 41959cb
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions scripts/code_generation/jsoncan/src/can_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ def unpack(self, id: int, data: bytes) -> Dict:
if signal_bits & (1 << (signal.bits - 1)):
signal_bits = ~signal_bits & ((1 << signal.bits) - 1)
signal_bits += 1
signal_bits *= -1

# Decode the signal value using the scale/offset.
signal_value = signal_bits * signal.scale + signal.offset
Expand Down

0 comments on commit 41959cb

Please sign in to comment.