Tweak process_line_done for speed
This commit is contained in:
parent
4ef627d79f
commit
22b974691e
1 changed files with 11 additions and 7 deletions
|
@ -254,7 +254,7 @@ void GCodeQueue::ok_to_send() {
|
||||||
SERIAL_ECHO(*p++);
|
SERIAL_ECHO(*p++);
|
||||||
}
|
}
|
||||||
SERIAL_ECHOPAIR_P(SP_P_STR, int(BLOCK_BUFFER_SIZE - planner.movesplanned() - 1));
|
SERIAL_ECHOPAIR_P(SP_P_STR, int(BLOCK_BUFFER_SIZE - planner.movesplanned() - 1));
|
||||||
SERIAL_ECHOPAIR(" B", BUFSIZE - length);
|
SERIAL_ECHOPAIR(" B", int(BUFSIZE - length));
|
||||||
#endif
|
#endif
|
||||||
SERIAL_EOL();
|
SERIAL_EOL();
|
||||||
}
|
}
|
||||||
|
@ -364,9 +364,9 @@ inline void process_stream_char(const char c, uint8_t &sis, char (&buff)[MAX_CMD
|
||||||
inline bool process_line_done(uint8_t &sis, char (&buff)[MAX_CMD_SIZE], int &ind) {
|
inline bool process_line_done(uint8_t &sis, char (&buff)[MAX_CMD_SIZE], int &ind) {
|
||||||
sis = PS_NORMAL;
|
sis = PS_NORMAL;
|
||||||
buff[ind] = 0;
|
buff[ind] = 0;
|
||||||
if (!ind) { thermalManager.manage_heater(); return true; }
|
if (ind) { ind = 0; return false; }
|
||||||
ind = 0;
|
thermalManager.manage_heater();
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -415,7 +415,9 @@ void GCodeQueue::get_serial_commands() {
|
||||||
|
|
||||||
if (serial_char == '\n' || serial_char == '\r') {
|
if (serial_char == '\n' || serial_char == '\r') {
|
||||||
|
|
||||||
if (process_line_done(serial_input_state[i], serial_line_buffer[i], serial_count[i])) continue;
|
// Reset our state, continue if the line was empty
|
||||||
|
if (process_line_done(serial_input_state[i], serial_line_buffer[i], serial_count[i]))
|
||||||
|
continue;
|
||||||
|
|
||||||
char* command = serial_line_buffer[i];
|
char* command = serial_line_buffer[i];
|
||||||
|
|
||||||
|
@ -551,7 +553,9 @@ void GCodeQueue::get_serial_commands() {
|
||||||
else if (n < 0)
|
else if (n < 0)
|
||||||
SERIAL_ERROR_MSG(MSG_SD_ERR_READ);
|
SERIAL_ERROR_MSG(MSG_SD_ERR_READ);
|
||||||
|
|
||||||
if (process_line_done(sd_input_state, command_buffer[index_w], sd_count)) continue;
|
// Terminate the buffer, reset the input state, continue for empty line
|
||||||
|
if (process_line_done(sd_input_state, command_buffer[index_w], sd_count))
|
||||||
|
continue;
|
||||||
|
|
||||||
_commit_command(false);
|
_commit_command(false);
|
||||||
|
|
||||||
|
|
Reference in a new issue