I'm currently building a 3d printer, that is of my own design. The mechanics, electronics and software are all custom. The control software uses g-code; naturally. I also own an Anet A8 3d printer, with Marlin firmware. With Marlin I have noticed that commands have a simple "OK" response. Based on what little I know about the inner workings of Marlin that OK happens after the line has been interpreted but before the movement has occurred (please correct me if I'm wrong).
Marlin and other firmware do not appear to have a way of caching commands. If OctoPrint sends 10 commands does Marlin say OK for each or OK for all ten? This brings me to my real question.
How does OctoPrint instruct a printer to cache commands instead of needing to send them one at a time?
If it does not, then I would like to propose the use of g-code's line number feature (N<0-9>). Here's how it would work:
Octoprint Sends 10 lines numbered 1 to 10 to Machine.
Machine responds with OK for each line, also echoing back the entire line that OK was for.
<- N009 G1 X0.4 Y2 Z.04
-> OK; N009 G1 X0.4 Y2 Z.04
Emergency commands like M112 however would not be cached, and as such would be executed immediately.