# HG changeset patch # User matthewreed # Date 2017-05-23 21:58:52 # Node ID eaddb578c329d868ace58bdad741b1c95234b688 # Parent 8b77baddb5abc0a06873570f0948f72bf203f0ac Fixed bugs in protocol receive and changed can receive led diff --git a/src/can.c b/src/can.c --- a/src/can.c +++ b/src/can.c @@ -125,9 +125,9 @@ void HAL_CAN_RxCpltCallback(CAN_HandleTy if ((hcan->pRxMsg->StdId == can_rx_id) | (hcan->pRxMsg->StdId == can_broadcast_id)) { protocol_receive_message(hcan->pRxMsg); - led_start_time(LED_CAN, 500); HAL_CAN_Receive_IT(&can_handle, CAN_FIFO0); } + led_start_time(LED_CAN, 500); } void HAL_CAN_TxCpltCallback(CAN_HandleTypeDef* hcan) {} diff --git a/src/protocol.c b/src/protocol.c --- a/src/protocol.c +++ b/src/protocol.c @@ -25,7 +25,7 @@ bool protocol_receive_message(CanRxMsgTy protocol_message_t message; message.command = can_message->Data[0] & 0x80; message.id = can_message->Data[0] & 0x7F; - message.key = (can_message->Data[1] << 8) & can_message->Data[2]; + message.key = (can_message->Data[1] << 8) | can_message->Data[2]; message.sensor = can_message->Data[3]; message.data.byte_data[0] = can_message->Data[4]; message.data.byte_data[1] = can_message->Data[5];