Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blocking versions of send and send_now do not exist #1449

Open
tomasiser opened this issue Sep 27, 2024 · 3 comments
Open

Blocking versions of send and send_now do not exist #1449

tomasiser opened this issue Sep 27, 2024 · 3 comments

Comments

@tomasiser
Copy link

tomasiser commented Sep 27, 2024

Hello, in Printrun 2.1.0, there are send and send_now methods as part of printcore.py.

These methods are non-blocking, which means when you send a G0 ... command to move to a certain position, the method returns immediately without waiting for the printer to finish the movement.

Could blocking versions of these commands be implemented? Is it even possible given the communication protocol? Of course you can calculate a rough estimate of the time it needs to move by dividing the distance by the move rate (in mm/min), but that is not the same as a blocking version of these methods.

@kliment
Copy link
Owner

kliment commented Sep 27, 2024

There are no blocking methods like this. However, there is a synchronization command M400. M400 will not complete until all moves are done, so sending two M400s in a row will let you check for completion by seeing if queue is empty.

For related work, see #990 and #1008 which implements a very similar thing but needs to be rebased because it's drifted away from the current state of the code.

@tomasiser
Copy link
Author

Thank you, so what you recommend as a workaround is to send M400 twice and then wait until priqueue.empty()? :)

@kliment
Copy link
Owner

kliment commented Oct 3, 2024

That's probably the easiest way to do it, yes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants