Skip to content
Snippets Groups Projects
Commit 34bda116 authored by kochalas's avatar kochalas Committed by al.schwinn
Browse files

[SIL-279] Fix offset calculation for SNAP7 I/O

parent c739ab6f
No related branches found
No related tags found
No related merge requests found
......@@ -243,6 +243,7 @@ int SNAP7Connection::readIO(PLC* thePLC, unsigned long address, unsigned long of
//DATA topic makes sense with RECV one
if (RECV & Log::topics_) LOG(DATA) << "Read data, address: " << address << ", ofs: " << offset << ", byte-size: " << size;
address += offset;
err = Cli_EBRead(recvClient_, (int)address, (int)size, (void *)pBuffer);
checkError(thePLC, err, false); // close the connection, will try again at the next access
}
......@@ -260,6 +261,7 @@ int SNAP7Connection::writeIO(PLC* thePLC, unsigned long address, unsigned long o
//DATA topic makes sense with SEND one
if (SEND & Log::topics_) LOG(DATA) << "Write data, address: " << address << ", ofs: " << offset << ", byte-size: " << size;
address += offset;
err = Cli_ABWrite(sendClient_, (int)address, (int)size, (void *)pBuffer);
checkError(thePLC, err, false); // close the connection, will try again at the next access
}
......@@ -271,7 +273,7 @@ bool SNAP7Connection::checkError(PLC* thePLC, int err, bool retry)
{
if (err != 0)
{
LOG(COMM) << "Transaction failure with PLC: " << thePLC->getName() << getErrorMessage(err);
LOG(COMM) << "Transaction failure with PLC: " << thePLC->getName() << " " << getErrorMessage(err);
if (retry)
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment