Skip to content

Commit

Permalink
Merge pull request #34 from NomAnor/absolute
Browse files Browse the repository at this point in the history
When using absolute addressing, only read the minimal required words
  • Loading branch information
MarkRivers authored Nov 24, 2024
2 parents ba253bf + c3547cd commit 59a57f4
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions modbusApp/src/drvModbusAsyn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ asynStatus drvModbusAsyn::readUInt32Digital(asynUser *pasynUser, epicsUInt32 *va
/* If absolute addressing then there is no poller running */
if (checkModbusFunction(&modbusFunction)) return asynError;
ioStatus_ = doModbusIO(modbusSlave_, modbusFunction,
offset, data_, modbusLength_);
offset, data_, std::min(1, modbusLength_));
if (ioStatus_ != asynSuccess) return(ioStatus_);
offset = 0;
readOnceDone_ = true;
Expand Down Expand Up @@ -667,7 +667,7 @@ asynStatus drvModbusAsyn::readInt32 (asynUser *pasynUser, epicsInt32 *value)
/* If absolute addressing then there is no poller running */
if (checkModbusFunction(&modbusFunction)) return asynError;
ioStatus_ = doModbusIO(modbusSlave_, modbusFunction,
offset, data_, modbusLength_);
offset, data_, std::min(2, modbusLength_));
if (ioStatus_ != asynSuccess) return(ioStatus_);
offset = 0;
readOnceDone_ = true;
Expand Down Expand Up @@ -828,7 +828,7 @@ asynStatus drvModbusAsyn::readInt64 (asynUser *pasynUser, epicsInt64 *value)
/* If absolute addressing then there is no poller running */
if (checkModbusFunction(&modbusFunction)) return asynError;
ioStatus_ = doModbusIO(modbusSlave_, modbusFunction,
offset, data_, modbusLength_);
offset, data_, std::min(4, modbusLength_));
if (ioStatus_ != asynSuccess) return(ioStatus_);
offset = 0;
readOnceDone_ = true;
Expand Down Expand Up @@ -974,7 +974,7 @@ asynStatus drvModbusAsyn::readFloat64 (asynUser *pasynUser, epicsFloat64 *value)
/* If absolute addressing then there is no poller running */
if (checkModbusFunction(&modbusFunction)) return asynError;
ioStatus_ = doModbusIO(modbusSlave_, modbusFunction,
offset, data_, modbusLength_);
offset, data_, std::min(4, modbusLength_));
if (ioStatus_ != asynSuccess) return(ioStatus_);
offset = 0;
readOnceDone_ = true;
Expand Down Expand Up @@ -1117,7 +1117,7 @@ asynStatus drvModbusAsyn::readInt32Array (asynUser *pasynUser, epicsInt32 *data,
/* If absolute addressing then there is no poller running */
if (checkModbusFunction(&modbusFunction)) return asynError;
ioStatus_ = doModbusIO(modbusSlave_, modbusFunction,
offset, data_, modbusLength_);
offset, data_, std::min(maxChans, static_cast<size_t>(modbusLength_)));
if (ioStatus_ != asynSuccess) return(ioStatus_);
offset = 0;
} else {
Expand Down Expand Up @@ -1287,7 +1287,7 @@ asynStatus drvModbusAsyn::readOctet(asynUser *pasynUser, char *data, size_t maxC
/* If absolute addressing then there is no poller running */
if (checkModbusFunction(&modbusFunction)) return asynError;
ioStatus_ = doModbusIO(modbusSlave_, modbusFunction,
offset, data_, modbusLength_);
offset, data_, std::min(maxChars, static_cast<size_t>(modbusLength_)));
if (ioStatus_ != asynSuccess) return(ioStatus_);
offset = 0;
} else {
Expand Down

0 comments on commit 59a57f4

Please sign in to comment.