Browse Source

added M31 - delete file from sd card

Christian Thalhammer 13 years ago
parent
commit
5f3a422e68
1 changed files with 11 additions and 9 deletions
  1. 11
    9
      Marlin/Marlin.pde

+ 11
- 9
Marlin/Marlin.pde View File

@@ -739,20 +739,22 @@ void process_commands()
739 739
       //processed in write to file routine above
740 740
       //card,saving = false;
741 741
       break;
742
-    case 31: //M31 <filename> Delete File 
743
-	if (card.cardok){
742
+    case 30: //M31 <filename> Delete File 
743
+	if (card.cardOK){
744 744
 		card.closefile();
745
-		if (SdBaseFile::remove(strchr_pointer + 4)){
746
-			SERIAL_PROTOCOLLNPGM("File deleted");
747
-		}
748
-		else{
749
-			SERIAL_PROTOCOLLNPGM("Deletion failed");
750
-		}	
745
+		starpos = (strchr(strchr_pointer + 4,'*'));
746
+                if(starpos != NULL){
747
+                char* npos = strchr(cmdbuffer[bufindr], 'N');
748
+                strchr_pointer = strchr(npos,' ') + 1;
749
+                *(starpos-1) = '\0';
750
+         }
751
+	 card.removeFile(strchr_pointer + 4);
751 752
 	}
753
+	break;
752 754
 	
753 755
 #endif //SDSUPPORT
754 756
 
755
-    case 30: //M30 take time since the start of the SD print or an M109 command
757
+    case 31: //M30 take time since the start of the SD print or an M109 command
756 758
       {
757 759
       stoptime=millis();
758 760
       char time[30];

Loading…
Cancel
Save