I am writing a python code for a 3D printer (Marlin). I'm trying to execute a movement that might be composed of multiple commands (G0
). Unfortunately, sending all commands at once does not seem to work. To my understanding, this is caused because the printer command buffer for unexecuted commands is quite small and gets overloaded when sending so many commands at once.
Is there a way for me to know how much of the printer buffer is free, so I'll know when to send the next 1, 2, 5, etc. commands to the printer? I cannot send the next commands once the buffer is completely free as this would stop the movement and I need it to be fluid the whole way.
Two supplementary questions:
- Does any of you know how the printer handles the G-code file it receives on an SD card so it executes it whole fluidly without overloading?
- Does the
'ok'
message received from the printer tell me that all the commands have been executed or that there is at least one free space in the command buffer?