From 10bf2bb8e19286bde16e531ece204a529a6eac27 Mon Sep 17 00:00:00 2001 From: Christian Thalhammer Date: Wed, 29 Feb 2012 14:51:15 +0100 Subject: [PATCH 1/6] - --- Marlin/Marlin.pde | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Marlin/Marlin.pde b/Marlin/Marlin.pde index 7ee0762211..2ec088ca07 100644 --- a/Marlin/Marlin.pde +++ b/Marlin/Marlin.pde @@ -714,6 +714,17 @@ void process_commands() //processed in write to file routine above //card,saving = false; break; + case 31: //M31 Delete File + if (card.cardok){ + card.closefile(); + if (SdBaseFile::remove(strchr_pointer + 4)){ + SERIAL_PROTOCOLLNPGM("File deleted"); + } + else{ + SERIAL_PROTOCOLLNPGM("Deletion failed"); + } + } + #endif //SDSUPPORT case 30: //M30 take time since the start of the SD print or an M109 command From 9fa586bbed11f710df08e34d87c735452c17fc04 Mon Sep 17 00:00:00 2001 From: Christian Thalhammer Date: Thu, 1 Mar 2012 14:05:40 +0100 Subject: [PATCH 2/6] fixed languages; Preheat_PLA and Preheat_ABS was not defined for non english --- Marlin/language.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Marlin/language.h b/Marlin/language.h index 6dfd7e0be1..e885f23e29 100644 --- a/Marlin/language.h +++ b/Marlin/language.h @@ -88,9 +88,10 @@ #define MSG_DISABLE_STEPPERS " Disable Steppers" #define MSG_AUTO_HOME " Auto Home" #define MSG_SET_ORIGIN " Set Origin" - #define MSG_PREHEAT " Preheat" #define MSG_COOLDOWN " Cooldown" #define MSG_EXTRUDE " Extrude" + #define MSG_PREHEAT_PLA " Preheat PLA" + #define MSG_PREHEAT_ABS " Preheat ABS" #define MSG_MOVE_AXIS " Move Axis \x7E" #define MSG_SPEED " Speed:" #define MSG_NOZZLE " \002Nozzle:" @@ -153,7 +154,8 @@ #define MSG_DISABLE_STEPPERS " Disable Steppers" #define MSG_AUTO_HOME " Auto Home" #define MSG_SET_ORIGIN " Set Origin" - #define MSG_PREHEAT " Preheat" + #define MSG_PREHEAT_PLA " Preheat PLA" + #define MSG_PREHEAT_ABS " Preheat ABS" #define MSG_COOLDOWN " Cooldown" #define MSG_EXTRUDE " Extrude" #define MSG_MOVE_AXIS " Move Axis \x7E" @@ -218,7 +220,8 @@ #define MSG_DISABLE_STEPPERS " Disable Steppers" #define MSG_AUTO_HOME " Auto Home" #define MSG_SET_ORIGIN " Set Origin" - #define MSG_PREHEAT " Preheat" + #define MSG_PREHEAT_PLA " Preheat PLA" + #define MSG_PREHEAT_ABS " Preheat ABS" #define MSG_COOLDOWN " Cooldown" #define MSG_EXTRUDE " Extrude" #define MSG_MOVE_AXIS " Move Axis \x7E" @@ -283,7 +286,8 @@ #define MSG_DISABLE_STEPPERS " Disable Steppers" #define MSG_AUTO_HOME " Auto Home" #define MSG_SET_ORIGIN " Set Origin" - #define MSG_PREHEAT " Preheat" + #define MSG_PREHEAT_PLA " Preheat PLA" + #define MSG_PREHEAT_ABS " Preheat ABS" #define MSG_COOLDOWN " Cooldown" #define MSG_EXTRUDE " Extrude" #define MSG_MOVE_AXIS " Move Axis \x7E" From a92b3afe64a3da424720c8488aefa943d8dcf32a Mon Sep 17 00:00:00 2001 From: Christian Thalhammer Date: Thu, 1 Mar 2012 14:24:20 +0100 Subject: [PATCH 3/6] added german translation;Menue should be in english.. sounds better --- Marlin/language.h | 62 +++++++++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/Marlin/language.h b/Marlin/language.h index e885f23e29..fade6cd2e6 100644 --- a/Marlin/language.h +++ b/Marlin/language.h @@ -212,31 +212,31 @@ // LCD Menu Messages - #define WELCOME_MSG "RepRap Ready." - #define MSG_SD_INSERTED "Card Ready" - #define MSG_SD_REMOVED "Card Initiate" + #define WELCOME_MSG "RepRap bereit" + #define MSG_SD_INSERTED "SDKarte bereit" + #define MSG_SD_REMOVED "SDKarte entfernt" #define MSG_MAIN " Main \003" #define MSG_AUTOSTART " Autostart" - #define MSG_DISABLE_STEPPERS " Disable Steppers" - #define MSG_AUTO_HOME " Auto Home" - #define MSG_SET_ORIGIN " Set Origin" - #define MSG_PREHEAT_PLA " Preheat PLA" - #define MSG_PREHEAT_ABS " Preheat ABS" - #define MSG_COOLDOWN " Cooldown" - #define MSG_EXTRUDE " Extrude" - #define MSG_MOVE_AXIS " Move Axis \x7E" - #define MSG_SPEED " Speed:" - #define MSG_NOZZLE " \002Nozzle:" - #define MSG_BED " \002Bed:" - #define MSG_FAN_SPEED " Fan speed:" - #define MSG_FLOW " Flow:" - #define MSG_CONTROL " Control \003" + #define MSG_DISABLE_STEPPERS " Stepper abschalten" + #define MSG_AUTO_HOME " Auto Heim" + #define MSG_SET_ORIGIN " Position setzen" + #define MSG_PREHEAT_PLA " Aufheizen PLA" + #define MSG_PREHEAT_ABS " Aufheizen ABS" + #define MSG_COOLDOWN " Abkuehlen" + #define MSG_EXTRUDE " Extrudiren" + #define MSG_MOVE_AXIS " Achsen verfahren \x7E" + #define MSG_SPEED " Geschw:" + #define MSG_NOZZLE " \002Duese:" + #define MSG_BED " \002Bett:" + #define MSG_FAN_SPEED " Luefter geschw.:" + #define MSG_FLOW " Fluss:" + #define MSG_CONTROL " Kontrolle \003" #define MSG_MIN " \002 Min:" #define MSG_MAX " \002 Max:" - #define MSG_FACTOR " \002 Fact:" - #define MSG_AUTOTEMP " Autotemp:" - #define MSG_ON "On " - #define MSG_OFF "Off" + #define MSG_FACTOR " \002 Faktor:" + #define MSG_AUTOTEMP " AutoTemp:" + #define MSG_ON "Ein " + #define MSG_OFF "Aus " #define MSG_PID_P " PID-P: " #define MSG_PID_I " PID-I: " #define MSG_PID_D " PID-D: " @@ -257,20 +257,20 @@ #define MSG_ZSTEPS " Zsteps/mm:" #define MSG_ESTEPS " Esteps/mm:" #define MSG_MAIN_WIDE " Main \003" - #define MSG_TEMPERATURE_WIDE " Temperature \x7E" + #define MSG_TEMPERATURE_WIDE " Temperatur \x7E" #define MSG_MOTION_WIDE " Motion \x7E" - #define MSG_STORE_EPROM " Store EPROM" - #define MSG_LOAD_EPROM " Load EPROM" - #define MSG_RESTORE_FAILSAFE " Restore Failsafe" + #define MSG_STORE_EPROM " EPROM speichern" + #define MSG_LOAD_EPROM " EPROM laden" + #define MSG_RESTORE_FAILSAFE " Standard Konfig." #define MSG_REFRESH "\004Refresh" - #define MSG_WATCH " Watch \003" + #define MSG_WATCH " Beobachten \003" #define MSG_PREPARE " Prepare \x7E" - #define MSG_CONTROL_ARROW " Control \x7E" + #define MSG_CONTROL_ARROW " Kontrolle \x7E" #define MSG_TUNE " Tune \x7E" - #define MSG_STOP_PRINT " Stop Print \x7E" - #define MSG_CARD_MENU " Card Menu \x7E" - #define MSG_NO_CARD " No Card" - #define MSG_SERIAL_ERROR_MENU_STRUCTURE "Something is wrong in the MenuStructure." + #define MSG_STOP_PRINT " Druck stoppen \x7E" + #define MSG_CARD_MENU " SDKarten Menue \x7E" + #define MSG_NO_CARD " Keine SDKarte" + #define MSG_SERIAL_ERROR_MENU_STRUCTURE "Fehler in der Menuestruktur." #endif From fa2e3a40e943e97c1488f9106f2660bacd03dddf Mon Sep 17 00:00:00 2001 From: Christian Thalhammer Date: Thu, 1 Mar 2012 14:38:50 +0100 Subject: [PATCH 4/6] fixed LCD manual z axis move Feedrate to 70 (was 1700) --- Marlin/ultralcd.pde | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/ultralcd.pde b/Marlin/ultralcd.pde index 54b7012848..00f5e59125 100644 --- a/Marlin/ultralcd.pde +++ b/Marlin/ultralcd.pde @@ -652,14 +652,14 @@ void MainMenu::showAxisMove() { if (encoderpos >0) { - enquecommand("G1 F170 Z0.1"); + enquecommand("G1 F70 Z0.1"); oldencoderpos=encoderpos; encoderpos=0; } else if (encoderpos < 0) { - enquecommand("G1 F1700 Z-0.1"); + enquecommand("G1 F70 Z-0.1"); oldencoderpos=encoderpos; encoderpos=0; } From 5f3a422e68b098460a1c53d69913d48247a25fe0 Mon Sep 17 00:00:00 2001 From: Christian Thalhammer Date: Fri, 2 Mar 2012 21:49:05 +0100 Subject: [PATCH 5/6] 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 c595b5baa1..5c213e2838 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]; From fde51084f310d4031a415d529a93038a8c34d3ed Mon Sep 17 00:00:00 2001 From: Christian Thalhammer Date: Sat, 3 Mar 2012 21:58:12 +0100 Subject: [PATCH 6/6] set SD file delete to M30; switch printime output to M31 --- Marlin/Marlin.pde | 7 +++-- Marlin/cardreader.cpp | 69 +++++++++++++++++++++++++++++++++++++++++++ Marlin/cardreader.h | 3 +- 3 files changed, 75 insertions(+), 4 deletions(-) diff --git a/Marlin/Marlin.pde b/Marlin/Marlin.pde index 5c213e2838..a3e60d4081 100644 --- a/Marlin/Marlin.pde +++ b/Marlin/Marlin.pde @@ -75,7 +75,8 @@ // M27 - Report SD print status // M28 - Start SD write (M28 filename.g) // M29 - Stop SD write -// M30 - Output time since last M109 or SD card start to serial +// M30 - Delete file from SD (M30 filename.g) +// M31 - Output time since last M109 or SD card start to serial // M42 - Change pin status via gcode // M80 - Turn on Power Supply // M81 - Turn off Power Supply @@ -739,7 +740,7 @@ void process_commands() //processed in write to file routine above //card,saving = false; break; - case 30: //M31 Delete File + case 30: //M30 Delete File if (card.cardOK){ card.closefile(); starpos = (strchr(strchr_pointer + 4,'*')); @@ -754,7 +755,7 @@ void process_commands() #endif //SDSUPPORT - case 31: //M30 take time since the start of the SD print or an M109 command + case 31: //M31 take time since the start of the SD print or an M109 command { stoptime=millis(); char time[30]; diff --git a/Marlin/cardreader.cpp b/Marlin/cardreader.cpp index 052ce20302..7b0a4d2459 100644 --- a/Marlin/cardreader.cpp +++ b/Marlin/cardreader.cpp @@ -295,6 +295,75 @@ void CardReader::openFile(char* name,bool read) } +void CardReader::removeFile(char* name) +{ + if(!cardOK) + return; + file.close(); + sdprinting = false; + + + SdFile myDir; + curDir=&root; + char *fname=name; + + char *dirname_start,*dirname_end; + if(name[0]=='/') + { + dirname_start=strchr(name,'/')+1; + while(dirname_start>0) + { + dirname_end=strchr(dirname_start,'/'); + //SERIAL_ECHO("start:");SERIAL_ECHOLN((int)(dirname_start-name)); + //SERIAL_ECHO("end :");SERIAL_ECHOLN((int)(dirname_end-name)); + if(dirname_end>0 && dirname_end>dirname_start) + { + char subdirname[13]; + strncpy(subdirname, dirname_start, dirname_end-dirname_start); + subdirname[dirname_end-dirname_start]=0; + SERIAL_ECHOLN(subdirname); + if(!myDir.open(curDir,subdirname,O_READ)) + { + SERIAL_PROTOCOLPGM("open failed, File: "); + SERIAL_PROTOCOL(subdirname); + SERIAL_PROTOCOLLNPGM("."); + return; + } + else + ;//SERIAL_ECHOLN("dive ok"); + + curDir=&myDir; + dirname_start=dirname_end+1; + } + else // the reminder after all /fsa/fdsa/ is the filename + { + fname=dirname_start; + //SERIAL_ECHOLN("remaider"); + //SERIAL_ECHOLN(fname); + break; + } + + } + } + else //relative path + { + curDir=&workDir; + } + if (file.remove(curDir, fname)) + { + SERIAL_PROTOCOLPGM("File deleted:"); + SERIAL_PROTOCOL(fname); + sdpos = 0; + } + else + { + SERIAL_PROTOCOLPGM("Deletion failed, File: "); + SERIAL_PROTOCOL(fname); + SERIAL_PROTOCOLLNPGM("."); + } + +} + void CardReader::getStatus() { if(cardOK){ diff --git a/Marlin/cardreader.h b/Marlin/cardreader.h index 67fe58a90a..a411f3d2b0 100644 --- a/Marlin/cardreader.h +++ b/Marlin/cardreader.h @@ -17,6 +17,7 @@ public: void checkautostart(bool x); void openFile(char* name,bool read); + void removeFile(char* name); void closefile(); void release(); void startFileprint(); @@ -99,4 +100,4 @@ public: FORCE_INLINE uint8_t percentDone(){return 0;}; }; #endif //SDSUPPORT -#endif \ No newline at end of file +#endif