Fix parsing of M110 command
This commit is contained in:
parent
6e3174cba2
commit
67d824d914
|
|
@ -1497,14 +1497,16 @@ void get_command()
|
||||||
}
|
}
|
||||||
cmdbuffer[bufindw+serial_count+1] = 0; //terminate string
|
cmdbuffer[bufindw+serial_count+1] = 0; //terminate string
|
||||||
if(!comment_mode){
|
if(!comment_mode){
|
||||||
if ((strchr_pointer = strstr(cmdbuffer+bufindw+1, "PRUSA")) == NULL && (strchr_pointer = strchr(cmdbuffer+bufindw+1, 'N')) != NULL) {
|
// Line numbers must be first in buffer
|
||||||
if ((strchr_pointer = strchr(cmdbuffer+bufindw+1, 'N')) != NULL)
|
if ((strstr(cmdbuffer+bufindw+1, "PRUSA") == NULL) &&
|
||||||
{
|
(cmdbuffer[bufindw + 1] == 'N')) {
|
||||||
|
|
||||||
// Line number met. When sending a G-code over a serial line, each line may be stamped with its index,
|
// Line number met. When sending a G-code over a serial line, each line may be stamped with its index,
|
||||||
// and Marlin tests, whether the successive lines are stamped with an increasing line number ID.
|
// and Marlin tests, whether the successive lines are stamped with an increasing line number ID.
|
||||||
gcode_N = (strtol(strchr_pointer+1, NULL, 10));
|
gcode_N = (strtol(cmdbuffer + bufindw + 2, NULL, 10));
|
||||||
if(gcode_N != gcode_LastN+1 && (strstr_P(cmdbuffer+bufindw+1, PSTR("M110")) == NULL) ) {
|
if ((gcode_N != gcode_LastN + 1) &&
|
||||||
// M110 - set current line number.
|
(strstr_P(cmdbuffer+bufindw+1, PSTR("M110")) == NULL))
|
||||||
|
{
|
||||||
// Line numbers not sent in succession.
|
// Line numbers not sent in succession.
|
||||||
SERIAL_ERROR_START;
|
SERIAL_ERROR_START;
|
||||||
SERIAL_ERRORRPGM(MSG_ERR_LINE_NO);
|
SERIAL_ERRORRPGM(MSG_ERR_LINE_NO);
|
||||||
|
|
@ -1542,21 +1544,23 @@ void get_command()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
gcode_LastN = gcode_N;
|
// Don't parse N again with code_seen('N')
|
||||||
|
cmdbuffer[bufindw + 1] = '$';
|
||||||
//if no errors, continue parsing
|
//if no errors, continue parsing
|
||||||
} // end of 'N' command
|
gcode_LastN = gcode_N;
|
||||||
}
|
}
|
||||||
else // if we don't receive 'N' but still see '*'
|
|
||||||
|
// if we don't receive 'N' but still see '*'
|
||||||
|
if((cmdbuffer[bufindw + 1] != 'N') && (cmdbuffer[bufindw + 1] != '$') &&
|
||||||
|
(strchr(cmdbuffer + bufindw + 1, '*') != NULL))
|
||||||
{
|
{
|
||||||
if((strchr(cmdbuffer+bufindw+1, '*') != NULL))
|
|
||||||
{
|
|
||||||
SERIAL_ERROR_START;
|
SERIAL_ERROR_START;
|
||||||
SERIAL_ERRORRPGM(MSG_ERR_NO_LINENUMBER_WITH_CHECKSUM);
|
SERIAL_ERRORRPGM(MSG_ERR_NO_LINENUMBER_WITH_CHECKSUM);
|
||||||
SERIAL_ERRORLN(gcode_LastN);
|
SERIAL_ERRORLN(gcode_LastN);
|
||||||
serial_count = 0;
|
serial_count = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} // end of '*' command
|
|
||||||
if ((strchr_pointer = strchr(cmdbuffer+bufindw+1, 'G')) != NULL) {
|
if ((strchr_pointer = strchr(cmdbuffer+bufindw+1, 'G')) != NULL) {
|
||||||
if (! IS_SD_PRINTING) {
|
if (! IS_SD_PRINTING) {
|
||||||
usb_printing_counter = 10;
|
usb_printing_counter = 10;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue