自研批检仪检测命令测试成功

广播方式升级从机发现卡死现象
This commit is contained in:
ranchuan
2023-12-04 18:15:37 +08:00
parent 66b9453255
commit 2451c5dfc5
19 changed files with 256 additions and 69 deletions

View File

@@ -71,8 +71,9 @@ myarray CodecYm::decode(int &srcAddr, int &dstAddr, int &cmd, myarray data)
Q_UNUSED(srcAddr);
Q_UNUSED(dstAddr);
myarray r;
if (packCheck(data) == true)
if (packCheck(data) >0)
{
qDebug("offset=%d",offset);
cmd = this->cmd;
if (is_big_data == false)
r = data.mid(offset+7, len - 3);
@@ -100,7 +101,7 @@ int CodecYm::packCheck(myarray data)
if (data.size() < 9)
{
// 主机一帧数据至少9字节
qWarning("recv data len too less");
// qWarning("recv data len too less");
return ack;
}
@@ -118,7 +119,7 @@ int CodecYm::packCheck(myarray data)
if (len + 6 > data.size())
{
// 如果长度不相等则产生了数据丢失
qWarning("recv data have lossed");
// qWarning("recv data have lossed");
return ack;
}
uint8_t chk_a = 0, chk_b = 0;
@@ -133,7 +134,7 @@ int CodecYm::packCheck(myarray data)
cmd_no = data[5] | (data[6] << 8);
cmd = data[4];
// 数据负载
return len+offset;
return len+offset+6;
}
myarray CodecYm::encode(int srcAddr, int dstAddr, int cmd, myarray data)
{