probonopd / WirelessPrinting

Print wirelessly from Cura, PrusaSlicer or Slic3r to your 3D printer connected to an ESP8266 or ESP32 module
352 stars 65 forks source link

Upload to printer SD card #131

Open probonopd opened 4 years ago

probonopd commented 4 years ago

We could try to upload to printer SD card, although it is reported to be very slow.

probonopd commented 4 years ago
probonopd commented 4 years ago

Most interestingly, we could use

Use this command to start logging all console and host input to an SD file while still operating the machine.

The way I understand it, we could print at normal speed and after a complete print would find the printed GCODE on the printer's SD card, from where it could be re-printed at any time.

Might also come in handy for debugging purposes.

Try this by adding to a GCODE file as the first line:

M22 ; Release SD card
M21 ; Init SD card
M928 log.gcode ; Start logging to SD card

(replace log.txt with the name of the GCODE file being uploaded), and as the last line:

M29 ; Stop logging to SD card

We should probably save the file as ERROR-name-of-the.gcode and rename it to name-of-the.gcode only after the print has succeeded. This way we won't accidentally print half-complete GCODE.

GMagician commented 4 years ago

It seems promising...

probonopd commented 4 years ago

Trying it manually as we speak.

GMagician commented 4 years ago

Perhaps I think printer still print sent code

probonopd commented 4 years ago

I don't see the GCODE being saved, do you?

M22 ; Release SD card
M21 ; Init SD card
M23 log.gcode ; Select SD file
M928 log.gcode ; Start logging to SD card
; TEST
M29 ; Stop logging to SD card

telnet says:

>M21 
<echo:SD card ok#wait more#
<ok#ok#
>M928 log.gcode 
<echo:Now fresh file: log.gcode #wait more#
<open failed, File: log.gcode .#wait more#
<ok#ok#
>M29 
<ok#ok#
>M117 Complete

Perhaps we need M23.

GMagician commented 4 years ago

I can't test...long print... but

<open failed, File: log.gcode .#wait more#

is not a good sign..

Loocking into marlin code M928 opens a file and set some flags, nothing more should be needed

probonopd commented 4 years ago

With it, getting

>M21 
<echo:SD card ok#wait more#
<ok#ok#
>M23 log.gcode 
<echo:Now fresh file: log.gcode#wait more#
<open failed, File: log.gcode.#wait more#
<ok#ok#
>M928 log.gcode 
<echo:Now fresh file: log.gcode #wait more#
<open failed, File: log.gcode .#wait more#
<ok#ok#
>M29 
<ok#ok#
>M117 Complete
<ok#ok#
probonopd commented 4 years ago

I am stuck here. Running stock Marlin bugfix-1.1.x firmware from https://github.com/probonopd/marlin-for-ender-2.

GMagician commented 4 years ago

open in marlin calls:

if (!file.open(curDir, fname, O_CREAT | O_APPEND | O_WRITE | O_TRUNC))

and fail to this will send such error message. I'm looking at marlin 2.0 source.

I don't like both O_CREAT and O_APPEND but I need to wait 4h before checking something

probonopd commented 4 years ago

Tried with 2 SD cards, and also with LOG.GCO as the filename.

probonopd commented 4 years ago

Prusa i3 MK2S says:

>M22 
<ok#ok#
>M21 
<echo:SD card ok#wait more#
<ok#ok#
>M23 LOG.GCO 
<ok#ok#
>M928 LOG.GCO 
<ok#ok#
>M29 
<ok#ok#
>M117 Complete
<ok#ok#
>M105

but I don't see the file on the printer's SD card either.

GMagician commented 4 years ago

1h left then I'll have printer to test it

probonopd commented 4 years ago

Having a transparent serial bridge #132 would come in neat to test things like this.

GMagician commented 4 years ago

Tested now.. use file format 8.3

GMagician commented 4 years ago

but as I said before, it execute commands while it save them into file

probonopd commented 4 years ago

Yes, it would be good if it would print as usual and save a copy of what is being printed to the printer's SD, so that it could be re-printed later from the printer's LCD. I could not make it work, though...

GMagician commented 4 years ago

I just sent: M928 test.gco G28 G0 x0 y0 M29

GMagician commented 4 years ago

That's may be a new approach, but only available on Marlin2 and must be enabled on firmware https://github.com/MarlinFirmware/Marlin/pull/14817