Added a-lurkers proposed changes to speed up message porcessing.
This commit is contained in:
@@ -128,19 +128,23 @@ void processEthernetMessages()
|
|||||||
EthernetClient client = server.available();
|
EthernetClient client = server.available();
|
||||||
|
|
||||||
if (client)
|
if (client)
|
||||||
|
{
|
||||||
|
// if got 1 or more bytes
|
||||||
|
if (client.available())
|
||||||
{
|
{
|
||||||
// read the bytes incoming from the client
|
// read the bytes incoming from the client
|
||||||
char inChar = client.read();
|
char inChar = client.read();
|
||||||
|
|
||||||
// echo the bytes to the serial port
|
|
||||||
Serial.print(inChar);
|
|
||||||
|
|
||||||
if (inputPos<MAX_RECEIVE_LENGTH-1) {
|
if (inputPos<MAX_RECEIVE_LENGTH-1) {
|
||||||
// if newline then command is complete
|
// if newline then command is complete
|
||||||
if (inChar == '\n')
|
if (inChar == '\n')
|
||||||
{ // a command was issued by the client
|
{ // a command was issued by the client
|
||||||
// we will now try to send it to the actuator
|
// we will now try to send it to the actuator
|
||||||
inputString[inputPos] = 0;
|
inputString[inputPos] = 0;
|
||||||
|
|
||||||
|
// echo the string to the serial port
|
||||||
|
Serial.print(inputString);
|
||||||
|
|
||||||
gw.parseAndSend(inputString);
|
gw.parseAndSend(inputString);
|
||||||
|
|
||||||
// clear the string:
|
// clear the string:
|
||||||
@@ -157,6 +161,7 @@ void processEthernetMessages()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user