chiark / gitweb /
added M31 - delete file from sd card
authorChristian Thalhammer <christian_thalhammer@gmx.at>
Fri, 2 Mar 2012 20:49:05 +0000 (21:49 +0100)
committerChristian Thalhammer <christian_thalhammer@gmx.at>
Fri, 2 Mar 2012 20:49:05 +0000 (21:49 +0100)
Marlin/Marlin.pde

index c595b5baa16d49f94c350fc900c9918886f19dcc..5c213e2838d4c11e709fe04c82cf199c298c6a3f 100644 (file)
@@ -739,20 +739,22 @@ void process_commands()
       //processed in write to file routine above
       //card,saving = false;
       break;
-    case 31: //M31 <filename> Delete File 
-       if (card.cardok){
+    case 30: //M31 <filename> 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];