Browse Source

update

master
zhaohe 2 years ago
parent
commit
d3a61bcf93
  1. 10
      api/i_xyrobot_ctrl_module.hpp
  2. 1
      zcancmder_protocol.hpp
  3. 6
      zcancmder_protocol_basic.hpp

10
api/i_xyrobot_ctrl_module.hpp

@ -76,10 +76,10 @@ class I_XYRobotCtrlModule {
#pragma pack() #pragma pack()
public: 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 enable(bool venable) = 0;
virtual int32_t stop(uint8_t stopType) = 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 set_base_param(const base_param_t& param) = 0;
virtual int32_t get_base_param(base_param_t& ack) = 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() {} virtual ~I_XYRobotCtrlModule() {}
}; };

1
zcancmder_protocol.hpp

@ -8,6 +8,7 @@
#include "api/i_xyrobot_ctrl_module.hpp" #include "api/i_xyrobot_ctrl_module.hpp"
#include "api/i_eeprom.hpp" #include "api/i_eeprom.hpp"
#include "zcancmder_protocol_basic.hpp" #include "zcancmder_protocol_basic.hpp"
namespace iflytop { namespace iflytop {
namespace zcr { namespace zcr {

6
zcancmder_protocol_basic.hpp

@ -30,8 +30,8 @@
auto* cmd = rxcmd->get_data_as<ordername##_##cmd##_t>(); \ auto* cmd = rxcmd->get_data_as<ordername##_##cmd##_t>(); \
auto* ack = (ordername##_##ack##_t*)m_txbuf; \ auto* ack = (ordername##_##ack##_t*)m_txbuf; \
static_assert(sizeof(*ack) < sizeof(m_txbuf), "ack size too large"); \ 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) { \ if (cmd->id == varid) { \
ack->id = cmd->id; ack->id = cmd->id;
@ -80,6 +80,8 @@ typedef enum {
} PacketType_t; } PacketType_t;
#define CMDID(cmdid, subcmdid) ((cmdid << 8) + subcmdid) #define CMDID(cmdid, subcmdid) ((cmdid << 8) + subcmdid)
#define SUBCMDID(cmdid) (cmdid & 0xff)
#define MODULE_CMDID(cmdid) (cmdid >> 8)
} // namespace zcr } // namespace zcr
} // namespace iflytop } // namespace iflytop
Loading…
Cancel
Save