Browse Source

结束验收

master
鹏鹏 李 5 days ago
parent
commit
f8ca76bb31
2 changed files with 4 additions and 3 deletions
  1. +3
    -2
      mymodbus.cpp
  2. +1
    -1
      serialcommunicator.cpp

+ 3
- 2
mymodbus.cpp View File

@@ -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; // 仅右移
}


+ 1
- 1
serialcommunicator.cpp View File

@@ -154,9 +154,9 @@ void SerialCommunicator::close()
resendTimer_->stop();
stationCheck_->stop();
checkTimeOut_->stop();
emit stationConnect(false);

// 清除可能存在的待处理数据
emit stationConnect(false);
serialPort_->clear();

// 关闭串口


Loading…
Cancel
Save