MCPcopy Create free account
hub / github.com/MarlinFirmware/Marlin / process_injected_command

Method process_injected_command

Marlin/src/gcode/queue.cpp:166–188  ·  view source on GitHub ↗

* Process the next "immediate" command from SRAM. * Return 'true' if any commands were processed. */

Source from the content-addressed store, hash-verified

164 * Return 'true' if any commands were processed.
165 */
166bool GCodeQueue::process_injected_command() {
167 if (injected_commands[0] == '\0') return false;
168
169 char c;
170 size_t i = 0;
171 while ((c = injected_commands[i]) && c != '\n') i++;
172
173 // Execute a non-blank command
174 if (i) {
175 injected_commands[i] = '\0';
176 parser.parse(injected_commands);
177 gcode.process_parsed_command();
178 }
179
180 // Copy the next command into place
181 for (
182 uint8_t d = 0, s = i + !!c; // dst, src
183 (injected_commands[d] = injected_commands[s]); // copy, exit if 0
184 d++, s++ // next dst, src
185 );
186
187 return true;
188}
189
190/**
191 * Enqueue and return only when commands are actually enqueued.

Callers

nothing calls this directly

Calls 2

parseMethod · 0.45

Tested by

no test coverage detected