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

Method MoveLoop

src/Movement/Move.cpp:622–827  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

620}
621
622[[noreturn]] void Move::MoveLoop() noexcept
623{
624 stepsTimer.SetCallback(Move::TimerCallback, CallbackParameter(this));
625 for (;;)
626 {
627 if (reprap.IsStopped() || hadStepError)
628 {
629 // Emergency stop has been commanded, so terminate this task to prevent new moves being prepared and executed
630 moveTask.TerminateAndUnlink();
631 }
632
633#if SUPPORT_REMOTE_COMMANDS
634 if (CanInterface::InExpansionMode())
635 {
636 // In expansion mode we don't need the Move task to do anything, and in particular we must not perform udle detection.
637 // We could terminate the Move task here but currently we don't because:
638 // (a) if we do then we must make sure that any attempts to wake it up are benign
639 // (b) in future we may wish to use the Move task to queue movement commands
640 // So for now we just delay.
641 delay(10000);
642 continue;
643 }
644#endif
645
646 bool moveRead = false;
647
648 // See if we can add another move to ring 0
649 const bool canAddRing0Move = rings[0].CanAddMove();
650 if (canAddRing0Move)
651 {
652 // OK to add another move. First check if a special move is available.
653 if (bedLevellingMoveAvailable)
654 {
655 moveRead = true;
656 if (simulationMode < SimulationMode::partial)
657 {
658 if (rings[0].AddSpecialMove(MaxFeedrate(Z_AXIS), specialMoveCoords))
659 {
660 const uint32_t now = millis();
661 const uint32_t timeWaiting = now - whenLastMoveAdded[0];
662 if (timeWaiting > longestGcodeWaitInterval)
663 {
664 longestGcodeWaitInterval = timeWaiting;
665 }
666 whenLastMoveAdded[0] = now;
667 moveState = MoveState::collecting;
668 }
669 }
670 bedLevellingMoveAvailable = false;
671 }
672 else
673 {
674 // If there's a G Code move available, add it to the DDA ring for processing.
675 RawMove nextMove;
676 GCodes& gcodes = reprap.GetGCodes();
677 if (gcodes.ReadMove(0, nextMove)) // if we have a new move
678 {
679 moveRead = true;

Callers 1

Move.cppFile · 0.80

Calls 13

SetCallbackMethod · 0.80
IsStoppedMethod · 0.80
CanAddMoveMethod · 0.80
AddSpecialMoveMethod · 0.80
ReadMoveMethod · 0.80
AddStandardMoveMethod · 0.80
ReportMovementErrorMethod · 0.80
GetGracePeriodMethod · 0.80
AddAsyncMoveMethod · 0.80
GetDebugFlagsMethod · 0.80
GetPauseStateMethod · 0.80
SpinMethod · 0.45

Tested by

no test coverage detected