Browse Source

update

master
zhaohe 1 year ago
parent
commit
e859289827
  1. 3
      .vscode/settings.json
  2. 1
      CMakeLists.txt
  3. 2
      src/mainwindow.cpp
  4. 4
      src/tab/board_ext_tab.cpp
  5. 4
      src/tab/code_scaner_tab.cpp
  6. 4
      src/tab/mini_servo_tab.cpp
  7. 68
      src/tab/pipette_ctrl_tab.cpp
  8. 43
      src/tab/pipette_ctrl_tab.hpp
  9. 25
      src/tab/step_motor_ctrl_tab.cpp

3
.vscode/settings.json

@ -121,7 +121,8 @@
"xmemory": "cpp",
"xtr1common": "cpp",
"xtree": "cpp",
"xutility": "cpp"
"xutility": "cpp",
"qstatusbar": "cpp"
},
"files.autoGuessEncoding": false,
}

1
CMakeLists.txt

@ -55,6 +55,7 @@ set(PROJECT_SOURCES
a8000_protocol/api/apibasic/errorcode.cpp
src/tab/pipette_ctrl_tab.cpp
app.rc
)

2
src/mainwindow.cpp

@ -26,6 +26,7 @@
#include "tab/mini_servo_tab.hpp"
#include "tab/module_opera_tab.hpp"
#include "tab/step_motor_ctrl_tab.hpp"
#include "tab/pipette_ctrl_tab.hpp"
#include "version.h"
using namespace std;
@ -296,6 +297,7 @@ void MainWindow::constructAppUI() {
MiniServoTab::inst()->construct(ui->buttonTabWidget);
CodeScanerTab::inst()->construct(ui->buttonTabWidget);
PipetteCtrlTab::inst()->construct(ui->buttonTabWidget);
}
void MainWindow::on_PublicState_ConfirmKey_clicked() {}

4
src/tab/board_ext_tab.cpp

@ -66,10 +66,6 @@ void BoardExtTab::construct(QTabWidget *fathertab) {
return true;
});
tableBox->addReg("mod-version", kreg_module_version, ZRegItem::krw | ZRegItem::kdec);
tableBox->addReg("mod-type", kreg_module_type, ZRegItem::krw | ZRegItem::kdec);
tableBox->addReg("mod-status", kreg_module_status, ZRegItem::krw | ZRegItem::kdec);
tableBox->addReg("mod-errorcode", kreg_module_errorcode, ZRegItem::krw | ZRegItem::kdec);
tableBox->addSpacer();
}

4
src/tab/code_scaner_tab.cpp

@ -69,10 +69,6 @@ void CodeScanerTab::construct(QTabWidget *fathertab) {
return true;
});
tableBox->addReg("mod-version", kreg_module_version, ZRegItem::krw | ZRegItem::kdec);
tableBox->addReg("mod-type", kreg_module_type, ZRegItem::krw | ZRegItem::kdec);
tableBox->addReg("mod-status", kreg_module_status, ZRegItem::krw | ZRegItem::kdec);
tableBox->addReg("mod-errorcode", kreg_module_errorcode, ZRegItem::krw | ZRegItem::kdec);
tableBox->addSpacer();
}

4
src/tab/mini_servo_tab.cpp

@ -65,10 +65,6 @@ void MiniServoTab::construct(QTabWidget *fathertab) {
return true;
});
tableBox->addReg("mod-version", kreg_module_version, ZRegItem::krw | ZRegItem::kdec);
tableBox->addReg("mod-type", kreg_module_type, ZRegItem::krw | ZRegItem::kdec);
tableBox->addReg("mod-status", kreg_module_status, ZRegItem::krw | ZRegItem::kdec);
tableBox->addReg("mod-errorcode", kreg_module_errorcode, ZRegItem::krw | ZRegItem::kdec);
tableBox->addReg("pos", kreg_mini_servo_pos, ZRegItem::krw | ZRegItem::kdec);
tableBox->addReg("limit-torque(位置模式,速度模式有效)", kreg_mini_servo_limit_torque, ZRegItem::krw | ZRegItem::kdec);

68
src/tab/pipette_ctrl_tab.cpp

@ -0,0 +1,68 @@
#include "pipette_ctrl_tab.hpp"
#include "iflytop_canbus/iflytop_canbus_master.hpp"
#include "logger.hpp"
#include "qt_serial_datachannel.hpp"
#include "zexception.hpp"
#include "zui/z_function_list_box.hpp"
#include "zui/z_reg_table_list_box.hpp"
#include "zui/zq_vtab_page.hpp"
//
#include "./mainwindow.h"
#include "zui\zqui.hpp"
//
using namespace iflytop;
using namespace std;
extern Ui::MainWindow *main_ui;
extern int getDeviceId();
PipetteCtrlTab *PipetteCtrlTab::inst() {
static PipetteCtrlTab *ins = new PipetteCtrlTab();
return ins;
}
void PipetteCtrlTab::construct(QTabWidget *fathertab) {
/***********************************************************************************************************************
* *
***********************************************************************************************************************/
// kpipette_ctrl_init_device
// kpipette_ctrl_put_tip
// kpipette_ctrl_move_to_ul
ZQVTabPage *tab = new ZQVTabPage(fathertab, "移液枪操作");
{
ZQFunctionListBox *box = new ZQFunctionListBox(tab, "移液枪操作", 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) { ICM->callcmd0(getDeviceId(), kpipette_ctrl_init_device); });
box->newFunc("推出吸头", {}, [this](int argn, const char **args) { ICM->callcmd0(getDeviceId(), kpipette_ctrl_put_tip); });
box->newFunc("移动到指定位置", {"ul"}, [this](int argn, const char **args) { ICM->callcmd1(getDeviceId(), kpipette_ctrl_move_to_ul, atoi(args[0])); });
}
tab->addSpacer();
{
ZRegTableList *tableBox = new ZRegTableList(tab, "寄存器操作");
tableBox->initializeRegOperation(
[this](int32_t add, int32_t val) { //
ICM->writereg(getDeviceId(), add, val);
return true;
},
[this](int32_t add, int32_t *val) { //
ICM->readreg(getDeviceId(), add, val);
return true;
});
tableBox->addReg("reg_pipette_pos_ul", kreg_pipette_pos_ul, ZRegItem::krw | ZRegItem::kdec);
tableBox->addReg("reg_pipette_capactitance_val", kreg_pipette_capactitance_val, ZRegItem::krw | ZRegItem::kdec);
tableBox->addReg("reg_pipette_tip_state", kreg_pipette_tip_state, ZRegItem::krw | ZRegItem::kdec);
tableBox->addReg("reg_pipette_limit_ul", kreg_pipette_limit_ul, ZRegItem::krw | ZRegItem::kdec);
tableBox->addSpacer();
tab->addSpacer();
}
}

43
src/tab/pipette_ctrl_tab.hpp

@ -0,0 +1,43 @@
#pragma once
#include <QDateTime>
#include <QMainWindow>
#include <QMessageBox>
#include <QObject>
#include <QtConcurrent>
#include <QtCore/QVariant>
#include <QtSerialPort/QSerialPort>
#include <QtSerialPort/QSerialPortInfo>
#include <QtWidgets/QAction>
#include <QtWidgets/QApplication>
#include <QtWidgets/QComboBox>
#include <QtWidgets/QFormLayout>
#include <QtWidgets/QGridLayout>
#include <QtWidgets/QGroupBox>
#include <QtWidgets/QHBoxLayout>
#include <QtWidgets/QLabel>
#include <QtWidgets/QLineEdit>
#include <QtWidgets/QMainWindow>
#include <QtWidgets/QMenu>
#include <QtWidgets/QMenuBar>
#include <QtWidgets/QPushButton>
#include <QtWidgets/QSpacerItem>
#include <QtWidgets/QStatusBar>
#include <QtWidgets/QTabWidget>
#include <QtWidgets/QTextBrowser>
#include <QtWidgets/QTextEdit>
#include <QtWidgets/QVBoxLayout>
#include <QtWidgets/QWidget>
//
#include <functional>
namespace iflytop {
using namespace std;
class PipetteCtrlTab {
public:
static PipetteCtrlTab *inst();
void construct(QTabWidget *fathertab);
};
} // namespace iflytop

25
src/tab/step_motor_ctrl_tab.cpp

@ -50,6 +50,16 @@ void StepMotorCtrlTab::construct(QTabWidget *fathertab) {
{
ZQFunctionListBox *box = new ZQFunctionListBox(tab, "方法组2", 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])); });
}
{
ZQFunctionListBox *box = new ZQFunctionListBox(tab, "方法组3", 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;
@ -204,16 +214,6 @@ void StepMotorCtrlTab::construct(QTabWidget *fathertab) {
});
}
{
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();
}
@ -230,11 +230,6 @@ void StepMotorCtrlTab::constructRegTab(QTabWidget *fathertab) {
return true;
});
tableBox->addReg("mod-version", kreg_module_version, ZRegItem::krw | ZRegItem::kdec);
tableBox->addReg("mod-type", kreg_module_type, ZRegItem::krw | ZRegItem::kdec);
tableBox->addReg("mod-status", kreg_module_status, ZRegItem::krw | ZRegItem::kdec);
tableBox->addReg("mod-errorcode", kreg_module_errorcode, ZRegItem::krw | ZRegItem::kdec);
tableBox->addReg("motor_pos", kreg_step_motor_pos, ZRegItem::krw | ZRegItem::kdec);
tableBox->addReg("motor_dpos", kreg_step_motor_dpos, ZRegItem::krw | ZRegItem::kdec);

Loading…
Cancel
Save