Browse Source

update

master
zhaohe 1 year ago
parent
commit
521999a447
  1. 2
      CMakeLists.txt
  2. 24
      README.md
  3. 2
      a8000_protocol
  4. 29
      iflytop_canbus/iflytop_canbus_master.cpp
  5. 12
      iflytop_canbus/iflytop_canbus_master.hpp
  6. 2
      src/mainwindow.cpp
  7. 20
      src/mainwindow.ui
  8. 98
      src/tab/xyrobot_tab.cpp
  9. 43
      src/tab/xyrobot_tab.hpp

2
CMakeLists.txt

@ -60,6 +60,8 @@ set(PROJECT_SOURCES
src/tab/pipette_ctrl_tab.cpp
src/basic/stm32_pin.cpp
src/tab/xyrobot_tab.cpp
app.rc
)

24
README.md

@ -65,17 +65,17 @@ V4:
```
ID地址:
0x080E0000
10 :A
20 :14
30 :1E
40 :28
50 :32
60 :3C
70 :46
80 :50
90 :5A
100:64
110:6E
200:CB
10 :(0x0A)
20 :(0x14)
30 :(0x1E)
40 :(0x28)
50 :(0x32)
60 :(0x3C)
70 :(0x46)
80 :(0x50)
90 :(0x5A)
100:(0x64)
110:(0x6E)
200:(0xCB)
```

2
a8000_protocol

@ -1 +1 @@
Subproject commit 6486ccf75f3e6bd05c7454ff994d8c003d908227
Subproject commit fad4311315d63e2db871959f67a0fb5e5c07af38

29
iflytop_canbus/iflytop_canbus_master.cpp

@ -7,7 +7,8 @@
using namespace iflytop;
using namespace zcr;
#define TAG "IflytopCanbusMaster"
#define TAG "IflytopCanbusMaster"
#define G_OVERTIME 100
IflytopCanbusMaster *IflytopCanbusMaster::ins() {
static IflytopCanbusMaster *ins = new IflytopCanbusMaster();
@ -99,9 +100,15 @@ void IflytopCanbusMaster::processRxPacket(zcr_cmd_header_t *frame, size_t len) {
void IflytopCanbusMaster::updateChannelConfig() { //
m_waveCan.setCanpPrameter(CANUSB_SPEED_500000, CANUSB_MODE_NORMAL, CANUSB_FRAME_EXTENDED);
}
void IflytopCanbusMaster::ping(int32_t device_id) { callcmd0(device_id, kmodule_ping, 10); }
void IflytopCanbusMaster::ping(int32_t device_id) {
int32_t param[4];
callcmd(device_id, kmodule_ping, (uint8_t *)nullptr, 0, 10);
}
void IflytopCanbusMaster::readreg(int32_t device_id, int32_t regaddr, int32_t *val) {
callcmd1(device_id, kmodule_get_reg, regaddr, 10);
int32_t param[4];
param[0] = regaddr;
callcmd(device_id, kmodule_get_reg, (uint8_t *)param, 4, 10);
*val = *(int32_t *)(&m_receipt_frame->data[0]);
}
@ -110,27 +117,27 @@ int32_t IflytopCanbusMaster::getAck(int32_t index) { return *(int32_t *)(&m_rece
uint8_t *IflytopCanbusMaster::getAckBuf() { return m_receipt_frame->data; }
int32_t IflytopCanbusMaster::getAckBufLen() { return m_receipt_len - sizeof(zcr_cmd_header_t); }
void IflytopCanbusMaster::writereg(int32_t device_id, int32_t regaddr, int32_t val) { callcmd2(device_id, kmodule_set_reg, regaddr, val, 10); }
void IflytopCanbusMaster::writereg(int32_t device_id, int32_t regaddr, int32_t val) { callcmd2(device_id, kmodule_set_reg, regaddr, val); }
void IflytopCanbusMaster::callcmd0(int32_t device_id, int32_t cmdid, int32_t overtime) { callcmd(device_id, cmdid, nullptr, 0, overtime); }
void IflytopCanbusMaster::callcmd0(int32_t device_id, int32_t cmdid) { callcmd(device_id, cmdid, nullptr, 0,G_OVERTIME); }
void IflytopCanbusMaster::callcmd1(int32_t device_id, int32_t cmdid, int32_t param0, int32_t overtime) {
void IflytopCanbusMaster::callcmd1(int32_t device_id, int32_t cmdid, int32_t param0) {
int32_t param[4];
param[0] = param0;
callcmd(device_id, cmdid, (uint8_t *)param, 4, overtime);
callcmd(device_id, cmdid, (uint8_t *)param, 4, G_OVERTIME);
}
void IflytopCanbusMaster::callcmd2(int32_t device_id, int32_t cmdid, int32_t param0, int32_t param1, int32_t overtime) {
void IflytopCanbusMaster::callcmd2(int32_t device_id, int32_t cmdid, int32_t param0, int32_t param1) {
int32_t param[4];
param[0] = param0;
param[1] = param1;
callcmd(device_id, cmdid, (uint8_t *)param, 8, overtime);
callcmd(device_id, cmdid, (uint8_t *)param, 8, G_OVERTIME);
}
void IflytopCanbusMaster::callcmd3(int32_t device_id, int32_t cmdid, int32_t param0, int32_t param1, int32_t param2, int32_t overtime) {
void IflytopCanbusMaster::callcmd3(int32_t device_id, int32_t cmdid, int32_t param0, int32_t param1, int32_t param2) {
int32_t param[4];
param[0] = param0;
param[1] = param1;
param[2] = param2;
callcmd(device_id, cmdid, (uint8_t *)param, 12, overtime);
callcmd(device_id, cmdid, (uint8_t *)param, 12, G_OVERTIME);
}
void IflytopCanbusMaster::callcmd(int32_t device_id, int32_t cmdid, uint8_t *param, int32_t paramLen, int32_t overtime) { //

12
iflytop_canbus/iflytop_canbus_master.hpp

@ -88,11 +88,11 @@ class IflytopCanbusMaster {
void regOnRawData(on_raw_data_t cb) { on_rx_raw = cb; }
void updateChannelConfig();
void callcmd(int32_t device_id, int32_t cmdid, uint8_t *param, int32_t paramLen, int32_t overtime = 100);
void callcmd0(int32_t device_id, int32_t cmdid, int32_t overtime = 100);
void callcmd1(int32_t device_id, int32_t cmdid, int32_t param0, int32_t overtime = 100);
void callcmd2(int32_t device_id, int32_t cmdid, int32_t param0, int32_t param1, int32_t overtime = 100);
void callcmd3(int32_t device_id, int32_t cmdid, int32_t param0, int32_t param1, int32_t param2, int32_t overtime = 100);
void callcmd(int32_t device_id, int32_t cmdid, uint8_t *param, int32_t paramLen, int32_t overtime);
void callcmd0(int32_t device_id, int32_t cmdid);
void callcmd1(int32_t device_id, int32_t cmdid, int32_t param0);
void callcmd2(int32_t device_id, int32_t cmdid, int32_t param0, int32_t param1);
void callcmd3(int32_t device_id, int32_t cmdid, int32_t param0, int32_t param1, int32_t param2);
void sendraw(int32_t fromId, uint8_t *data, size_t len);
@ -114,7 +114,7 @@ class IflytopCanbusMaster {
void step_motor_easy_move_to(int32_t device_id, int32_t position) { callcmd1(device_id, kstep_motor_easy_move_to, position); }
void step_motor_easy_move_to_zero(int32_t device_id) { callcmd0(device_id, kstep_motor_easy_move_to_zero); }
void step_motor_easy_set_current_pos(int32_t device_id, int32_t position) { callcmd1(device_id, kstep_motor_easy_set_current_pos, position); }
void step_motor_easy_move_to_io(int32_t device_id, int32_t io, int32_t direction) { callcmd1(device_id, kstep_motor_easy_move_to_io, io, direction); }
void step_motor_easy_move_to_io(int32_t device_id, int32_t io, int32_t direction) { callcmd2(device_id, kstep_motor_easy_move_to_io, io, direction); }
void step_motor_active_cfg(int32_t device_id) { callcmd0(device_id, kstep_motor_active_cfg); }
void step_motor_read_io_state(int32_t device_id, int32_t io, int32_t *state) {
callcmd1(device_id, kstep_motor_read_io_state, io);

2
src/mainwindow.cpp

@ -29,6 +29,7 @@
#include "tab/pipette_ctrl_tab.hpp"
#include "tab/step_motor_ctrl_tab.hpp"
#include "tab/water_cooling_temperature_tab.hpp"
#include "tab/xyrobot_tab.hpp"
#include "version.h"
using namespace std;
@ -302,6 +303,7 @@ void MainWindow::constructAppUI() {
WaterCoolingTemperatureControlerTab::inst()->construct(ui->buttonTabWidget);
FanCtrlTab::inst()->construct(ui->buttonTabWidget);
XYRobotTab::inst()->construct(ui->buttonTabWidget);
}
void MainWindow::on_PublicState_ConfirmKey_clicked() {}

20
src/mainwindow.ui

@ -992,12 +992,12 @@ QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'SimSun'; font-size:9pt; font-weight:400; font-style:normal;">
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Consolas','Courier New','monospace'; font-size:11pt; color:#ff0000;">10  机械臂 </span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Consolas','Courier New','monospace'; font-size:11pt; color:#ff0000;">10(0x0A)  机械臂 </span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Consolas','Courier New','monospace'; font-size:11pt; color:#ff0000;"> XY机械臂模块(11)</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Consolas','Courier New','monospace'; font-size:11pt; color:#ff0000;">20  板夹仓模块 </span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Consolas','Courier New','monospace'; font-size:11pt; color:#ff0000;">20(0x14)  板夹仓模块 </span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Consolas','Courier New','monospace'; font-size:11pt; color:#ff0000;"> 板夹仓平移电机(21)</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Consolas','Courier New','monospace'; font-size:11pt; color:#ff0000;"> 板夹枪推杆电机(22)</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Consolas','Courier New','monospace'; font-size:11pt; color:#ff0000;">30  摇匀模组</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Consolas','Courier New','monospace'; font-size:11pt; color:#ff0000;">30(0x1E)  摇匀模组</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Consolas','Courier New','monospace'; font-size:11pt; color:#ff0000;"> 31:步进夹爪 (单位0.1mm,单边开合范围0->9mm,打开为正方向)</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Consolas','Courier New','monospace'; font-size:11pt; color:#ff0000;"> 32:步进升降 (正转向下,0.1mm)</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Consolas','Courier New','monospace'; font-size:11pt; color:#ff0000;"> 33:步进摇匀 (360为1圈)</span></p>
@ -1006,9 +1006,9 @@ p, li { white-space: pre-wrap; }
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Consolas','Courier New','monospace'; font-size:11pt; color:#ff0000;"> 36:舵机-试管扫码夹紧(舵机一圈3600)</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Consolas','Courier New','monospace'; font-size:11pt; color:#ff0000;"> 37:舵机-试管旋转</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Consolas','Courier New','monospace'; font-size:11pt; color:#ff0000;"> </span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Consolas','Courier New','monospace'; font-size:11pt; color:#ff0000;">40  孵育盘加热 加热模块</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Consolas','Courier New','monospace'; font-size:11pt; color:#ff0000;">50  板夹仓加热</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Consolas','Courier New','monospace'; font-size:11pt; color:#ff0000;">60  进出料 </span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Consolas','Courier New','monospace'; font-size:11pt; color:#ff0000;">40(0x28)  孵育盘加热 加热模块</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Consolas','Courier New','monospace'; font-size:11pt; color:#ff0000;">50(0x32)  板夹仓加热</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Consolas','Courier New','monospace'; font-size:11pt; color:#ff0000;">60(0x3C)  进出料 </span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Consolas','Courier New','monospace'; font-size:11pt; color:#ff0000;"> IO扩展板(60)</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Consolas','Courier New','monospace'; font-size:11pt; color:#ff0000;"> IO0:试管高低</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Consolas','Courier New','monospace'; font-size:11pt; color:#ff0000;"> IO1:转移通道外光电</span></p>
@ -1020,18 +1020,18 @@ p, li { white-space: pre-wrap; }
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Consolas','Courier New','monospace'; font-size:11pt; color:#ff0000;"> 转移电机(62)</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Consolas','Courier New','monospace'; font-size:11pt; color:#ff0000;"> 出料电机(63)</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Consolas','Courier New','monospace'; font-size:11pt; color:#ff0000;"> 扫码器(64)</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Consolas','Courier New','monospace'; font-size:11pt; color:#ff0000;">70  孵育盘 </span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Consolas','Courier New','monospace'; font-size:11pt; color:#ff0000;">70(0x46)  孵育盘 </span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Consolas','Courier New','monospace'; font-size:11pt; color:#ff0000;"> 孵育盘转盘(71)</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Consolas','Courier New','monospace'; font-size:11pt; color:#ff0000;">80  机械臂Z轴 </span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Consolas','Courier New','monospace'; font-size:11pt; color:#ff0000;">80(0x50)  机械臂Z轴 </span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Consolas','Courier New','monospace'; font-size:11pt; color:#ff0000;"> Z轴升降(81)</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Consolas','Courier New','monospace'; font-size:11pt; color:#ff0000;"> 移液枪(82)</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Consolas','Courier New','monospace'; font-size:11pt; color:#ff0000;"> 扫码器(83)</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Consolas','Courier New','monospace'; font-size:11pt; color:#ff0000;">90  光学模组 </span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Consolas','Courier New','monospace'; font-size:11pt; color:#ff0000;">90(0x5A)  光学模组 </span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Consolas','Courier New','monospace'; font-size:11pt; color:#ff0000;"> 拍照电机(91)</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Consolas','Courier New','monospace'; font-size:11pt; color:#ff0000;"> 推杆电机(92)</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Consolas','Courier New','monospace'; font-size:11pt; color:#ff0000;"> 光学模块(93)</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Consolas','Courier New','monospace'; font-size:11pt; color:#ff0000;"> 光学板(90)</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Consolas','Courier New','monospace'; font-size:11pt; color:#ff0000;">100 ID卡读卡器 </span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Consolas','Courier New','monospace'; font-size:11pt; color:#ff0000;">100(0x64) ID卡读卡器 </span></p>
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Consolas','Courier New','monospace'; font-size:11pt; color:#ff0000;&quot;&gt; 读卡器(101)&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>

98
src/tab/xyrobot_tab.cpp

@ -0,0 +1,98 @@
#include "xyrobot_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 "../basic/stm32_pin.hpp"
#include "./mainwindow.h"
#include "zui\zqui.hpp"
//
using namespace iflytop;
using namespace std;
extern Ui::MainWindow *main_ui;
extern int getDeviceId();
XYRobotTab *XYRobotTab::inst() {
static XYRobotTab *ins = new XYRobotTab();
return ins;
}
static inline const char *hex2binstr(int32_t hex) {
static char buf[32];
sprintf(buf, "%d%d%d%d_%d%d%d%d", (hex >> 7) & 1, (hex >> 6) & 1, (hex >> 5) & 1, (hex >> 4) & 1, (hex >> 3) & 1, (hex >> 2) & 1, (hex >> 1) & 1, (hex >> 0) & 1);
return buf;
}
void XYRobotTab::construct(QTabWidget *fathertab) {
ZQVTabPage *tab = new ZQVTabPage(fathertab, "XY-Robot");
/***********************************************************************************************************************
* *
***********************************************************************************************************************/
{
ZQFunctionListBox *box = new ZQFunctionListBox(tab, "方法", 4);
box->newFunc("使能", {}, [this](int argn, const char **args) { ICM->callcmd1(getDeviceId(), kxymotor_enable, 1); });
box->newFunc("失能", {}, [this](int argn, const char **args) { ICM->callcmd1(getDeviceId(), kxymotor_enable, 0); });
box->newFunc("相对移动", {"dx", "dy", "velocity"}, [this](int argn, const char **args) { ICM->callcmd3(getDeviceId(), kxymotor_move_by, atoi(args[0]), atoi(args[1]), atoi(args[2])); });
box->newFunc("绝对移动", {"x", "y", "velocity"}, [this](int argn, const char **args) { ICM->callcmd3(getDeviceId(), kxymotor_move_to, atoi(args[0]), atoi(args[1]), atoi(args[2])); });
box->newFunc("移动到原点", {}, [this](int argn, const char **args) { ICM->callcmd0(getDeviceId(), kxymotor_move_to_zero); });
box->newFunc("读取位置", {}, [this](int argn, const char **args) {
int32_t x, y;
ICM->callcmd0(getDeviceId(), kxymotor_read_pos);
x = ICM->getAck(0);
y = ICM->getAck(1);
ZQUI::ins()->ishow("x,y(%d,%d)", x, y);
});
}
/***********************************************************************************************************************
* *
***********************************************************************************************************************/
{
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("default_velocity", kreg_xyrobot_default_velocity, ZRegItem::krw | ZRegItem::kdec);
tableBox->addReg("default_acc", kreg_xyrobot_default_acc, ZRegItem::krw | ZRegItem::kdec);
tableBox->addReg("default_dec", kreg_xyrobot_default_dec, ZRegItem::krw | ZRegItem::kdec);
tableBox->addReg("default_break_dec", kreg_xyrobot_default_break_dec, ZRegItem::krw | ZRegItem::kdec);
tableBox->addReg("run_to_zero_speed", kreg_xyrobot_run_to_zero_speed, ZRegItem::krw | ZRegItem::kdec);
tableBox->addReg("run_to_zero_dec", kreg_xyrobot_run_to_zero_dec, ZRegItem::krw | ZRegItem::kdec);
tableBox->addReg("look_zero_edge_speed", kreg_xyrobot_look_zero_edge_speed, ZRegItem::krw | ZRegItem::kdec);
tableBox->addReg("look_zero_edge_dec", kreg_xyrobot_look_zero_edge_dec, ZRegItem::krw | ZRegItem::kdec);
tableBox->addReg("ihold", kreg_xyrobot_ihold, ZRegItem::krw | ZRegItem::kdec);
tableBox->addReg("irun", kreg_xyrobot_irun, ZRegItem::krw | ZRegItem::kdec);
tableBox->addReg("iholddelay", kreg_xyrobot_iholddelay, ZRegItem::krw | ZRegItem::kdec);
tableBox->addReg("robot_type", kreg_xyrobot_robot_type, ZRegItem::krw | ZRegItem::kdec);
tableBox->addReg("x_shift", kreg_xyrobot_x_shift, ZRegItem::krw | ZRegItem::kdec);
tableBox->addReg("y_shift", kreg_xyrobot_y_shift, ZRegItem::krw | ZRegItem::kdec);
tableBox->addReg("x_shaft", kreg_xyrobot_x_shaft, ZRegItem::krw | ZRegItem::kdec);
tableBox->addReg("y_shaft", kreg_xyrobot_y_shaft, ZRegItem::krw | ZRegItem::kdec);
tableBox->addReg("x_one_circle_pulse", kreg_xyrobot_x_one_circle_pulse, ZRegItem::krw | ZRegItem::kdec);
tableBox->addReg("y_one_circle_pulse", kreg_xyrobot_y_one_circle_pulse, ZRegItem::krw | ZRegItem::kdec);
tableBox->addReg("run_to_zero_max_x_d", kreg_xyrobot_run_to_zero_max_x_d, ZRegItem::krw | ZRegItem::kdec);
tableBox->addReg("run_to_zero_max_y_d", kreg_xyrobot_run_to_zero_max_y_d, ZRegItem::krw | ZRegItem::kdec);
tableBox->addReg("look_zero_edge_max_x_d", kreg_xyrobot_look_zero_edge_max_x_d, ZRegItem::krw | ZRegItem::kdec);
tableBox->addReg("look_zero_edge_max_y_d", kreg_xyrobot_look_zero_edge_max_y_d, ZRegItem::krw | ZRegItem::kdec);
tableBox->addReg("io_state0", kreg_xyrobot_io_state0, ZRegItem::krw | ZRegItem::kbinary);
tableBox->addSpacer();
}
tab->addSpacer();
}

43
src/tab/xyrobot_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 XYRobotTab {
public:
static XYRobotTab *inst();
void construct(QTabWidget *fathertab);
};
} // namespace iflytop
Loading…
Cancel
Save