From 73b4640ce51a1d5f6a9a43faeaf1f5f3612ff1ff Mon Sep 17 00:00:00 2001 From: Stefan Kremser Date: Wed, 28 Mar 2018 19:35:30 +0200 Subject: [PATCH] Fixed Errors in serial parser Sorry seems like I skipped testing when I commited the changes earlier --- esp8266_deauther/SerialInterface.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/esp8266_deauther/SerialInterface.cpp b/esp8266_deauther/SerialInterface.cpp index e511493..37170e9 100644 --- a/esp8266_deauther/SerialInterface.cpp +++ b/esp8266_deauther/SerialInterface.cpp @@ -145,7 +145,6 @@ void SerialInterface::runCommands(String input) { } void SerialInterface::runCommand(String input) { - input input.replace(String(NEWLINE), String()); input.replace(String(CARRIAGERETURN), String()); @@ -159,13 +158,13 @@ void SerialInterface::runCommand(String input) { for (int i = 0; i < input.length() && i < 512; i++) { c = input.charAt(i); - // when char is an unescaped \ + // when char is an unescaped if(!escaped && c == BACKSLASH){ escaped = true; } // (when char is a unescaped space AND it's not within quotes) OR char is \r or \n - else if (c == SPACE && !escaped && !withinQuotes) || c == CARRIAGERETURN || c == NEWLINE) { + else if ((c == SPACE && !escaped && !withinQuotes) || c == CARRIAGERETURN || c == NEWLINE) { // when tmp string isn't empty, add it to the list if (tmp.length() > 0){ list->add(tmp); @@ -182,7 +181,7 @@ void SerialInterface::runCommand(String input) { // add character to tmp string else { - tmp += c + tmp += c; escaped = false; } }