Skip to content

Conversation

@willson556
Copy link
Contributor

@willson556 willson556 commented Nov 25, 2024

Previously, when attempting a write of "" to a VISIBLE_STRING, the expedited SDO request would not be sent and the transaction would timeout.

I traced this down to the BufferedWriter not issuing a write to the underlying stream when it has only been called with b"". Additionally, it turns out that it's not possible to correctly send an expedited SDO request with size == 0.

To resolve this, if the transaction size is known to be 0, a segmented transfer is used.

@codecov-commenter
Copy link

codecov-commenter commented Nov 25, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 71.36%. Comparing base (ffbd10f) to head (79790d9).

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #551   +/-   ##
=======================================
  Coverage   71.36%   71.36%           
=======================================
  Files          26       26           
  Lines        3129     3129           
  Branches      480      480           
=======================================
  Hits         2233     2233           
  Misses        765      765           
  Partials      131      131           
Files with missing lines Coverage Δ
canopen/sdo/client.py 72.01% <100.00%> (ø)

Copy link
Member

@acolomb acolomb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice find and good job in fixing it. Some nit-picks, but nothing serious that would keep this from being merged.

@willson556
Copy link
Contributor Author

Nice find and good job in fixing it. Some nit-picks, but nothing serious that would keep this from being merged.

Thanks for the quick review! Got back around to this today and realized you were right about the command byte issue. I updated the code to force a segmented transfer instead since the 2-bit size field overflows when attempting to use a transfer size of 0.

@acolomb acolomb changed the title Fix SDO writes of empty strings. Fix SDO writes of empty strings Jan 5, 2025
@acolomb acolomb merged commit ae71853 into canopen-python:master Jan 5, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants