dbcppp icon indicating copy to clipboard operation
dbcppp copied to clipboard

motorola byte order in dbc file makes layout dispaly incorrectly

Open Jimmy-drod opened this issue 1 year ago • 2 comments

when use this command :dbcppp dbc2 --dbc=file.dbc --format=human, and the signals is motorola byte order in file.dbc, the layout does not display correctly, It no longer plots the signal position.

Jimmy-drod avatar Jan 04 '24 07:01 Jimmy-drod

another problem is : it seems in function bool bit_is_inbetween(const ISignal& sig, std::size_t i_bit, uint64_t switch_value = -1) (called by auto iter = std::find_if(beg, end, [&](const ISignal& sig) { return bit_is_inbetween(sig, i_bit, mux_value); });)

case ISignal::EByteOrder::BigEndian:
    {
        std::size_t start = sig.StartBit();
        std::size_t n = sig.BitSize();
        while (n)
        {
            if (start == i_bit)
            {
                return true;
            }
            if (start % 8 == 0)
            {
                start += 15;
            }
            else
            {
                start--;
            }
            n--;
        }
        return true;
    }

No matter what the value of i_bit is, it will always return true on this branch, resulting in only the first signal being parsed.

Jimmy-drod avatar Jan 04 '24 09:01 Jimmy-drod

I made a PR,please confirm.

BR

Jimmy-drod avatar Jan 05 '24 03:01 Jimmy-drod