diff --git a/src/protocol.c b/src/protocol.c --- a/src/protocol.c +++ b/src/protocol.c @@ -42,14 +42,14 @@ bool protocol_send_message(protocol_mess bool result = true; uint8_t data[8]; - data[0] = (message->command & 0x80) & (message->id & 0x7F); + data[0] = (message->command & 0x80) | (message->id & 0x7F); data[1] = (message->key >> 8) & 0xFF; data[2] = (message->key >> 0) & 0xFF; data[3] = message->sensor; - data[4] = (message->data.byte_data[0] >> 24) & 0xFF; - data[5] = (message->data.byte_data[1] >> 16) & 0xFF; - data[6] = (message->data.byte_data[2] >> 8) & 0xFF; - data[7] = (message->data.byte_data[3] >> 0) & 0xFF; + data[4] = message->data.byte_data[0]; + data[5] = message->data.byte_data[1]; + data[6] = message->data.byte_data[2]; + data[7] = message->data.byte_data[3]; can_send(protocol_settings.val.can_id | 0x00000001, CAN_ID_STD, 8, data);