Update queue.cpp
This commit is contained in:
parent
a49f0205ea
commit
c03bac9ad4
1 changed files with 6 additions and 2 deletions
|
@ -535,6 +535,10 @@ static int read_serial(const uint8_t index) {
|
|||
|
||||
#endif // FAST_FILE_TRANSFER
|
||||
|
||||
FORCE_INLINE bool is_M29(const char * const cmd) {
|
||||
return cmd[0] == 'M' && cmd[1] == '2' && cmd[2] == '9' && !WITHIN(cmd[3], '0', '9');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all commands waiting on the serial port and queue them.
|
||||
* Exit when the buffer is full or when no more characters are
|
||||
|
@ -631,7 +635,7 @@ inline void get_serial_commands() {
|
|||
}
|
||||
#if ENABLED(SDSUPPORT)
|
||||
// Pronterface "M29" and "M29 " has no line number
|
||||
else if (card.flag.saving && !(command[0] == 'M' && command[1] == '2' && command[2] == '9' && (command[3] == '\0' || command[3] == ' ' || || command[3] == '*')))
|
||||
else if (card.flag.saving && !is_M29(command))
|
||||
return gcode_line_error(PSTR(MSG_ERR_NO_CHECKSUM), i);
|
||||
#endif
|
||||
|
||||
|
@ -840,7 +844,7 @@ void advance_command_queue() {
|
|||
|
||||
if (card.flag.saving) {
|
||||
char* command = command_queue[cmd_queue_index_r];
|
||||
if (command[0] == 'M' && command[1] == '2' && command[2] == '9' && (command[3] == '\0' || command[3] == ' ' || || command[3] == '*')) {
|
||||
if (is_M29(command)) {
|
||||
// M29 closes the file
|
||||
card.closefile();
|
||||
SERIAL_ECHOLNPGM(MSG_FILE_SAVED);
|
||||
|
|
Reference in a new issue