|
43 | 43 | #include "modbus.h" |
44 | 44 | #include "drvModbusAsyn.h" |
45 | 45 |
|
| 46 | +// Windows can define macros min() and max() that interfere with std::min() and std::max() |
| 47 | +#ifdef _WIN32 |
| 48 | + #undef min |
| 49 | + #undef max |
| 50 | +#endif |
| 51 | + |
46 | 52 | /* Defined constants */ |
47 | 53 |
|
48 | 54 | #define MAX_READ_WORDS 125 /* Modbus limit on number of words to read */ |
@@ -1110,11 +1116,6 @@ asynStatus drvModbusAsyn::readFloat64Array (asynUser *pasynUser, epicsFloat64 *d |
1110 | 1116 | asynStatus status; |
1111 | 1117 | static const char *functionName="readFloat64Array"; |
1112 | 1118 |
|
1113 | | - for (i=0; i<maxChans && offset<modbusLength_; i++) { |
1114 | | - errlogPrintf("data[%d] = %d\n", offset, data_[offset]); |
1115 | | - offset++; |
1116 | | - } |
1117 | | - |
1118 | 1119 | *nactual = 0; |
1119 | 1120 | pasynManager->getAddr(pasynUser, &offset); |
1120 | 1121 | if (function == P_Data) { |
@@ -1228,7 +1229,7 @@ asynStatus drvModbusAsyn::writeFloat64Array(asynUser *pasynUser, epicsFloat64 *d |
1228 | 1229 | case MODBUS_WRITE_MULTIPLE_COILS: |
1229 | 1230 | /* Need to copy data to local buffer to convert to epicsUInt16 */ |
1230 | 1231 | for (i=0; i<maxChans && outIndex<modbusLength_; i++) { |
1231 | | - data_[outIndex] = data[i]; |
| 1232 | + data_[outIndex] = (epicsUInt16)data[i]; |
1232 | 1233 | outIndex++; |
1233 | 1234 | nwrite++; |
1234 | 1235 | } |
@@ -1291,7 +1292,7 @@ asynStatus drvModbusAsyn::readInt32Array (asynUser *pasynUser, epicsInt32 *data, |
1291 | 1292 | /* If absolute addressing then there is no poller running */ |
1292 | 1293 | if (checkModbusFunction(&modbusFunction)) return asynError; |
1293 | 1294 | ioStatus_ = doModbusIO(modbusSlave_, modbusFunction, |
1294 | | - offset, data_, std::min(maxChans, static_cast<size_t>(modbusLength_))); |
| 1295 | + offset, data_, std::min((int)maxChans, modbusLength_)); |
1295 | 1296 | if (ioStatus_ != asynSuccess) return(ioStatus_); |
1296 | 1297 | offset = 0; |
1297 | 1298 | } else { |
@@ -1461,7 +1462,7 @@ asynStatus drvModbusAsyn::readOctet(asynUser *pasynUser, char *data, size_t maxC |
1461 | 1462 | /* If absolute addressing then there is no poller running */ |
1462 | 1463 | if (checkModbusFunction(&modbusFunction)) return asynError; |
1463 | 1464 | ioStatus_ = doModbusIO(modbusSlave_, modbusFunction, |
1464 | | - offset, data_, std::min(maxChars, static_cast<size_t>(modbusLength_))); |
| 1465 | + offset, data_, std::min((int)maxChars, modbusLength_)); |
1465 | 1466 | if (ioStatus_ != asynSuccess) return(ioStatus_); |
1466 | 1467 | offset = 0; |
1467 | 1468 | } else { |
|
0 commit comments