summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmanuele Caruso <emanuele.caruso@gmail.com>2011-04-08 07:19:19 +0200
committerEmanuele Caruso <emanuele.caruso@gmail.com>2011-04-08 07:19:19 +0200
commit8f8acb8e5bfd0979ec1364da11e02e622496bab3 (patch)
tree732e8254ffe1b9586ee61a10634fa00c82093232
parentdf8611817a4fd042604792ad4533d2dfc85139b2 (diff)
parentc0ccdd0438f7fd511ee1dded70ab1074afc1fcb9 (diff)
Merge remote branch 'origin/master'
-rw-r--r--Tonokip_Firmware/Tonokip_Firmware.pde33
1 files changed, 19 insertions, 14 deletions
diff --git a/Tonokip_Firmware/Tonokip_Firmware.pde b/Tonokip_Firmware/Tonokip_Firmware.pde
index aa639d6..51ae3ea 100644
--- a/Tonokip_Firmware/Tonokip_Firmware.pde
+++ b/Tonokip_Firmware/Tonokip_Firmware.pde
@@ -506,6 +506,9 @@ inline void process_commands()
if(sdactive){
sdmode=false;
file.close();
+ starpos=(strchr(strchr_pointer+4,'*'));
+ if(starpos!=NULL)
+ *starpos='\0';
if (file.open(&root, strchr_pointer+4, O_READ)) {
Serial.print("File opened:");
Serial.print(strchr_pointer+4);
@@ -547,20 +550,22 @@ inline void process_commands()
}
break;
case 28: //M28 - Start SD write
- file.close();
- sdmode=false;
- starpos=(strchr(strchr_pointer+4,'*'));
- if(starpos!=NULL)
- *starpos='\0';
- if (!file.open(&root, strchr_pointer+4, O_CREAT | O_APPEND | O_WRITE | O_TRUNC))
- {
- Serial.print("open failed, File: ");
- Serial.print(strchr_pointer+4);
- Serial.print(".");
- }else{
- savetosd = true;
- Serial.print("Writing to file: ");
- Serial.println(strchr_pointer+4);
+ if(sdactive){
+ file.close();
+ sdmode=false;
+ starpos=(strchr(strchr_pointer+4,'*'));
+ if(starpos!=NULL)
+ *starpos='\0';
+ if (!file.open(&root, strchr_pointer+4, O_CREAT | O_APPEND | O_WRITE | O_TRUNC))
+ {
+ Serial.print("open failed, File: ");
+ Serial.print(strchr_pointer+4);
+ Serial.print(".");
+ }else{
+ savetosd = true;
+ Serial.print("Writing to file: ");
+ Serial.println(strchr_pointer+4);
+ }
}
break;
case 29: //M29 - Stop SD write