From 211cd2315e154d07d22944cad255e48a70ae4cfc Mon Sep 17 00:00:00 2001 From: zhaohe Date: Sun, 15 Oct 2023 16:49:47 +0800 Subject: [PATCH] update --- components/cmdscheduler/cmd_scheduler.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/components/cmdscheduler/cmd_scheduler.cpp b/components/cmdscheduler/cmd_scheduler.cpp index 6021d3f..211f88f 100644 --- a/components/cmdscheduler/cmd_scheduler.cpp +++ b/components/cmdscheduler/cmd_scheduler.cpp @@ -7,7 +7,7 @@ #include "sdk\components\zprotocols\errorcode\errorcode.hpp" using namespace iflytop; -#define TAG "CmdScheduler" +#define TAG "CMD" void CmdScheduler::registerCmd(std::string cmd, const char* helpinfo, int npara, call_cmd_t call_cmd) { CMD cmdinfo; @@ -19,13 +19,17 @@ void CmdScheduler::registerCmd(std::string cmd, const char* helpinfo, int npara, void CmdScheduler::regbasiccmd() { this->registerCmd("help", "", 0, [this](Context* context) { - ZLOGI(TAG, "help"); ZLOGI(TAG, "cmdlist:"); for (auto it = m_cmdMap.begin(); it != m_cmdMap.end(); it++) { ZLOGI(TAG, " %s %s", it->first.c_str(), it->second.help_info.c_str()); } return (int32_t)0; }); + this->registerCmd("sleep_ms", "", 1, [this](Context* context) { + int ms = atoi(context->argv[1]); + osDelay(ms); + return 0; + }); } void CmdScheduler::initialize(UART_HandleTypeDef* huart, uint32_t rxbufsize) {