Commit 18267458 authored by 梁百峰's avatar 梁百峰

🐞 fix:修复数据与帧尾相同时错误获取数据问题

parent 93f000e6
......@@ -232,10 +232,21 @@ void datacheck(void)
{
for(int i = 0;i<255;i++)
{
if(BarCode[i] == 0x4A && BarCode[i - 1] == 0x4B)
if(BarCode[3] == 0x40)
{
arraynum = i;
if(BarCode[i] == 0x4A && BarCode[i - 1] == 0x4B && i > 0x40-3)
{
arraynum = i;
}
}
else
{
if(BarCode[i] == 0x4A && BarCode[i - 1] == 0x4B)
{
arraynum = i;
}
}
}
// g_Stage = 1;
if(((BarCode[arraynum]) == 0x4A) && ((BarCode[arraynum-1]) == 0x4B))
......@@ -494,8 +505,8 @@ void Recv_Byte(void)
}
if((mDataBufPtr[k] == 0x59 && mDataBufPtr[k+1] == 0x44) && (mDataBufPtr[i] == 0x4A ) && (mDataBufPtr[i - 1] == 0x4B))
if((mDataBufPtr[k] == 0x59 && mDataBufPtr[k+1] == 0x44) && (mDataBufPtr[i] == 0x4A ) && (mDataBufPtr[i - 1] == 0x4B) && (i > mDataBufPtr[k + 3] - 3))
{
if( i < 1)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment