Browse Source

update

master
zhaohe 1 year ago
parent
commit
aae36da9eb
  1. 2
      a8000_protocol
  2. 2
      iflytop_canbus/iflytop_canbus_master.cpp
  3. 7
      iflytop_canbus/waveshare_can.cpp
  4. 2
      iflytop_canbus/waveshare_can.hpp
  5. 1
      src/qt_serial_datachannel.cpp
  6. 32
      src/tab/pipette_ctrl_tab.cpp
  7. 18
      移液枪测试笔记.md

2
a8000_protocol

@ -1 +1 @@
Subproject commit 24d216ced0a6d5f8ebc636067c2d5b174d9edbe6
Subproject commit cab27e09a7e78e662b55de7b72e6b232988d5b27

2
iflytop_canbus/iflytop_canbus_master.cpp

@ -110,7 +110,7 @@ void IflytopCanbusMaster::readreg(int32_t device_id, int32_t regaddr, int32_t *v
*val = *(int32_t *)(&m_receipt_frame->data[0]);
}
int32_t IflytopCanbusMaster::getAck(int32_t index) { return *(int32_t *)(&m_receipt_frame->data[index]); }
int32_t IflytopCanbusMaster::getAck(int32_t index) { return ((int32_t *)(m_receipt_frame->data))[index]; }
uint8_t *IflytopCanbusMaster::getAckBuf() { return m_receipt_frame->data; }
int32_t IflytopCanbusMaster::getAckBufLen() { return m_receipt_len - sizeof(zcr_cmd_header_t); }

7
iflytop_canbus/waveshare_can.cpp

@ -47,7 +47,12 @@ bool WaveshareCan::init(IDataChannel* ch, frame_callback_t framecb) {
{
lock_guard<mutex> lock(lock_);
if (m_rxlen == 0) {
continue;
}
// 1.找头部
int32_t headerpos = -1;
for (int32_t i = 0; i < m_rxlen - 1; i++) {
if (isHeader(m_rxcache + i)) {
@ -61,6 +66,7 @@ bool WaveshareCan::init(IDataChannel* ch, frame_callback_t framecb) {
}
// 将包头移动到缓存头部
// ZLOGI(TAG, "rxlen:%d headerpos:%d", m_rxlen, headerpos);
if (headerpos != 0) {
memmove(m_rxcache, m_rxcache + headerpos, m_rxlen - headerpos);
m_rxlen = m_rxlen - headerpos;
@ -68,6 +74,7 @@ bool WaveshareCan::init(IDataChannel* ch, frame_callback_t framecb) {
}
if (m_rxlen < 20) continue;
// ZLOGI(TAG, "rxlen:%d find header %s ", m_rxlen, zhex2str(m_rxcache, 20).c_str());
onReceivePacket(m_rxcache, 20);
memmove(m_rxcache, m_rxcache + 20, m_rxlen - 20);

2
iflytop_canbus/waveshare_can.hpp

@ -93,7 +93,7 @@ class WaveshareCan {
mutex lock_;
uint8_t m_rxcache[1024] = {0};
uint8_t m_rxlen = 0;
int32_t m_rxlen = 0;
public:
bool init(IDataChannel* ch, frame_callback_t framecb);

1
src/qt_serial_datachannel.cpp

@ -24,6 +24,7 @@ void QTDataChannel::init() {
uint8_t rx[1024] = {0};
int rx_cnt = com_receive(rx, 1024);
if (rx_cnt != 0) {
ZLOGI(TAG, "rx %s ", zhex2str(rx, rx_cnt).c_str());
// ZLOGI(TAG, "rx %s ", zhe x2str(rx, rx_cnt).c_str());
if (m_rxcb) m_rxcb(rx, rx_cnt);
}

32
src/tab/pipette_ctrl_tab.cpp

@ -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); });
}
{

18
移液枪测试笔记.md

@ -0,0 +1,18 @@
```
1. 新的tip 4
2. tip上有水滴 10
3. 用手摸tip 150
4. tip浸没在水中 30
5. tip浸没在水中,用手摸试管 50
只有没有tip的情况下允许调用lld_prepare
移液枪的使用流程:
1. 丢tip
2. 移动泵机到z轴中间(液面探测准备)
3. 装tip
4. 检测是否有tip,检测是否已经执行过吸液,液面探测(记录吸液排液水平线)
5. 吸液()记录最大值,如果超过最大值则,不允许继续吸液
6. 排液()记录最大值,如果超过最大值则,不允许继续吸液
```
Loading…
Cancel
Save