Browse Source

update

master
zhaohe 2 years ago
parent
commit
1aa9ede09b
  1. 16
      usrc/main.cpp

16
usrc/main.cpp

@ -173,7 +173,6 @@ void regfn() {
}); });
cmdScheduler.registerCmd("stepmotor45_moveTo", [](int argc, char** argv, CmdScheduler::CmdProcessContext* context) { cmdScheduler.registerCmd("stepmotor45_moveTo", [](int argc, char** argv, CmdScheduler::CmdProcessContext* context) {
// stepmotor45_rotate motorid pos
CHECK_ARGC(2); CHECK_ARGC(2);
int motorid = atoi(argv[1]); int motorid = atoi(argv[1]);
int pos = atoi(argv[2]); int pos = atoi(argv[2]);
@ -187,7 +186,6 @@ void regfn() {
}); });
cmdScheduler.registerCmd("stepmotor45_moveBy", [](int argc, char** argv, CmdScheduler::CmdProcessContext* context) { cmdScheduler.registerCmd("stepmotor45_moveBy", [](int argc, char** argv, CmdScheduler::CmdProcessContext* context) {
// stepmotor45_rotate motorid pos
CHECK_ARGC(2); CHECK_ARGC(2);
int motorid = atoi(argv[1]); int motorid = atoi(argv[1]);
int pos = atoi(argv[2]); int pos = atoi(argv[2]);
@ -201,7 +199,6 @@ void regfn() {
}); });
cmdScheduler.registerCmd("stepmotor45_stop", [](int argc, char** argv, CmdScheduler::CmdProcessContext* context) { cmdScheduler.registerCmd("stepmotor45_stop", [](int argc, char** argv, CmdScheduler::CmdProcessContext* context) {
// stepmotor45_rotate motorid pos
CHECK_ARGC(1); CHECK_ARGC(1);
int motorid = atoi(argv[1]); int motorid = atoi(argv[1]);
@ -213,6 +210,19 @@ void regfn() {
g_step_motor45[motorid].stop(); g_step_motor45[motorid].stop();
}); });
cmdScheduler.registerCmd("stepmotor45_setSpeed", [](int argc, char** argv, CmdScheduler::CmdProcessContext* context) {
CHECK_ARGC(1);
int motorid = atoi(argv[1]);
int speed = atoi(argv[2]);
if (motorid < 1 || motorid > 6) {
ZLOGE(TAG, "motorid out of range");
return;
}
g_step_motor45[motorid].setDefaultSpeed(speed);
});
/******************************************************************************* /*******************************************************************************
* ²½½øµç»ú * * ²½½øµç»ú *
*******************************************************************************/ *******************************************************************************/

Loading…
Cancel
Save