|
|
@ -27,8 +27,12 @@ PipetteCtrlTab *PipetteCtrlTab::inst() { |
|
|
|
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); |
|
|
|
state = string((char *)ICM->getAckBuf()); |
|
|
|
try { |
|
|
|
ICM->callcmd(getDeviceId(), kpipette_write_cmd_direct, (uint8_t *)txbuf, strlen(txbuf) + 1, 1000); |
|
|
|
state = string((char *)ICM->getAckBuf()); |
|
|
|
} catch (const std::exception &e) { |
|
|
|
state = e.what(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void PipetteCtrlTab::construct(QTabWidget *fathertab) { |
|
|
@ -47,6 +51,30 @@ void PipetteCtrlTab::construct(QTabWidget *fathertab) { |
|
|
|
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])); }); |
|
|
|
|
|
|
|
box->newFunc("测试CLLD", {"dpos"}, [this](int argn, const char **args) { ICM->callcmd1(getDeviceId(), kpipette_clld_test, atoi(args[0])); }); |
|
|
|
box->newFunc("测试PLLD", {"dpos"}, [this](int argn, const char **args) { ICM->callcmd1(getDeviceId(), kpipette_plld_test, atoi(args[0])); }); |
|
|
|
box->newFunc("使能Z轴电机", {"enable"}, [this](int argn, const char **args) { ICM->callcmd1(getDeviceId(), kpipette_enable_zmotor, atoi(args[0])); }); |
|
|
|
|
|
|
|
box->newFunc("打印传感器数据记录", {}, [this](int argn, const char **args) { |
|
|
|
ICM->callcmd0(getDeviceId(), kpipette_get_sensor_sample_data_num); |
|
|
|
int32_t nsample = ICM->getAck(0); |
|
|
|
|
|
|
|
int32_t sample_period = 0; |
|
|
|
ICM->readreg(getDeviceId(), kreg_pipette_data_sample_period, &sample_period); |
|
|
|
|
|
|
|
ZQUI::ins()->ishow("%5s, %5s, %5s, %5s", "time", "zpos", "cval", "pval"); |
|
|
|
|
|
|
|
for (int32_t i = 0; i < nsample; i++) { |
|
|
|
ICM->callcmd1(getDeviceId(), kpipette_get_sensor_sample_data, i); |
|
|
|
int32_t motor_pos = ICM->getAck(0); |
|
|
|
int32_t cval = ICM->getAck(1); |
|
|
|
int32_t pval = ICM->getAck(2); |
|
|
|
|
|
|
|
ZQUI::ins()->ishow("%5d, %5d, %5d, %5d", i * sample_period, motor_pos, cval, pval); |
|
|
|
} |
|
|
|
}); |
|
|
|
// box->newFunc("获取传感器数据数量", {}, [this](int argn, const char **args) { ICM->callcmd0(getDeviceId(), kpipette_get_sensor_sample_data_num); });
|
|
|
|
} |
|
|
|
|
|
|
|
{ |
|
|
|