Skip to content

Commit d37f6dd

Browse files
committed
Merge branch 'master' of github.com:epics-modules/modbus
2 parents 7944e94 + 59a57f4 commit d37f6dd

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

modbusApp/src/drvModbusAsyn.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ asynStatus drvModbusAsyn::readUInt32Digital(asynUser *pasynUser, epicsUInt32 *va
517517
/* If absolute addressing then there is no poller running */
518518
if (checkModbusFunction(&modbusFunction)) return asynError;
519519
ioStatus_ = doModbusIO(modbusSlave_, modbusFunction,
520-
offset, data_, modbusLength_);
520+
offset, data_, std::min(1, modbusLength_));
521521
if (ioStatus_ != asynSuccess) return(ioStatus_);
522522
offset = 0;
523523
readOnceDone_ = true;
@@ -667,7 +667,7 @@ asynStatus drvModbusAsyn::readInt32 (asynUser *pasynUser, epicsInt32 *value)
667667
/* If absolute addressing then there is no poller running */
668668
if (checkModbusFunction(&modbusFunction)) return asynError;
669669
ioStatus_ = doModbusIO(modbusSlave_, modbusFunction,
670-
offset, data_, modbusLength_);
670+
offset, data_, std::min(2, modbusLength_));
671671
if (ioStatus_ != asynSuccess) return(ioStatus_);
672672
offset = 0;
673673
readOnceDone_ = true;
@@ -828,7 +828,7 @@ asynStatus drvModbusAsyn::readInt64 (asynUser *pasynUser, epicsInt64 *value)
828828
/* If absolute addressing then there is no poller running */
829829
if (checkModbusFunction(&modbusFunction)) return asynError;
830830
ioStatus_ = doModbusIO(modbusSlave_, modbusFunction,
831-
offset, data_, modbusLength_);
831+
offset, data_, std::min(4, modbusLength_));
832832
if (ioStatus_ != asynSuccess) return(ioStatus_);
833833
offset = 0;
834834
readOnceDone_ = true;
@@ -974,7 +974,7 @@ asynStatus drvModbusAsyn::readFloat64 (asynUser *pasynUser, epicsFloat64 *value)
974974
/* If absolute addressing then there is no poller running */
975975
if (checkModbusFunction(&modbusFunction)) return asynError;
976976
ioStatus_ = doModbusIO(modbusSlave_, modbusFunction,
977-
offset, data_, modbusLength_);
977+
offset, data_, std::min(4, modbusLength_));
978978
if (ioStatus_ != asynSuccess) return(ioStatus_);
979979
offset = 0;
980980
readOnceDone_ = true;
@@ -1291,7 +1291,7 @@ asynStatus drvModbusAsyn::readInt32Array (asynUser *pasynUser, epicsInt32 *data,
12911291
/* If absolute addressing then there is no poller running */
12921292
if (checkModbusFunction(&modbusFunction)) return asynError;
12931293
ioStatus_ = doModbusIO(modbusSlave_, modbusFunction,
1294-
offset, data_, modbusLength_);
1294+
offset, data_, std::min(maxChans, static_cast<size_t>(modbusLength_)));
12951295
if (ioStatus_ != asynSuccess) return(ioStatus_);
12961296
offset = 0;
12971297
} else {
@@ -1461,7 +1461,7 @@ asynStatus drvModbusAsyn::readOctet(asynUser *pasynUser, char *data, size_t maxC
14611461
/* If absolute addressing then there is no poller running */
14621462
if (checkModbusFunction(&modbusFunction)) return asynError;
14631463
ioStatus_ = doModbusIO(modbusSlave_, modbusFunction,
1464-
offset, data_, modbusLength_);
1464+
offset, data_, std::min(maxChars, static_cast<size_t>(modbusLength_)));
14651465
if (ioStatus_ != asynSuccess) return(ioStatus_);
14661466
offset = 0;
14671467
} else {

0 commit comments

Comments
 (0)