From d3a61bcf93898d4c7b506cfff0e0a6bb03355d74 Mon Sep 17 00:00:00 2001 From: zhaohe Date: Wed, 11 Oct 2023 15:25:16 +0800 Subject: [PATCH] update --- api/i_xyrobot_ctrl_module.hpp | 10 ++++------ zcancmder_protocol.hpp | 1 + zcancmder_protocol_basic.hpp | 6 ++++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/api/i_xyrobot_ctrl_module.hpp b/api/i_xyrobot_ctrl_module.hpp index 1295633..52cd4ef 100644 --- a/api/i_xyrobot_ctrl_module.hpp +++ b/api/i_xyrobot_ctrl_module.hpp @@ -76,10 +76,10 @@ class I_XYRobotCtrlModule { #pragma pack() public: - virtual int32_t move_to(int32_t x, int32_t y, action_cb_status_t status_cb) = 0; - virtual int32_t move_by(int32_t dx, int32_t dy, action_cb_status_t status_cb) = 0; - virtual int32_t move_to_zero(action_cb_status_t status_cb) = 0; - virtual int32_t move_to_zero_with_calibrate(int32_t x, int32_t y, action_cb_status_t status_cb) = 0; + virtual int32_t move_to(int32_t x, int32_t y, int speed, action_cb_status_t status_cb) = 0; + virtual int32_t move_by(int32_t dx, int32_t dy, action_cb_status_t status_cb) = 0; + virtual int32_t move_to_zero(action_cb_status_t status_cb) = 0; + virtual int32_t move_to_zero_with_calibrate(int32_t nowx, int32_t nowxy, action_cb_status_t status_cb) = 0; virtual int32_t enable(bool venable) = 0; virtual int32_t stop(uint8_t stopType) = 0; @@ -91,8 +91,6 @@ class I_XYRobotCtrlModule { virtual int32_t set_base_param(const base_param_t& param) = 0; virtual int32_t get_base_param(base_param_t& ack) = 0; - // virtual int32_t set_run_to_zero_param(uint8_t operation, const run_to_zero_param_t& param, run_to_zero_param_t& ack) = 0; - // virtual int32_t set_warning_limit_param(uint8_t operation, const warning_limit_param_t& param, warning_limit_param_t& ack) = 0; virtual ~I_XYRobotCtrlModule() {} }; diff --git a/zcancmder_protocol.hpp b/zcancmder_protocol.hpp index 6ea698f..b4bb7cf 100644 --- a/zcancmder_protocol.hpp +++ b/zcancmder_protocol.hpp @@ -8,6 +8,7 @@ #include "api/i_xyrobot_ctrl_module.hpp" #include "api/i_eeprom.hpp" #include "zcancmder_protocol_basic.hpp" + namespace iflytop { namespace zcr { diff --git a/zcancmder_protocol_basic.hpp b/zcancmder_protocol_basic.hpp index 1752634..14f4970 100644 --- a/zcancmder_protocol_basic.hpp +++ b/zcancmder_protocol_basic.hpp @@ -30,8 +30,8 @@ auto* cmd = rxcmd->get_data_as(); \ auto* ack = (ordername##_##ack##_t*)m_txbuf; \ static_assert(sizeof(*ack) < sizeof(m_txbuf), "ack size too large"); \ - auto __attribute__((unused)) cmdheader = rxcmd->get_cmdheader(); \ - uint32_t errorcode = 0; \ + auto __attribute__((unused)) cmdheader = rxcmd->get_cmdheader(); \ + uint32_t errorcode = 0; \ if (cmd->id == varid) { \ ack->id = cmd->id; @@ -80,6 +80,8 @@ typedef enum { } PacketType_t; #define CMDID(cmdid, subcmdid) ((cmdid << 8) + subcmdid) +#define SUBCMDID(cmdid) (cmdid & 0xff) +#define MODULE_CMDID(cmdid) (cmdid >> 8) } // namespace zcr } // namespace iflytop