|
|
|
|
@ -66,12 +66,15 @@ static uint8_t ParseCommand(const uint8_t *cmd, bool *handled, McuShell_ConstStd |
|
|
|
|
vQueueShellCmd(shellCmd); |
|
|
|
|
} else if(McuUtility_strcmp((char*)cmd,SHELL_CMD_POWEROFF_RPI) == 0){ |
|
|
|
|
// shutown rpi
|
|
|
|
|
*handled = TRUE; |
|
|
|
|
Shell_cmd_s shellCmd = {.shellCmd = Shell_Powerof_rpi, .numberOfParams = 0}; |
|
|
|
|
vQueueShellCmd(shellCmd); |
|
|
|
|
}else if(McuUtility_strcmp((char*)cmd, SHELL_CMD_INIT_ALL_SF) == 0){ |
|
|
|
|
*handled = TRUE; |
|
|
|
|
Shell_cmd_s shellCmd = {.shellCmd = Shell_Init_All_SF, .numberOfParams = 0}; |
|
|
|
|
vQueueShellCmd(shellCmd); |
|
|
|
|
}else if(McuUtility_strncmp((char*)cmd,SHELL_CMD_DISPLAY_STRING,sizeof(SHELL_CMD_DISPLAY_STRING)-1) == 0){ |
|
|
|
|
*handled = TRUE; |
|
|
|
|
Shell_cmd_s shellCmd = {.shellCmd = Shell_Display_String_SF, .numberOfParams = NUM_FLAPS, .params = {0}}; |
|
|
|
|
cmd += sizeof(SHELL_CMD_DISPLAY_STRING)-1; |
|
|
|
|
if(SHELL_stringToInt32ArrayForSFCMD(&cmd, shellCmd.params, NUM_FLAPS) != ERR_OK){ |
|
|
|
|
@ -95,9 +98,13 @@ uint8_t SHELL_stringToInt32ArrayForSFCMD(const unsigned char **str, int32_t* res |
|
|
|
|
// its a number
|
|
|
|
|
*res = (int32_t)c; |
|
|
|
|
res++; |
|
|
|
|
}else if(c >= 'A' && c <= 'Z'){ |
|
|
|
|
}else if((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')){ |
|
|
|
|
// its a char
|
|
|
|
|
*res = (int32_t)c; |
|
|
|
|
if(c >= 'a' && c <= 'z'){ |
|
|
|
|
*res = (int32_t)c-0x20; |
|
|
|
|
}else{ |
|
|
|
|
*res = (int32_t)c; |
|
|
|
|
} |
|
|
|
|
res++; |
|
|
|
|
} else if(c == '!' || c == '?' || c == ':' || c == ' '){ |
|
|
|
|
// special character allowed by SF
|
|
|
|
|
@ -109,7 +116,14 @@ uint8_t SHELL_stringToInt32ArrayForSFCMD(const unsigned char **str, int32_t* res |
|
|
|
|
c = *(++(*str)); |
|
|
|
|
} |
|
|
|
|
return ERR_OK; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
uint8_t SHELL_Int32ArrayToStringForSF(int32_t* intArray, int8_t size, char *str){ |
|
|
|
|
for(uint8_t i = 0; i < size; i++){ |
|
|
|
|
*str = (char)intArray[i]; |
|
|
|
|
str++; |
|
|
|
|
} |
|
|
|
|
return ERR_OK; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static const McuShell_ParseCommandCallback CmdParserTable[] = |
|
|
|
|
|