Browse Source

update

change_pipette_api
zhaohe 2 years ago
parent
commit
d0f4558017
  1. 6
      api/zi_motor.hpp
  2. 11
      cmdid.hpp
  3. 9
      protocol_parser.cpp
  4. 9
      protocol_proxy.cpp
  5. 10
      protocol_proxy.hpp
  6. 9
      zmodule_device_manager.cpp
  7. 10
      zmodule_device_manager.hpp
  8. 12
      zmodule_device_script_cmder_paser.cpp

6
api/zi_motor.hpp

@ -11,6 +11,7 @@ class ZIMotor {
public:
virtual ~ZIMotor() {}
virtual int32_t motor_enable(int32_t enable) { return err::koperation_not_support; }
virtual int32_t motor_rotate(int32_t direction, int32_t motor_velocity, int32_t acc) { return err::koperation_not_support; }
virtual int32_t motor_move_by(int32_t distance, int32_t motor_velocity, int32_t acc) { return err::koperation_not_support; }
virtual int32_t motor_move_to(int32_t position, int32_t motor_velocity, int32_t acc) { return err::koperation_not_support; }
@ -33,6 +34,11 @@ class ZIMotor {
virtual int32_t motor_read_pos(int32_t* pos) { return err::koperation_not_support; }
virtual int32_t motor_set_current_pos_by_change_shift(int32_t pos) { return err::koperation_not_support; } // Ò»°ãÓÃÓÚ¶æ»ú
virtual int32_t motor_easy_rotate(int32_t direction) { return err::koperation_not_support; };
virtual int32_t motor_easy_move_by(int32_t distance) { return err::koperation_not_support; };
virtual int32_t motor_easy_move_to(int32_t position) { return err::koperation_not_support; };
virtual int32_t motor_easy_move_to_zero(int32_t direction) { return err::koperation_not_support; };
// virtual int32_t motor_set_shaft();
// s32 pos, s32 speed, s32 torque,

11
cmdid.hpp

@ -56,6 +56,12 @@ typedef enum {
virtual int32_t motor_read_pos(int32_t* pos) { return err::koperation_not_support; }
virtual int32_t motor_set_current_pos_by_change_shift(int32_t pos) { return err::koperation_not_support; } // Ò»°ãÓÃÓÚ¶æ»ú
virtual int32_t motor_easy_rotate(int32_t direction) { return err::koperation_not_support; };
virtual int32_t motor_easy_move_by(int32_t distance) { return err::koperation_not_support; };
virtual int32_t motor_easy_move_to(int32_t position) { return err::koperation_not_support; };
virtual int32_t motor_easy_move_to_zero(int32_t direction) { return err::koperation_not_support; };
#endif
kmotor_enable = CMDID(2, 1), // para:{1}, ack:{}
@ -75,6 +81,11 @@ typedef enum {
kmotor_move_to_torque = CMDID(2, 15), // para:{4,4,4}, ack:{}
kmotor_calculated_pos_by_move_to_zero = CMDID(2, 16), // para:{}, ack:{}
kmotor_easy_rotate = CMDID(2, 17), // para:{4}, ack:{}
kmotor_easy_move_by = CMDID(2, 18), // para:{4}, ack:{}
kmotor_easy_move_to = CMDID(2, 19), // para:{4}, ack:{}
kmotor_easy_move_to_zero = CMDID(2, 20), // para:{1}, ack:{}
#if 0
virtual ~ZIXYMotor() {}
virtual int32_t xymotor_enable(int32_t enable) { return err::koperation_not_support; }

9
protocol_parser.cpp

@ -204,6 +204,11 @@ void ZIProtocolParser::onRceivePacket(zcr_cmd_header_t* rxcmd, uint8_t* data, in
virtual int32_t motor_calculated_pos_by_move_to_zero() { return err::koperation_not_support; }
virtual int32_t motor_easy_rotate(int32_t direction) { return err::koperation_not_support; };
virtual int32_t motor_easy_move_by(int32_t distance) { return err::koperation_not_support; };
virtual int32_t motor_easy_move_to(int32_t position) { return err::koperation_not_support; };
virtual int32_t motor_easy_move_to_zero(int32_t direction) { return err::koperation_not_support; };
#endif
PROCESS_PACKET_10(kmotor_enable, ZIMotor, motor_enable);
PROCESS_PACKET_30(kmotor_rotate, ZIMotor, motor_rotate);
@ -221,6 +226,10 @@ void ZIProtocolParser::onRceivePacket(zcr_cmd_header_t* rxcmd, uint8_t* data, in
PROCESS_PACKET_40(kmotor_motor_move_to_zero_backward_and_calculated_shift, ZIMotor, motor_move_to_zero_backward_and_calculated_shift);
PROCESS_PACKET_30(kmotor_move_to_torque, ZIMotor, motor_move_to_torque);
PROCESS_PACKET_00(kmotor_calculated_pos_by_move_to_zero, ZIMotor, motor_calculated_pos_by_move_to_zero);
PROCESS_PACKET_10(kmotor_easy_rotate, ZIMotor, motor_easy_rotate);
PROCESS_PACKET_10(kmotor_easy_move_by, ZIMotor, motor_easy_move_by);
PROCESS_PACKET_10(kmotor_easy_move_to, ZIMotor, motor_easy_move_to);
PROCESS_PACKET_10(kmotor_easy_move_to_zero, ZIMotor, motor_easy_move_to_zero);
/*******************************************************************************
* xymotor *

9
protocol_proxy.cpp

@ -133,6 +133,10 @@ int32_t ZIProtocolProxy::module_enable(int32_t para0) { PROXY_IMPL_10(kmodule_en
virtual int32_t motor_set_current_pos_by_change_shift(int32_t pos) { return err::koperation_not_support; } // Ò»°ãÓÃÓÚ¶æ»ú
virtual int32_t motor_calculated_pos_by_move_to_zero() { return err::koperation_not_support; }
virtual int32_t motor_easy_rotate(int32_t direction) { return err::koperation_not_support; };
virtual int32_t motor_easy_move_by(int32_t distance) { return err::koperation_not_support; };
virtual int32_t motor_easy_move_to(int32_t position) { return err::koperation_not_support; };
virtual int32_t motor_easy_move_to_zero(int32_t direction) { return err::koperation_not_support; };
#endif
int32_t ZIProtocolProxy::motor_enable(int32_t para0) { PROXY_IMPL_10(kmotor_enable, 30); }
@ -157,6 +161,11 @@ int32_t ZIProtocolProxy::motor_move_to_zero_backward_and_calculated_shift(int32_
int32_t ZIProtocolProxy::motor_move_to_torque(int32_t para0, int32_t para1, int32_t para2) { PROXY_IMPL_30(kmotor_move_to_torque, 30); }
int32_t ZIProtocolProxy::motor_calculated_pos_by_move_to_zero() { PROXY_IMPL_00(kmotor_calculated_pos_by_move_to_zero, 30); }
int32_t ZIProtocolProxy::motor_easy_rotate(int32_t para0) { PROXY_IMPL_10(kmotor_easy_rotate, 30); }
int32_t ZIProtocolProxy::motor_easy_move_by(int32_t para0) { PROXY_IMPL_10(kmotor_easy_move_by, 30); }
int32_t ZIProtocolProxy::motor_easy_move_to(int32_t para0) { PROXY_IMPL_10(kmotor_easy_move_to, 30); }
int32_t ZIProtocolProxy::motor_easy_move_to_zero(int32_t para0) { PROXY_IMPL_10(kmotor_easy_move_to_zero, 30); }
/*******************************************************************************
* ZIXYMotor *
*******************************************************************************/

10
protocol_proxy.hpp

@ -87,6 +87,11 @@ class ZIProtocolProxy : public ZIMotor, //
virtual int32_t motor_set_current_pos_by_change_shift(int32_t pos) { return err::koperation_not_support; } // 一锟斤拷锟斤拷锟节讹拷锟?
virtual int32_t motor_calculated_pos_by_move_to_zero() { return err::koperation_not_support; }
virtual int32_t motor_easy_rotate(int32_t direction) { return err::koperation_not_support; };
virtual int32_t motor_easy_move_by(int32_t distance) { return err::koperation_not_support; };
virtual int32_t motor_easy_move_to(int32_t position) { return err::koperation_not_support; };
virtual int32_t motor_easy_move_to_zero(int32_t direction) { return err::koperation_not_support; };
#endif
virtual int32_t motor_enable(int32_t enable) override;
@ -111,6 +116,11 @@ class ZIProtocolProxy : public ZIMotor, //
virtual int32_t motor_move_to_torque(int32_t pos, int32_t torque, int32_t overtime) override;
virtual int32_t motor_calculated_pos_by_move_to_zero() override;
virtual int32_t motor_easy_rotate(int32_t direction) override;
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;
/*******************************************************************************
* ZIXYMotor *
*******************************************************************************/

9
zmodule_device_manager.cpp

@ -89,6 +89,11 @@ int32_t ZModuleDeviceManager::module_start(uint16_t id) { PROXY_IMPL(ZIModule, m
virtual int32_t motor_set_current_pos_by_change_shift(int32_t pos) { return err::koperation_not_support; } // 一锟斤拷锟斤拷锟节讹拷锟?
virtual int32_t motor_calculated_pos_by_move_to_zero() { return err::koperation_not_support; }
virtual int32_t motor_easy_rotate(uint16_t id, int32_t direction);
virtual int32_t motor_easy_move_by(uint16_t id, int32_t distance);
virtual int32_t motor_easy_move_to(uint16_t id, int32_t position);
virtual int32_t motor_easy_move_to_zero(uint16_t id, int32_t direction);
#endif
int32_t ZModuleDeviceManager::motor_enable(uint16_t id, int32_t enable) { PROXY_IMPL(ZIMotor, motor_enable, enable); }
int32_t ZModuleDeviceManager::motor_rotate(uint16_t id, int32_t direction, int32_t motor_velocity, int32_t acc) { PROXY_IMPL(ZIMotor, motor_rotate, direction, motor_velocity, acc); }
@ -106,6 +111,10 @@ int32_t ZModuleDeviceManager::motor_move_to_zero_forward_and_calculated_shift(ui
int32_t ZModuleDeviceManager::motor_move_to_zero_backward_and_calculated_shift(uint16_t id, int32_t findzerospeed, int32_t findzeroedge_speed, int32_t acc, int32_t overtime) { PROXY_IMPL(ZIMotor, motor_move_to_zero_backward_and_calculated_shift, findzerospeed, findzeroedge_speed, acc, overtime); }
int32_t ZModuleDeviceManager::motor_move_to_torque(uint16_t id, int32_t pos, int32_t torque, int32_t overtime) { PROXY_IMPL(ZIMotor, motor_move_to_torque, pos, torque, overtime); }
int32_t ZModuleDeviceManager::motor_calculated_pos_by_move_to_zero(uint16_t id) { PROXY_IMPL(ZIMotor, motor_calculated_pos_by_move_to_zero); }
int32_t ZModuleDeviceManager::motor_easy_rotate(uint16_t id, int32_t direction) { PROXY_IMPL(ZIMotor, motor_easy_rotate, direction); }
int32_t ZModuleDeviceManager::motor_easy_move_by(uint16_t id, int32_t distance) { PROXY_IMPL(ZIMotor, motor_easy_move_by, distance); }
int32_t ZModuleDeviceManager::motor_easy_move_to(uint16_t id, int32_t position) { PROXY_IMPL(ZIMotor, motor_easy_move_to, position); }
int32_t ZModuleDeviceManager::motor_easy_move_to_zero(uint16_t id, int32_t direction) { PROXY_IMPL(ZIMotor, motor_easy_move_to_zero, direction); }
/*******************************************************************************
* ZIXYMotor *
*******************************************************************************/

10
zmodule_device_manager.hpp

@ -131,6 +131,11 @@ class ZModuleDeviceManager {
virtual int32_t motor_set_current_pos_by_change_shift(int32_t pos) { return err::koperation_not_support; } // 一锟斤拷锟斤拷锟节讹拷锟?
virtual int32_t motor_calculated_pos_by_move_to_zero() { return err::koperation_not_support; }
virtual int32_t motor_easy_rotate(int32_t direction) { return err::koperation_not_support; };
virtual int32_t motor_easy_move_by(int32_t distance) { return err::koperation_not_support; };
virtual int32_t motor_easy_move_to(int32_t position) { return err::koperation_not_support; };
virtual int32_t motor_easy_move_to_zero(int32_t direction) { return err::koperation_not_support; };
#endif
virtual int32_t motor_enable(uint16_t id, int32_t enable);
virtual int32_t motor_rotate(uint16_t id, int32_t direction, int32_t motor_velocity, int32_t acc);
@ -148,6 +153,11 @@ class ZModuleDeviceManager {
virtual int32_t motor_move_to_zero_backward_and_calculated_shift(uint16_t id, int32_t findzerospeed, int32_t findzeroedge_speed, int32_t acc, int32_t overtime);
virtual int32_t motor_move_to_torque(uint16_t id, int32_t pos, int32_t torque, int32_t overtime);
virtual int32_t motor_calculated_pos_by_move_to_zero(uint16_t id);
virtual int32_t motor_easy_rotate(uint16_t id, int32_t direction);
virtual int32_t motor_easy_move_by(uint16_t id, int32_t distance);
virtual int32_t motor_easy_move_to(uint16_t id, int32_t position);
virtual int32_t motor_easy_move_to_zero(uint16_t id, int32_t direction);
/*******************************************************************************
* ZIXYMotor *

12
zmodule_device_script_cmder_paser.cpp

@ -99,6 +99,7 @@ void ZModuleDeviceScriptCmderPaser::regfn() {
virtual int32_t motor_move_to_zero_forward_and_calculated_shift(int32_t findzerospeed, int32_t findzeroedge_speed, int32_t acc, int32_t overtime) override;
virtual int32_t motor_move_to_zero_backward_and_calculated_shift(int32_t findzerospeed, int32_t findzeroedge_speed, int32_t acc, int32_t overtime) override;
virtual int32_t module_enable(uint16_t id, int32_t enable);
#endif
PROCESS_PACKET_10(module_ping, "(mid)");
PROCESS_PACKET_10(module_stop, "(mid)");
@ -128,7 +129,6 @@ void ZModuleDeviceScriptCmderPaser::regfn() {
ack->acktype = ICmdParserACK::kAckType_buf;
});
PROCESS_PACKET_20(module_enable, "(mid, enable)");
#if 0
virtual int32_t motor_enable(int32_t enable) { return err::koperation_not_support; }
virtual int32_t motor_rotate(int32_t direction, int32_t motor_velocity, int32_t acc) { return err::koperation_not_support; }
@ -151,6 +151,11 @@ void ZModuleDeviceScriptCmderPaser::regfn() {
virtual int32_t motor_read_pos(int32_t* pos) { return err::koperation_not_support; }
virtual int32_t motor_set_current_pos_by_change_shift(int32_t pos) { return err::koperation_not_support; } // Ò»°ãÓÃÓÚ¶æ»ú
virtual int32_t motor_calculated_pos_by_move_to_zero() { return err::koperation_not_support; }
virtual int32_t motor_easy_rotate(uint16_t id, int32_t direction);
virtual int32_t motor_easy_move_by(uint16_t id, int32_t distance);
virtual int32_t motor_easy_move_to(uint16_t id, int32_t position);
virtual int32_t motor_easy_move_to_zero(uint16_t id, int32_t direction);
#endif
PROCESS_PACKET_20(motor_enable, "(mid, enable)");
@ -175,6 +180,11 @@ void ZModuleDeviceScriptCmderPaser::regfn() {
PROCESS_PACKET_50(motor_move_to_zero_backward_and_calculated_shift, "(mid, findzerospeed, findzeroedge_speed, acc, overtime)");
PROCESS_PACKET_10(motor_calculated_pos_by_move_to_zero, "(mid)");
PROCESS_PACKET_20(motor_easy_rotate, "(mid, direction)");
PROCESS_PACKET_20(motor_easy_move_by, "(mid, distance)");
PROCESS_PACKET_20(motor_easy_move_to, "(mid, position)");
PROCESS_PACKET_20(motor_easy_move_to_zero, "(mid, direction)");
#if 0
virtual ~ZIXYMotor() {}
virtual int32_t xymotor_enable(int32_t enable) { return err::koperation_not_support; }

Loading…
Cancel
Save