|
|
@@ -202,7 +202,7 @@ QVector<bool> MyModbus::analReadCoil() |
|
|
|
return coil; |
|
|
|
} |
|
|
|
|
|
|
|
quint8 byteCount = static_cast<quint8>(receive_[2]); // 数据字节数 |
|
|
|
quint8 byteCount = static_cast<quint8>(receive_.at(2)); // 数据字节数 |
|
|
|
|
|
|
|
// 解析每个数据字节 |
|
|
|
for (int byteIndex = 0; byteIndex < byteCount; byteIndex++) |
|
|
@@ -272,7 +272,8 @@ quint16 MyModbus::calculateCrc(const QByteArray &data) |
|
|
|
{ |
|
|
|
// 检查最低位 |
|
|
|
crc = (crc >> 1) ^ polynomial; // 右移并且异或多项式 |
|
|
|
} else |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
crc >>= 1; // 仅右移 |
|
|
|
} |
|
|
|