mirror of
https://github.com/SpacehuhnTech/esp8266_deauther.git
synced 2025-12-21 23:01:00 -08:00
Fixed Errors in serial parser
Sorry seems like I skipped testing when I commited the changes earlier
This commit is contained in:
@@ -145,7 +145,6 @@ void SerialInterface::runCommands(String input) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SerialInterface::runCommand(String input) {
|
void SerialInterface::runCommand(String input) {
|
||||||
input
|
|
||||||
input.replace(String(NEWLINE), String());
|
input.replace(String(NEWLINE), String());
|
||||||
input.replace(String(CARRIAGERETURN), 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++) {
|
for (int i = 0; i < input.length() && i < 512; i++) {
|
||||||
c = input.charAt(i);
|
c = input.charAt(i);
|
||||||
|
|
||||||
// when char is an unescaped \
|
// when char is an unescaped
|
||||||
if(!escaped && c == BACKSLASH){
|
if(!escaped && c == BACKSLASH){
|
||||||
escaped = true;
|
escaped = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// (when char is a unescaped space AND it's not within quotes) OR char is \r or \n
|
// (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
|
// when tmp string isn't empty, add it to the list
|
||||||
if (tmp.length() > 0){
|
if (tmp.length() > 0){
|
||||||
list->add(tmp);
|
list->add(tmp);
|
||||||
@@ -182,7 +181,7 @@ void SerialInterface::runCommand(String input) {
|
|||||||
|
|
||||||
// add character to tmp string
|
// add character to tmp string
|
||||||
else {
|
else {
|
||||||
tmp += c
|
tmp += c;
|
||||||
escaped = false;
|
escaped = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user