bnjmnp / pysoem

Cython wrapper for the Simple Open EtherCAT Master Library
MIT License
95 stars 36 forks source link

Raise WkcError in sdo_write and sdo_read when working counter is not … #127

Closed GullinBustin closed 5 months ago

GullinBustin commented 6 months ago

In sdo_read and sdo_write, the working counter is saved as a local variable named result, but it is not used anywhere. When SDO read/write is performed on a ECAT device, It is not possible to know if connections fail or if a timeout occurs because the working counter is not shared, and sdo_read/sdo_write does not raise any exception in these cases. In this PR, sdo_read/sdo_write raise a WkcError when the 'result' value is not higher than 0 and adds the 'result' value as a property in the exception.

GullinBustin commented 5 months ago

@bnjmnp Do you want any changes to merge this PR? Nowadays we need this update to use SDOs.

bnjmnp commented 5 months ago

Many thanks for you contribution. The check on the working counter for SDO read and write seems resonalbe. Sorry that I did not merge the PR very quickly, I wanted to take the time to run my tests on this.

bnjmnp commented 5 months ago

Maybe I should also apply this to mbx_receive(). It would align more nicely if wk errors would also raise an exception there. What do you think?