added M31 - delete file from sd card

This commit is contained in:
Christian Thalhammer 2012-03-02 21:49:05 +01:00
parent fa2e3a40e9
commit 5f3a422e68

View File

@ -739,20 +739,22 @@ void process_commands()
//processed in write to file routine above //processed in write to file routine above
//card,saving = false; //card,saving = false;
break; break;
case 31: //M31 <filename> Delete File case 30: //M31 <filename> Delete File
if (card.cardok){ if (card.cardOK){
card.closefile(); card.closefile();
if (SdBaseFile::remove(strchr_pointer + 4)){ starpos = (strchr(strchr_pointer + 4,'*'));
SERIAL_PROTOCOLLNPGM("File deleted"); if(starpos != NULL){
} char* npos = strchr(cmdbuffer[bufindr], 'N');
else{ strchr_pointer = strchr(npos,' ') + 1;
SERIAL_PROTOCOLLNPGM("Deletion failed"); *(starpos-1) = '\0';
} }
card.removeFile(strchr_pointer + 4);
} }
break;
#endif //SDSUPPORT #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(); stoptime=millis();
char time[30]; char time[30];