merging with SCUBA82

This commit is contained in:
Erik van der Zalm 2012-03-04 13:41:47 +01:00
commit 632528aa95
5 changed files with 116 additions and 31 deletions

View file

@ -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
@ -738,9 +739,22 @@ void process_commands()
//processed in write to file routine above
//card,saving = false;
break;
case 30: //M30 <filename> Delete File
if (card.cardOK){
card.closefile();
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: //M31 take time since the start of the SD print or an M109 command
{
stoptime=millis();
char time[30];

View file

@ -297,6 +297,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){

View file

@ -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();

View file

@ -23,9 +23,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:"
@ -159,25 +160,26 @@
#define MSG_SD_REMOVED "Card removed"
#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 " Preheat"
#define MSG_COOLDOWN " Cooldown"
#define MSG_EXTRUDE " Extrude"
#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_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_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: "
@ -198,21 +200,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_PREPARE_ALT " Prepare \003"
#define MSG_CONTROL_ARROW " Control \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."
#define MSG_DWELL "DWELL..."
#define MSG_NO_MOVE "No move."
#define MSG_PART_RELEASE "Partial Release"

View file

@ -658,14 +658,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;
}