From 74b9516ccc68e3e128cc2c12482d9e936d7b5068 Mon Sep 17 00:00:00 2001 From: Luc Date: Sun, 4 Dec 2016 16:54:56 +0100 Subject: [PATCH] avoid dead loop if continuous flow from serial if continuous flow cannot purge so just empty current rx buffer and skip --- esp3d/webinterface.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/esp3d/webinterface.cpp b/esp3d/webinterface.cpp index 40eee76c..d91079d3 100644 --- a/esp3d/webinterface.cpp +++ b/esp3d/webinterface.cpp @@ -3777,7 +3777,7 @@ void handle_web_command(){ #if (PURGE_SERIAL == 1) //empty the serial buffer and incoming data LOG("Start PurgeSerial\r\n") - while(Serial.available()){ + if(Serial.available()){ BRIDGE::processFromSerial2TCP(); delay(1); } @@ -3791,7 +3791,7 @@ void handle_web_command(){ LOG(String(cmd.length())) #if (PURGE_SERIAL == 1) LOG("Start PurgeSerial\r\n") - while(Serial.available()){ + if(Serial.available()){ BRIDGE::processFromSerial2TCP(); delay(1); } @@ -3832,6 +3832,7 @@ void handle_web_command(){ break; } //get the line and transmit it + LOG("Check command: ") LOG(current_line) LOG("\r\n") //check command @@ -3864,7 +3865,7 @@ void handle_web_command(){ web_interface->WebServer.sendContent(""); #if (PURGE_SERIAL == 1) LOG("Start PurgeSerial\r\n") - while(Serial.available()){ + if(Serial.available()){ BRIDGE::processFromSerial2TCP(); delay(1); }