mirror of https://github.com/ArduPilot/ardupilot
Added back the feature to prompt users when an invalid CLI command is entered.
Thanks to Yury Smirnov for this patch!
This commit is contained in:
parent
67873813ce
commit
e965d95ba8
|
@ -102,10 +102,12 @@ Menu::run(void)
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool cmd_found = false;
|
||||||
// look for a command matching the first word (note that it may be empty)
|
// look for a command matching the first word (note that it may be empty)
|
||||||
for (i = 0; i < _entries; i++) {
|
for (i = 0; i < _entries; i++) {
|
||||||
if (!strcasecmp_P(_argv[0].str, _commands[i].command)) {
|
if (!strcasecmp_P(_argv[0].str, _commands[i].command)) {
|
||||||
ret = _call(i, argc);
|
ret = _call(i, argc);
|
||||||
|
cmd_found=true;
|
||||||
if (-2 == ret)
|
if (-2 == ret)
|
||||||
return;
|
return;
|
||||||
break;
|
break;
|
||||||
|
@ -116,10 +118,17 @@ Menu::run(void)
|
||||||
if (i == _entries) {
|
if (i == _entries) {
|
||||||
if (!strcmp(_argv[0].str, "?") || (!strcasecmp_P(_argv[0].str, PSTR("help")))) {
|
if (!strcmp(_argv[0].str, "?") || (!strcasecmp_P(_argv[0].str, PSTR("help")))) {
|
||||||
_help();
|
_help();
|
||||||
|
cmd_found=true;
|
||||||
} else if (!strcasecmp_P(_argv[0].str, PSTR("exit"))) {
|
} else if (!strcasecmp_P(_argv[0].str, PSTR("exit"))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cmd_found==false)
|
||||||
|
{
|
||||||
|
Serial.println("Invalid command, type 'help'");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue