From 855e07612dd6654556ce415ada1148b95c80fcfa Mon Sep 17 00:00:00 2001 From: zhaohe Date: Wed, 6 Sep 2023 05:42:18 +0800 Subject: [PATCH] update --- usrc/main.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/usrc/main.cpp b/usrc/main.cpp index fd9dedd..5ac500c 100644 --- a/usrc/main.cpp +++ b/usrc/main.cpp @@ -149,6 +149,24 @@ void regfn() { cmdScheduler.registerCmd("help", // [](int argc, char** argv, CmdScheduler::CmdProcessContext* context) { ZLOGI(TAG, "do_help"); }); + cmdScheduler.registerCmd("stepmotor45_wait_to_reach_pos", [](int argc, char** argv, CmdScheduler::CmdProcessContext* context) { + // stepmotor45_rotate motorid direction + CHECK_ARGC(2); + int motorid = atoi(argv[1]); + + if (motorid < 1 || motorid > 6) { + ZLOGE(TAG, "motorid out of range"); + return; + } + while (true) { + if (g_step_motor45[motorid].isReachTargetPos()) { + break; + } + ZLOGI(TAG, "stepmotor45_wait_to_reach_pos %d", motorid); + osDelay(100); + } + }); + // stepmotor45 cmdScheduler.registerCmd("stepmotor45_rotate", [](int argc, char** argv, CmdScheduler::CmdProcessContext* context) { // stepmotor45_rotate motorid direction