-
Notifications
You must be signed in to change notification settings - Fork 406
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix frame decoding #224
Fix frame decoding #224
Conversation
this fixes wrong decoding frames (#119) BUT this is only proof of concept, further cleanup is needed (encoding, multiplex support, dismiss old code ...)
@altendky Now I tried to use your pack code also, but stumbled over some magic code: |
Let's start with a vague overview... I'm just rereading the code since I really don't remember this stuff. Keep in mind that I wanted to allow for overlapped signals and mixed big and little endian as well. Unpacking overlapped signals... Whatever. A single bit from the bus might end up in multiple signals, no conflict. Packing though, you may have to prioritize one over another, or report a conflict (this code prioritizes I think which is probably a bad choice). I think the first two lines take the bits calculated from little endian signals and 'turn them around' to align with the big endian bits.
The Maybe? |
add dbc-files in test folder to egg
Codecov Report
@@ Coverage Diff @@
## development #224 +/- ##
===============================================
+ Coverage 17.48% 22.68% +5.19%
===============================================
Files 25 27 +2
Lines 5960 6168 +208
Branches 1604 1609 +5
===============================================
+ Hits 1042 1399 +357
+ Misses 4852 4660 -192
- Partials 66 109 +43
Continue to review full report at Codecov.
|
add float decoding tests add mux decoding tests fix py2 compatibility
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would break the test down into five separate tests. At least three: integers, floats, and multiplexed.
remove not needed python version checking
Encoding tests still failing. guess: something with sign seems to be wrong TODO: check if test data is correct
I'm not sure at the moment but we should be able to monitor for unrun tests (like would happen with matching names) via coverage of the tests. |
src/canmatrix/canmatrix.py
Outdated
@@ -400,7 +400,7 @@ def pack_bitstring(self, length, is_float, value, signed): | |||
signed=signed) | |||
b = '{:0{}b}'.format(int.from_bytes(b, byteorder='big'), | |||
length) | |||
bitstring = b[:length] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@altendky
seems I found a bug. At least now my tests seem to produce correct data.
This was your code, maybe you should have a look to your code also...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh... I wonder how I haven't had issues. It seems to show up for signed values (I forget big endian or little or...). Anyways, thanks for pointing that out. As a double check I made up #235 to recreate it 'in my world' of .sym
files.
@altendky Could you do another review? Thanks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alrighty... I'll try to finish up the rest tomorrow. Thanks for all this, of course.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alrighty... i'll probably have to either take a pass three later or reserve the right to think that followup changes might be good. Probably better to do the latter, if at all. i don't like dragging out pr's forever...
Co-Authored-By: ebroecker <eduard.broecker@gmail.com>
Co-Authored-By: ebroecker <eduard.broecker@gmail.com>
* Add .sym based test * fixup for py2
this is NOT ready for merge, but in a PR the could be better done.