|
@@ -254,7 +254,7 @@ void GCodeQueue::ok_to_send() {
|
254
|
254
|
SERIAL_ECHO(*p++);
|
255
|
255
|
}
|
256
|
256
|
SERIAL_ECHOPAIR_P(SP_P_STR, int(BLOCK_BUFFER_SIZE - planner.movesplanned() - 1));
|
257
|
|
- SERIAL_ECHOPAIR(" B", BUFSIZE - length);
|
|
257
|
+ SERIAL_ECHOPAIR(" B", int(BUFSIZE - length));
|
258
|
258
|
#endif
|
259
|
259
|
SERIAL_EOL();
|
260
|
260
|
}
|
|
@@ -364,9 +364,9 @@ inline void process_stream_char(const char c, uint8_t &sis, char (&buff)[MAX_CMD
|
364
|
364
|
inline bool process_line_done(uint8_t &sis, char (&buff)[MAX_CMD_SIZE], int &ind) {
|
365
|
365
|
sis = PS_NORMAL;
|
366
|
366
|
buff[ind] = 0;
|
367
|
|
- if (!ind) { thermalManager.manage_heater(); return true; }
|
368
|
|
- ind = 0;
|
369
|
|
- return false;
|
|
367
|
+ if (ind) { ind = 0; return false; }
|
|
368
|
+ thermalManager.manage_heater();
|
|
369
|
+ return true;
|
370
|
370
|
}
|
371
|
371
|
|
372
|
372
|
/**
|
|
@@ -415,11 +415,13 @@ void GCodeQueue::get_serial_commands() {
|
415
|
415
|
|
416
|
416
|
if (serial_char == '\n' || serial_char == '\r') {
|
417
|
417
|
|
418
|
|
- if (process_line_done(serial_input_state[i], serial_line_buffer[i], serial_count[i])) continue;
|
|
418
|
+ // Reset our state, continue if the line was empty
|
|
419
|
+ if (process_line_done(serial_input_state[i], serial_line_buffer[i], serial_count[i]))
|
|
420
|
+ continue;
|
419
|
421
|
|
420
|
422
|
char* command = serial_line_buffer[i];
|
421
|
423
|
|
422
|
|
- while (*command == ' ') command++; // Skip leading spaces
|
|
424
|
+ while (*command == ' ') command++; // Skip leading spaces
|
423
|
425
|
char *npos = (*command == 'N') ? command : nullptr; // Require the N parameter to start the line
|
424
|
426
|
|
425
|
427
|
if (npos) {
|
|
@@ -551,7 +553,9 @@ void GCodeQueue::get_serial_commands() {
|
551
|
553
|
else if (n < 0)
|
552
|
554
|
SERIAL_ERROR_MSG(MSG_SD_ERR_READ);
|
553
|
555
|
|
554
|
|
- if (process_line_done(sd_input_state, command_buffer[index_w], sd_count)) continue;
|
|
556
|
+ // Terminate the buffer, reset the input state, continue for empty line
|
|
557
|
+ if (process_line_done(sd_input_state, command_buffer[index_w], sd_count))
|
|
558
|
+ continue;
|
555
|
559
|
|
556
|
560
|
_commit_command(false);
|
557
|
561
|
|