Skip to content

armgit / flix

Public Imported from GitHub
0

Making an ESP32-based quadcopter from scratch

Make cli command case insensitive iOS QGC capitalizes the command by default, so it's more convinient

Oleg Kalachev2bcab6edb3ac
diff --git a/flix/cli.ino b/flix/cli.ino
index cfe0664..36d281d 100644
--- a/flix/cli.ino
+++ b/flix/cli.ino
@@ -78,6 +78,8 @@ void doCommand(String str, bool echo = false) {
print("> %s\n", str.c_str());
}
+ command.toLowerCase();
+
// execute command
if (command == "help" || command == "motd") {
print("%s\n", motd);
diff --git a/gazebo/Arduino.h b/gazebo/Arduino.h
index 77841cf..775d0fc 100644
--- a/gazebo/Arduino.h
+++ b/gazebo/Arduino.h
@@ -52,6 +52,10 @@ public:
this->erase(0, this->find_first_not_of(" \t\n\r"));
this->erase(this->find_last_not_of(" \t\n\r") + 1);
}
+ void toLowerCase() {
+ std::transform(this->begin(), this->end(), this->begin(),
+ [](unsigned char c) { return std::tolower(c); });
+ }
};
class Print;