|
@@ -329,16 +329,17 @@ MarlinSerial customizedSerial;
|
329
|
329
|
state_M,
|
330
|
330
|
state_M1,
|
331
|
331
|
state_M10,
|
|
332
|
+ state_M108,
|
332
|
333
|
state_M11,
|
|
334
|
+ state_M112,
|
333
|
335
|
state_M4,
|
334
|
336
|
state_M41,
|
|
337
|
+ state_M410,
|
335
|
338
|
state_IGNORE // to '\n'
|
336
|
339
|
};
|
337
|
340
|
|
338
|
341
|
static e_parser_state state = state_RESET;
|
339
|
342
|
|
340
|
|
- if (c == '\n') state = state_IGNORE;
|
341
|
|
-
|
342
|
343
|
switch (state) {
|
343
|
344
|
case state_RESET:
|
344
|
345
|
switch (c) {
|
|
@@ -378,13 +379,11 @@ MarlinSerial customizedSerial;
|
378
|
379
|
break;
|
379
|
380
|
|
380
|
381
|
case state_M10:
|
381
|
|
- if (c == '8') wait_for_heatup = false; // M108
|
382
|
|
- state = state_IGNORE;
|
|
382
|
+ state = (c == '8') ? state_M108 : state_IGNORE;
|
383
|
383
|
break;
|
384
|
384
|
|
385
|
385
|
case state_M11:
|
386
|
|
- if (c == '2') kill(PSTR(MSG_KILLED)); // M112
|
387
|
|
- state = state_IGNORE;
|
|
386
|
+ state = (c == '2') ? state_M112 : state_IGNORE;
|
388
|
387
|
break;
|
389
|
388
|
|
390
|
389
|
case state_M4:
|
|
@@ -392,8 +391,7 @@ MarlinSerial customizedSerial;
|
392
|
391
|
break;
|
393
|
392
|
|
394
|
393
|
case state_M41:
|
395
|
|
- if (c == '0') quickstop_stepper(); // M410
|
396
|
|
- state = state_IGNORE;
|
|
394
|
+ state = (c == '0') ? state_M410 : state_IGNORE;
|
397
|
395
|
break;
|
398
|
396
|
|
399
|
397
|
case state_IGNORE:
|
|
@@ -401,7 +399,20 @@ MarlinSerial customizedSerial;
|
401
|
399
|
break;
|
402
|
400
|
|
403
|
401
|
default:
|
404
|
|
- state = state_RESET;
|
|
402
|
+ if (c == '\n') {
|
|
403
|
+ switch (state) {
|
|
404
|
+ case state_M108:
|
|
405
|
+ wait_for_heatup = false;
|
|
406
|
+ break;
|
|
407
|
+ case state_M112:
|
|
408
|
+ kill(PSTR(MSG_KILLED));
|
|
409
|
+ break;
|
|
410
|
+ case state_M410:
|
|
411
|
+ quickstop_stepper();
|
|
412
|
+ break;
|
|
413
|
+ }
|
|
414
|
+ state = state_RESET;
|
|
415
|
+ }
|
405
|
416
|
}
|
406
|
417
|
}
|
407
|
418
|
#endif
|