Cura - Duet RepRap Firmware Integration Question
-
Anyone using the Duet RepRap Firmware Integration plugin on Cura 3.6? I'm getting an error message on the Duet DWC every time I upload a new file from Cura to the Duet. Each new file gets the message "Error: Failed to delete file 0:/gcodes/myfilename.gcode. But, the file gets stored on the Duet just fine. If I re-upload the same file from Cura there is no message. The error is only on the first time for a new filename.
This is with Duet FW 2.02RC6, DWC 1.22.5 and the latest PanelDue. Cura is 3.6 and the plugin is 1.0.
Just curious if this is a Cura or Duet thing. -
Hi @DaveA,
I'm the creator of the Cura-DuetRRF plugin.
When you upload a new gcode file, the first step is to delete any old file with the same name. Of course, if the file doesn't exist, it causes the message you are seeing. This is normal and expected.
Deleting the file, before uploading it, is done to ensure you don't accidentally start printing an outdated version of the file (same filename). This could happen if the upload fails for some reason and the firmware didn't catch it.
Unfortunately there is no "check if file exists" function that I can use to prevent this message from showing up. Maybe @dc42 can be convinced to add one?
-
Hi,
Thanks for the info. Nice job. It's quite convenient to just push one button and copy the file.
Would it not be possible to attempt to open the file in python? If it opens then it exists so close it and delete it. I'm not familiar with python. I worked for 40 years in C, C++ and C# but never python. -
@resam, does your plugin delete the file explicitly? If so, it doesn't need to because RRF will take care of removing the existing file when you upload a new one with the same name.
If not, then I guess I could suppress the error message when the error is that the file doesn't exist.
-
@dc42 yes, I'm calling the
delete
HTTP endpoint: https://github.com/Kriechi/Cura-DuetRRFPlugin/blob/master/DuetRRFOutputDevice.py#L174If you can confirm this is not necessary, I will remove it - but I seem to remember that in the past it was an additional safety measure to prevent accidentally reprinting an old file if a newer upload failed.
-
If the rr_upload command reaches the Duet and is well-formed, then any existing file of that name will be truncated to zero length, so there would be no danger of printing the old file.
-
PS - I'll change the code not to generate a global error message if the delete failed because the file or path was not found. The rr_delete call will still return an error code in this case. The error message will still be generated if any other error is returned by the f_unlink call to the filesystem.
-
Ok - I'll remove the explicit delete call in the Cura plugin and release a new version in the next days.
Thanks for clarifying this!
-
v1.0.1 of the plugin is now published and available in the Cura Marketplace for Cura 3.6 and the 4.0-beta.