Understanding how octoprint prints files from server

Hi All! I'm trying to understand how octoprint communicates GCode to the printer when printing from files uploaded to the server (not the sd card). Am I correct in thinking that this code in src/util/comm.py is ultimately what is responsible, and that the general process is:

  1. Octoprint maintains a _currentFile state variable
  2. The value for _currentFile is set during this api route (/files/<string:target>/<path:filename>)
  3. When the user triggers a print, octoprint sends an M29 command and copies the content of the file onto the sd card
  4. Once the file is copied over, octoprint tells the printer to begin (using and M23 command)

I'm really just trying to figure out if octoprint streams the commands over it's serial/tty connection on some timeout/interval, or if it behaves like I outlined above. The other day I rebooted my octoprint serve process mindlessly (probably rebooting after an apt update or something) during a print and noticed the printer just stopped executing commands. That leads me to believe it is not copying the gcode to the SD card before the print but streaming them outright, though I'm just not sure.

Thanks in advance!

No, that's the process for saving to SD card. OctoPrint actually sends the commands line by line from reading the file from the server.

1 Like