|
|
|
@ -13,7 +13,7 @@ |
|
|
|
#include "McuLog.h" |
|
|
|
#include "McuLog.h" |
|
|
|
#include "McuUtility.h" |
|
|
|
#include "McuUtility.h" |
|
|
|
#include "MotOffsetTable.h" |
|
|
|
#include "MotOffsetTable.h" |
|
|
|
#include "multi-splitflap.h" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define SHELL_CMD_ELEM_SIZE (sizeof(Shell_cmd_s)) |
|
|
|
#define SHELL_CMD_ELEM_SIZE (sizeof(Shell_cmd_s)) |
|
|
|
|
|
|
|
|
|
|
|
@ -71,6 +71,42 @@ static uint8_t ParseCommand(const uint8_t *cmd, bool *handled, McuShell_ConstStd |
|
|
|
}else if(McuUtility_strcmp((char*)cmd, SHELL_CMD_INIT_ALL_SF) == 0){ |
|
|
|
}else if(McuUtility_strcmp((char*)cmd, SHELL_CMD_INIT_ALL_SF) == 0){ |
|
|
|
Shell_cmd_s shellCmd = {.shellCmd = Shell_Init_All_SF, .numberOfParams = 0}; |
|
|
|
Shell_cmd_s shellCmd = {.shellCmd = Shell_Init_All_SF, .numberOfParams = 0}; |
|
|
|
vQueueShellCmd(shellCmd); |
|
|
|
vQueueShellCmd(shellCmd); |
|
|
|
|
|
|
|
}else if(McuUtility_strncmp((char*)cmd,SHELL_CMD_DISPLAY_STRING,sizeof(SHELL_CMD_DISPLAY_STRING)-1) == 0){ |
|
|
|
|
|
|
|
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){ |
|
|
|
|
|
|
|
return ERR_FAILED; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
vQueueShellCmd(shellCmd); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return ERR_OK; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
uint8_t SHELL_stringToInt32ArrayForSFCMD(const unsigned char **str, int32_t* res, int8_t sizeRes){ |
|
|
|
|
|
|
|
uint8_t c = 0; |
|
|
|
|
|
|
|
while(**str == ' '){ |
|
|
|
|
|
|
|
(*str)++; // skip leading spaces
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
c = **str; |
|
|
|
|
|
|
|
while(c != '\0' && sizeRes>0){ |
|
|
|
|
|
|
|
sizeRes--; |
|
|
|
|
|
|
|
if(c <= '9' && c >= '0'){ |
|
|
|
|
|
|
|
// its a number
|
|
|
|
|
|
|
|
*res = (int32_t)c; |
|
|
|
|
|
|
|
res++; |
|
|
|
|
|
|
|
}else if(c >= 'A' && c <= 'Z'){ |
|
|
|
|
|
|
|
// its a char
|
|
|
|
|
|
|
|
*res = (int32_t)c; |
|
|
|
|
|
|
|
res++; |
|
|
|
|
|
|
|
} else if(c == '!' || c == '?' || c == ':' || c == ' '){ |
|
|
|
|
|
|
|
// special character allowed by SF
|
|
|
|
|
|
|
|
*res = (int32_t)c; |
|
|
|
|
|
|
|
res++; |
|
|
|
|
|
|
|
} else{ |
|
|
|
|
|
|
|
return ERR_FAILED; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
c = *(++(*str)); |
|
|
|
} |
|
|
|
} |
|
|
|
return ERR_OK; |
|
|
|
return ERR_OK; |
|
|
|
|
|
|
|
|
|
|
|
|