chrishrb / hoval-gateway

Hoval Gateway
Apache License 2.0
13 stars 5 forks source link

Implementation of arbitration ID is incorrect #23

Open abichinger opened 9 months ago

abichinger commented 9 months ago

The arbitration ID is composed of a sender_id and a receiver_mask:

Explanation using the can id 0x1FE40801

hex:       1    F    E    4    0    8    0    1
binary: 0001 1111 1110 0100 0000 1000 0000 0001
index:    28   24   20   16   12    8    4    0

image

Current implementation

def build_arbitration_id(message_id, priority, device_type, device_id):
    return (message_id << 24) | (priority << 16) | (device_type << 8) | device_id

Should be:

def build_arbitration_id(sender_id, receiver_mask):
    return (0x7F << 22) | (sender_id << 11) | receiver_mask;