* Process the parsed command and dispatch it to its handler */
| 320 | * Process the parsed command and dispatch it to its handler |
| 321 | */ |
| 322 | void GcodeSuite::process_parsed_command(bool no_ok/*=false*/) { |
| 323 | TERN_(HAS_FANCHECK, fan_check.check_deferred_error()); |
| 324 | |
| 325 | KEEPALIVE_STATE(IN_HANDLER); |
| 326 | |
| 327 | /** |
| 328 | * Block all Gcodes except M511 Unlock Printer, if printer is locked |
| 329 | * Will still block Gcodes if M511 is disabled, in which case the printer should be unlocked via LCD Menu |
| 330 | */ |
| 331 | #if ENABLED(PASSWORD_FEATURE) |
| 332 | if (password.is_locked && !parser.is_command('M', 511)) { |
| 333 | SERIAL_ECHO_MSG(STR_PRINTER_LOCKED); |
| 334 | if (!no_ok) queue.ok_to_send(); |
| 335 | return; |
| 336 | } |
| 337 | #endif |
| 338 | |
| 339 | #if ENABLED(FLOWMETER_SAFETY) |
| 340 | if (cooler.flowfault) { |
| 341 | SERIAL_ECHO_MSG(STR_FLOWMETER_FAULT); |
| 342 | return; |
| 343 | } |
| 344 | #endif |
| 345 | |
| 346 | // Handle a known command or reply "unknown command" |
| 347 | |
| 348 | switch (parser.command_letter) { |
| 349 | |
| 350 | case 'G': switch (parser.codenum) { |
| 351 | |
| 352 | case 0: case 1: // G0: Fast Move, G1: Linear Move |
| 353 | G0_G1(TERN_(HAS_FAST_MOVES, parser.codenum == 0)); break; |
| 354 | |
| 355 | #if ENABLED(ARC_SUPPORT) |
| 356 | case 2: case 3: G2_G3(parser.codenum == 2); break; // G2: CW ARC, G3: CCW ARC |
| 357 | #endif |
| 358 | |
| 359 | case 4: G4(); break; // G4: Dwell |
| 360 | |
| 361 | #if ENABLED(BEZIER_CURVE_SUPPORT) |
| 362 | case 5: G5(); break; // G5: Cubic B_spline |
| 363 | #endif |
| 364 | |
| 365 | #if ENABLED(DIRECT_STEPPING) |
| 366 | case 6: G6(); break; // G6: Direct Stepper Move |
| 367 | #endif |
| 368 | |
| 369 | #if ENABLED(FWRETRACT) |
| 370 | case 10: G10(); break; // G10: Retract / Swap Retract |
| 371 | case 11: G11(); break; // G11: Recover / Swap Recover |
| 372 | #endif |
| 373 | |
| 374 | #if ENABLED(NOZZLE_CLEAN_FEATURE) |
| 375 | case 12: G12(); break; // G12: Nozzle Clean |
| 376 | #endif |
| 377 | |
| 378 | #if ENABLED(CNC_WORKSPACE_PLANES) |
| 379 | case 17: G17(); break; // G17: Select Plane XY |