From 7a1fb05e924cd5a3a302394cf8f3410f5abeac5c Mon Sep 17 00:00:00 2001 From: zhaohe Date: Wed, 12 Jun 2024 10:50:06 +0800 Subject: [PATCH] update --- a8000_protocol | 2 +- src/basic/smtp2_constant.cpp | 29 +++++------------------ src/basic/smtp2_constant.hpp | 10 +++++--- src/tab/pipette_ctrl_tab.cpp | 55 +++++++++++++++++++------------------------- 4 files changed, 38 insertions(+), 58 deletions(-) diff --git a/a8000_protocol b/a8000_protocol index 6afc585..24d216c 160000 --- a/a8000_protocol +++ b/a8000_protocol @@ -1 +1 @@ -Subproject commit 6afc585f793d13d0ea66c08d3298cca5b2015ab7 +Subproject commit 24d216ced0a6d5f8ebc636067c2d5b174d9edbe6 diff --git a/src/basic/smtp2_constant.cpp b/src/basic/smtp2_constant.cpp index 313b304..b14b617 100644 --- a/src/basic/smtp2_constant.cpp +++ b/src/basic/smtp2_constant.cpp @@ -88,7 +88,7 @@ static state_info_t states[] = { STATE_ITEM(kstate_pump_pos_nl, "泵位置(纳升)"), STATE_ITEM(kstate_back_clearance, "背隙[K],泵位置"), STATE_ITEM(kstate_start_v, "启动速度[v]"), - STATE_ITEM(kstate_max_v, "最高速度[V]*10, 默认:{1400}"), + STATE_ITEM(kstate_max_v, "最高速度[V], 默认:{1400}"), STATE_ITEM(kstate_stop_v, "停止速度[c], 默认:{900}"), STATE_ITEM(kstate_acc, "加速度的[L]值"), STATE_ITEM(kstate_dec, "减速度的[L]值"), @@ -117,6 +117,10 @@ static state_info_t states[] = { STATE_ITEM(kstate_pressure_max, "自上次[f1]命令以来记录的最高压力值"), STATE_ITEM(kstate_pressure_min, "自上次[f1]命令以来记录的最低压力值"), STATE_ITEM(kstate_q_max_diff, "获取[q]指令执行过程中的最大差值"), + STATE_ITEM(kstate_command_cache_state, "命令缓冲区状态 0:空 1:有命令字符串"), + STATE_ITEM(kstate_capacitance, "电容读数计数"), + STATE_ITEM(kstate_common_setting0, "常规配置0"), + STATE_ITEM(kstate_common_setting1, "常规配置1"), STATE_ITEM(kstate_cmd_buf, "缓冲区中的当前命令字符串"), STATE_ITEM(kstate_p_cmd, "当前[p]命令设置"), STATE_ITEM(kstate_n_cmd, "当前[N]命令设置"), @@ -125,28 +129,7 @@ static state_info_t states[] = { // }; -// kSMTP2_NoError = 0, // 无错误 -// kSMTP2_InitFail = 1, // 初始化失败 -// kSMTP2_InvalidCmd = 2, // 无效命令 -// kSMTP2_InvalidArg = 3, // 无效参数 -// kSMTP2_PressureSensorError = 4, // 压力传感器故障 -// kSMTP2_OverPressure = 5, // 超过压力 -// kSMTP2_LLDError = 6, // LLD 错误 -// kSMTP2_DeviceNotInit = 7, // 设备未初始化 -// kSMTP2_TipPopError = 8, // Tip 弹出错误 -// kSMTP2_PumpOverload = 9, // 泵过载 -// kSMTP2_TipDrop = 10, // Tip 脱落 -// kSMTP2_CanBusError = 11, // CAN 总线故障 -// kSMTP2_InvalidChecksum = 12, // 无效校验和 -// kSMTP2_EEPROMError = 13, // EEPROM 故障 -// kSMTP2_CmdBufferEmpty = 14, // 命令缓冲区为空 -// kSMTP2_CmdBufferOverflow = 15, // 命令溢出 -// kSMTP2_TipBlock = 16, // Tip 堵塞 -// kSMTP2_AirSuction = 17, // 吸入空气 -// kSMTP2_Bubble = 18, // 液体中有气泡/泡沫 -// kSMTP2_VolumeError = 19, // 吸取/分配量不准确 -// kSMTP2_TipAlreadyLoad = 20, // Tip已经装载 -// kSMTP2_TipLoadFail = 21, + static ecode_info_t ecodes[] = { ECODE_ITEM(kSMTP2_NoError, "无错误"), diff --git a/src/basic/smtp2_constant.hpp b/src/basic/smtp2_constant.hpp index 8a52678..2886095 100644 --- a/src/basic/smtp2_constant.hpp +++ b/src/basic/smtp2_constant.hpp @@ -27,9 +27,9 @@ using namespace std; // kcmd_pump_factory_reset, // "!22" typedef enum { - kcfg_pump_limit_ul = 1, // 最大行程(Tip尺寸) 1...3500 default:3143 - kcfg_baudrate = 2, // 0:9600 1:38400 default:1 - kcfg_communication_protocol = 3, + kcfg_pump_limit_ul = 1, // 最大行程(Tip尺寸) 1...3500 default:3143 + kcfg_baudrate = 2, // 0:9600 1:38400 default:1 + kcfg_communication_protocol = 3, // kcfg_pressure_data_port_channel = 4, // 压力数据流端口 0=无 1=RS232 3=CAN kcfg_can_enable = 5, // CAN总线使能 kcfg_can_baudrate = 6, // CAN总线波特率 @@ -90,6 +90,10 @@ typedef enum { // /1? kstate_pressure_max = 58, // 自上次[f1]命令以来记录的最高压力值 kstate_pressure_min = 59, // 自上次[f1]命令以来记录的最低压力值 kstate_q_max_diff = 60, // 获取[q]指令执行过程中的最大差值 + kstate_command_cache_state = 67, // 命令缓冲区状态 0:空 1:有命令字符串 + kstate_capacitance = 68, // 电容读数计数 + kstate_common_setting0 = 76, // 常规配置0 + kstate_common_setting1 = 77, // 常规配置1 kstate_cmd_buf = 99, // 缓冲区中的当前命令字符串 kstate_p_cmd = 100, // 当前[p]命令设置 kstate_n_cmd = 102, // 当前[N]命令设置 diff --git a/src/tab/pipette_ctrl_tab.cpp b/src/tab/pipette_ctrl_tab.cpp index 71d294d..5e03ba1 100644 --- a/src/tab/pipette_ctrl_tab.cpp +++ b/src/tab/pipette_ctrl_tab.cpp @@ -28,13 +28,6 @@ static void pipette_ctrl_read_state(int32_t index, string &state) { char txbuf[256]; snprintf(txbuf, sizeof(txbuf), "/1?%dR\r", index); ICM->callcmd(getDeviceId(), kpipette_write_cmd_direct, (uint8_t *)txbuf, strlen(txbuf) + 1, 100); - ICM->getAckBuf()[ICM->getAckBufLen() - 2] = 0; - for (size_t i = 0; i < ICM->getAckBufLen(); i++) { - if (ICM->getAckBuf()[i] == '\r' || ICM->getAckBuf()[i] == '\n') { - ICM->getAckBuf()[i] = 0; - } - } - state = string((char *)ICM->getAckBuf()); } @@ -61,7 +54,7 @@ void PipetteCtrlTab::construct(QTabWidget *fathertab) { box->newFunc("写指令到移液枪(直接)", {"cmdstr"}, [this](int argn, const char **args) { char txbuf[256]; - snprintf(txbuf, sizeof(txbuf), "%sR\r", args[0]); + snprintf(txbuf, sizeof(txbuf), "/1%sR\r", args[0]); ZQUI::ins()->ishow("TX:%s", txbuf); ICM->callcmd(getDeviceId(), kpipette_write_cmd_direct, (uint8_t *)txbuf, strlen(txbuf) + 1, 100); @@ -79,35 +72,35 @@ void PipetteCtrlTab::construct(QTabWidget *fathertab) { }); box->newFunc("打印常用指令", {}, [this](int argn, const char **args) { - ZQUI::ins()->ishow("设备复位: /1!0R"); - ZQUI::ins()->ishow("恢复出厂设置: /1!22R"); - ZQUI::ins()->ishow("初始化: /1[Z]R"); + ZQUI::ins()->ishow("设备复位: !0"); + ZQUI::ins()->ishow("恢复出厂设置: !22"); + ZQUI::ins()->ishow("初始化: [Z]"); ZQUI::ins()->ishow(""); - ZQUI::ins()->ishow("查看状态: /1?"); - ZQUI::ins()->ishow("设置配置: /1u,R"); - ZQUI::ins()->ishow("查询命令缓冲区: /1="); - ZQUI::ins()->ishow("查询固件版本 : /1&"); + ZQUI::ins()->ishow("查看状态: ?"); + ZQUI::ins()->ishow("设置配置: u,"); + ZQUI::ins()->ishow("查询命令缓冲区: ="); + ZQUI::ins()->ishow("查询固件版本 : &"); ZQUI::ins()->ishow(""); - ZQUI::ins()->ishow("设置加速度和减速度: /1L100,100R"); - ZQUI::ins()->ishow("设置起始速度: /1v100R"); - ZQUI::ins()->ishow("设置最大速度: /1V100R"); - ZQUI::ins()->ishow("设置停止速度: /1c100R"); - ZQUI::ins()->ishow("设置背隙增量: /1K100R"); + ZQUI::ins()->ishow("设置加速度和减速度: L100,100"); + ZQUI::ins()->ishow("设置起始速度: v100"); + ZQUI::ins()->ishow("设置最大速度: V100"); + ZQUI::ins()->ishow("设置停止速度: c100"); + ZQUI::ins()->ishow("设置背隙增量: K100"); ZQUI::ins()->ishow(""); - ZQUI::ins()->ishow("移动到: /1A10R [0...3143]"); - ZQUI::ins()->ishow("相对吸取: /1P10R [0...3143]"); - ZQUI::ins()->ishow("相对分配: /1D10R [0...3143]"); - - ZQUI::ins()->ishow("停止: /1HR"); - ZQUI::ins()->ishow("清除命令缓冲区: /1CR"); - ZQUI::ins()->ishow("弹出Tip: /1E10R"); - ZQUI::ins()->ishow("pLLD : /1t100,100R"); - ZQUI::ins()->ishow("cLLD : /1^100R"); - ZQUI::ins()->ishow("mixLLD: /1B100,100R"); - ZQUI::ins()->ishow("设定压力传感器增益: /1p1R 0,1,2,3(default),4 1倍 2倍 5倍 10倍 20倍"); + ZQUI::ins()->ishow("移动到: A10 [0...3143]"); + ZQUI::ins()->ishow("相对吸取: P10 [0...3143]"); + ZQUI::ins()->ishow("相对分配: D10 [0...3143]"); + + ZQUI::ins()->ishow("停止: H"); + ZQUI::ins()->ishow("清除命令缓冲区: C"); + ZQUI::ins()->ishow("弹出Tip: E"); + ZQUI::ins()->ishow("pLLD : t100,100"); + ZQUI::ins()->ishow("cLLD : ^100"); + ZQUI::ins()->ishow("mixLLD: B100,100"); + ZQUI::ins()->ishow("设定压力传感器增益: p1 0,1,2,3(default),4 1倍 2倍 5倍 10倍 20倍"); ZQUI::ins()->ishow("操作验证: q,"); });