* Process the next "immediate" command from SRAM. * Return 'true' if any commands were processed. */
| 164 | * Return 'true' if any commands were processed. |
| 165 | */ |
| 166 | bool 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. |
nothing calls this directly
no test coverage detected