diff --git a/esp32_marauder/CommandLine.cpp b/esp32_marauder/CommandLine.cpp index d9337d845..508edc441 100644 --- a/esp32_marauder/CommandLine.cpp +++ b/esp32_marauder/CommandLine.cpp @@ -19,19 +19,31 @@ String CommandLine::getSerialInput() { String input = ""; if (Serial.available() > 0) - input = Serial.readStringUntil('\n'); + input = Serial.readString(); - input.trim(); return input; } void CommandLine::main(uint32_t currentTime) { String input = this->getSerialInput(); - this->runCommand(input); + if (input == "") + return; + + this->cmdLine = this->cmdLine + input; - if (input != "") - Serial.print("> "); + for (int i=0; irunCommand(cmdLine.substring(0,i)); + if (i < (cmdLine.length() - 1)) + this->cmdLine = cmdLine.substring(i+1); + else + this->cmdLine = ""; + Serial.print("> "); + return; + } + } } LinkedList CommandLine::parseCommand(String input, char* delim) { diff --git a/esp32_marauder/CommandLine.h b/esp32_marauder/CommandLine.h index a17ab8202..3b5960a16 100644 --- a/esp32_marauder/CommandLine.h +++ b/esp32_marauder/CommandLine.h @@ -154,6 +154,7 @@ class CommandLine { bool hasSSIDs(); void showCounts(int selected, int unselected = -1); int argSearch(LinkedList* cmd_args, String key); + String cmdLine; const char* ascii_art = "\r\n"