Merge pull request #7459 from ejtagle/xon-xoff-sdxfer

[1.1.x] XON/XOFF serial handshake (for faster transfers to SD)
This commit is contained in:
Scott Lahteine 2017-10-02 23:52:41 -05:00 committed by GitHub
commit a47c5c093d
66 changed files with 907 additions and 122 deletions

View file

@ -1098,9 +1098,10 @@ inline void get_serial_commands() {
/**
* Loop while serial characters are incoming and the queue is not full
*/
while (commands_in_queue < BUFSIZE && MYSERIAL.available() > 0) {
int c;
while (commands_in_queue < BUFSIZE && (c = MYSERIAL.read()) >= 0) {
char serial_char = MYSERIAL.read();
char serial_char = c;
/**
* If the character ends the line
@ -1200,9 +1201,9 @@ inline void get_serial_commands() {
// The command will be injected when EOL is reached
}
else if (serial_char == '\\') { // Handle escapes
if (MYSERIAL.available() > 0) {
if ((c = MYSERIAL.read()) >= 0) {
// if we have one more character, copy it over
serial_char = MYSERIAL.read();
serial_char = c;
if (!serial_comment_mode) serial_line_buffer[serial_count++] = serial_char;
}
// otherwise do nothing
@ -13610,6 +13611,15 @@ void loop() {
// M29 closes the file
card.closefile();
SERIAL_PROTOCOLLNPGM(MSG_FILE_SAVED);
#if ENABLED(SERIAL_STATS_DROPPED_RX)
SERIAL_ECHOLNPAIR("Dropped bytes: ", customizedSerial.dropped());
#endif
#if ENABLED(SERIAL_STATS_MAX_RX_QUEUED)
SERIAL_ECHOLNPAIR("Max RX Queue Size: ", customizedSerial.rxMaxEnqueued());
#endif
ok_to_send();
}
else {