From 2cf017488b0ecec5a87f5144e3e0216000a7ff06 Mon Sep 17 00:00:00 2001 From: zhaohe Date: Tue, 4 Jun 2024 18:25:01 +0800 Subject: [PATCH] update --- a8000_protocol | 2 +- iflytop_canbus/iflytop_canbus_master.cpp | 3 ++ iflytop_canbus/iflytop_canbus_master.hpp | 2 +- src/mainwindow.ui | 50 ++++++++++++++++++++++++++++++++ src/tab/mini_servo_tab.cpp | 13 +++++---- 5 files changed, 63 insertions(+), 7 deletions(-) diff --git a/a8000_protocol b/a8000_protocol index f41c0ba..a713580 160000 --- a/a8000_protocol +++ b/a8000_protocol @@ -1 +1 @@ -Subproject commit f41c0ba7a5ca666a6038621f813001a530316a97 +Subproject commit a71358065a9e7359f5a282d687d430ae4e2a324e diff --git a/iflytop_canbus/iflytop_canbus_master.cpp b/iflytop_canbus/iflytop_canbus_master.cpp index 27b4d0a..1608c45 100644 --- a/iflytop_canbus/iflytop_canbus_master.cpp +++ b/iflytop_canbus/iflytop_canbus_master.cpp @@ -134,6 +134,9 @@ void IflytopCanbusMaster::callcmd(int32_t device_id, int32_t cmdid, uint8_t *par zcr_cmd_header_t *frame = (zcr_cmd_header_t *)m_txbuf; frame->cmdMainId = cmdid >> 8; frame->cmdSubId = cmdid & 0xff; + if (m_txindex < 60000) { + m_txindex = 60000; + } frame->packetindex = m_txindex; frame->subModuleid = device_id; diff --git a/iflytop_canbus/iflytop_canbus_master.hpp b/iflytop_canbus/iflytop_canbus_master.hpp index dbf35ef..bce0548 100644 --- a/iflytop_canbus/iflytop_canbus_master.hpp +++ b/iflytop_canbus/iflytop_canbus_master.hpp @@ -69,7 +69,7 @@ class IflytopCanbusMaster { mutex m_tx_lock; uint8_t m_txbuf[1024]; int32_t m_rxsize; - uint8_t m_txindex = 0; + uint16_t m_txindex = 0; WaveshareCan m_waveCan; diff --git a/src/mainwindow.ui b/src/mainwindow.ui index 040a4c5..b4701d9 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -921,6 +921,56 @@ QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical { 基础页 + + + + 30 + 20 + 541 + 611 + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<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;"> 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;"> 板夹仓平移电机(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;"> 31:步进夹爪</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:步进摇匀</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;"> 34:舵机-试管帽夹爪-水平移动(舵机一圈3600,中点1800)</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;"> 35:舵机-试管帽夹爪(夹紧点为1800)</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;"> 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;"> 进料电机(61)</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;"> 转移电机(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;"> 扫码器(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;"> 孵育盘转盘(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;"> 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;"> 拍照电机(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;"> 读卡器(101)</span></p></body></html> + + diff --git a/src/tab/mini_servo_tab.cpp b/src/tab/mini_servo_tab.cpp index d542dcb..d3760c3 100644 --- a/src/tab/mini_servo_tab.cpp +++ b/src/tab/mini_servo_tab.cpp @@ -38,8 +38,11 @@ void MiniServoTab::construct(QTabWidget *fathertab) { }); box->newFunc("激活配置", {}, [this](int argn, const char **args) { ICM->callcmd0(getDeviceId(), kmini_servo_active_cfg); }); box->newFunc("停止", {"breakstop"}, [this](int argn, const char **args) { ICM->callcmd1(getDeviceId(), kmini_servo_stop, atoi(args[0])); }); - box->newFunc("旋转", {"direction"}, [this](int argn, const char **args) { ICM->callcmd1(getDeviceId(), kmini_servo_rotate, atoi(args[0])); }); - box->newFunc("移动到", {"position"}, [this](int argn, const char **args) { ICM->callcmd1(getDeviceId(), kmini_servo_move_to, atoi(args[0])); }); + + box->newFunc("位置模式-运动到", {"position"}, [this](int argn, const char **args) { ICM->callcmd1(getDeviceId(), kmini_servo_move_to, atoi(args[0])); }); + box->newFunc("速度模式-旋转", {"velocity"}, [this](int argn, const char **args) { ICM->callcmd1(getDeviceId(), kmini_servo_rotate, atoi(args[0])); }); + box->newFunc("扭矩模式-旋转", {"torque"}, [this](int argn, const char **args) { ICM->callcmd1(getDeviceId(), kmini_servo_rotate_with_torque, atoi(args[0])); }); + box->newFunc("设置中点", {}, [this](int argn, const char **args) { ICM->callcmd0(getDeviceId(), kmini_servo_set_mid_point); }); box->newFunc("读取IO状态", {"ioindex"}, [this](int argn, const char **args) { ICM->callcmd1(getDeviceId(), kmini_servo_read_io_state, atoi(args[0])); @@ -68,9 +71,9 @@ void MiniServoTab::construct(QTabWidget *fathertab) { 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-velocity", kreg_mini_servo_limit_velocity, ZRegItem::krw | ZRegItem::kdec); - tableBox->addReg("limit-torque", kreg_mini_servo_limit_torque, ZRegItem::krw | ZRegItem::kdec); - tableBox->addReg("protective-torque", kreg_mini_servo_protective_torque, ZRegItem::krw | ZRegItem::kdec); + tableBox->addReg("limit-torque(位置模式,速度模式有效)", kreg_mini_servo_limit_torque, ZRegItem::krw | ZRegItem::kdec); + tableBox->addReg("limit-velocity(位置模式有效)", kreg_mini_servo_limit_velocity, ZRegItem::krw | ZRegItem::kdec); + tableBox->addReg("protective-torque(暂时无效)", kreg_mini_servo_protective_torque, ZRegItem::krw | ZRegItem::kdec); tableBox->addSpacer(); }