Pārlūkot izejas kodu

Update queue.cpp

Scott Lahteine 6 gadus atpakaļ
vecāks
revīzija
c03bac9ad4
Revīzijas autora e-pasta adrese nav piesaistīta nevienam kontam
1 mainītis faili ar 6 papildinājumiem un 2 dzēšanām
  1. 6
    2
      Marlin/src/gcode/queue.cpp

+ 6
- 2
Marlin/src/gcode/queue.cpp Parādīt failu

@@ -535,6 +535,10 @@ static int read_serial(const uint8_t index) {
535 535
 
536 536
 #endif // FAST_FILE_TRANSFER
537 537
 
538
+FORCE_INLINE bool is_M29(const char * const cmd) {
539
+  return cmd[0] == 'M' && cmd[1] == '2' && cmd[2] == '9' && !WITHIN(cmd[3], '0', '9');
540
+}
541
+
538 542
 /**
539 543
  * Get all commands waiting on the serial port and queue them.
540 544
  * Exit when the buffer is full or when no more characters are
@@ -631,7 +635,7 @@ inline void get_serial_commands() {
631 635
         }
632 636
         #if ENABLED(SDSUPPORT)
633 637
           // Pronterface "M29" and "M29 " has no line number 
634
-          else if (card.flag.saving && !(command[0] == 'M' && command[1] == '2' && command[2] == '9' && (command[3] == '\0' || command[3] == ' ' ||  || command[3] == '*')))
638
+          else if (card.flag.saving && !is_M29(command))
635 639
             return gcode_line_error(PSTR(MSG_ERR_NO_CHECKSUM), i);
636 640
         #endif
637 641
 
@@ -840,7 +844,7 @@ void advance_command_queue() {
840 844
 
841 845
     if (card.flag.saving) {
842 846
       char* command = command_queue[cmd_queue_index_r];
843
-      if (command[0] == 'M' && command[1] == '2' && command[2] == '9' && (command[3] == '\0' || command[3] == ' ' ||  || command[3] == '*')) {
847
+      if (is_M29(command)) {
844 848
         // M29 closes the file
845 849
         card.closefile();
846 850
         SERIAL_ECHOLNPGM(MSG_FILE_SAVED);

Notiek ielāde…
Atcelt
Saglabāt