修复当传输字节大于255是存在解析失败的问题
This commit is contained in:
@@ -82,14 +82,16 @@ int resend_decode(resend_device_t *resend_device, uint8_t c)
|
||||
resend_device->status.c_state = RESEND_RETRY_CNT;
|
||||
break;
|
||||
case RESEND_RETRY_CNT:
|
||||
printf("cnt %d\r\n",c);
|
||||
resend_device->rx_frame.retry_cnt = c;
|
||||
//超过最大允许重传次数
|
||||
if(resend_device->rx_frame.retry_cnt > RESEND_MAX_RETRY_CNT)
|
||||
resend_device->status.c_state = RESEND_IDLE;
|
||||
fmav_crc_accumulate(&frame_crc, c);
|
||||
resend_device->status.c_state = RESEND_LEN_1;
|
||||
break;
|
||||
case RESEND_LEN_1:
|
||||
resend_device->rx_frame.len = 0;
|
||||
resend_device->rx_frame.len = (uint16_t)(c << 8) & 0xF0;
|
||||
resend_device->rx_frame.len = (uint16_t)(c << 8);
|
||||
fmav_crc_accumulate(&frame_crc, c);
|
||||
resend_device->status.c_state = RESEND_LEN_2;
|
||||
break;
|
||||
@@ -100,6 +102,9 @@ int resend_decode(resend_device_t *resend_device, uint8_t c)
|
||||
{
|
||||
resend_device->status.data_offset = 0;
|
||||
resend_device->status.c_state = RESEND_DATA;
|
||||
//超过允许的字节数
|
||||
if(resend_device->rx_frame.len > RESEND_DATA_SIZE)
|
||||
resend_device->status.c_state = RESEND_IDLE;
|
||||
}
|
||||
else
|
||||
resend_device->status.c_state = RESEND_CRC_1;
|
||||
|
||||
Reference in New Issue
Block a user