|
|
@ -38,7 +38,7 @@ extern Main gmain; |
|
|
|
|
|
|
|
using namespace iflytop; |
|
|
|
using namespace std; |
|
|
|
|
|
|
|
#define TAG "CMD"
|
|
|
|
extern "C" {} |
|
|
|
/*******************************************************************************
|
|
|
|
* ÅäÖÃ * |
|
|
@ -236,9 +236,49 @@ void script_reg_fn() { |
|
|
|
}); |
|
|
|
|
|
|
|
g_cmdScheduler.regCMD("step_motor_ctrl_move_to_zero", "(id)", 1, [](int32_t paramN, const char** paraV, ICmdParserACK* ack) { |
|
|
|
int32_t ecode = g_zmodule_device_manager.motor_move_to_zero_backward(4, 0, 0, 0, 0); |
|
|
|
int32_t ecode = g_zmodule_device_manager.motor_move_to_zero_backward(4, 450, 300, 2000, 0); |
|
|
|
ack->setNoneAck(ecode); |
|
|
|
}); |
|
|
|
|
|
|
|
g_cmdScheduler.regCMD("step_motor_ctrl_move_to_zero_with_calibrate", "(id,x)", 2, [](int32_t paramN, const char** paraV, ICmdParserACK* ack) { |
|
|
|
int32_t x = atoi(paraV[1]); |
|
|
|
int32_t ecode = g_zmodule_device_manager.motor_move_to_zero_backward_and_calculated_shift(4, 0, 0, 0, 0); |
|
|
|
ack->setNoneAck(ecode); |
|
|
|
}); |
|
|
|
|
|
|
|
g_cmdScheduler.regCMD("step_motor_ctrl_read_detailed_status", "(id)", 1, [](int32_t paramN, const char** paraV, ICmdParserACK* ack) { |
|
|
|
// g_zmodule_device_script_cmder_paser.motor_read_pos(4);
|
|
|
|
}); |
|
|
|
|
|
|
|
g_cmdScheduler.regCMD("step_motor_ctrl_read_status", "(id)", 1, [](int32_t paramN, const char** paraV, ICmdParserACK* ack) { |
|
|
|
// g_zmodule_device_script_cmder_paser.motor_read_pos(4);
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
int32_t pos; |
|
|
|
int32_t errocode; |
|
|
|
int32_t status; |
|
|
|
|
|
|
|
g_zmodule_device_manager.motor_read_pos(4, &pos); |
|
|
|
g_zmodule_device_manager.module_get_error(4, &errocode); |
|
|
|
g_zmodule_device_manager.module_get_status(4, &status); |
|
|
|
|
|
|
|
ZLOGI(TAG, "pos:%d,errocode:%d,status:%d", pos, errocode, status); |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
// g_cmdScheduler.regCMD("step_motor_ctrl_rotate", "(id,speed,lastforms)", 3, [](int32_t paramN, const char** paraV, ICmdParserACK* ack) {
|
|
|
|
// int32_t speed = atoi(paraV[1]);
|
|
|
|
// int32_t lastforms = atoi(paraV[2]);
|
|
|
|
// int32_t direction = speed > 0 ? 1 : -1;
|
|
|
|
// int32_t ecode = g_zmodule_device_manager.motor_rotate(4,direction ,abs(speed), lastforms);
|
|
|
|
// ack->setNoneAck(ecode);
|
|
|
|
// });
|
|
|
|
|
|
|
|
g_cmdScheduler.regCMD("step_motor_ctrl_stop", "(id,stop_type)", 2, [](int32_t paramN, const char** paraV, ICmdParserACK* ack) { |
|
|
|
int32_t stop_type = atoi(paraV[1]); |
|
|
|
int32_t ecode = g_zmodule_device_manager.module_stop(4); |
|
|
|
ack->setNoneAck(ecode); |
|
|
|
}); |
|
|
|
} |