From 5f3a422e68b098460a1c53d69913d48247a25fe0 Mon Sep 17 00:00:00 2001 From: Christian Thalhammer Date: Fri, 2 Mar 2012 21:49:05 +0100 Subject: [PATCH] added M31 - delete file from sd card --- Marlin/Marlin.pde | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/Marlin/Marlin.pde b/Marlin/Marlin.pde index c595b5baa..5c213e283 100644 --- a/Marlin/Marlin.pde +++ b/Marlin/Marlin.pde @@ -739,20 +739,22 @@ void process_commands() //processed in write to file routine above //card,saving = false; break; - case 31: //M31 Delete File - if (card.cardok){ + case 30: //M31 Delete File + if (card.cardOK){ card.closefile(); - if (SdBaseFile::remove(strchr_pointer + 4)){ - SERIAL_PROTOCOLLNPGM("File deleted"); - } - else{ - SERIAL_PROTOCOLLNPGM("Deletion failed"); - } + starpos = (strchr(strchr_pointer + 4,'*')); + if(starpos != NULL){ + char* npos = strchr(cmdbuffer[bufindr], 'N'); + strchr_pointer = strchr(npos,' ') + 1; + *(starpos-1) = '\0'; + } + card.removeFile(strchr_pointer + 4); } + break; #endif //SDSUPPORT - case 30: //M30 take time since the start of the SD print or an M109 command + case 31: //M30 take time since the start of the SD print or an M109 command { stoptime=millis(); char time[30];