* Send an "ok" message to the host, indicating * that a command was successfully processed. * * With ADVANCED_OK: * N Line number of the command, if any * P Planner space remaining * B Block queue space remaining */
| 238 | * B<int> Block queue space remaining |
| 239 | */ |
| 240 | void GCodeQueue::RingBuffer::ok_to_send() { |
| 241 | #if NO_TIMEOUTS > 0 |
| 242 | // Start counting from the last command's execution |
| 243 | last_command_time = millis(); |
| 244 | #endif |
| 245 | CommandLine &command = commands[index_r]; |
| 246 | #if HAS_MULTI_SERIAL |
| 247 | const serial_index_t serial_ind = command.port; |
| 248 | if (!serial_ind.valid()) return; // Optimization here, skip processing if it's not going anywhere |
| 249 | PORT_REDIRECT(SERIAL_PORTMASK(serial_ind)); // Reply to the serial port that sent the command |
| 250 | #endif |
| 251 | if (command.skip_ok) return; |
| 252 | SERIAL_ECHOPGM(STR_OK); |
| 253 | #if ENABLED(ADVANCED_OK) |
| 254 | char* p = command.buffer; |
| 255 | if (*p == 'N') { |
| 256 | SERIAL_CHAR(' ', *p++); |
| 257 | while (NUMERIC_SIGNED(*p)) |
| 258 | SERIAL_CHAR(*p++); |
| 259 | } |
| 260 | SERIAL_ECHOPGM_P(SP_P_STR, planner.moves_free(), SP_B_STR, BUFSIZE - length); |
| 261 | #endif |
| 262 | SERIAL_EOL(); |
| 263 | } |
| 264 | |
| 265 | /** |
| 266 | * Send a "Resend: nnn" message to the host to |
no test coverage detected