Copy the feed rate etc. from the channel that was running config.g to the input channels
| 399 | |
| 400 | // Copy the feed rate etc. from the channel that was running config.g to the input channels |
| 401 | void GCodes::CheckFinishedRunningConfigFile(GCodeBuffer& gb) noexcept |
| 402 | { |
| 403 | if (runningConfigFile && gb.GetChannel() == GCodeChannel::Trigger) |
| 404 | { |
| 405 | gb.LatestMachineState().GetPrevious()->CopyStateFrom(gb.LatestMachineState()); // so that M83 etc. in nested files don't get forgotten |
| 406 | if (gb.LatestMachineState().GetPrevious()->GetPrevious() == nullptr) // if we've finished running config.g rather than a macro it called |
| 407 | { |
| 408 | for (GCodeBuffer *_ecv_null gb2 : gcodeSources) |
| 409 | { |
| 410 | if (gb2 != nullptr && gb2 != &gb) |
| 411 | { |
| 412 | gb2->LatestMachineState().CopyStateFrom(gb.LatestMachineState()); |
| 413 | } |
| 414 | } |
| 415 | runningConfigFile = false; |
| 416 | } |
| 417 | reprap.InputsUpdated(); |
| 418 | } |
| 419 | } |
| 420 | |
| 421 | void GCodes::Spin() noexcept |
| 422 | { |
| 423 | if (!active) |
| 424 | { |
| 425 | return; |
| 426 | } |
| 427 | |
| 428 | #if HAS_AUX_DEVICES |
| 429 | if (emergencyStopCommanded) |
| 430 | { |
| 431 | DoEmergencyStop(); |
| 432 | while (SERIAL_AUX_DEVICE.read() >= 0) { } |
| 433 | emergencyStopCommanded = false; |
| 434 | return; |
| 435 | } |
| 436 | #endif |
| 437 | |
| 438 | #if defined(SERIAL_MAIN_DEVICE) && (!SAME5x || CORE_USES_TINYUSB) |
| 439 | // Read from USB into the input buffer and check for out-of-band urgent commands (M112/M122/M108) |
| 440 | usbInput->Spin(); |
| 441 | #endif |
| 442 | |
| 443 | CheckTriggers(); |
| 444 | |
| 445 | // The autoPause buffer has priority, so spin that one first. It may have to wait for other buffers to release locks etc. |
| 446 | (void)SpinGCodeBuffer(*AutoPauseGCode()); |
| 447 | |
| 448 | // Use round-robin scheduling for the other input sources |
| 449 | // Scan the GCode input channels until we find one that we can do some useful work with, or we have scanned them all. |
| 450 | // The idea is that when a single GCode input channel is active, we do some useful work every time we come through this polling loop, not once every N times (N = number of input channels) |
| 451 | const size_t originalNextGCodeSource = nextGcodeSource; |
| 452 | do |
| 453 | { |
| 454 | GCodeBuffer *_ecv_null const gbp = gcodeSources[nextGcodeSource]; |
| 455 | ++nextGcodeSource; // move on to the next gcode source ready for next time |
| 456 | if (nextGcodeSource == GCodeChannel::Autopause) |
| 457 | { |
| 458 | ++nextGcodeSource; // don't do autoPause again |
nothing calls this directly
no test coverage detected