你好:
原本people counting相關參數設定需透過GUI端進行設定
但後續做應用開發時,不想透過GUI端做參數設定
目前已知GUI所附的mmw_pplcount_demo_default.cfg提供的參數設定到mmWave
目前找到有部份參數設定是在cli.c檔,請問還有哪些檔案需要修改? 是否有參考範例或資料?
你好:
原本people counting相關參數設定需透過GUI端進行設定
但後續做應用開發時,不想透過GUI端做參數設定
目前已知GUI所附的mmw_pplcount_demo_default.cfg提供的參數設定到mmWave
目前找到有部份參數設定是在cli.c檔,請問還有哪些檔案需要修改? 是否有參考範例或資料?
你好,經參考相關作法已將cli.c檔修改,但直接將EVM接上電源仍無法啟動,需要透過gui按下start才能運作,想請問是哪裡的問題?
目前修改的地方如下:
/**************************************************************************
*************************** Hard-coded Configuation **********************
**************************************************************************/
#define USE_HARD_CODED_CONFIG
#ifdef USE_HARD_CODED_CONFIG
int32_t hardCodedConfigIndex;
char * hardCodedConfigCommands[] =
{
"dfeDataOutputMode 1",
"channelCfg 15 3 0",
"adcCfg 2 1",
"adcbufCfg 0 1 1 1",
"profileCfg 0 77 30 7 62 0 0 60 1 128 2500 0 0 30",
"chirpCfg 0 0 0 0 0 0 0 1",
"chirpCfg 1 1 0 0 0 0 0 2",
"frameCfg 0 1 128 0 50 1 0",
"lowPower 0 1",
"guiMonitor 1 1 0 0",
"cfarCfg 6 4 4 4 4 16 16 4 4 50 62 0",
"doaCfg 600 1875 30 1",
"SceneryParam -6 6 0.05 6",
"GatingParam 4 3 2 0",
"StateParam 10 5 10 100 5",
"AllocationParam 450 0.01 25 1 2",
"VariationParam 0.289 0.289 1.0",
"PointCloudEn 1",
"trackingCfg 1 2 250 20 200 50 90",
"sensorStart",
"!!!END_OF_HARD_CODED_COMMANDS"
};
#endif
/**************************************************************************
*************************** Global Variables *****************************
**************************************************************************/
/**
* @brief Global variable which tracks the CLI MCB
*/
CLI_MCB gCLI;
/**************************************************************************
**************************** CLI Functions *******************************
**************************************************************************/
/**
* @b Description
* @n
* The function is the HELP generated by the CLI Module
*
* \ingroup CLI_UTIL_INTERNAL_FUNCTION
*
* @retval
* Not Applicable.
*/
static int32_t CLI_help (int32_t argc, char* argv[])
{
uint32_t index;
/* Display the banner: */
CLI_write ("Help: This will display the usage of the CLI commands\n");
CLI_write ("Command: Help Description\n");
/* Cycle through all the registered CLI commands: */
for (index = 0; index < gCLI.numCLICommands; index++)
{
/* Display the help string*/
CLI_write ("%s: %s\n",
gCLI.cfg.tableEntry[index].cmd,
(gCLI.cfg.tableEntry[index].helpString == NULL) ?
"No help available" :
gCLI.cfg.tableEntry[index].helpString);
}
/* Is the mmWave Extension enabled? */
if (gCLI.cfg.enableMMWaveExtension == 1U)
{
/* YES: Pass the control to the extension help handler. */
CLI_MMWaveExtensionHelp ();
}
return 0;
}
/**
* @b Description
* @n
* This is the CLI Execution Task
*
* \ingroup CLI_UTIL_INTERNAL_FUNCTION
*
* @retval
* Not Applicable.
*/
static void CLI_task(UArg arg0, UArg arg1)
{
uint8_t cmdString[256];
char* tokenizedArgs[CLI_MAX_ARGS];
char* ptrCLICommand;
char delimitter[] = " \r\n";
uint32_t argIndex;
CLI_CmdTableEntry* ptrCLICommandEntry;
int32_t cliStatus;
uint32_t index;
/* Do we have a banner to be displayed? */
if (gCLI.cfg.cliBanner != NULL)
{
/* YES: Display the banner */
CLI_write (gCLI.cfg.cliBanner);
}
#ifdef USE_HARD_CODED_CONFIG
hardCodedConfigIndex = 0;
CLI_write ("Wait some time for system to initialize...\n");
Task_sleep(100);
CLI_write ("Performing hard-coded config\n");
#endif
/* Loop around forever: */
while (1)
{
/* Demo Prompt: */
CLI_write (gCLI.cfg.cliPrompt);
/* Reset the command string: */
memset ((void *)&cmdString[0], 0, sizeof(cmdString));
#ifdef USE_HARD_CODED_CONFIG
/* Run hard-coded commands, one at a time until '!!!END_OF_HARD_CODED_COMMANDS' is reached: */
if (hardCodedConfigCommands[hardCodedConfigIndex][0] != '!')
{
//CLI_write (hardCodedConfigCommands[hardCodedConfigIndex]);
CLI_write ("Command\n");
memcpy((void *)&cmdString[0], (void *)hardCodedConfigCommands[hardCodedConfigIndex], strlen(hardCodedConfigCommands[hardCodedConfigIndex]));
hardCodedConfigIndex++;
}
/* Accept commands from UART after all hard-coded commands done: */
else
{
/* Read the command message from the UART: */
UART_read (gCLI.cfg.cliUartHandle, &cmdString[0], (sizeof(cmdString) - 1));
}
#else
/* Read the command message from the UART: */
UART_read (gCLI.cfg.cliUartHandle, &cmdString[0], (sizeof(cmdString) - 1));
#endif
/* Reset all the tokenized arguments: */
memset ((void *)&tokenizedArgs, 0, sizeof(tokenizedArgs));
argIndex = 0;
ptrCLICommand = (char*)&cmdString[0];
/* comment lines found - ignore the whole line*/
if (cmdString[0]=='%') {
CLI_write ("Skipped\n");
continue;
}
/* Set the CLI status: */
cliStatus = -1;
/* The command has been entered we now tokenize the command message */
while (1)
{
/* Tokenize the arguments: */
tokenizedArgs[argIndex] = strtok(ptrCLICommand, delimitter);
if (tokenizedArgs[argIndex] == NULL)
break;
/* Increment the argument index: */
argIndex++;
if (argIndex >= CLI_MAX_ARGS)
break;
/* Reset the command string */
ptrCLICommand = NULL;
}
/* Were we able to tokenize the CLI command? */
if (argIndex == 0)
continue;
/* Cycle through all the registered CLI commands: */
for (index = 0; index < gCLI.numCLICommands; index++)
{
ptrCLICommandEntry = &gCLI.cfg.tableEntry[index];
/* Do we have a match? */
if (strcmp(ptrCLICommandEntry->cmd, tokenizedArgs[0]) == 0)
{
/* YES: Pass this to the CLI registered function */
cliStatus = ptrCLICommandEntry->cmdHandlerFxn (argIndex, tokenizedArgs);
if (cliStatus == 0)
{
CLI_write ("Done\n");
}
else
{
CLI_write ("Error %d\n", cliStatus);
}
break;
}
}
/* Did we get a matching CLI command? */
if (index == gCLI.numCLICommands)
{
/* NO matching command found. Is the mmWave extension enabled? */
if (gCLI.cfg.enableMMWaveExtension == 1U)
{
/* Yes: Pass this to the mmWave extension handler */
cliStatus = CLI_MMWaveExtensionHandler (argIndex, tokenizedArgs);
}
/* Was the CLI command found? */
if (cliStatus == -1)
{
/* No: The command was still not found */
CLI_write ("'%s' is not recognized as a CLI command\n", tokenizedArgs[0]);
}
}
}
}
/**
* @b Description
* @n
* Logging function which can log the messages to the CLI console
*
* @param[in] format
* Format string
*
* \ingroup CLI_UTIL_EXTERNAL_FUNCTION
*
* @retval
* Not Applicable.
*/
void CLI_write (const char* format, ...)
{
va_list arg;
char logMessage[256];
int32_t sizeMessage;
/* Format the message: */
va_start (arg, format);
sizeMessage = vsnprintf (&logMessage[0], sizeof(logMessage), format, arg);
va_end (arg);
/* Log the message on the UART CLI console: */
if (gCLI.cfg.usePolledMode == true)
{
/* Polled mode: */
UART_writePolling (gCLI.cfg.cliUartHandle, (uint8_t*)&logMessage[0], sizeMessage);
}
else
{
/* Blocking Mode: */
UART_write (gCLI.cfg.cliUartHandle, (uint8_t*)&logMessage[0], sizeMessage);
}
}
/**
* @b Description
* @n
* This is the function which is used to initialize and setup the CLI
*
* @param[in] ptrCLICfg
* Pointer to the CLI configuration
*
* \ingroup CLI_UTIL_EXTERNAL_FUNCTION
*
* @retval
* Success - 0
* @retval
* Error - <0
*/
int32_t CLI_open (CLI_Cfg* ptrCLICfg)
{
Task_Params taskParams;
uint32_t index;
/* Sanity Check: Validate the arguments */
if (ptrCLICfg == NULL)
return -1;
/* Initialize the CLI MCB: */
memset ((void*)&gCLI, 0, sizeof(CLI_MCB));
/* Copy over the configuration: */
memcpy ((void *)&gCLI.cfg, (void *)ptrCLICfg, sizeof(CLI_Cfg));
/* Cycle through and determine the number of supported CLI commands: */
for (index = 0; index < CLI_MAX_CMD; index++)
{
/* Do we have a valid entry? */
if (gCLI.cfg.tableEntry[index].cmd == NULL)
{
/* NO: This is the last entry */
break;
}
else
{
/* YES: Increment the number of CLI commands */
gCLI.numCLICommands = gCLI.numCLICommands + 1;
}
}
/* Is the mmWave Extension enabled? */
if (gCLI.cfg.enableMMWaveExtension == 1U)
{
/* YES: Initialize the CLI Extension: */
if (CLI_MMWaveExtensionInit (ptrCLICfg) < 0)
return -1;
}
/* Do we have a CLI Prompt specified? */
if (gCLI.cfg.cliPrompt == NULL)
gCLI.cfg.cliPrompt = "CLI:/>";
/* The CLI provides a help command by default:
* - Since we are adding this at the end of the table; a user of this module can also
* override this to provide its own implementation. */
gCLI.cfg.tableEntry[gCLI.numCLICommands].cmd = "help";
gCLI.cfg.tableEntry[gCLI.numCLICommands].helpString = NULL;
gCLI.cfg.tableEntry[gCLI.numCLICommands].cmdHandlerFxn = CLI_help;
/* Increment the number of CLI commands: */
gCLI.numCLICommands++;
/* Initialize the task parameters and launch the CLI Task: */
Task_Params_init(&taskParams);
taskParams.priority = gCLI.cfg.taskPriority;
taskParams.stackSize = 4*1024;
gCLI.*** = Task_create(CLI_task, &taskParams, NULL);
return 0;
}
/**
* @b Description
* @n
* This is the function which is used to close the CLI module
*
* \ingroup CLI_UTIL_EXTERNAL_FUNCTION
*
* @retval
* Success - 0
* @retval
* Error - <0
*/
int32_t CLI_close (void)
{
/* Shutdown the CLI Task */
Task_delete(&gCLI.***);
/* Cleanup the memory */
memset ((void*)&gCLI, 0, sizeof(CLI_MCB));
return 0;
}