I know 3D printers can read only .gcode files. How does OctoPrint communicate with 3D Printers through USB? Does it save every gcode command in a .gcode file and transmit to the Printer? If that's the case how is it sending the files to the printer and where does it send? because I couldn't see any files on the SD card.
OctoPrint reads the gcode and sends each line to the printer over serial (the 's' in USB). It doesn't go to the SD card because it can talk directly.
So if it sends each line of Gcode directly to the printer, how does the printer know its a Gcode. I mean we could send anything through USB.
It's just an agreement on protocol. G-code is what the printer is expecting to receive. Octoprint negotiates the right sending speed and then sends a line, gets an okay, and continues.
Tedder, doesn't the firmware respond with "OK" if it likes what it's seeing? And then OctoPrint sees that and is happy as a result...?
But I guess your firmware could be from Memphis.