ethercrab-rs / ethercrab

EtherCAT master written in pure Rust
258 stars 25 forks source link

Check group SubDevice states in chunks of 16 #237

Closed jamwaffles closed 2 months ago

jamwaffles commented 2 months ago

This makes the state check 16x more efficient by sending a single EtherCAT frame with state requests for (up to) 16 SubDevices in the group.

It would be great if the chunk size could be computed based on the PDU size specified by the user, but Rust isn't there yet. A chunk size of 16 was chosen quite arbitrarily as a balance between allowing small PDU sizes but more efficient state checks.

jamwaffles commented 2 months ago

Also fixes a subtle bug when freeing up frames for reuse. I believe this bug is only caused when a multi-PDU frame is sent with n PDUs where n is a multiple of the PDU storage size.

jamwaffles commented 2 months ago

Tested on my local test bench with 16 devices. Also tested by another user on a much larger network which also works fine with this change.