mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2024-11-27 13:56:24 +00:00
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
This commit is contained in:
commit
1497fb388a
@ -536,6 +536,10 @@ void gcode_line_error(PGM_P err, uint8_t port) {
|
|||||||
|
|
||||||
#endif // FAST_FILE_TRANSFER
|
#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.
|
* Get all commands waiting on the serial port and queue them.
|
||||||
* Exit when the buffer is full or when no more characters are
|
* Exit when the buffer is full or when no more characters are
|
||||||
@ -631,7 +635,8 @@ inline void get_serial_commands() {
|
|||||||
gcode_LastN = gcode_N;
|
gcode_LastN = gcode_N;
|
||||||
}
|
}
|
||||||
#if ENABLED(SDSUPPORT)
|
#if ENABLED(SDSUPPORT)
|
||||||
else if (card.flag.saving && command[0] == 'M' && command[1] == '2' && command[2] == '9' && (command[3] == '\0' || command[3] == ' '))
|
// Pronterface "M29" and "M29 " has no line number
|
||||||
|
else if (card.flag.saving && !is_M29(command))
|
||||||
return gcode_line_error(PSTR(MSG_ERR_NO_CHECKSUM), i);
|
return gcode_line_error(PSTR(MSG_ERR_NO_CHECKSUM), i);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -840,7 +845,7 @@ void advance_command_queue() {
|
|||||||
|
|
||||||
if (card.flag.saving) {
|
if (card.flag.saving) {
|
||||||
char* command = command_queue[cmd_queue_index_r];
|
char* command = command_queue[cmd_queue_index_r];
|
||||||
if (command[0] == 'M' && command[1] == '2' && command[2] == '9' && (command[3] == '\0' || command[3] == ' ')) {
|
if (is_M29(command)) {
|
||||||
// M29 closes the file
|
// M29 closes the file
|
||||||
card.closefile();
|
card.closefile();
|
||||||
SERIAL_ECHOLNPGM(MSG_FILE_SAVED);
|
SERIAL_ECHOLNPGM(MSG_FILE_SAVED);
|
||||||
|
Loading…
Reference in New Issue
Block a user