@ -20,6 +20,17 @@
# define SHELL_CMD_ELEM_SIZE (sizeof(Shell_cmd_s))
# if configUSE_SHELL
static uint8_t PrintHelp ( const McuShell_StdIOType * io ) {
McuShell_SendHelpStr ( ( unsigned char * ) " SplitFlap " , ( unsigned char * ) " Group of McuRTOS commands \r \n " , io - > stdOut ) ;
McuShell_SendHelpStr ( ( unsigned char * ) " help " , ( unsigned char * ) " Print help or status information \r \n " , io - > stdOut ) ;
McuShell_SendHelpStr ( ( unsigned char * ) " setId <SetupId> <hwId> " , ( const unsigned char * ) " sets the position (setupId) of the sf and its id (hwId) \r \n " , io - > stdOut ) ;
McuShell_SendHelpStr ( ( unsigned char * ) " initAll " , ( const unsigned char * ) " init all Splitflaps \r \n " , io - > stdOut ) ;
McuShell_SendHelpStr ( ( unsigned char * ) " Display <string> " , ( const unsigned char * ) " displays as many chars of the string as sf are available \r \n " , io - > stdOut ) ;
return ERR_OK ;
}
# endif
static QueueHandle_t shellCmdQueue ;
static void vQueueShellCmd ( Shell_cmd_s shellCmd ) {
@ -29,17 +40,9 @@ static void vQueueShellCmd(Shell_cmd_s shellCmd){
}
static uint8_t ParseCommand ( const uint8_t * cmd , bool * handled , McuShell_ConstStdIOType * io ) {
if ( McuUtility_strcmp ( ( char * ) cmd , McuShell_CMD_HELP ) = = 0 ) {
McuShell_SendStr ( ( unsigned char * ) " \r \n " , io - > stdOut ) ;
McuShell_SendStr ( ( unsigned char * ) McuShell_DASH_LINE , io - > stdOut ) ;
McuShell_SendStr ( ( unsigned char * ) " \r \n " , io - > stdOut ) ;
McuShell_SendHelpStr ( ( unsigned char * ) " SplitFlap Help " , ( const unsigned char * ) " Group of SplitFlap commands \r \n " , io - > stdOut ) ;
McuShell_SendHelpStr ( ( unsigned char * ) " help " , ( const unsigned char * ) " Print help this message \r \n " , io - > stdOut ) ;
McuShell_SendHelpStr ( ( unsigned char * ) SHELL_CMD_IDENTIFY_SF , ( const unsigned char * ) " <SetupIdentifier> <HardwareIdentifier> (uint8_t) (uint8_t) \r \n " , io - > stdOut ) ;
McuShell_SendHelpStr ( ( unsigned char * ) SHELL_CMD_POWEROFF_RPI , ( const unsigned char * ) " power of the raspberry pi \r \n " , io - > stdOut ) ;
McuShell_SendHelpStr ( ( unsigned char * ) SHELL_CMD_INIT_ALL_SF , ( const unsigned char * ) " init all Splitflaps \r \n " , io - > stdOut ) ;
* handled = TRUE ;
return ERR_OK ;
if ( McuUtility_strcmp ( ( char * ) cmd , McuShell_CMD_HELP ) = = 0 | | McuUtility_strcmp ( ( char * ) cmd , " SplitFlap help " ) = = 0 ) {
* handled = TRUE ;
return PrintHelp ( io ) ;
} else if ( McuUtility_strncmp ( ( char * ) cmd , SHELL_CMD_IDENTIFY_SF , sizeof ( SHELL_CMD_IDENTIFY_SF ) - 1 ) = = 0 ) {
int32_t hwId = 0 ;
int32_t setupId = 0 ;
@ -67,19 +70,14 @@ static uint8_t ParseCommand(const uint8_t *cmd, bool *handled, McuShell_ConstStd
Shell_cmd_s shellCmd = { . shellCmd = Shell_Identify_SF , . numberOfParams = 2 , . params = { hwId , setupId } } ;
//Shell_cmd_s shellCmd = {.shellCmd = Shell_Identify_SF, .value1 = setupId, .value2 = hwId};
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 ) {
} 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 ) {
} else if ( McuUtility_strncmp ( ( char * ) cmd , SHELL_CMD_DISPLAY_STRING_SF , sizeof ( SHELL_CMD_DISPLAY_STRING_SF ) - 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 ;
cmd + = sizeof ( SHELL_CMD_DISPLAY_STRING_SF ) - 1 ;
if ( SHELL_stringToInt32ArrayForSFCMD ( & cmd , shellCmd . params , NUM_FLAPS ) ! = ERR_OK ) {
return ERR_FAILED ;
}
@ -138,8 +136,8 @@ uint8_t SHELL_Int32ArrayToStringForSF(int32_t* intArray, int8_t size, char *str)
static const McuShell_ParseCommandCallback CmdParserTable [ ] =
{
ParseCommand ,
McuShell_ParseCommand ,
ParseCommand ,
McuRTOS_ParseCommand ,
McuFlash_ParseCommand ,
ini_ParseCommand ,