Ver código fonte

M29 match logic was reversed (#13013)

* M29 logic was reversed 

If in card-saving mode generate errors line errors for anything that's *NOT* "M29 ?"

* Update queue.cpp

* Update queue.cpp
Scott Lahteine 6 anos atrás
pai
commit
1497fb388a
Nenhuma conta vinculada ao e-mail do autor do commit
1 arquivos alterados com 7 adições e 2 exclusões
  1. 7
    2
      Marlin/src/gcode/queue.cpp

+ 7
- 2
Marlin/src/gcode/queue.cpp Ver arquivo

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

Carregando…
Cancelar
Salvar