Skip to content
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

Incorrect endianness for array type signals #125

Open
nuts4coffee opened this issue Oct 26, 2023 · 1 comment
Open

Incorrect endianness for array type signals #125

nuts4coffee opened this issue Oct 26, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@nuts4coffee
Copy link
Contributor

nuts4coffee commented Oct 26, 2023

Describe the bug
A clear and concise description of what the bug is.

According to the spec,
The list values for array type signal is MSB order:
image

However, the default transmission order for multi-byte signal values is LSB:
image

The current implementation is based on MSB:
https://github.com/c4deszes/ldfparser/blob/master/tests/test_frame.py#L52

Expected behavior
A clear and concise description of what you expected to happen.

def test_frame_raw_encoding_array():
    signal1 = LinSignal('Signal_1', 16, [0, 0])
    frame = LinUnconditionalFrame(1, 'Frame_1', 2, {0: signal1})
    content = frame.raw({
        'Signal_1': [1, 2]
    })
    assert list(content) == [2, 1]

Stacktrace/Code
If applicable, add stacktrace or code segments to help explain your problem.

Environment:

  • OS: (e.g. Linux)
  • Python version: (e.g. 3.8.5)
  • ldfparser version: (e.g. 0.2.1)
Optionally include the output of 'pipdeptree --warn silence -p ldfparser'

Additional context
Add any other context about the problem here.

@kayoub5
Copy link
Contributor

kayoub5 commented Oct 27, 2023

@nuts4coffee the paragraph you are stating refer to how should a numeric number be encoded, for arrays, the concept of little endian/big endian does not really exist, endianess only applies when you try to pack a number into a multi-byte field.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants