Browse Source

update

change_pipette_api
zhaohe 1 year ago
parent
commit
df10e6c255
  1. 3
      api/apibasic/cmdid.hpp
  2. 12
      api/apibasic/errorcode.hpp
  3. 17
      api/apibasic/reg_index.hpp
  4. 7
      api/zi_module.cpp
  5. 3
      api/zi_module.hpp
  6. 1
      api/zi_motor.hpp

3
api/apibasic/cmdid.hpp

@ -19,7 +19,7 @@ typedef enum {
virtual int32_t module_enable(int32_t enable) { return err::koperation_not_support; }
virtual int32_t module_start() { return err::koperation_not_support; }
#endif
kmodule_ping = CMDID(1, 0), // para:{}, ack:{}
kmodule_ping = CMDID(1, 0), // para:{}, ack:{}
// kmodule_stop = CMDID(1, 1), // para:{}, ack:{}
// kmodule_break = CMDID(1, 2), // para:{}, ack:{}
// kmodule_get_last_exec_status = CMDID(1, 3), // para:{}, ack:{4}
@ -111,6 +111,7 @@ typedef enum {
kstep_motor_easy_move_to_io = CMDID(2, 22), // para:{4,4}, ack:{}
kstep_motor_active_cfg = CMDID(2, 23), // para:{4,4}, ack:{}
kstep_motor_stop = CMDID(2, 24), // para:{4}, ack:{}
kstep_motor_read_io_state = CMDID(2, 25), // para:{4}, ack:{}
} cmdid_t;

12
api/apibasic/errorcode.hpp

@ -67,6 +67,7 @@ typedef enum {
kxymotor_x_find_zero_edge_fail = ERROR_CODE(300, 6), // 离开零点失败
kxymotor_y_find_zero_edge_fail = ERROR_CODE(300, 7), // 离开零点失败
kmotor_run_overtime = ERROR_CODE(300, 8), // 运行超时
kmotor_not_enable = ERROR_CODE(300, 9), // 电机未使能
/**
* @brief STMP2错误
@ -102,6 +103,17 @@ typedef enum {
kmicro_uartRecvFail = ERROR_CODE(500, 2), //
kmicro_adcRecvFail = ERROR_CODE(500, 3), //
/**
* @brief step motor error
*/
kstep_motor_not_found_zero_point = ERROR_CODE(600, 0), // 未找到零点
kstep_motor_not_go_zero = ERROR_CODE(600, 1), // 设备未归零
kstep_motor_over_temperature = ERROR_CODE(600, 2), // 过温
kstep_motor_over_voltage = ERROR_CODE(600, 3), // 过压
kstep_motor_run_overtime = ERROR_CODE(600, 4), // 运行超时
kstep_motor_not_enable = ERROR_CODE(600, 5), // 电机未使能
kstep_motor_ioindex_out_of_range = ERROR_CODE(600, 6), // IO超出范围
} error_t;
const char* error2str(int32_t code);

17
api/apibasic/reg_index.hpp

@ -9,10 +9,10 @@ typedef enum {
/*******************************************************************************
* *
*******************************************************************************/
kreg_module_version = REG_INDEX(0, 0, 0), // 模块版本
kreg_module_type = REG_INDEX(0, 0, 1), // 模块类型
kreg_module_status = REG_INDEX(0, 0, 2), // 0idle,1busy,2error
kreg_module_errorcode = REG_INDEX(0, 0, 3), // inited_flag
kreg_module_version = REG_INDEX(0, 0, 0), // 模块版本
kreg_module_type = REG_INDEX(0, 0, 1), // 模块类型
kreg_module_status = REG_INDEX(0, 0, 2), // 0idle,1busy,2error
kreg_module_errorcode = REG_INDEX(0, 0, 3), // inited_flag
// kreg_module_raw_sector_size = REG_INDEX(0, 0, 10), // sector_size
// kreg_module_raw_sector_num = REG_INDEX(0, 0, 11), //
@ -125,8 +125,10 @@ typedef enum {
/*******************************************************************************
* MOTOR_DEFAULT *
*******************************************************************************/
kreg_step_motor_pos = REG_INDEX(10, 0, 1), // 机器人x坐标
kreg_step_motor_io_state = REG_INDEX(10, 0, 2), // IO状态
kreg_step_motor_pos = REG_INDEX(10, 0, 1), // 机器人x坐标
kreg_step_motor_io_state = REG_INDEX(10, 0, 2), // IO状态
kreg_step_motor_dpos = REG_INDEX(10, 0, 3), // 执行完上一条指令后的相对位移
kreg_step_motor_shift = REG_INDEX(10, 50, 0), // x偏移
kreg_step_motor_shaft = REG_INDEX(10, 50, 1), // x轴是否反转
kreg_step_motor_one_circle_pulse = REG_INDEX(10, 50, 2), // x轴一圈脉冲数
@ -149,9 +151,6 @@ typedef enum {
kreg_step_motor_max_d = REG_INDEX(10, 50, 28), // 最大限制距离
kreg_step_motor_min_d = REG_INDEX(10, 50, 29), // 最小限制距离
/***********************************************************************************************************************
* XYROBOT *
***********************************************************************************************************************/

7
api/zi_module.cpp

@ -1,4 +1,4 @@
#pragma once
#include "zi_module.hpp"
#include <stdint.h>
@ -89,3 +89,8 @@ int32_t ZIModule::module_clear_error() {
creg.module_errorbitflag0 = 0;
return 0;
}
int32_t ZIModule::module_get_status(int32_t *status) {
*status = creg.m_module_status;
return 0;
}

3
api/zi_module.hpp

@ -40,6 +40,7 @@ using namespace std;
typedef struct {
int32_t module_errorcode;
int32_t module_errorbitflag0;
int32_t m_module_status;
} module_common_reg_t;
class ZIModule {
@ -58,6 +59,7 @@ class ZIModule {
virtual int32_t module_clear_error();
virtual int32_t module_set_reg(int32_t param_id, int32_t param_value);
virtual int32_t module_get_reg(int32_t param_id, int32_t *param_value);
virtual int32_t module_get_status(int32_t *status);
virtual int32_t module_get_version(int32_t *val) = 0;
virtual int32_t module_get_type(int32_t *val) = 0;
@ -65,7 +67,6 @@ class ZIModule {
* Óû§ÊµÏÖ *
***********************************************************************************************************************/
virtual int32_t getid(int32_t *id) = 0;
virtual int32_t module_get_status(int32_t *status) = 0;
virtual int32_t module_xxx_reg(int32_t param_id, bool read, int32_t &val) = 0;
protected:

1
api/zi_motor.hpp

@ -20,5 +20,6 @@ class ZIStepMotor {
virtual int32_t step_motor_easy_set_current_pos(int32_t pos) = 0;
virtual int32_t step_motor_easy_move_to_io(int32_t ioindex, int32_t direction) = 0;
virtual int32_t step_motor_active_cfg() = 0;
virtual int32_t step_motor_read_io_state(int32_t ioindex) = 0;
};
} // namespace iflytop
Loading…
Cancel
Save