Make cli command case insensitive

iOS QGC capitalizes the command by default, so it's more convinient
This commit is contained in:
Oleg Kalachev 2025-05-10 05:15:54 +03:00
parent df2b10acd4
commit 2bcab6edb3
2 changed files with 6 additions and 0 deletions

View File

@ -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);

View File

@ -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;