prepared command to set manualy offset

main
Simon Frei 4 years ago
parent 1bf631b1e0
commit b6a3d272db
  1. 3
      ADIS_tinyK22_SplitFlap/source/application.c
  2. 15
      ADIS_tinyK22_SplitFlap/source/shell.c
  3. 4
      ADIS_tinyK22_SplitFlap/source/shell.h

@ -90,6 +90,9 @@ static void App_Task(void* pv){
McuLog_error("Invalid String to Display"); McuLog_error("Invalid String to Display");
} }
break; break;
case Shell_Add_New_Id_SF:
McuLog_error("Command is coming soon...");
break;
default: default:
McuLog_error("Not implemented command recieved in App_Task. Command Id was <%i>", (int)cmd.shellCmd); McuLog_error("Not implemented command recieved in App_Task. Command Id was <%i>", (int)cmd.shellCmd);
break; break;

@ -28,6 +28,7 @@ static uint8_t PrintHelp(const McuShell_StdIOType *io) {
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*)" 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*)" 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); McuShell_SendHelpStr((unsigned char*)" Display <string>", (const unsigned char*)"displays as many chars of the string as sf are available\r\n", io->stdOut);
McuShell_SendHelpStr((unsigned char*)" addId <hwId> <offset>", (const unsigned char*)"add new hwId with offset\r\n", io->stdOut);
return ERR_OK; return ERR_OK;
} }
@ -94,6 +95,20 @@ static uint8_t ParseCommand(const uint8_t *cmd, bool *handled, McuShell_ConstStd
return ERR_FAILED; return ERR_FAILED;
} }
vQueueShellCmd(shellCmd); vQueueShellCmd(shellCmd);
}else if(McuUtility_strncmp((char*)cmd,SHELL_CMD_ADD_NEW_ID_SF,sizeof(SHELL_CMD_ADD_NEW_ID_SF)-1) == 0){
int32_t hwId = 0;
int32_t offset = 0;
*handled = TRUE;
cmd += sizeof(SHELL_CMD_ADD_NEW_ID_SF)-1;
if(McuUtility_xatoi(&cmd, &hwId) != ERR_OK){
return PrintError(cmdCpy, (const uint8_t*)"failed to parse hwId", io);
}
cmd++;
if(McuUtility_xatoi(&cmd, &offset) != ERR_OK){
return PrintError(cmdCpy, (const uint8_t*)"failed to parse offset", io);
}
Shell_cmd_s shellCmd = {.shellCmd = Shell_Add_New_Id_SF, .numberOfParams = 2, .params = {hwId,offset}};
vQueueShellCmd(shellCmd);
} }
return ERR_OK; return ERR_OK;

@ -15,6 +15,7 @@
#define SHELL_CMD_IDENTIFY_SF "SplitFlap setId" #define SHELL_CMD_IDENTIFY_SF "SplitFlap setId"
#define SHELL_CMD_INIT_ALL_SF "SplitFlap initAll" #define SHELL_CMD_INIT_ALL_SF "SplitFlap initAll"
#define SHELL_CMD_DISPLAY_STRING_SF "SplitFlap Display" #define SHELL_CMD_DISPLAY_STRING_SF "SplitFlap Display"
#define SHELL_CMD_ADD_NEW_ID_SF "SplitFlap addId"
#define SHELL_CMD_QUEUE_LENGTH 5 #define SHELL_CMD_QUEUE_LENGTH 5
@ -23,7 +24,8 @@ typedef enum ShellCmd {
Shell_Identify_SF, Shell_Identify_SF,
Shell_Init_All_SF, Shell_Init_All_SF,
Shell_Display_String_SF, Shell_Display_String_SF,
Shell_Powerof_rpi Shell_Powerof_rpi,
Shell_Add_New_Id_SF,
}Shell_cmd_t; }Shell_cmd_t;
typedef struct ShellCmd_s { typedef struct ShellCmd_s {

Loading…
Cancel
Save