How terminal handle firmware response after sending Gcode command?


#1

What is the problem?

I wonder how terminal (of the web app) handle the response of the firmware after sending a G-Code
command.

What did you already try to solve it?

I try to check a complete call in order to analyse the full stack trace and try to understand how it works but I'm stuck. I saw that when I enter a command in the terminal this is the /api/printer/command function which is call but after that, how the response is handle by the terminal ? Is there a way to retrieve a firmware response via the API after attempting a POST request with /api/printer/command. (For example a M114 command)


Additional information about your setup
I'm currently running with the latest version of Octoprint. My printer is custom and runnig marlin firmware.


#2

No. This has technical reasons. Due to a firmware bug that is still present in vendor forks it's not possible to reliably associate sent commands with their output (due to commands not necessarily being acknowledged in the same order as they were sent in). Which makes it impossible for OctoPrint to provide you with the output produced by a command you send.

What OctoPrint does internally is look for known response formats in the received lines and match them via string matching or regular expressions. The whole communication is completely asynchronous. It also happens in the backend/server portion of OctoPrint, not the Terminal tab (otherwise your printer would stop if you'd close the browser).


Issue M112 through the restful API