5 changed files with 1039 additions and 1023 deletions
-
1596sdk/components/pipette_module/pipette_ctrl_module_v1.cpp
-
368sdk/components/pipette_module/pipette_ctrl_module_v1.hpp
-
69sdk/components/pipette_module/pipette_ctrl_module_v2.cpp
-
27sdk/components/sensors/smtp2_v2/smtp2_v2.cpp
-
2sdk/components/sensors/smtp2_v2/smtp2_v2.hpp
1596
sdk/components/pipette_module/pipette_ctrl_module_v1.cpp
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -1,185 +1,185 @@ |
|||
#pragma once
|
|||
//
|
|||
#include "a8000_protocol\protocol.hpp"
|
|||
#include "sdk/os/zos.hpp"
|
|||
#include "sdk\components\sensors\smtp2_v2\smtp2_v2.hpp"
|
|||
#include "sdk\components\step_motor_ctrl_module\step_motor_ctrl_module.hpp"
|
|||
// #include "StepMotorCtrlModule"
|
|||
|
|||
/**
|
|||
* @brief |
|||
* |
|||
* 参考:https://iflytop1.feishu.cn/wiki/LTilwSyJwi6fJUkiIhzc2oRqnTb 对设备进行初始化
|
|||
* |
|||
*/ |
|||
namespace iflytop { |
|||
|
|||
#define PIPETTEMODULE_SAMPLE_BUF_SIZE 300
|
|||
|
|||
class PipetteModule : public ZIModule, public ZIPipetteCtrlModule { |
|||
ENABLE_MODULE(PipetteModule, kpipette_ctrl_module, PC_VERSION); |
|||
|
|||
public: |
|||
typedef enum { |
|||
kclld = 0, |
|||
kplld = 1, |
|||
kmixlld = 2, |
|||
} lld_mode_t; |
|||
|
|||
typedef struct { |
|||
UART_HandleTypeDef *uart; |
|||
DMA_HandleTypeDef *hdma_rx; |
|||
DMA_HandleTypeDef *hdma_tx; |
|||
} hardward_config_t; |
|||
|
|||
typedef struct { |
|||
int32_t motor_pos; |
|||
int32_t cap_val; // 电容值
|
|||
int32_t pressure_val; // 压力值
|
|||
} snesor_sample_data_t; |
|||
|
|||
typedef struct { |
|||
int32_t limit_ul; |
|||
int32_t pump_acc; |
|||
int32_t pump_dec; |
|||
int32_t pump_vstart; |
|||
int32_t pump_vstop; |
|||
int32_t pump_vmax; |
|||
int32_t aspirate_pump_vel; // 吸吐泵机速度
|
|||
int32_t lld_pump_vel; // lld,泵机吸吐速度
|
|||
int32_t lld_motor_vel_rpm; // lld,z轴电机移动速度
|
|||
int32_t lld_detect_period_ms; // lld,探测周期
|
|||
int32_t lld_prepare_pos; // lld,页面探测准备位置
|
|||
int32_t lld_prepare_pre_distribut_ul; // lld前,预分配位置
|
|||
} config_t; |
|||
|
|||
typedef struct { |
|||
int32_t load_val_ul; // 已装载量
|
|||
int32_t aspirated; // 已经吸入过液体
|
|||
int32_t lld_prepared; // 已经准备液面探测
|
|||
int32_t pipette_is_inited; // 泵机是否初始化
|
|||
|
|||
int32_t dul; // 吸吐变化量
|
|||
int32_t pump_before_pos_ul; // 执行指令前泵机位置
|
|||
int32_t pump_after_pos_ul; // 执行指令后泵机位置
|
|||
int32_t detected_liquid; // 检测到液面
|
|||
} state_t; |
|||
|
|||
private: |
|||
smtp2::SMTP2V2 m_smtp2; |
|||
StepMotorCtrlModule *m_zmotor = nullptr; |
|||
|
|||
ZThread m_thread; |
|||
|
|||
int32_t m_id = 0; |
|||
config_t m_config = {0}; |
|||
state_t m_state = {0}; |
|||
|
|||
snesor_sample_data_t capturedata_buf[PIPETTEMODULE_SAMPLE_BUF_SIZE]; |
|||
int32_t capturedata_num = 0; |
|||
|
|||
public: |
|||
void initialize(int32_t id, config_t *config, StepMotorCtrlModule *zmotor, hardward_config_t *hardwaredcfg); |
|||
|
|||
virtual int32_t getid(int32_t *id); |
|||
|
|||
/*******************************************************************************
|
|||
* Module * |
|||
*******************************************************************************/ |
|||
|
|||
virtual int32_t module_stop() override; |
|||
virtual int32_t module_active_cfg() override; |
|||
virtual int32_t module_xxx_reg(int32_t param_id, bool read, int32_t &val) override; |
|||
|
|||
/*******************************************************************************
|
|||
* pipette_ctrl * |
|||
*******************************************************************************/ |
|||
/**
|
|||
* 参数: |
|||
* vstart |
|||
* vstop |
|||
* vmax |
|||
* acc |
|||
* dec |
|||
* |
|||
* 0.泵机复位 |
|||
* 0.Z轴失能 |
|||
* 1.移液枪初始化 |
|||
* 2.移液枪探测液面初始化 |
|||
* |
|||
* 3.移液枪-电容探测液面-测试(moterv,dpos),动作:Z轴向下以motor_v移动dpos,使用电容模式 ,同时采集电容数值 |
|||
* 3.移液枪-压力探测液面-测试(moterv,dpos),动作:Z轴向下以motor_v移动dpos,使用分配压力模式,压力阈值设置为最大, 同时采集电容数值,压力值 |
|||
* 4.读取压力和电容数值变化数据(电机位置,电容数值,压力数值,泵机位置) |
|||
* |
|||
* 5.吸液(ul) |
|||
* 6.排液(ul) |
|||
* |
|||
* |
|||
* |
|||
* |
|||
* 使用流程 |
|||
* |
|||
* pipette_ctrl_put_tip |
|||
* | |
|||
* pipette_lld_prepare |
|||
* | |
|||
* pipette_lld |
|||
* | |
|||
* pipette_aspirate |
|||
* pipette_distribut |
|||
* pipette_mix(吸吐混匀) |
|||
* |
|||
* |
|||
*/ |
|||
|
|||
virtual int32_t pipette_ctrl_move_to_ul(int32_t ul) override; // 丢弃
|
|||
|
|||
virtual int32_t pipette_ctrl_init_device() override; |
|||
virtual int32_t pipette_ctrl_put_tip() override; |
|||
virtual int32_t pipette_lld_prepare() override; |
|||
virtual int32_t pipette_plld(int32_t zdpos, int32_t p_threshold) override; |
|||
virtual int32_t pipette_clld(int32_t zdpos, int32_t c_threshold) override; |
|||
virtual int32_t pipette_mlld(int32_t zdpos, int32_t c_threshold, int32_t p_threshold) override; |
|||
virtual int32_t pipette_lld_is_detect_liquid(int32_t *liquid) override; |
|||
|
|||
virtual int32_t pipette_aspirate(int32_t ul) override; |
|||
virtual int32_t pipette_distribut(int32_t ul) override; |
|||
virtual int32_t pipette_shake_up(int32_t ul, int32_t times) override; |
|||
|
|||
virtual int32_t pipette_aspirate_llf(int32_t ul, int32_t zmotor_v) override; |
|||
virtual int32_t pipette_distribut_llf(int32_t ul, int32_t zmotor_v) override; |
|||
virtual int32_t pipette_shake_up_llf(int32_t ul, int32_t zmotor_v, int32_t times) override; |
|||
|
|||
virtual int32_t pipette_enable_zmotor(int32_t enable); |
|||
virtual int32_t pipette_write_cmd_direct(uint8_t *tx, int32_t len, uint8_t *rx, int32_t *rxlen) override; |
|||
virtual int32_t pipette_get_sensor_sample_data(int32_t index, int32_t *motor_pos, int32_t *cval, int32_t *pval) override; //
|
|||
virtual int32_t pipette_get_sensor_sample_data_num(int32_t *num) override; |
|||
|
|||
private: |
|||
int32_t do_pipette_ctrl_init_device(); |
|||
int32_t do_pipette_ctrl_put_tip(); |
|||
int32_t do_pipette_ctrl_move_to_ul(int32_t ul); |
|||
int32_t do_pipette_lld_prepare(); |
|||
int32_t do_pipette_lld(lld_mode_t mode, int32_t zdpos, int32_t c_threshold, int32_t p_threshold); |
|||
|
|||
int32_t do_pipette_aspirate(int32_t ul, int32_t zmotor_v); |
|||
int32_t do_pipette_distribut(int32_t ul, int32_t zmotor_v); |
|||
int32_t do_pipette_shake_up(int32_t ul, int32_t zmotor_v, int32_t times); |
|||
|
|||
private: |
|||
int32_t befor_run(); |
|||
int32_t do_put_tip_before_run(); |
|||
int32_t after_run(); |
|||
bool check_when_run(); |
|||
|
|||
private: |
|||
int32_t read_pos_ul(int32_t *val); |
|||
int32_t read_capactitance(int32_t *val); |
|||
int32_t read_tip_state(int32_t *val); |
|||
|
|||
private: |
|||
|
|||
private: |
|||
void push_snesor_sample_data(int32_t motor_pos, int32_t cap_val, int32_t pressure_val); |
|||
}; |
|||
} // namespace iflytop
|
|||
// //
|
|||
// #include "a8000_protocol\protocol.hpp"
|
|||
// #include "sdk/os/zos.hpp"
|
|||
// #include "sdk\components\sensors\smtp2_v2\smtp2_v2.hpp"
|
|||
// #include "sdk\components\step_motor_ctrl_module\step_motor_ctrl_module.hpp"
|
|||
// // #include "StepMotorCtrlModule"
|
|||
|
|||
// /**
|
|||
// * @brief
|
|||
// *
|
|||
// * 参考:https://iflytop1.feishu.cn/wiki/LTilwSyJwi6fJUkiIhzc2oRqnTb 对设备进行初始化
|
|||
// *
|
|||
// */
|
|||
// namespace iflytop {
|
|||
|
|||
// #define PIPETTEMODULE_SAMPLE_BUF_SIZE 300
|
|||
|
|||
// class PipetteModule : public ZIModule, public ZIPipetteCtrlModule {
|
|||
// ENABLE_MODULE(PipetteModule, kpipette_ctrl_module, PC_VERSION);
|
|||
|
|||
// public:
|
|||
// typedef enum {
|
|||
// kclld = 0,
|
|||
// kplld = 1,
|
|||
// kmixlld = 2,
|
|||
// } lld_mode_t;
|
|||
|
|||
// typedef struct {
|
|||
// UART_HandleTypeDef *uart;
|
|||
// DMA_HandleTypeDef *hdma_rx;
|
|||
// DMA_HandleTypeDef *hdma_tx;
|
|||
// } hardward_config_t;
|
|||
|
|||
// typedef struct {
|
|||
// int32_t motor_pos;
|
|||
// int32_t cap_val; // 电容值
|
|||
// int32_t pressure_val; // 压力值
|
|||
// } snesor_sample_data_t;
|
|||
|
|||
// typedef struct {
|
|||
// int32_t limit_ul;
|
|||
// int32_t pump_acc;
|
|||
// int32_t pump_dec;
|
|||
// int32_t pump_vstart;
|
|||
// int32_t pump_vstop;
|
|||
// int32_t pump_vmax;
|
|||
// int32_t aspirate_pump_vel; // 吸吐泵机速度
|
|||
// int32_t lld_pump_vel; // lld,泵机吸吐速度
|
|||
// int32_t lld_motor_vel_rpm; // lld,z轴电机移动速度
|
|||
// int32_t lld_detect_period_ms; // lld,探测周期
|
|||
// int32_t lld_prepare_pos; // lld,页面探测准备位置
|
|||
// int32_t lld_prepare_pre_distribut_ul; // lld前,预分配位置
|
|||
// } config_t;
|
|||
|
|||
// typedef struct {
|
|||
// int32_t load_val_ul; // 已装载量
|
|||
// int32_t aspirated; // 已经吸入过液体
|
|||
// int32_t lld_prepared; // 已经准备液面探测
|
|||
// int32_t pipette_is_inited; // 泵机是否初始化
|
|||
|
|||
// int32_t dul; // 吸吐变化量
|
|||
// int32_t pump_before_pos_ul; // 执行指令前泵机位置
|
|||
// int32_t pump_after_pos_ul; // 执行指令后泵机位置
|
|||
// int32_t detected_liquid; // 检测到液面
|
|||
// } state_t;
|
|||
|
|||
// private:
|
|||
// smtp2::SMTP2V2 m_smtp2;
|
|||
// StepMotorCtrlModule *m_zmotor = nullptr;
|
|||
|
|||
// ZThread m_thread;
|
|||
|
|||
// int32_t m_id = 0;
|
|||
// config_t m_config = {0};
|
|||
// state_t m_state = {0};
|
|||
|
|||
// snesor_sample_data_t capturedata_buf[PIPETTEMODULE_SAMPLE_BUF_SIZE];
|
|||
// int32_t capturedata_num = 0;
|
|||
|
|||
// public:
|
|||
// void initialize(int32_t id, config_t *config, StepMotorCtrlModule *zmotor, hardward_config_t *hardwaredcfg);
|
|||
|
|||
// virtual int32_t getid(int32_t *id);
|
|||
|
|||
// /*******************************************************************************
|
|||
// * Module *
|
|||
// *******************************************************************************/
|
|||
|
|||
// virtual int32_t module_stop() override;
|
|||
// virtual int32_t module_active_cfg() override;
|
|||
// virtual int32_t module_xxx_reg(int32_t param_id, bool read, int32_t &val) override;
|
|||
|
|||
// /*******************************************************************************
|
|||
// * pipette_ctrl *
|
|||
// *******************************************************************************/
|
|||
// /**
|
|||
// * 参数:
|
|||
// * vstart
|
|||
// * vstop
|
|||
// * vmax
|
|||
// * acc
|
|||
// * dec
|
|||
// *
|
|||
// * 0.泵机复位
|
|||
// * 0.Z轴失能
|
|||
// * 1.移液枪初始化
|
|||
// * 2.移液枪探测液面初始化
|
|||
// *
|
|||
// * 3.移液枪-电容探测液面-测试(moterv,dpos),动作:Z轴向下以motor_v移动dpos,使用电容模式 ,同时采集电容数值
|
|||
// * 3.移液枪-压力探测液面-测试(moterv,dpos),动作:Z轴向下以motor_v移动dpos,使用分配压力模式,压力阈值设置为最大, 同时采集电容数值,压力值
|
|||
// * 4.读取压力和电容数值变化数据(电机位置,电容数值,压力数值,泵机位置)
|
|||
// *
|
|||
// * 5.吸液(ul)
|
|||
// * 6.排液(ul)
|
|||
// *
|
|||
// *
|
|||
// *
|
|||
// *
|
|||
// * 使用流程
|
|||
// *
|
|||
// * pipette_ctrl_put_tip
|
|||
// * |
|
|||
// * pipette_lld_prepare
|
|||
// * |
|
|||
// * pipette_lld
|
|||
// * |
|
|||
// * pipette_aspirate
|
|||
// * pipette_distribut
|
|||
// * pipette_mix(吸吐混匀)
|
|||
// *
|
|||
// *
|
|||
// */
|
|||
|
|||
// virtual int32_t pipette_ctrl_move_to_ul(int32_t ul) override; // 丢弃
|
|||
|
|||
// virtual int32_t pipette_ctrl_init_device() override;
|
|||
// virtual int32_t pipette_ctrl_put_tip() override;
|
|||
// virtual int32_t pipette_lld_prepare() override;
|
|||
// virtual int32_t pipette_plld(int32_t zdpos, int32_t p_threshold) override;
|
|||
// virtual int32_t pipette_clld(int32_t zdpos, int32_t c_threshold) override;
|
|||
// virtual int32_t pipette_mlld(int32_t zdpos, int32_t c_threshold, int32_t p_threshold) override;
|
|||
// virtual int32_t pipette_lld_is_detect_liquid(int32_t *liquid) override;
|
|||
|
|||
// virtual int32_t pipette_aspirate(int32_t ul) override;
|
|||
// virtual int32_t pipette_distribut(int32_t ul) override;
|
|||
// virtual int32_t pipette_shake_up(int32_t ul, int32_t times) override;
|
|||
|
|||
// virtual int32_t pipette_aspirate_llf(int32_t ul, int32_t zmotor_v) override;
|
|||
// virtual int32_t pipette_distribut_llf(int32_t ul, int32_t zmotor_v) override;
|
|||
// virtual int32_t pipette_shake_up_llf(int32_t ul, int32_t zmotor_v, int32_t times) override;
|
|||
|
|||
// virtual int32_t pipette_enable_zmotor(int32_t enable);
|
|||
// virtual int32_t pipette_write_cmd_direct(uint8_t *tx, int32_t len, uint8_t *rx, int32_t *rxlen) override;
|
|||
// virtual int32_t pipette_get_sensor_sample_data(int32_t index, int32_t *motor_pos, int32_t *cval, int32_t *pval) override; //
|
|||
// virtual int32_t pipette_get_sensor_sample_data_num(int32_t *num) override;
|
|||
|
|||
// private:
|
|||
// int32_t do_pipette_ctrl_init_device();
|
|||
// int32_t do_pipette_ctrl_put_tip();
|
|||
// int32_t do_pipette_ctrl_move_to_ul(int32_t ul);
|
|||
// int32_t do_pipette_lld_prepare();
|
|||
// int32_t do_pipette_lld(lld_mode_t mode, int32_t zdpos, int32_t c_threshold, int32_t p_threshold);
|
|||
|
|||
// int32_t do_pipette_aspirate(int32_t ul, int32_t zmotor_v);
|
|||
// int32_t do_pipette_distribut(int32_t ul, int32_t zmotor_v);
|
|||
// int32_t do_pipette_shake_up(int32_t ul, int32_t zmotor_v, int32_t times);
|
|||
|
|||
// private:
|
|||
// int32_t befor_run();
|
|||
// int32_t do_put_tip_before_run();
|
|||
// int32_t after_run();
|
|||
// bool check_when_run();
|
|||
|
|||
// private:
|
|||
// int32_t read_pos_ul(int32_t *val);
|
|||
// int32_t read_capactitance(int32_t *val);
|
|||
// int32_t read_tip_state(int32_t *val);
|
|||
|
|||
// private:
|
|||
|
|||
// private:
|
|||
// void push_snesor_sample_data(int32_t motor_pos, int32_t cap_val, int32_t pressure_val);
|
|||
// };
|
|||
// } // namespace iflytop
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue