|
|
@ -24,6 +24,20 @@ PipetteCtrlTab *PipetteCtrlTab::inst() { |
|
|
|
return ins; |
|
|
|
} |
|
|
|
|
|
|
|
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()); |
|
|
|
} |
|
|
|
|
|
|
|
void PipetteCtrlTab::construct(QTabWidget *fathertab) { |
|
|
|
/***********************************************************************************************************************
|
|
|
|
* 模块操作 * |
|
|
@ -35,13 +49,16 @@ void PipetteCtrlTab::construct(QTabWidget *fathertab) { |
|
|
|
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()); });
|
|
|
|
ZQFunctionListBox *box = new ZQFunctionListBox(tab, "移液枪-操作", 4); |
|
|
|
|
|
|
|
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])); }); |
|
|
|
} |
|
|
|
|
|
|
|
{ |
|
|
|
ZQFunctionListBox *box = new ZQFunctionListBox(tab, "移液枪-子设备直接操作", 4); |
|
|
|
|
|
|
|
box->newFunc("写指令到移液枪(直接)", {"cmdstr"}, [this](int argn, const char **args) { |
|
|
|
char txbuf[256]; |
|
|
|
snprintf(txbuf, sizeof(txbuf), "%sR\r", args[0]); |
|
|
@ -58,7 +75,7 @@ void PipetteCtrlTab::construct(QTabWidget *fathertab) { |
|
|
|
errorcode = errorcode - '@'; |
|
|
|
workingstate = 1; |
|
|
|
} |
|
|
|
ZQUI::ins()->ishow("RX: ecode:%s(%d),working_state:%d,raw:%s", smtp2::ecode2str(errorcode), errorcode, workingstate, ICM->getAckBuf()); |
|
|
|
ZQUI::ins()->ishow("RX: ecode:%s(%d),working_state:%d,raw:%s(%d)", smtp2::ecode2str(errorcode), errorcode, workingstate, (char *)ICM->getAckBuf(), ICM->getAckBufLen()); |
|
|
|
}); |
|
|
|
|
|
|
|
box->newFunc("打印常用指令", {}, [this](int argn, const char **args) { |
|
|
@ -97,23 +114,28 @@ void PipetteCtrlTab::construct(QTabWidget *fathertab) { |
|
|
|
box->newFunc("打印泵机状态列表", {}, [this](int argn, const char **args) { |
|
|
|
ZQUI::ins()->ishow("查看状态: /1?<n>R"); |
|
|
|
|
|
|
|
smtp2::cfg_info_t *table = nullptr; |
|
|
|
int32_t itermNum = 0; |
|
|
|
smtp2::state_info_t *table = nullptr; |
|
|
|
int32_t itermNum = 0; |
|
|
|
|
|
|
|
smtp2::cfg_info_get_table(&table, &itermNum); |
|
|
|
smtp2::state_info_get_table(&table, &itermNum); |
|
|
|
ZQUI::ins()->ishow("id, val, des"); |
|
|
|
for (int i = 0; i < itermNum; i++) { |
|
|
|
ZQUI::ins()->ishow("id:%d, des:%s", table[i].index, table[i].description); |
|
|
|
string val; |
|
|
|
pipette_ctrl_read_state(table[i].index, val); |
|
|
|
ZQUI::ins()->ishow("%2d , %s , %s", table[i].index, val.c_str(), table[i].description); |
|
|
|
} |
|
|
|
}); |
|
|
|
box->newFunc("打印泵机配置列表", {}, [this](int argn, const char **args) { |
|
|
|
ZQUI::ins()->ishow("设置配置: /1u<n1>,<n2>R"); |
|
|
|
|
|
|
|
smtp2::state_info_t *table = nullptr; |
|
|
|
int32_t itermNum = 0; |
|
|
|
smtp2::cfg_info_t *table = nullptr; |
|
|
|
int32_t itermNum = 0; |
|
|
|
|
|
|
|
smtp2::cfg_info_get_table(&table, &itermNum); |
|
|
|
ZQUI::ins()->ishow("id, des"); |
|
|
|
|
|
|
|
smtp2::state_info_get_table(&table, &itermNum); |
|
|
|
for (int i = 0; i < itermNum; i++) { |
|
|
|
ZQUI::ins()->ishow("id:%d, des:%s", table[i].index, table[i].description); |
|
|
|
ZQUI::ins()->ishow(" %2d , %s", table[i].index, table[i].description); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|