|
@@ -71,6 +71,7 @@ void GetDataFromUartQueue(UART_HandleTypeDef *huart)
|
71
|
71
|
volatile static int cnt;
|
72
|
72
|
bool chksumret = 0;
|
73
|
73
|
uint16_t Length = 0;
|
|
74
|
+ uint16_t CrcChk = 0;
|
74
|
75
|
UART_HandleTypeDef *dst = (huart->Instance == USART2 ? &hTest:&hTerminal);
|
75
|
76
|
// UART_HandleTypeDef *dst = &hTerminal;
|
76
|
77
|
pUARTQUEUE pQueue = &TerminalQueue;
|
|
@@ -106,7 +107,8 @@ void GetDataFromUartQueue(UART_HandleTypeDef *huart)
|
106
|
107
|
|
107
|
108
|
if(Chksum_Check(uart_buf,MBIC_HEADER_SIZE - 4,uart_buf[MBIC_CHECKSHUM_INDEX])){
|
108
|
109
|
Length = ((uart_buf[MBIC_LENGTH_0] << 8) | uart_buf[MBIC_LENGTH_1]);
|
109
|
|
-// if((CRC16_Check(&uart_buf[MBIC_PAYLOADSTART], Length,uart_buf[MBIC_PAYLOADSTART + Length]);
|
|
110
|
+ CrcChk = ((uart_buf[MBIC_PAYLOADSTART + Length + 1] << 8) | (uart_buf[MBIC_PAYLOADSTART + Length + 2]));
|
|
111
|
+ if((CRC16_Check(&uart_buf[MBIC_PAYLOADSTART], Length,CrcChk)
|
110
|
112
|
MBIC_Operate(uart_buf);
|
111
|
113
|
}
|
112
|
114
|
else{
|