Fix Motorola signal extraction in the DBC decoder #1

Closed
opened 2026-10-01 16:48:44 +00:00 by deeaitch · 0 comments
Owner

Description:
Motorola signal decoding incorrectly calculates the bit position within a byte and the transition to the next byte.
Reproduction:

  • Signal: startBit=7, length=16, ByteOrder::Motorola, unsigned, factor 1, offset 0.
  • Payload: {0x12, 0x34}.
  • Expected: rawValue=4660 (0x1234), physicalValue=4660.
  • Actual: rawValue=0, valid=true.
    Scope:
  • Fix ExtractMotorola() to follow DBC bit numbering.
  • Add reproducible regression tests covering:
    • A signal contained within one byte.
    • A signal spanning multiple bytes.
    • A non-byte-aligned start bit.
    • A signed Motorola signal.
    • An insufficient payload.
  • Verify that Intel decoding still works.
  • Do not modify generated docs.
    Acceptance criteria:
  • The reproduction case returns the expected values.
  • All regression tests pass.
  • An insufficient payload produces an invalid signal result.
  • The project builds without warnings using -Wall -Wextra -Wpedantic.
    Suggested branch: fix/motorola-extraction
Description: Motorola signal decoding incorrectly calculates the bit position within a byte and the transition to the next byte. Reproduction: - Signal: startBit=7, length=16, ByteOrder::Motorola, unsigned, factor 1, offset 0. - Payload: {0x12, 0x34}. - Expected: rawValue=4660 (0x1234), physicalValue=4660. - Actual: rawValue=0, valid=true. Scope: - Fix ExtractMotorola() to follow DBC bit numbering. - Add reproducible regression tests covering: - A signal contained within one byte. - A signal spanning multiple bytes. - A non-byte-aligned start bit. - A signed Motorola signal. - An insufficient payload. - Verify that Intel decoding still works. - Do not modify generated docs. Acceptance criteria: - The reproduction case returns the expected values. - All regression tests pass. - An insufficient payload produces an invalid signal result. - The project builds without warnings using -Wall -Wextra -Wpedantic. Suggested branch: fix/motorola-extraction
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: automotive/dbc#1