Don not copy frame data to datagram memory, if datagram type is write-only.

This commit is contained in:
Florian Pose
2011-09-16 12:44:54 +02:00
parent ad0e01da9e
commit 197fe386b9

View File

@@ -1094,8 +1094,14 @@ void ec_master_receive_datagrams(ec_master_t *master, /**< EtherCAT master */
continue;
}
// copy received data into the datagram memory
memcpy(datagram->data, cur_data, data_size);
if (datagram->type != EC_DATAGRAM_APWR &&
datagram->type != EC_DATAGRAM_FPWR &&
datagram->type != EC_DATAGRAM_BWR &&
datagram->type != EC_DATAGRAM_LWR) {
// copy received data into the datagram memory,
// if something has been read
memcpy(datagram->data, cur_data, data_size);
}
cur_data += data_size;
// set the datagram's working counter