MCPcopy Create free account
hub / github.com/Duet3D/RepRapFirmware / CheckFinishedRunningConfigFile

Method CheckFinishedRunningConfigFile

src/GCodes/GCodes.cpp:401–1502  ·  view source on GitHub ↗

Copy the feed rate etc. from the channel that was running config.g to the input channels

Source from the content-addressed store, hash-verified

399
400// Copy the feed rate etc. from the channel that was running config.g to the input channels
401void 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
421void 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

Callers

nothing calls this directly

Calls 15

IsSimulatingFunction · 0.85
CopyStateFromMethod · 0.80
InputsUpdatedMethod · 0.80
readMethod · 0.80
UsingSbcInterfaceMethod · 0.80
IsPrintAbortedMethod · 0.80
MessageMethod · 0.80
SetMotorPositionsMethod · 0.80
GetNumberMethod · 0.80
SelectToolMethod · 0.80
MoveUpdatedMethod · 0.80

Tested by

no test coverage detected