From d27d03b79b19debd3240b5ec8bd919db09d95904 Mon Sep 17 00:00:00 2001 From: zhaohe Date: Wed, 5 Jun 2024 22:27:15 +0800 Subject: [PATCH] Version5 --- src/tab/step_motor_ctrl_tab.cpp | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/tab/step_motor_ctrl_tab.cpp b/src/tab/step_motor_ctrl_tab.cpp index a3266af..4dcf8fe 100644 --- a/src/tab/step_motor_ctrl_tab.cpp +++ b/src/tab/step_motor_ctrl_tab.cpp @@ -42,21 +42,14 @@ void StepMotorCtrlTab::construct(QTabWidget *fathertab) { ZQVTabPage *tab = new ZQVTabPage(fathertab, "步进电机"); { - ZQFunctionListBox *box = new ZQFunctionListBox(tab, "方法", 4); - + ZQFunctionListBox *box = new ZQFunctionListBox(tab, "方法组1", 4); box->newFunc("使能", {"enable"}, [this](int argn, const char **args) { ICM->step_motor_enable(getDeviceId(), atoi(args[0])); }); box->newFunc("停止", {}, [this](int argn, const char **args) { ICM->step_motor_stop(getDeviceId(), 0); }); box->newFunc("激活配置", {}, [this](int argn, const char **args) { ICM->step_motor_active_cfg(getDeviceId()); }); - box->newFunc("", {}, [this](int argn, const char **args) {}); - - box->newFunc("旋转", {"direction"}, [this](int argn, const char **args) { ICM->step_motor_easy_rotate(getDeviceId(), atoi(args[0])); }); - box->newFunc("相对移动", {"distance"}, [this](int argn, const char **args) { ICM->step_motor_easy_move_by(getDeviceId(), atoi(args[0])); }); - box->newFunc("移动到", {"position"}, [this](int argn, const char **args) { ICM->step_motor_easy_move_to(getDeviceId(), atoi(args[0])); }); - box->newFunc("归零", {}, [this](int argn, const char **args) { ICM->step_motor_easy_move_to_zero(getDeviceId()); }); - box->newFunc("移动到终点", {}, [this](int argn, const char **args) { ICM->callcmd0(getDeviceId(), kstep_motor_easy_move_to_end_point); }); - box->newFunc("移动到IO", {"ioindex", "direction"}, [this](int argn, const char **args) { ICM->step_motor_easy_move_to_io(getDeviceId(), atoi(args[0]), atoi(args[1])); }); + } - box->newFunc("", {}, [this](int argn, const char **args) {}); + { + ZQFunctionListBox *box = new ZQFunctionListBox(tab, "方法组2", 4); box->newFunc("设置当前位置", {"position"}, [this](int argn, const char **args) { ICM->step_motor_easy_set_current_pos(getDeviceId(), atoi(args[0])); }); box->newFunc("读取位置", {}, [this](int argn, const char **args) { int32_t pos = 0; @@ -91,6 +84,17 @@ void StepMotorCtrlTab::construct(QTabWidget *fathertab) { ZQUI::ins()->ishow("stst :%d", status.stst); }); } + + { + ZQFunctionListBox *box = new ZQFunctionListBox(tab, "方法组3", 4); + box->newFunc("旋转", {"direction"}, [this](int argn, const char **args) { ICM->step_motor_easy_rotate(getDeviceId(), atoi(args[0])); }); + box->newFunc("相对移动", {"distance"}, [this](int argn, const char **args) { ICM->step_motor_easy_move_by(getDeviceId(), atoi(args[0])); }); + box->newFunc("移动到", {"position"}, [this](int argn, const char **args) { ICM->step_motor_easy_move_to(getDeviceId(), atoi(args[0])); }); + box->newFunc("归零", {}, [this](int argn, const char **args) { ICM->step_motor_easy_move_to_zero(getDeviceId()); }); + box->newFunc("移动到终点", {}, [this](int argn, const char **args) { ICM->callcmd0(getDeviceId(), kstep_motor_easy_move_to_end_point); }); + box->newFunc("移动到IO", {"ioindex", "direction"}, [this](int argn, const char **args) { ICM->step_motor_easy_move_to_io(getDeviceId(), atoi(args[0]), atoi(args[1])); }); + } + tab->addSpacer(); }