diff --git a/os/various/shell/shell.c b/os/various/shell/shell.c index 2a61c70eb..341f9eb06 100644 --- a/os/various/shell/shell.c +++ b/os/various/shell/shell.c @@ -227,7 +227,7 @@ static int get_history(ShellHistory *shp, char *line, int dir) { } #endif -#if (SHELL_USE_COMPLETION == TRUE) +#if (SHELL_USE_COMPLETION == TRUE) || defined(__DOXYGEN__) static void get_completions(ShellConfig *scfg, char *line) { ShellCommand *lcp = shell_local_commands; const ShellCommand *scp = scfg->sc_commands; @@ -327,8 +327,8 @@ static void write_completions(ShellConfig *scfg, char *line, int pos) { THD_FUNCTION(shellThread, p) { int n; ShellConfig *scfg = p; - BaseSequentialStream *chp = ((ShellConfig *)p)->sc_channel; - const ShellCommand *scp = ((ShellConfig *)p)->sc_commands; + BaseSequentialStream *chp = scfg->sc_channel; + const ShellCommand *scp = scfg->sc_commands; char *lp, *cmd, *tokp, line[SHELL_MAX_LINE_LENGTH]; char *args[SHELL_MAX_ARGUMENTS + 1]; @@ -433,8 +433,10 @@ void shellExit(msg_t msg) { bool shellGetLine(ShellConfig *scfg, char *line, unsigned size) { char *p = line; BaseSequentialStream *chp = scfg->sc_channel; +#if (SHELL_USE_ESC_SEQ == TRUE) bool escape = false; bool bracket = false; +#endif #if (SHELL_USE_HISTORY == TRUE) ShellHistory *shp = scfg->sc_history; @@ -445,7 +447,7 @@ bool shellGetLine(ShellConfig *scfg, char *line, unsigned size) { if (streamRead(chp, (uint8_t *)&c, 1) == 0) return true; -#if (SHELL_USE_ESC_SEQ == TRUE) +#if SHELL_USE_ESC_SEQ == TRUE if (c == 27) { escape = true; continue; @@ -459,7 +461,7 @@ bool shellGetLine(ShellConfig *scfg, char *line, unsigned size) { } if (bracket) { bracket = false; -#if (SHELL_USE_HISTORY == TRUE) +#if SHELL_USE_HISTORY == TRUE if (c == 'A') { int len = get_history(shp, line, SHELL_HIST_DIR_BK); @@ -507,7 +509,7 @@ bool shellGetLine(ShellConfig *scfg, char *line, unsigned size) { } if (c == '\r') { chprintf(chp, SHELL_NEWLINE_STR); -#if (SHELL_USE_HISTORY == TRUE) +#if SHELL_USE_HISTORY == TRUE if (shp != NULL) { save_history(shp, line, p - line); } @@ -515,7 +517,7 @@ bool shellGetLine(ShellConfig *scfg, char *line, unsigned size) { *p = 0; return false; } -#if (SHELL_USE_COMPLETION == TRUE) +#if SHELL_USE_COMPLETION == TRUE if (c == '\t') { if (p < line + size - 1) { *p = 0; @@ -530,7 +532,7 @@ bool shellGetLine(ShellConfig *scfg, char *line, unsigned size) { continue; } #endif -#if (SHELL_USE_HISTORY == TRUE) +#if SHELL_USE_HISTORY == TRUE if (c == 14) { int len = get_history(shp, line, SHELL_HIST_DIR_FW); diff --git a/os/various/shell/shell.h b/os/various/shell/shell.h index cf52bce9a..4620ded8b 100644 --- a/os/various/shell/shell.h +++ b/os/various/shell/shell.h @@ -25,6 +25,10 @@ #ifndef SHELL_H #define SHELL_H +#if defined(SHELL_CONFIG_FILE) +#include "shellconf.h" +#endif + /*===========================================================================*/ /* Module constants. */ /*===========================================================================*/ @@ -74,14 +78,14 @@ * @brief Enable shell command history */ #if !defined(SHELL_USE_HISTORY) || defined(__DOXYGEN__) -#define SHELL_USE_HISTORY TRUE +#define SHELL_USE_HISTORY FALSE #endif /** * @brief Enable shell command completion */ #if !defined(SHELL_USE_COMPLETION) || defined(__DOXYGEN__) -#define SHELL_USE_COMPLETION TRUE +#define SHELL_USE_COMPLETION FALSE #endif /** @@ -95,7 +99,7 @@ * @brief Enable shell escape sequence processing */ #if !defined(SHELL_USE_ESC_SEQ) || defined(__DOXYGEN__) -#define SHELL_USE_ESC_SEQ TRUE +#define SHELL_USE_ESC_SEQ FALSE #endif /*===========================================================================*/ diff --git a/os/various/shell/shell_cmd.c b/os/various/shell/shell_cmd.c index 3b40f1bb8..724d83351 100644 --- a/os/various/shell/shell_cmd.c +++ b/os/various/shell/shell_cmd.c @@ -156,8 +156,8 @@ static void cmd_threads(BaseSequentialStream *chp, int argc, char *argv[]) { chprintf(chp, "stklimit stack addr refs prio state name\r\n"SHELL_NEWLINE_STR); tp = chRegFirstThread(); do { -#if CH_DBG_ENABLE_STACK_CHECK == TRUE - uint32_t stklimit = (uint32_t)tp->stklimit; +#if (CH_DBG_ENABLE_STACK_CHECK == TRUE) || (CH_CFG_USE_DYNAMIC == TRUE) + uint32_t stklimit = (uint32_t)tp->wabase; #else uint32_t stklimit = 0U; #endif