Watchdog... bug fix.
Ça sembre bon.
This commit is contained in:
parent
31ce874693
commit
ffd2a4383d
@ -35,14 +35,15 @@ void CModbusBackend::ModbusDataReady()
|
|||||||
*TransactionDataStrm >> Transaction.mPDU.mFunctionCode;
|
*TransactionDataStrm >> Transaction.mPDU.mFunctionCode;
|
||||||
Transaction.mPDU.mData = InData.right(Transaction.mHeader.mMessageLength - 2); //-2 to remove Device ID and Function Code.
|
Transaction.mPDU.mData = InData.right(Transaction.mHeader.mMessageLength - 2); //-2 to remove Device ID and Function Code.
|
||||||
|
|
||||||
// qDebug("modbus data received %s",InData.toHex().data());
|
// qDebug("---------------------------------------");
|
||||||
// qDebug("Transaction ID 0x%X",Transaction.mHeader.mTransactionID);
|
// qDebug("modbus data received %s",InData.toHex().data());
|
||||||
// qDebug("Message Length %d",Transaction.mHeader.mMessageLength);
|
// qDebug("Transaction ID 0x%X",Transaction.mHeader.mTransactionID);
|
||||||
// qDebug("Protocol ID 0x%X",Transaction.mHeader.mProtocolID);
|
// qDebug("Message Length %d",Transaction.mHeader.mMessageLength);
|
||||||
// qDebug("Unit ID 0x%X",Transaction.mHeader.mUnitID);
|
// qDebug("Protocol ID 0x%X",Transaction.mHeader.mProtocolID);
|
||||||
|
// qDebug("Unit ID 0x%X",Transaction.mHeader.mUnitID);
|
||||||
// qDebug("Function Code 0x%X",Transaction.mPDU.mFunctionCode);
|
// qDebug("Function Code 0x%X",Transaction.mPDU.mFunctionCode);
|
||||||
// qDebug("Data %s",Transaction.mPDU.mData.toHex().data());
|
// qDebug("Data %s",Transaction.mPDU.mData.toHex().data());
|
||||||
|
// qDebug("---------------------------------------");
|
||||||
|
|
||||||
if(mModbusMode == MODBUS_MASTER_MODE)
|
if(mModbusMode == MODBUS_MASTER_MODE)
|
||||||
{
|
{
|
||||||
@ -143,9 +144,13 @@ int CModbusBackend::AnalyzeModbusRequest(CModbusTransaction Transaction)
|
|||||||
|
|
||||||
//Write register data
|
//Write register data
|
||||||
mModbusRepo->WriteHRData(StartAdress,1,data);
|
mModbusRepo->WriteHRData(StartAdress,1,data);
|
||||||
|
if(StartAdress == 2000)
|
||||||
|
{
|
||||||
|
qDebug("debug... 2000");
|
||||||
|
}
|
||||||
|
|
||||||
// qDebug("Slave Rx Write Single Register. Address: %d, Value: 0x%s",StartAdress, data.toHex().data());
|
// qDebug("Slave Rx Write Single Register. Address: %d, Value: 0x%s",StartAdress, data.toHex().data());
|
||||||
// qDebug("Data: %s",data.toHex().data());
|
// qDebug("Data: %s",data.toHex().data());
|
||||||
|
|
||||||
data = Transaction.mPDU.mData.left(4); //The response corresponds to the Reg. Address & the value. Which is the first 4 bytes of the initial request.
|
data = Transaction.mPDU.mData.left(4); //The response corresponds to the Reg. Address & the value. Which is the first 4 bytes of the initial request.
|
||||||
SendModbusResponse(Transaction, data);
|
SendModbusResponse(Transaction, data);
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
#define PROTOCOLDEFS_H
|
#define PROTOCOLDEFS_H
|
||||||
|
|
||||||
#define MODBUS_ZT_WATCHDOG_TIMEOUT 3000
|
#define MODBUS_ZT_WATCHDOG_TIMEOUT 3000
|
||||||
#define MODBUS_CC_WATCHDOG_TIMEOUT 5000
|
#define MODBUS_CC_WATCHDOG_TIMEOUT 7000
|
||||||
|
|
||||||
//ZT - CC modbus table masks
|
//ZT - CC modbus table masks
|
||||||
|
|
||||||
|
|||||||
@ -84,6 +84,7 @@ void CModbusCCMgr::RegistersDatabaseUpdated(quint16 StartAddress, quint16 Length
|
|||||||
|
|
||||||
|
|
||||||
qint16 WD = mModbusRepo->GetSingleReg(MODBUS_CC_WATCHDOG_BASE_REG_ADD);
|
qint16 WD = mModbusRepo->GetSingleReg(MODBUS_CC_WATCHDOG_BASE_REG_ADD);
|
||||||
|
// qDebug("WD = %d",WD);
|
||||||
if(WD != mCCWatchdogState)
|
if(WD != mCCWatchdogState)
|
||||||
{
|
{
|
||||||
mCCWatchdogTimer->start(MODBUS_CC_WATCHDOG_TIMEOUT); //The watchdog has toggled. Kick the timer.
|
mCCWatchdogTimer->start(MODBUS_CC_WATCHDOG_TIMEOUT); //The watchdog has toggled. Kick the timer.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user