From e965d95ba83512af6600b729e72acff5b1a34cf1 Mon Sep 17 00:00:00 2001 From: Doug Weibel Date: Sat, 26 Nov 2011 19:25:35 -0700 Subject: [PATCH] Added back the feature to prompt users when an invalid CLI command is entered. Thanks to Yury Smirnov for this patch! --- libraries/AP_Common/menu.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libraries/AP_Common/menu.cpp b/libraries/AP_Common/menu.cpp index 70d771eac0..7d30565c62 100644 --- a/libraries/AP_Common/menu.cpp +++ b/libraries/AP_Common/menu.cpp @@ -102,10 +102,12 @@ Menu::run(void) i++; } + bool cmd_found = false; // look for a command matching the first word (note that it may be empty) for (i = 0; i < _entries; i++) { if (!strcasecmp_P(_argv[0].str, _commands[i].command)) { ret = _call(i, argc); + cmd_found=true; if (-2 == ret) return; break; @@ -116,10 +118,17 @@ Menu::run(void) if (i == _entries) { if (!strcmp(_argv[0].str, "?") || (!strcasecmp_P(_argv[0].str, PSTR("help")))) { _help(); + cmd_found=true; } else if (!strcasecmp_P(_argv[0].str, PSTR("exit"))) { return; } } + + if (cmd_found==false) + { + Serial.println("Invalid command, type 'help'"); + } + } }