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

Method ActOnCode

src/GCodes/GCodes2.cpp:73–157  ·  view source on GitHub ↗

If the code to act on is completed, this returns true, otherwise false. It is called repeatedly for a given code until it returns true for that code.

Source from the content-addressed store, hash-verified

71// If the code to act on is completed, this returns true, otherwise false.
72// It is called repeatedly for a given code until it returns true for that code.
73bool GCodes::ActOnCode(GCodeBuffer& gb, const StringRef& reply) noexcept
74{
75#if SUPPORT_ASYNC_MOVES
76 // If we are running multiple motion systems in single input stream mode and we have resumed after a pause, then we may need to skip some commands
77 // Also if we did a synchronous pause then we need to sip the pause command
78 {
79 if (&gb == FileGCode() && gb.ExecutingAll())
80 {
81 const FilePosition offsetToSkipTo = GetMovementState(gb).fileOffsetToSkipTo;
82 if (offsetToSkipTo != 0 && offsetToSkipTo != noFilePosition)
83 {
84 const FilePosition jobFilePos = gb.GetJobFilePosition();
85 if (jobFilePos < offsetToSkipTo)
86 {
87 // Skip any command except M596
88 if (!(gb.GetCommandLetter() == 'M' && gb.HasCommandNumber() && gb.GetCommandNumber() == 596))
89 {
90 HandleReply(gb, GCodeResult::ok, "");
91 return true;
92 }
93 }
94 else if (jobFilePos == offsetToSkipTo)
95 {
96 // If we paused on a synchronous pause command, skip it
97 int commandNumber;
98 if ( gb.GetCommandLetter() == 'M'
99 && ((commandNumber = gb.GetCommandNumber()) == 226 || commandNumber == 600 || commandNumber == 601 || commandNumber == 25)
100 )
101 {
102 HandleReply(gb, GCodeResult::ok, "");
103 return true;
104 }
105 }
106 else
107 {
108 GetMovementState(gb).fileOffsetToSkipTo = 0; // clear this to speed up the test next time
109 }
110 }
111 }
112 }
113#endif
114
115 try
116 {
117 switch (gb.GetCommandLetter())
118 {
119 case 'G':
120 if (gb.HasCommandNumber())
121 {
122 return HandleGcode(gb, reply);
123 }
124 break;
125
126 case 'M':
127 if (gb.HasCommandNumber())
128 {
129 return HandleMcode(gb, reply);
130 }

Callers

nothing calls this directly

Calls 8

ExecutingAllMethod · 0.80
GetJobFilePositionMethod · 0.80
GetMessageMethod · 0.80
GetCommandLetterMethod · 0.45
HasCommandNumberMethod · 0.45
GetCommandNumberMethod · 0.45
printfMethod · 0.45
AppendFullCommandMethod · 0.45

Tested by

no test coverage detected