Simplify command for command handling

This commit is contained in:
Oleg Kalachev
2025-10-21 19:31:38 +03:00
parent dc9aed113b
commit 7170b20d1d

View File

@@ -74,9 +74,10 @@ void doCommand(String str, bool echo = false) {
// parse command
String command, arg0, arg1;
splitString(str, command, arg0, arg1);
if (command.isEmpty()) return;
// echo command
if (echo && !command.isEmpty()) {
if (echo) {
print("> %s\n", str.c_str());
}
@@ -170,8 +171,6 @@ void doCommand(String str, bool echo = false) {
attitude = Quaternion();
} else if (command == "reboot") {
ESP.restart();
} else if (command == "") {
// do nothing
} else {
print("Invalid command: %s\n", command.c_str());
}