[Feature Request] View GCode when printing from SD Card


Hi everyone,

first off: thanks for OctoPrint - it's pretty awesome. I'm running it off an Raspberry Pi 1B, and I'm amazed that this ancient piece of hardware is still able to do something useful.

However, some of my prints are very slow when I print them via OctoPrint, I assume because the Pi (and the serial connection) is not fast enough to supply the GCode, especially on round segments. It's a lot faster when I print from SD card. However, I love the GCode viewer in OctoPrint, which is not available when printing from SD card.

I understand that when OctoPrint does not control the executed GCode, it doesn't know "by default" what GCode is currently executed, and how the whole file looks like. However - wouldn't it be great if I were able to upload the file that's currently printing to OctoPrint, and tell it "that's the file that's currently printing". In the terminal I see that the Marlin firmware periodically reports what the current position in the GCode file is (as a response to an M27 command).

Thus, what I would love to see is something along the lines of:
1.) A button in the file browser with which you can tell OctoPrint "this is the file that's currently printing"
2.) When this button is pressed, OctoPrint pretends (to the GCode viewer, the time-estimation-logic, potential plugins, …) to be sending GCode to the printer. Whenever a status response (M27) arrives, it seeks in the file to the position that is reported and updates the "currently printing GCode".

Would something like that be thinkable? Looking forward to your feedback!



The author has indicated this before. When printing from the SD, OctoPrint has the entire collection of GCode available, it just doesn't have the line that the firmware is currently printing. Therefore, it lacks this ability to provide any status which is derived by the line number.


Thanks for your reply. Actually, I read her reply rather that OctoPrint does not have the GCode available. And how should it? If I started the print from the SD card, the (Marlin) firmware will only send a "Print started: " message to OctoPrint, it won't stream the GCode file (which also would take forever for a large file…)

Thus, we'd need to manually tell OctoPrint what GCode file in OctoPrint's storage corresponds to whatever is printing on the printer right now - that's what I'm suggesting. Then, figuring out the GCode line that's currently printing is easy, because the firmware regularly sends the currently printing file position.


Tighter SD card integration would be very welcome, I usually never print anything from SD but I have considered doing so to not lose the "power panic" features of the Prusa i3 MK3.

With the new action command features in Marlin combined with https://github.com/benlye/OctoPrint-ActionCommandsPlugin it should be possible for a slicer to give some extra hints about stuff like timelapses in the generated gcode. It would be fun to do a timelapse per color change instead of per layer with the new prusa MMU2 and Palette multicolor systems.