0

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:

  1. 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?
  2. 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?
0scar
  • 32,029
  • 10
  • 59
  • 135
  • 1
    I think something similar has been asked before, see e.g. [this answer](/a/14680/). This could we'll be a duplicate question. I think this answers your questions. With respect to the SD reading part of the question, you could look that up in the Marlin sources. – 0scar Apr 07 '21 at 11:21
  • Thanks for the link. I completely missed that "Buffering" subsection on the RepRap page. I had a problem previously with sending multiple `M105` during movement and I might have falsely assumed that it was due to buffer overload. I did not realize that signals are treated differently and only some are buffered. I will check this behaviour with my printer tomorrow, maybe I was worrying over nothing :) – Alathen Apr 07 '21 at 11:43
  • OK means there is space in the "buffer". Whenever you receive OK send a command. Also Marlin will never execute a "fluid" set of commands. There will always be a pause in between. The idea is that it will be smooth enough. – user77232 Apr 08 '21 at 17:30

0 Answers0