添加广播方式升级

This commit is contained in:
ranchuan
2023-11-29 15:36:45 +08:00
parent a0b0f41c39
commit e34b8111dc
30 changed files with 1388 additions and 146 deletions

View File

@@ -43,17 +43,17 @@ bool codec_m4::recvByte(int byte)
return fullFrame;
}
bool codec_m4::packCheck(myarray data)
int codec_m4::packCheck(myarray data)
{
if (data[0] != 0xff)
{
return false;
return 0;
}
if (data.size() >= 2 && (data.size() == (data[1] + 2)))
if (data.size() >= 2 && (data.size() >= (data[1] + 2)))
{
return true;
return data[1] + 2;
}
return false;
return 0;
}
myarray codec_m4::encode(int srcAddr, int dstAddr, int cmd, myarray data)
@@ -66,6 +66,7 @@ myarray codec_m4::encode(int srcAddr, int dstAddr, int cmd, myarray data)
}
myarray codec_m4::decode(int &srcAddr, int &dstAddr, int &cmd, myarray data)
{
// qDebug("m4 recv:%s",data.toHex(' ').data());
if (packCheck(data))
{
return data.mid(2);