浏览代码

Merge pull request #425 from kefir-/m928_logging

M928 logging
ErikZalm 12 年前
父节点
当前提交
7f622467fc
共有 2 个文件被更改,包括 25 次插入1 次删除
  1. 18
    1
      Marlin/Marlin_main.cpp
  2. 7
    0
      Marlin/cardreader.cpp

+ 18
- 1
Marlin/Marlin_main.cpp 查看文件

133
 // M908 - Control digital trimpot directly.
133
 // M908 - Control digital trimpot directly.
134
 // M350 - Set microstepping mode.
134
 // M350 - Set microstepping mode.
135
 // M351 - Toggle MS1 MS2 pins directly.
135
 // M351 - Toggle MS1 MS2 pins directly.
136
+// M928 - Start SD logging (M928 filename.g) - ended by M29
136
 // M999 - Restart after being stopped by error
137
 // M999 - Restart after being stopped by error
137
 
138
 
138
 //Stepper Movement Variables
139
 //Stepper Movement Variables
403
 	if(strstr_P(cmdbuffer[bufindr], PSTR("M29")) == NULL)
404
 	if(strstr_P(cmdbuffer[bufindr], PSTR("M29")) == NULL)
404
 	{
405
 	{
405
 	  card.write_command(cmdbuffer[bufindr]);
406
 	  card.write_command(cmdbuffer[bufindr]);
406
-	  SERIAL_PROTOCOLLNPGM(MSG_OK);
407
+          if(card.logging)
408
+          {
409
+            process_commands();
410
+          }
411
+          else
412
+          {
413
+            SERIAL_PROTOCOLLNPGM(MSG_OK);
414
+          }
407
 	}
415
 	}
408
 	else
416
 	else
409
 	{
417
 	{
958
 	 card.removeFile(strchr_pointer + 4);
966
 	 card.removeFile(strchr_pointer + 4);
959
 	}
967
 	}
960
 	break;
968
 	break;
969
+    case 928: //M928 - Start SD write
970
+      starpos = (strchr(strchr_pointer + 5,'*'));
971
+      if(starpos != NULL){
972
+        char* npos = strchr(cmdbuffer[bufindr], 'N');
973
+        strchr_pointer = strchr(npos,' ') + 1;
974
+        *(starpos-1) = '\0';
975
+      }
976
+      card.openLogFile(strchr_pointer+5);
977
+      break;
961
 	
978
 	
962
 #endif //SDSUPPORT
979
 #endif //SDSUPPORT
963
 
980
 

+ 7
- 0
Marlin/cardreader.cpp 查看文件

16
    sdprinting = false;
16
    sdprinting = false;
17
    cardOK = false;
17
    cardOK = false;
18
    saving = false;
18
    saving = false;
19
+   logging = false;
19
    autostart_atmillis=0;
20
    autostart_atmillis=0;
20
 
21
 
21
    autostart_stilltocheck=true; //the sd start is delayed, because otherwise the serial cannot answer fast enought to make contact with the hostsoftware.
22
    autostart_stilltocheck=true; //the sd start is delayed, because otherwise the serial cannot answer fast enought to make contact with the hostsoftware.
212
 }
213
 }
213
 
214
 
214
 
215
 
216
+void CardReader::openLogFile(char* name)
217
+{
218
+  logging = true;
219
+  openFile(name, false);
220
+}
215
 
221
 
216
 void CardReader::openFile(char* name,bool read)
222
 void CardReader::openFile(char* name,bool read)
217
 {
223
 {
471
   file.sync();
477
   file.sync();
472
   file.close();
478
   file.close();
473
   saving = false; 
479
   saving = false; 
480
+  logging = false;
474
 }
481
 }
475
 
482
 
476
 void CardReader::getfilename(const uint8_t nr)
483
 void CardReader::getfilename(const uint8_t nr)

正在加载...
取消
保存