|
|
@ -147,6 +147,10 @@ void ZCanProtocolParser::_onRceivePacket(ZIModule* module, zcr_cmd_header_t* rxc |
|
|
|
if (module == nullptr) return err::koperation_not_support; \ |
|
|
|
if (paraNum >= 0 && paraNum != cxt->paramlen / 4) return err::kcmd_param_num_error; |
|
|
|
|
|
|
|
#define GET_MODULE(paraNum) \
|
|
|
|
auto* module = dynamic_cast<MODULE_CLASS*>(cxt->module); \ |
|
|
|
if (module == nullptr) return err::koperation_not_support; |
|
|
|
|
|
|
|
#define MODULE_CLASS ZIModule
|
|
|
|
int32_t ZCanProtocolParser::module_ping(cmdcontxt_t* cxt) { |
|
|
|
CHECK_AND_GET_MODULE(0); |
|
|
@ -225,7 +229,7 @@ int32_t ZCanProtocolParser::step_motor_easy_move_to(cmdcontxt_t* cxt) { |
|
|
|
return module->step_motor_easy_move_to(cxt->params[0]); |
|
|
|
} |
|
|
|
int32_t ZCanProtocolParser::step_motor_easy_move_to_zero(cmdcontxt_t* cxt) { |
|
|
|
CHECK_AND_GET_MODULE(0); |
|
|
|
GET_MODULE(0); |
|
|
|
return module->step_motor_easy_move_to_zero(); |
|
|
|
} |
|
|
|
int32_t ZCanProtocolParser::step_motor_easy_set_current_pos(cmdcontxt_t* cxt) { |
|
|
|