Mrnt / OctoPrint-FlashForge

OctoPrint plugin to support closed source printers from FlashForge, PowerSpec, Dremel
GNU General Public License v3.0
87 stars 12 forks source link

Adding SD Card Upload support for Creator Pro 2 #83

Open msmthng opened 1 year ago

msmthng commented 1 year ago

The Upload is working also the start to print from SD Card. The printer is not answering to the SD listening request (not supported by the firmware used). does it make sense to fake the M27 support based on a filedatabase what is uploaded to the printer using octoprint but i don't know if it is possible to inject that command in a way that the printer serial response is modified by the plugin.

Mrnt commented 1 year ago

It looks like the upload path is different for the CP2, but otherwise the behavior is the same?

Out of curiosity - were you able to sniff the USB traffic between FlashPrint and the printer when it controls the printer (lights, etc) and does the SD card upload? Wondering how much they changed the communication from the other printers.

What about making the file path a string that goes with the printer profile, eg:

    0x000e: {"name": "Creator Pro 2", "sd_path":"1:%s\r\n"},

and then the upload could be:

    def process_upload():
        error = ""
        errormsg = "Unable to upload to SD card"
        if "sd_path" in self._printer_profile:
            "sd_path" = self._printer_profile["sd_path"]
        else:
            "sd_path" = "0:/user/%s\r\n"

and then the upload could be something like:

    ok, answer = self._serial_obj.sendcommand(b"M28 %d "+sd_path % (file_size, remote_name.encode()), 5000)

and the print command something like:

    self._comm.selectFile(sd_path % remote_name, True)

Then special casing for other printers would be as simple as adding a path string to the printer profile.

msmthng commented 1 year ago
image

for sniffing the usb traffic i was able to get information for the sd card upload, turning the lights using flashprint isn't possilbe. se the falshprint screenshot for ffcp2 they don't provide the details window.

msmthng commented 1 year ago

i think your file path apporach is better then using this special var, i will change my implementation

Mrnt commented 1 year ago
image

for sniffing the usb traffic i was able to get information for the sd card upload, turning the lights using flashprint isn't possilbe. se the falshprint screenshot for ffcp2 they don't provide the details window.

Good that you were able to sniff it!