给xcmd_print添加宏定义参数
This commit is contained in:
parent
496dcb9ea4
commit
7bb6f83c75
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* @Author: your name
|
||||
* @Date: 2021-09-17 23:03:06
|
||||
* @LastEditTime: 2021-09-17 23:07:03
|
||||
* @LastEditTime: 2021-09-22 21:59:50
|
||||
* @LastEditors: Please set LastEditors
|
||||
* @Description: In User Settings Edit
|
||||
* @FilePath: /xcmd/inc/xcmd_confg.h
|
||||
|
@ -15,10 +15,16 @@ extern "C" {
|
|||
|
||||
#define VERSION "1.0.0"
|
||||
|
||||
#define XCMD_LINE_MAX_LENGTH (64) /* 命令行支持的最大字符数 */
|
||||
#define XCMD_LINE_MAX_LENGTH (256) /* 命令行支持的最大字符数 */
|
||||
#define XCMD_PRINT_BUF_MAX_LENGTH (128) /* xcmd_print缓存 */
|
||||
#define XCMD_HISTORY_MAX_NUM (8) /* 支持的历史记录个数,0为不支持 */
|
||||
#define XCMD_PARAM_MAX_NUM (16) /* 支持输入的参数个数 */
|
||||
|
||||
#if XCMD_PRINT_BUF_MAX_LENGTH < (XCMD_LINE_MAX_LENGTH+32)
|
||||
#undef XCMD_PRINT_BUF_MAX_LENGTH
|
||||
#define XCMD_PRINT_BUF_MAX_LENGTH (XCMD_LINE_MAX_LENGTH+32) /* xcmd_print缓存 */
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -246,10 +246,10 @@ static void xcmd_parser(uint8_t byte)
|
|||
|
||||
void xcmd_print(const char *fmt, ...)
|
||||
{
|
||||
char ucstring[128] = {0};
|
||||
char ucstring[XCMD_PRINT_BUF_MAX_LENGTH] = {0};
|
||||
va_list arg;
|
||||
va_start(arg, fmt);
|
||||
vsnprintf(ucstring, 128, fmt, arg);
|
||||
vsnprintf(ucstring, XCMD_PRINT_BUF_MAX_LENGTH, fmt, arg);
|
||||
va_end(arg);
|
||||
|
||||
for(uint16_t i=0; ucstring[i]; i++)
|
||||
|
|
Loading…
Reference in New Issue