watchdog
This commit is contained in:
@ -59,9 +59,7 @@ static int8_t cmdExecuteCommand(uint8_t *cmdLine, bool resetSpecialModes) {
|
||||
"\n\r" \
|
||||
"help ................................. Show this help page\n\r" \
|
||||
"quit ................................. Terminate the console session\n\r" \
|
||||
"enable ............................... Enable admin mode\n\r" \
|
||||
"config ............................... Enter configuration mode\n\r" \
|
||||
"disable .............................. Disable admin/config mode\n\r" \
|
||||
;
|
||||
const static char CONFIG_INTRO_MSG[] = \
|
||||
"In configuration mode each command changing the configuration\n\r" \
|
||||
@ -76,18 +74,14 @@ static int8_t cmdExecuteCommand(uint8_t *cmdLine, bool resetSpecialModes) {
|
||||
const static char UNKNOWN_COMMAND[] = "Unknown command\n\r";
|
||||
uint8_t *messageToSend = NULL;
|
||||
|
||||
static bool adminMode = false;
|
||||
static bool configMode = false;
|
||||
|
||||
if (resetSpecialModes) {
|
||||
adminMode = false;
|
||||
configMode = false;
|
||||
}
|
||||
|
||||
cmd_t const * commands = getRegularCommands();
|
||||
if (adminMode) {
|
||||
commands = getAdminCommands();
|
||||
} else if (configMode) {
|
||||
if (configMode) {
|
||||
commands = getConfigCommands();
|
||||
}
|
||||
|
||||
@ -127,15 +121,6 @@ static int8_t cmdExecuteCommand(uint8_t *cmdLine, bool resetSpecialModes) {
|
||||
cmdIdx++;
|
||||
}
|
||||
messageToSend = NULL;
|
||||
} else if (0 == strcmp(cmd, "enable")) {
|
||||
coloredMsg(LOG_YELLOW, "ch cec enable admin mode");
|
||||
adminMode = true;
|
||||
retCode = 1;
|
||||
} else if (0 == strcmp(cmd, "disable")) {
|
||||
coloredMsg(LOG_YELLOW, "ch cec disable admin mode");
|
||||
adminMode = false;
|
||||
configMode = false;
|
||||
retCode = 3;
|
||||
} else if (0 == strcmp(cmd, "config")) {
|
||||
coloredMsg(LOG_YELLOW, "ch cec enable config mode");
|
||||
configMode = true;
|
||||
@ -177,7 +162,6 @@ static void cmdHandlerEngine(void *handle) {
|
||||
|
||||
static char *prompt;
|
||||
static char defaultPrompt[] = " > ";
|
||||
static char adminPrompt[] = " (admin) # ";
|
||||
static char configPrompt[] = " (config) $ ";
|
||||
|
||||
|
||||
@ -291,10 +275,6 @@ static void cmdHandlerEngine(void *handle) {
|
||||
case -1:
|
||||
state = CH_DISCONNECT;
|
||||
break;
|
||||
case 1:
|
||||
prompt = adminPrompt;
|
||||
state = CH_PROMPT;
|
||||
break;
|
||||
case 2:
|
||||
prompt = configPrompt;
|
||||
state = CH_PROMPT;
|
||||
@ -303,6 +283,9 @@ static void cmdHandlerEngine(void *handle) {
|
||||
prompt = defaultPrompt;
|
||||
state = CH_PROMPT;
|
||||
break;
|
||||
default:
|
||||
state = CH_DISCONNECT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user