Browse Source

remove some code

master
zhaohe 2 years ago
parent
commit
725ad336d3
  1. 103
      components/motor_laser_code_scanner/motor_laser_code_scanne.cpp
  2. 38
      components/motor_laser_code_scanner/motor_laser_code_scanne.hpp
  3. 282
      components/pipette_module/pipette_ctrl_module.cpp
  4. 69
      components/pipette_module/pipette_ctrl_module.hpp
  5. 176
      components/step_motor_ctrl_module/step_motor_ctrl_module.cpp
  6. 111
      components/step_motor_ctrl_module/step_motor_ctrl_module.hpp
  7. 34
      components/zcancmder_module/zcan_motor_laser_code_scanner_scan_module.cpp
  8. 22
      components/zcancmder_module/zcan_motor_laser_code_scanner_scan_module.hpp
  9. 78
      components/zcancmder_module/zcan_pipette_module.cpp
  10. 20
      components/zcancmder_module/zcan_pipette_module.hpp
  11. 2
      components/zprotocols/zcancmder
  12. 2
      components/zprotocols/zcancmder_v2

103
components/motor_laser_code_scanner/motor_laser_code_scanne.cpp

@ -1,103 +0,0 @@
#include "motor_laser_code_scanne.hpp"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "sdk\components\zprotocols\errorcode\errorcode.hpp"
using namespace iflytop;
using namespace std;
#define TAG "MotorLaserCodeScanner"
#define DO(infostr, ACTION) \
{ \
int exec_ret = ACTION; \
if (exec_ret != 0) { \
ZLOGE(TAG, "do " infostr "(line:%d) fail, ret = %d", __LINE__, exec_ret); \
m_lastexecstatus = exec_ret; \
if (status_cb) status_cb(exec_ret); \
return; \
} \
}
void MotorLaserCodeScanner::initialize(int id, I_StepMotorCtrlModule* stepM, int max_scan_result_num) {
m_id = id;
m_stepM1 = stepM;
m_mallocsize = sizeof(scan_result_t) + 2 * max_scan_result_num;
m_scan_result = (scan_result_t*)malloc(m_mallocsize);
ZASSERT(m_scan_result != nullptr);
memset(m_scan_result, 0, m_mallocsize);
m_max_scan_result_num = max_scan_result_num;
m_lock.init();
m_thread.init(TAG, 1024, osPriorityNormal);
}
int32_t MotorLaserCodeScanner::start_scan(s32 moveby_distance, //
s32 scan_interval_distance, //
s32 each_sample_times, //
s32 transmitting_tube_amplification, //
s32 receiving_tube_amplification, //
//
action_cb_status_t status_cb) {
zlock_guard lock(m_lock);
ZLOGI(TAG, "start_scan %d %d %d %d %d", moveby_distance, scan_interval_distance, each_sample_times, transmitting_tube_amplification, receiving_tube_amplification);
m_thread.stop();
memset(m_scan_result, 0, m_mallocsize);
m_thread.start([this, //
moveby_distance, //
scan_interval_distance, //
each_sample_times, //
transmitting_tube_amplification, //
receiving_tube_amplification, //
status_cb]() {
int32_t count = moveby_distance / scan_interval_distance;
int32_t each_move_by_distance = moveby_distance > 0 ? abs(scan_interval_distance) : -abs(scan_interval_distance);
for (int32_t i = 0; i < count; i++) {
ZLOGI(TAG, "move to %d", each_move_by_distance);
DO("move_by", m_stepM1->move_by_block(each_move_by_distance));
// read adc
}
m_scan_result->each_scan_result_len = 2;
m_scan_result->scan_reult_nums = count;
call_action_cb(status_cb, 0);
});
return 0;
}
int32_t MotorLaserCodeScanner::stop_scan() {
zlock_guard lock(m_lock);
ZLOGI(TAG, "stop_scan");
m_thread.stop();
return 0;
};
int32_t MotorLaserCodeScanner::get_scan_result(u16 sector_index, u16 sector_size, zcancmder_read_ram_ack_t& ack) {
zlock_guard lock(m_lock);
if (m_thread.isworking()) return err::kdevice_is_busy;
uint8_t* src_data = m_scan_result->scan_result + sector_index * sector_size;
int32_t src_data_len = m_scan_result->each_scan_result_len * m_scan_result->scan_reult_nums;
return assign_scan_result(sector_index, sector_size, src_data, src_data_len, ack);
}
int32_t MotorLaserCodeScanner::assign_scan_result(u16 sector_index, u16 sector_size, u8* src_data, s32 src_data_len, zcancmder_read_ram_ack_t& ack) {
if (sector_size > sizeof(ack.packet)) return err::kbuffer_not_enough;
uint8_t* copy_s = (uint8_t*)src_data + sector_index * sector_size;
int32_t copy_len = (int32_t)src_data_len - sector_size * sector_index;
if (copy_len > sector_size) copy_len = sector_size;
if (copy_len < 0) copy_len = 0;
ack.len = copy_len;
if (ack.len < sector_size) ack.is_end = 1;
memcpy(ack.packet, copy_s, copy_len);
return 0;
}
void MotorLaserCodeScanner::call_action_cb(action_cb_status_t status_cb, int32_t status) {
m_lastexecstatus = status;
if (status_cb) status_cb(status);
}

38
components/motor_laser_code_scanner/motor_laser_code_scanne.hpp

@ -1,38 +0,0 @@
#pragma once
//
#include "sdk/os/zos.hpp"
#include "sdk\components\zprotocols\zcancmder\api\i_motor_laser_code_scanner.hpp"
#include "sdk\components\zprotocols\zcancmder\api\i_step_motor_ctrl_module.hpp"
namespace iflytop {
class MotorLaserCodeScanner : public I_MotorLaserCodeScanner {
ZThread m_thread;
int m_id = 0;
I_StepMotorCtrlModule* m_stepM1 = nullptr;
zmutex m_lock;
scan_result_t* m_scan_result = nullptr;
int m_max_scan_result_num = 0;
int m_mallocsize = 0;
int32_t m_lastexecstatus = 0;
public:
void initialize(int id, I_StepMotorCtrlModule* stepM, int max_scan_result_num);
virtual int32_t start_scan(s32 moveby_distance, //
s32 scan_interval_distance, //
s32 each_sample_times, //
s32 transmitting_tube_amplification, //
s32 receiving_tube_amplification, //
//
action_cb_status_t status_cb) override;
//
virtual int32_t stop_scan() override;
//
virtual int32_t get_scan_result(u16 sector_index, u16 sector_size, zcancmder_read_ram_ack_t& ack) override;
private:
void call_action_cb(action_cb_status_t status_cb, int32_t status);
int32_t assign_scan_result(u16 sector_index, u16 sector_size, u8* src_data, s32 src_data_len, zcancmder_read_ram_ack_t& ack);
};
}; // namespace iflytop

282
components/pipette_module/pipette_ctrl_module.cpp

@ -1,282 +0,0 @@
#include "pipette_ctrl_module.hpp"
using namespace iflytop;
using namespace std;
#define TAG "PipetteModule"
#if 0
#define DO(infostr, ACTION) \
{ \
int exec_ret = ACTION; \
if (exec_ret != 0) { \
ZLOGE(TAG, "do " infostr "(line:%d) fail, ret = %d", __LINE__, exec_ret); \
m_lastexecstatus = exec_ret; \
if (status_cb) status_cb(exec_ret); \
return; \
} \
ZLOGI(TAG, "do " infostr " complete"); \
}
#define DO2(infostr, ACTION) \
{ \
int exec_ret = ACTION; \
if (exec_ret != 0) { \
ZLOGE(TAG, "do " infostr "(line:%d) fail, ret = %d", __LINE__, exec_ret); \
return exec_ret; \
} \
}
void PipetteModule::initialize(SMTP2 *smtp2, //
StepMotorCtrlModule *stepMotor) {
m_smtp2 = smtp2;
m_stepMotor = stepMotor;
m_thread.init("pipette", 1024);
}
int32_t PipetteModule::enable(u8 enable) { //
m_stepMotor->enable(enable);
return 0;
}
int32_t PipetteModule::stop(u8 stop_type) {
m_stepMotor->stop(0);
m_smtp2->stop();
return 0;
}
int32_t PipetteModule::zero_pos_calibrate(action_cb_status_t status_cb) {
ZLOGI(TAG, "zero_pos_calibrate");
if (!m_smtp2->isOnline()) return err::kdevice_offline;
m_thread.stop();
m_thread.start([this, status_cb]() { //
DO("move_to_zero_with_calibrate_block", m_stepMotor->move_to_zero_with_calibrate_block(0));
call_status_cb(status_cb, 0);
return;
});
return 0;
}
int32_t PipetteModule::zmotor_reset(action_cb_status_t status_cb) {
ZLOGI(TAG, "reset_device");
if (!m_smtp2->isOnline()) return err::kdevice_offline;
m_thread.stop();
m_thread.start([this, status_cb]() {
// Z轴复位
DO("move_to_zero_block", m_stepMotor->move_to_zero_block());
//
call_status_cb(status_cb, 0);
});
return 0;
}
int32_t PipetteModule::pipette_reset(action_cb_status_t status_cb) {
ZLOGI(TAG, "reset_device");
if (!m_smtp2->isOnline()) return err::kdevice_offline;
m_thread.stop();
m_thread.start([this, status_cb]() {
// 移液枪复位
DO("init_device_block", m_smtp2->init_device_block())
call_status_cb(status_cb, 0);
});
return 0;
}
int32_t PipetteModule::take_tip(s16 vel, s16 height_mm, s16 tip_hight_mm, action_cb_status_t status_cb) {
ZLOGI(TAG, "take_tip");
if (!m_smtp2->isOnline()) return err::kdevice_offline;
bool hastip = false;
DO2("m_smtp2->read_tip_state(hastip)", m_smtp2->read_tip_state(hastip));
if (hastip) {
ZLOGI(TAG, "pipette gun has tip");
return err::kSMTP2_TipAlreadyLoad;
}
// m_tip_hight_mm = tip_hight_mm;
m_thread.stop();
m_thread.start([this, vel, height_mm, tip_hight_mm, status_cb]() {
// 移动移液枪到取Tip位置
ZLOGI(TAG, "move to take_tip_height_mm %d", height_mm);
DO("move_to", m_stepMotor->move_to_block(hight_trans(height_mm), vel));
// 取tip头
ZLOGI(TAG, "take tip");
osDelay(1000);
// 移液枪返回零点
ZLOGI(TAG, "move to transfer_height_mm %d", m_transfer_height_mm);
DO("move_to_block", m_stepMotor->move_to_block(hight_trans(m_transfer_height_mm), vel));
bool hastip = false;
DO("m_smtp2->read_tip_state(hastip)", m_smtp2->read_tip_state(hastip));
if (!hastip) {
ZLOGE(TAG, "pipette gun take tip fail,no tip detected");
call_status_cb(status_cb, err::kSMTP2_TipLoadFail);
return;
}
call_status_cb(status_cb, 0);
});
return 0;
}
int32_t PipetteModule::remove_tip(s16 vel, s16 height_mm, action_cb_status_t status_cb) {
ZLOGI(TAG, "rmove_tip ");
if (!m_smtp2->isOnline()) return err::kdevice_offline;
m_thread.stop();
m_thread.start([this, vel, height_mm, status_cb]() {
// 移动移液枪到丢Tip位置
ZLOGI(TAG, "move to remove_tip_height_mm %d", height_mm);
DO("move_to_block", m_stepMotor->move_to_block(hight_trans(height_mm), vel));
// 丢弃tip头
ZLOGI(TAG, "put_tip");
DO("put_tip_block", m_smtp2->put_tip_block());
// 移液枪返回零点
ZLOGI(TAG, "move to transfer_height_mm %d", m_transfer_height_mm);
DO("move_to_block", m_stepMotor->move_to_block(hight_trans(m_transfer_height_mm), vel));
call_status_cb(status_cb, 0);
});
return 0;
}
int32_t PipetteModule::move_to(s16 vel, s16 height_mm, action_cb_status_t status_cb) {
ZLOGI(TAG, "move_to %d %d", vel, height_mm);
m_thread.stop();
m_thread.start([this, vel, height_mm, status_cb]() {
ZLOGI(TAG, "move to transfer_height_mm %d", height_mm);
DO("m_stepMotor->move_to_block(targethith)", m_stepMotor->move_to_block(hight_trans(height_mm), vel));
call_status_cb(status_cb, 0);
});
return 0;
}
int32_t PipetteModule::exec_move_to_with_lld(s16 vel, s16 lld_cap_thr, s16 lld_max_hight_mm) {
return m_stepMotor->do_motor_action_block_2(
// action function
[this, vel, lld_cap_thr, lld_max_hight_mm]() { //
return m_stepMotor->move_to(vel, hight_trans(lld_max_hight_mm), nullptr);
},
// check function
[this, lld_cap_thr](bool &reachtarget, int periodcount) {
int32_t capacitance = 0;
int32_t ret = m_smtp2->read_capacitance_val(capacitance);
if (ret != 0) {
ZLOGE(TAG, "read_capacitance_val fail, ret = %d", ret);
return ret;
}
if (capacitance > lld_cap_thr) {
ZLOGI(TAG, "capacitance %d reach threshold %d", capacitance, lld_cap_thr);
reachtarget = true;
}
if (periodcount % 100 == 0) {
ZLOGI(TAG, "capacitance %d", capacitance);
}
return int32_t(0);
});
}
int32_t PipetteModule::move_to_with_lld( //
s16 vel, s16 lld_cap_thr, s16 lld_max_hight_mm, s16 lld_rela_hight_mm, action_cb_status_t status_cb) {
ZLOGI(TAG, "move_to_with_lld %d %d %d %d", vel, lld_cap_thr, lld_max_hight_mm, lld_rela_hight_mm);
m_thread.stop();
m_thread.start([this, vel, lld_cap_thr, lld_max_hight_mm, lld_rela_hight_mm, status_cb]() {
DO("m_stepMotor->move_to(lld_max_hight_mm)", exec_move_to_with_lld(vel, lld_cap_thr, lld_max_hight_mm));
int32_t nowpos;
DO("readpos", m_stepMotor->read_pos(nowpos));
int32_t targethith = nowpos + lld_rela_hight_mm;
if (targethith > lld_max_hight_mm) {
targethith = lld_max_hight_mm;
}
DO("m_stepMotor->move_to_block(targethith)", m_stepMotor->move_to_block(hight_trans(targethith), vel));
call_status_cb(status_cb, 0);
});
return 0;
}
int32_t PipetteModule::shake(s16 shake_times, s16 shake_volume, action_cb_status_t status_cb) {
ZLOGI(TAG, "shake_volume %d %d", shake_times, shake_volume);
m_thread.stop();
m_thread.start([this, shake_times, shake_volume, status_cb]() {
for (size_t i = 0; i < shake_times; i++) {
DO("m_smtp2->move_to_ul(0)", m_smtp2->move_to_ul(0));
DO("m_smtp2->move_to_ul(shake_volume)", m_smtp2->move_to_ul(shake_volume));
}
DO("m_smtp2->move_to_ul(0)", m_smtp2->move_to_ul(0));
call_status_cb(status_cb, 0);
});
return 0;
}
int32_t PipetteModule::pipette_move_to_ul(s16 take_volume_mm, action_cb_status_t status_cb) {
ZLOGI(TAG, "pipette_move_to_ul %d", take_volume_mm);
m_thread.stop();
m_thread.start([this, take_volume_mm, status_cb]() {
DO("m_stepMotor->move_to_block(nowpos)", m_smtp2->move_to_ul(take_volume_mm));
call_status_cb(status_cb, 0);
});
return 0;
}
int32_t PipetteModule::hight_trans(s16 targethith, s16 &motormovehight) {
motormovehight = targethith;
return 0;
#if 0
bool hastip = false;
int32_t err = m_smtp2->read_tip_state(hastip);
if (err != 0) {
ZLOGE(TAG, "pipette gun lost connection");
motormovehight = 0;
return err;
}
if (hastip) {
motormovehight = targethith - m_tip_hight_mm;
} else {
motormovehight = targethith;
}
if (motormovehight < 0) {
motormovehight = 0;
}
return 0;
#endif
}
int32_t PipetteModule::get_status(status_t &status) {
#if 0
uint8_t status; // 设备状态
uint8_t io_state; // IO0:z_zero_io/IO1:hastip/
int16_t zpos_mm; // z轴位置,如果有tip,则自动加上tip高度
int16_t pipette_ul; // 移液枪液量
#endif
status.status = m_thread.isworking() ? 1 : 0;
status.pipette_gun_status = m_smtp2->getState();
status.io_state = m_stepMotor->read_zero_io_state() ? 1 : 0;
status.has_tip = m_smtp2->read_tip_state();
status.zpos_mm = m_stepMotor->read_pos();
status.pipette_ul = m_smtp2->read_pos_ul();
return 0;
}
s16 PipetteModule::hight_trans(s16 targethith) {
s16 realhight = 0;
int32_t err = hight_trans(targethith, realhight);
if (err != 0) {
ZLOGE(TAG, "pipette gun lost connection");
return 0;
}
return realhight;
}
void PipetteModule::call_status_cb(action_cb_status_t status_cb, int32_t status) { call_status_cb(status_cb, status); }
#endif

69
components/pipette_module/pipette_ctrl_module.hpp

@ -1,69 +0,0 @@
#pragma once
//
#include "sdk/os/zos.hpp"
#include "sdk\components\sensors\smtp2\smtp2.hpp"
#include "sdk\components\tmc\basic\tmc_ic_interface.hpp"
#include "sdk\components\zprotocols\zcancmder\api\i_pipette_module.hpp"
#include "sdk\components\zprotocols\zcancmder\api\i_step_motor_ctrl_module.hpp"
#include "sdk\components\step_motor_ctrl_module\step_motor_ctrl_module.hpp"
// #include "StepMotorCtrlModule"
namespace iflytop {
class PipetteModule : public I_PipetteModule {
public:
private:
bool m_module_enable = false;
SMTP2 *m_smtp2;
StepMotorCtrlModule *m_stepMotor;
ZThread m_thread;
int32_t m_lastexecstatus = 0;
bool m_has_tip = false;
base_param_t m_base_param;
int16_t m_transfer_height_mm = 0;
public:
void initialize(SMTP2 *smtp2, StepMotorCtrlModule *stepMotor);
/*******************************************************************************
* ACTION *
*******************************************************************************/
virtual int32_t enable(u8 enable) override;
virtual int32_t stop(u8 stop_type) override;
virtual int32_t zero_pos_calibrate(action_cb_status_t status_cb) override;
virtual int32_t zmotor_reset(action_cb_status_t status_cb) override;
virtual int32_t pipette_reset(action_cb_status_t status_cb) override;
virtual int32_t take_tip(s16 vel, s16 height_mm, s16 tip_hight_mm, action_cb_status_t status_cb) override;
virtual int32_t remove_tip(s16 vel, s16 height_mm, action_cb_status_t status_cb) override;
virtual int32_t move_to(s16 vel, s16 height_mm, action_cb_status_t status_cb) override;
virtual int32_t move_to_with_lld(s16 vel, s16 lld_cap_thr, s16 lld_max_hight_mm, s16 lld_rela_hight_mm, action_cb_status_t status_cb) override;
virtual int32_t shake(s16 shake_times, s16 shake_volume, action_cb_status_t status_cb) override;
virtual int32_t pipette_move_to_ul(s16 take_volume_mm, action_cb_status_t status_cb) override;
/*******************************************************************************
* ReadStatus *
*******************************************************************************/
virtual int32_t get_status(status_t &status) override;
/*******************************************************************************
* SETTING *
*******************************************************************************/
virtual int32_t set_z_motor_para(const I_StepMotorCtrlModule::base_param_t &z_motor_param) override;
virtual int32_t get_z_motor_para(I_StepMotorCtrlModule::base_param_t &z_motor_param) override;
virtual int32_t set_base_param(const base_param_t &base_param) override;
virtual int32_t get_base_param(base_param_t &base_param) override;
public:
int32_t exec_move_to_with_lld(s16 vel, s16 lld_cap_thr, s16 lld_max_hight_mm);
int32_t hight_trans(s16 targethith, s16 &motormovehight);
s16 hight_trans(s16 targethith);
void call_status_cb(action_cb_status_t status_cb, int32_t status);
};
} // namespace iflytop

176
components/step_motor_ctrl_module/step_motor_ctrl_module.cpp

@ -34,20 +34,6 @@ void StepMotorCtrlModule::initialize(int moduleid, IStepperMotor* stepM, ZGPIO i
}
active_cfg();
#if 0
run_param_t run_param;
run_to_zero_param_t run_to_zero_param;
warning_limit_param_t warning_limit_param;
read_run_param(run_param);
read_run_to_zero_param(run_to_zero_param);
read_warning_limit_param(warning_limit_param);
set_run_param(run_param);
set_run_to_zero_param(run_to_zero_param);
set_warning_limit_param(warning_limit_param);
#endif
}
bool StepMotorCtrlModule::isbusy() { return m_thread.isworking(); }
@ -60,7 +46,7 @@ int32_t StepMotorCtrlModule::move_to_logic_point(int32_t logic_point_num, action
logic_point_t logic_point = m_cfg.logic_point[logic_point_num];
return move_to(logic_point.x, logic_point.velocity, status_cb);
}
int32_t StepMotorCtrlModule::set_logic_point(int logic_point_num, int32_t x, int32_t vel, s32 acc, s32 dec) {
int32_t StepMotorCtrlModule::set_logic_point(int logic_point_num, int32_t x, int32_t vel, int32_t acc, int32_t dec) {
ZLOGI(TAG, "set_logic_point %d %d %d %d %d", logic_point_num, x, vel, acc, dec);
if (logic_point_num >= ZARRAY_SIZE(m_cfg.logic_point)) return err::kparam_out_of_range;
if (logic_point_num < 0) logic_point_num = 0;
@ -83,9 +69,7 @@ int32_t StepMotorCtrlModule::_move_to(int32_t tox, action_cb_status_t status_cb)
zlock_guard lock(m_lock);
ZLOGI(TAG, "m%d move_to %d", m_id, tox);
m_status_cb = nullptr;
m_thread.stop();
m_status_cb = status_cb;
if (m_param.min_d != 0 && tox < m_param.min_d) {
tox = m_param.min_d;
@ -109,9 +93,7 @@ int32_t StepMotorCtrlModule::_move_to(int32_t tox, action_cb_status_t status_cb)
int32_t StepMotorCtrlModule::_move_by(int32_t dx, action_cb_status_t status_cb) {
zlock_guard lock(m_lock);
ZLOGI(TAG, "m%d move_by %d", m_id, dx);
m_status_cb = nullptr;
m_thread.stop();
m_status_cb = status_cb;
int32_t xnow = 0;
getnowpos(xnow);
@ -152,9 +134,7 @@ int32_t StepMotorCtrlModule::move_by(int32_t dx, action_cb_status_t status_cb) {
int32_t StepMotorCtrlModule::calculate_curpos(action_cb_status_t status_cb) {
zlock_guard lock(m_lock);
ZLOGI(TAG, "read_curpos_by_move2zero");
m_status_cb = nullptr;
m_thread.stop();
m_status_cb = status_cb;
m_thread.start(
[this, status_cb]() {
//
@ -175,9 +155,7 @@ int32_t StepMotorCtrlModule::read_calculate_curpos_action_result(int32_t& pos) {
int32_t StepMotorCtrlModule::move_to_zero(action_cb_status_t status_cb) {
zlock_guard lock(m_lock);
ZLOGI(TAG, "move_to_zero");
m_status_cb = nullptr;
m_thread.stop();
m_status_cb = status_cb;
m_thread.start(
[this, status_cb]() {
@ -195,9 +173,7 @@ int32_t StepMotorCtrlModule::move_to_zero(action_cb_status_t status_cb) {
int32_t StepMotorCtrlModule::move_to_zero_with_calibrate(int32_t nowx, action_cb_status_t status_cb) {
zlock_guard lock(m_lock);
ZLOGI(TAG, "move_to_zero_with_calibrate x:%d", nowx);
m_status_cb = nullptr;
m_thread.stop();
m_status_cb = status_cb;
m_thread.start([this, nowx, status_cb]() {
int32_t dx;
@ -282,32 +258,6 @@ int32_t StepMotorCtrlModule::rotate(int32_t speed, int32_t lastforms, action_cb_
return 0;
}
int32_t StepMotorCtrlModule::read_version(version_t& version) { return 0; }
int32_t StepMotorCtrlModule::read_status(status_t& status) {
zlock_guard l(m_statu_lock);
status.status = m_thread.isworking() ? 1 : 0;
for (int32_t i = 0; i < m_nio; i++) {
if (m_iotable[i].getState()) {
status.io_state |= (0x01 << i);
}
}
getnowpos(status.x);
return 0;
}
int32_t StepMotorCtrlModule::read_detailed_status(detailed_status_t& debug_info) {
debug_info.status = m_thread.isworking() ? 1 : 0;
for (int32_t i = 0; i < m_nio; i++) {
if (m_iotable[i].getState()) {
debug_info.io_state |= (0x01 << i);
}
}
debug_info.last_exec_status = m_com_reg.module_last_cmd_exec_status;
getnowpos(debug_info.x);
return 0;
}
int32_t StepMotorCtrlModule::set_base_param(const base_param_t& param) {
m_param = param;
active_cfg();
@ -325,13 +275,13 @@ int32_t StepMotorCtrlModule::set_base_param(const base_param_t& param) {
ZLOGI(TAG, "= motor_shift :%d", m_param.motor_shift);
#if 0
s32 run_to_zero_max_d;
s32 run_to_zero_speed;
s32 run_to_zero_dec;
int32_t run_to_zero_max_d;
int32_t run_to_zero_speed;
int32_t run_to_zero_dec;
s32 look_zero_edge_max_d;
s32 look_zero_edge_speed;
s32 look_zero_edge_dec;
int32_t look_zero_edge_max_d;
int32_t look_zero_edge_speed;
int32_t look_zero_edge_dec;
#endif
ZLOGI(TAG, "= run_to_zero_max_d :%d", m_param.motor_run_to_zero_max_d);
ZLOGI(TAG, "= run_to_zero_speed :%d", m_param.motor_run_to_zero_speed);
@ -570,11 +520,7 @@ int32_t StepMotorCtrlModule::move_by_block(int32_t dx, int32_t velocity, int ove
return do_motor_action_block([this, velocity, dx]() { return move_by(dx, velocity, nullptr); });
}
void StepMotorCtrlModule::call_exec_status_cb(int32_t status, action_cb_status_t status_cb) {
m_com_reg.module_last_cmd_exec_status = status;
auto cache_status_cb = m_status_cb;
if (cache_status_cb) cache_status_cb(status);
}
void StepMotorCtrlModule::call_exec_status_cb(int32_t status, action_cb_status_t status_cb) { m_com_reg.module_last_cmd_exec_status = status; }
void StepMotorCtrlModule::create_default_cfg(flash_config_t& cfg) {
memset(&cfg, 0, sizeof(cfg));
cfg.base_param.motor_one_circle_pulse = 10000;
@ -641,104 +587,6 @@ int32_t StepMotorCtrlModule::module_get_error(int32_t* iserror) {
return 0;
}
#if 0
kcfg_motor_x_shift = CONFIG_CODE(100, 0), // x偏移
kcfg_motor_x_shaft = CONFIG_CODE(100, 3), // x轴是否反转
kcfg_motor_x_one_circle_pulse = CONFIG_CODE(100, 6), // x轴一圈脉冲数
kcfg_motor_default_velocity = CONFIG_CODE(100, 9), // 默认速度
kcfg_motor_default_acc = CONFIG_CODE(100, 10), // 默认加速度
kcfg_motor_default_dec = CONFIG_CODE(100, 11), // 默认减速度
// kcfg_motor_default_break_dec = CONFIG_CODE(100, 12), // 默认减速度
/*******************************************************************************
* *
*******************************************************************************/
kcfg_motor_run_to_zero_max_x_d = CONFIG_CODE(150, 0), // x轴回零最大距离
kcfg_motor_look_zero_edge_max_x_d = CONFIG_CODE(150, 3), // x轴找零边缘最大距离
kcfg_motor_run_to_zero_speed = CONFIG_CODE(150, 6), // 回零速度
kcfg_motor_run_to_zero_dec = CONFIG_CODE(150, 7), // 回零减速度
kcfg_motor_look_zero_edge_speed = CONFIG_CODE(150, 8), // 找零边缘速度
kcfg_motor_look_zero_edge_dec = CONFIG_CODE(150, 9), // 找零边缘减速度
/*******************************************************************************
* *
*******************************************************************************/
k_cfg_stepmotor_ihold = CONFIG_CODE(200, 0),
k_cfg_stepmotor_irun = CONFIG_CODE(200, 1),
k_cfg_stepmotor_iholddelay = CONFIG_CODE(200, 2),
#endif
#define SET_REG(param_id, modulereg) \
case param_id: \
modulereg = val; \
break;
#define GET_REG(param_id, modulereg) \
case param_id: \
*val = modulereg; \
break;
#if 0
int32_t StepMotorCtrlModule::module_set_reg(int32_t param_id, int32_t val) {
switch (param_id) {
SET_REG(kreg_motor_shift, m_param.motor_shift);
SET_REG(kreg_motor_shaft, m_param.x_shaft);
SET_REG(kreg_motor_one_circle_pulse, m_param.distance_scale);
SET_REG(kreg_motor_one_circle_pulse_denominator, m_param.distance_scale_denominator);
SET_REG(kreg_motor_default_velocity, m_param.maxspeed);
SET_REG(kreg_motor_default_acc, m_param.acc);
SET_REG(kreg_motor_default_dec, m_param.dec);
// SET_REG(kreg_motor_default_break_dec, m_param.dec);
SET_REG(kreg_motor_run_to_zero_max_d, m_param.run_to_zero_max_d);
SET_REG(kreg_motor_look_zero_edge_max_d, m_param.look_zero_edge_max_d);
SET_REG(kreg_motor_run_to_zero_speed, m_param.run_to_zero_speed);
SET_REG(kreg_motor_run_to_zero_dec, m_param.run_to_zero_dec);
SET_REG(kreg_motor_look_zero_edge_speed, m_param.look_zero_edge_speed);
SET_REG(kreg_motor_look_zero_edge_dec, m_param.look_zero_edge_dec);
SET_REG(kreg_stepmotor_ihold, m_param.ihold);
SET_REG(kreg_stepmotor_irun, m_param.irun);
SET_REG(kreg_stepmotor_iholddelay, m_param.iholddelay);
default:
return err::kmodule_not_find_config_index;
}
return 0;
}
int32_t StepMotorCtrlModule::module_get_reg(int32_t param_id, int32_t* val) {
int32_t nowpos = 0;
read_pos(nowpos);
switch (param_id) {
GET_REG(kreg_motor_shift, m_param.motor_shift);
GET_REG(kreg_motor_shaft, m_param.x_shaft);
GET_REG(kreg_motor_one_circle_pulse, m_param.distance_scale);
GET_REG(kreg_motor_one_circle_pulse_denominator, m_param.distance_scale_denominator);
GET_REG(kreg_motor_default_velocity, m_param.maxspeed);
GET_REG(kreg_motor_default_acc, m_param.acc);
GET_REG(kreg_motor_default_dec, m_param.dec);
GET_REG(kreg_module_input_state, _read_io());
// GET_REG(kreg_motor_default_break_dec, m_param.dec);
GET_REG(kreg_motor_run_to_zero_max_d, m_param.run_to_zero_max_d);
GET_REG(kreg_motor_look_zero_edge_max_d, m_param.look_zero_edge_max_d);
GET_REG(kreg_motor_run_to_zero_speed, m_param.run_to_zero_speed);
GET_REG(kreg_motor_run_to_zero_dec, m_param.run_to_zero_dec);
GET_REG(kreg_motor_look_zero_edge_speed, m_param.look_zero_edge_speed);
GET_REG(kreg_motor_look_zero_edge_dec, m_param.look_zero_edge_dec);
GET_REG(kreg_stepmotor_ihold, m_param.ihold);
GET_REG(kreg_stepmotor_irun, m_param.irun);
GET_REG(kreg_stepmotor_iholddelay, m_param.iholddelay);
GET_REG(kreg_module_status, m_thread.isworking() ? 0x01 : 0x00);
GET_REG(kreg_module_errorcode, 0);
GET_REG(kreg_module_enableflag, m_enable);
GET_REG(kreg_robot_pos, nowpos);
default:
return err::kmodule_not_find_config_index;
}
return 0;
}
#endif
int32_t StepMotorCtrlModule::module_set_reg(int32_t param_id, int32_t param_value) { return module_xxx_reg(param_id, false, param_value); }
int32_t StepMotorCtrlModule::module_get_reg(int32_t param_id, int32_t* param_value) { return module_xxx_reg(param_id, true, *param_value); }
int32_t StepMotorCtrlModule::module_xxx_reg(int32_t param_id, bool read, int32_t& val) {
switch (param_id) {
MODULE_COMMON_PROCESS_REG_CB();
@ -808,7 +656,6 @@ int32_t StepMotorCtrlModule::motor_enable(int32_t varenable) {
}
int32_t StepMotorCtrlModule::motor_rotate(int32_t direction, int32_t motor_velocity, int32_t acc) {
ZLOGI(TAG, "m%d motor_rotate %d", m_id, direction);
m_status_cb = nullptr;
m_thread.stop();
if (acc == 0) {
acc = m_param.motor_default_acc;
@ -826,7 +673,6 @@ int32_t StepMotorCtrlModule::motor_move_by(int32_t dx, int32_t motor_velocity, i
int32_t StepMotorCtrlModule::motor_move_to(int32_t tox, int32_t motor_velocity, int32_t acc) {
zlock_guard lock(m_lock);
ZLOGI(TAG, "m%d motor_move_to %d", m_id, tox);
m_status_cb = nullptr;
m_thread.stop();
if (m_param.min_d != 0 && tox < m_param.min_d) {
@ -899,7 +745,6 @@ void StepMotorCtrlModule::set_last_exec_status(int32_t ecode, int32_t val0, int3
int32_t StepMotorCtrlModule::motor_calculated_pos_by_move_to_zero() {
zlock_guard lock(m_lock);
ZLOGI(TAG, "motor_calculated_pos_by_move_to_zero");
m_status_cb = nullptr;
m_thread.stop();
m_thread.start(
[this]() {
@ -921,7 +766,6 @@ int32_t StepMotorCtrlModule::motor_calculated_pos_by_move_to_zero() {
int32_t StepMotorCtrlModule::motor_easy_rotate(int32_t direction) {
zlock_guard lock(m_lock);
ZLOGI(TAG, "m%d motor_easy_rotate %d", m_id, direction);
m_status_cb = nullptr;
m_thread.stop();
_rotate(direction * m_param.motor_default_velocity, m_param.motor_default_acc, m_param.motor_default_dec);
return 0;
@ -930,14 +774,12 @@ int32_t StepMotorCtrlModule::motor_easy_rotate(int32_t direction) {
int32_t StepMotorCtrlModule::motor_easy_move_by(int32_t distance) {
zlock_guard lock(m_lock);
ZLOGI(TAG, "m%d motor_easy_move_by %d", m_id, distance);
m_status_cb = nullptr;
m_thread.stop();
return motor_move_by(distance, m_param.motor_default_velocity, m_param.motor_default_acc);
};
int32_t StepMotorCtrlModule::motor_easy_move_to(int32_t position) {
zlock_guard lock(m_lock);
ZLOGI(TAG, "m%d motor_easy_move_to %d", m_id, position);
m_status_cb = nullptr;
m_thread.stop();
return motor_move_to(position, m_param.motor_default_velocity, m_param.motor_default_acc);
};
@ -948,3 +790,5 @@ int32_t StepMotorCtrlModule::motor_easy_move_to_zero(int32_t direction) {
return err::koperation_not_support;
}
};
int32_t StepMotorCtrlModule::motor_easy_move_to_io(int32_t direction, int32_t io_index) { return 0; }

111
components/step_motor_ctrl_module/step_motor_ctrl_module.hpp

@ -3,12 +3,51 @@
#include "sdk/os/zos.hpp"
#include "sdk\components\tmc\basic\tmc_ic_interface.hpp"
#include "sdk\components\zcancmder\zcanreceiver.hpp"
#include "sdk\components\zprotocols\zcancmder\api\i_step_motor_ctrl_module.hpp"
namespace iflytop {
class StepMotorCtrlModule : public I_StepMotorCtrlModule, public ZIModule, public ZIMotor {
class StepMotorCtrlModule : public ZIModule, public ZIMotor {
ENABLE_MODULE(StepMotorCtrlModule, kmotor_module, 0x0001);
public:
typedef struct {
int32_t motor_shaft;
int32_t motor_one_circle_pulse; //
int32_t motor_one_circle_pulse_denominator; //
int32_t stepmotor_ihold;
int32_t stepmotor_irun;
int32_t stepmotor_iholddelay;
int32_t motor_default_acc;
int32_t motor_default_dec;
int32_t motor_default_velocity;
int32_t min_d;
int32_t max_d;
//
int32_t motor_shift;
int32_t motor_run_to_zero_max_d;
int32_t motor_run_to_zero_speed;
int32_t motor_run_to_zero_dec;
int32_t motor_look_zero_edge_max_d;
int32_t motor_look_zero_edge_speed;
int32_t motor_look_zero_edge_dec;
} base_param_t;
typedef struct {
uint8_t index;
int32_t acc;
int32_t dec;
int32_t velocity;
int32_t x;
} logic_point_t;
typedef struct {
bool configInited;
base_param_t base_param;
logic_point_t logic_point[5];
} flash_config_t;
typedef std::function<void(int32_t status)> action_cb_status_t;
private:
IStepperMotor* m_stepM1;
int m_id = 0;
@ -29,9 +68,9 @@ class StepMotorCtrlModule : public I_StepMotorCtrlModule, public ZIModule, publi
ZGPIO* m_iotable;
int m_nio;
int32_t m_calculate_curpos_result = 0;
const char* m_flashmark = nullptr;
action_cb_status_t m_status_cb;
int32_t m_calculate_curpos_result = 0;
const char* m_flashmark = nullptr;
// action_cb_status_t m_status_cb;
// int32_t m_enable = 0;
@ -40,52 +79,48 @@ class StepMotorCtrlModule : public I_StepMotorCtrlModule, public ZIModule, publi
static void create_default_cfg(flash_config_t& cfg);
static uint32_t get_flash_cfg_size() { return sizeof(flash_config_t); }
virtual bool isbusy() override;
virtual int32_t get_last_exec_status() override { return m_com_reg.module_last_cmd_exec_status; };
virtual bool isbusy();
virtual int32_t get_last_exec_status() { return m_com_reg.module_last_cmd_exec_status; };
virtual int32_t move_to(int32_t tox, action_cb_status_t status_cb) override;
virtual int32_t move_by(int32_t dx, action_cb_status_t status_cb) override;
virtual int32_t move_to(int32_t x, int32_t velocity, action_cb_status_t status_cb) override;
virtual int32_t move_by(int32_t dx, int32_t velocity, action_cb_status_t status_cb) override;
virtual int32_t move_to(int32_t tox, action_cb_status_t status_cb);
virtual int32_t move_by(int32_t dx, action_cb_status_t status_cb);
virtual int32_t move_to(int32_t x, int32_t velocity, action_cb_status_t status_cb);
virtual int32_t move_by(int32_t dx, int32_t velocity, action_cb_status_t status_cb);
virtual int32_t calculate_curpos(action_cb_status_t status_cb);
virtual int32_t read_calculate_curpos_action_result(int32_t& pos);
virtual int32_t move_to_logic_point(int32_t logic_point_num, action_cb_status_t status_cb) override;
virtual int32_t set_logic_point(int logic_point_num, int32_t x, int32_t vel, s32 acc, s32 dec) override;
virtual int32_t get_logic_point(int logic_point_num, logic_point_t& logic_point) override;
virtual int32_t move_to_logic_point(int32_t logic_point_num, action_cb_status_t status_cb);
virtual int32_t set_logic_point(int logic_point_num, int32_t x, int32_t vel, int32_t acc, int32_t dec);
virtual int32_t get_logic_point(int logic_point_num, logic_point_t& logic_point);
virtual int32_t move_to_zero(action_cb_status_t status_cb) override;
virtual int32_t move_to_zero_with_calibrate(int32_t x, action_cb_status_t status_cb) override;
virtual int32_t move_to_zero(action_cb_status_t status_cb);
virtual int32_t move_to_zero_with_calibrate(int32_t x, action_cb_status_t status_cb);
virtual int32_t move_to_block(int32_t tox, int overtime = 0) override;
virtual int32_t move_by_block(int32_t dx, int overtime = 0) override;
virtual int32_t move_to_block(int32_t tox, int overtime = 0);
virtual int32_t move_by_block(int32_t dx, int overtime = 0);
virtual int32_t move_to_block(int32_t tox, int32_t velocity, int overtime = 0) override;
virtual int32_t move_by_block(int32_t dx, int32_t velocity, int overtime = 0) override;
virtual int32_t move_to_block(int32_t tox, int32_t velocity, int overtime = 0);
virtual int32_t move_by_block(int32_t dx, int32_t velocity, int overtime = 0);
virtual int32_t move_to_zero_block(int overtime = 0) override;
virtual int32_t move_to_zero_with_calibrate_block(int32_t x, int overtime = 0) override;
virtual int32_t move_to_zero_block(int overtime = 0);
virtual int32_t move_to_zero_with_calibrate_block(int32_t x, int overtime = 0);
virtual int32_t rotate(int32_t speed, int32_t lastforms, action_cb_status_t status_cb);
virtual int32_t enable(bool venable) override;
virtual int32_t stop(uint8_t stopType) override;
virtual int32_t force_change_current_pos(int32_t x) override;
virtual int32_t read_version(version_t& version) override;
virtual int32_t read_status(status_t& status) override;
virtual int32_t read_detailed_status(detailed_status_t& debug_info) override;
virtual int32_t enable(bool venable);
virtual int32_t stop(uint8_t stopType);
virtual int32_t force_change_current_pos(int32_t x);
virtual int32_t set_base_param(const base_param_t& param) override;
virtual int32_t get_base_param(base_param_t& param) override;
virtual int32_t set_base_param(const base_param_t& param);
virtual int32_t get_base_param(base_param_t& param);
virtual int32_t read_pos(int32_t& pos) override;
virtual int32_t read_pos() override;
virtual bool read_zero_io_state() override;
virtual int32_t read_pos(int32_t& pos);
virtual int32_t read_pos();
virtual bool read_zero_io_state();
virtual int32_t flush() override;
virtual int32_t factory_reset() override;
virtual int32_t flush();
virtual int32_t factory_reset();
int32_t do_motor_action_block_2(function<int32_t()> action, function<int32_t(bool&, int periodcount)> break_condition);
@ -102,9 +137,6 @@ class StepMotorCtrlModule : public I_StepMotorCtrlModule, public ZIModule, publi
virtual int32_t module_get_error(int32_t* iserror) override;
virtual int32_t module_clear_error() override;
virtual int32_t module_set_reg(int32_t param_id, int32_t param_value) override;
virtual int32_t module_get_reg(int32_t param_id, int32_t* param_value) override;
virtual int32_t module_readio(int32_t* io) override;
virtual int32_t module_read_adc(int32_t adcindex, int32_t* adc) override;
@ -142,6 +174,7 @@ class StepMotorCtrlModule : public I_StepMotorCtrlModule, public ZIModule, publi
virtual int32_t motor_easy_move_by(int32_t distance) override;
virtual int32_t motor_easy_move_to(int32_t position) override;
virtual int32_t motor_easy_move_to_zero(int32_t direction) override;
virtual int32_t motor_easy_move_to_io(int32_t direction, int32_t io_index) override;
IStepperMotor* _getStepMotor() { return m_stepM1; }
base_param_t& _get_base_param() { return m_param; }

34
components/zcancmder_module/zcan_motor_laser_code_scanner_scan_module.cpp

@ -1,34 +0,0 @@
#include "zcan_motor_laser_code_scanner_scan_module.hpp"
#include "string.h"
using namespace iflytop;
#define TAG "ZcanMotorLaserCodeScannerScanModule"
#if 0
void ZcanMotorLaserCodeScannerScanModule::initialize(ZCanCmder* cancmder, int id, I_MotorLaserCodeScanner* module) {
m_cancmder = cancmder;
m_id = id;
m_module = module;
m_lock.init();
cancmder->registerListener(this);
}
void ZcanMotorLaserCodeScannerScanModule::onRceivePacket(CanPacketRxBuffer* rxcmd) {
PROCESS_PACKET(kcmd_motor_laser_code_scanner_scan, m_id) {
errorcode = m_module->start_scan( //
cmd->moveby_distance, //
cmd->scan_interval_distance, //
cmd->each_sample_times, //
cmd->transmitting_tube_amplification, //
cmd->receiving_tube_amplification, //
[this, cmdheader](int32_t status) { PROCESS_REPORT(kcmd_motor_laser_code_scanner_scan); });
}
END_PP();
PROCESS_PACKET(kcmd_motor_laser_code_scanner_stop_scan, m_id) { errorcode = m_module->stop_scan(); }
END_PP();
PROCESS_PACKET(kcmd_motor_laser_code_scanner_get_scan_result, m_id) { errorcode = m_module->get_scan_result(cmd->sector_index, cmd->sector_size, ack->ack); }
END_PP();
}
#endif

22
components/zcancmder_module/zcan_motor_laser_code_scanner_scan_module.hpp

@ -1,22 +0,0 @@
#pragma once
// #include "sdk/components/zprotocols/zcancmder/api/i_step_motor_ctrl_module.hpp"
// #include "sdk/components/zprotocols/zcancmder/api/i_pipette_module.hpp"
#include "sdk/components/zprotocols/zcancmder/api/i_motor_laser_code_scanner.hpp"
#include "sdk\components\zcancmder\zcanreceiver.hpp"
#include "sdk\os\zos.hpp"
namespace iflytop {
#if 0
class ZcanMotorLaserCodeScannerScanModule : public ZCanCmderListener {
ZCanCmder* m_cancmder = nullptr;
int m_id = 0;
I_MotorLaserCodeScanner* m_module;
uint8_t m_txbuf[512] = {0};
zmutex m_lock;
public:
void initialize(ZCanCmder* cancmder, int id, I_MotorLaserCodeScanner* module);
virtual void onRceivePacket(CanPacketRxBuffer* rxcmd);
};
#endif
} // namespace iflytop

78
components/zcancmder_module/zcan_pipette_module.cpp

@ -1,78 +0,0 @@
#include "zcan_pipette_module.hpp"
using namespace iflytop;
#define TAG "ZcanPipetteModule"
#if 0
void ZcanPipetteModule::initialize(ZCanCmder* cancmder, int id, I_PipetteModule* module) {
m_cancmder = cancmder;
m_id = id;
m_module = module;
m_lock.init();
cancmder->registerListener(this);
}
void ZcanPipetteModule::onRceivePacket(CanPacketRxBuffer* rxcmd) {
PROCESS_PACKET(kcmd_pipette_module_enable, m_id) { errorcode = m_module->enable(cmd->enable); }
END_PP();
PROCESS_PACKET(kcmd_pipette_module_stop, m_id) { errorcode = m_module->stop(cmd->stop_type); }
END_PP();
PROCESS_PACKET(kcmd_pipette_module_zero_pos_calibrate, m_id) {
errorcode = m_module->zero_pos_calibrate([this, cmdheader](int32_t status) { PROCESS_REPORT(kcmd_pipette_module_zero_pos_calibrate); });
}
END_PP();
PROCESS_PACKET(kcmd_pipeete_module_zmotor_reset, m_id) {
errorcode = m_module->zmotor_reset([this, cmdheader](int32_t status) { PROCESS_REPORT(kcmd_pipeete_module_zmotor_reset); });
}
END_PP();
PROCESS_PACKET(kcmd_pipeete_module_pipette_reset, m_id) {
errorcode = m_module->pipette_reset([this, cmdheader](int32_t status) { PROCESS_REPORT(kcmd_pipeete_module_pipette_reset); });
}
END_PP();
PROCESS_PACKET(kcmd_pipette_module_take_tip, m_id) {
errorcode = m_module->take_tip(cmd->vel, cmd->height_mm, cmd->tip_hight_mm, [this, cmdheader](int32_t status) { PROCESS_REPORT(kcmd_pipette_module_take_tip); });
}
END_PP();
PROCESS_PACKET(kcmd_pipette_module_remove_tip, m_id) {
errorcode = m_module->remove_tip(cmd->vel, cmd->height_mm, [this, cmdheader](int32_t status) { PROCESS_REPORT(kcmd_pipette_module_remove_tip); });
}
END_PP();
PROCESS_PACKET(kcmd_pipette_module_move_to, m_id) {
errorcode = m_module->move_to(cmd->vel, cmd->height_mm, [this, cmdheader](int32_t status) { PROCESS_REPORT(kcmd_pipette_module_move_to); });
}
END_PP();
PROCESS_PACKET(kcmd_pipette_module_move_to_with_lld, m_id) {
errorcode = m_module->move_to_with_lld(cmd->vel, cmd->lld_cap_thr, cmd->lld_max_hight_mm, cmd->lld_rela_hight_mm, [this, cmdheader](int32_t status) { PROCESS_REPORT(kcmd_pipette_module_move_to_with_lld); });
}
END_PP();
PROCESS_PACKET(kcmd_pipette_module_shake, m_id) {
errorcode = m_module->shake(cmd->shake_times, cmd->shake_volume, [this, cmdheader](int32_t status) { PROCESS_REPORT(kcmd_pipette_module_shake); });
}
END_PP();
PROCESS_PACKET(kcmd_pipette_module_pipette_move_to_ul, m_id) {
errorcode = m_module->pipette_move_to_ul(cmd->take_volume_mm, [this, cmdheader](int32_t status) { PROCESS_REPORT(kcmd_pipette_module_pipette_move_to_ul); });
}
END_PP();
PROCESS_PACKET(kcmd_pipette_module_get_status, m_id) { errorcode = m_module->get_status(ack->ack); }
END_PP();
PROCESS_PACKET(kcmd_pipette_module_set_z_motor_para, m_id) { errorcode = m_module->set_z_motor_para(cmd->param); }
END_PP();
PROCESS_PACKET(kcmd_pipette_module_get_z_motor_para, m_id) { errorcode = m_module->get_z_motor_para(ack->ack); }
END_PP();
PROCESS_PACKET(kcmd_pipette_module_set_base_param, m_id) { errorcode = m_module->set_base_param(cmd->param); }
END_PP();
PROCESS_PACKET(kcmd_pipette_module_get_base_param, m_id) { errorcode = m_module->get_base_param(ack->ack); }
END_PP();
}
#endif

20
components/zcancmder_module/zcan_pipette_module.hpp

@ -1,20 +0,0 @@
#pragma once
// #include "sdk/components/zprotocols/zcancmder/api/i_step_motor_ctrl_module.hpp"
#include "sdk/components/zprotocols/zcancmder/api/i_pipette_module.hpp"
#include "sdk\components\zcancmder\zcanreceiver.hpp"
namespace iflytop {
#if 0
class ZcanPipetteModule : public ZCanCmderListener {
ZCanCmder* m_cancmder = nullptr;
int m_id = 0;
I_PipetteModule* m_module;
uint8_t m_txbuf[128] = {0};
zmutex m_lock;
public:
void initialize(ZCanCmder* cancmder, int id, I_PipetteModule* module);
virtual void onRceivePacket(CanPacketRxBuffer* rxcmd);
};
#endif
} // namespace iflytop

2
components/zprotocols/zcancmder

@ -1 +1 @@
Subproject commit 35ead127ccd9676336f14a982d1dd3d6b95fe2ad
Subproject commit b03e0a12e3ae450cbcdf5fd0f0218b258071f2eb

2
components/zprotocols/zcancmder_v2

@ -1 +1 @@
Subproject commit b07e34e08cd6954295d3a6c2104fd0457bc4dab4
Subproject commit 006b7d8844cea0f95bc64f672cb3e7b82108e9ed
Loading…
Cancel
Save