|
|
@ -36,15 +36,16 @@ void XYRobotCtrlModule::initialize(int32_t id, IStepperMotor* stepM1, IStepperMo |
|
|
|
} else { |
|
|
|
m_cfg = m_default_cfg; |
|
|
|
} |
|
|
|
enable(false); |
|
|
|
active_cfg(); |
|
|
|
m_stepM1->setScaleDenominator(10); |
|
|
|
m_stepM2->setScaleDenominator(10); |
|
|
|
enable(true); |
|
|
|
m_thread.init("XYRobotCtrlModule", 1024, osPriorityNormal); |
|
|
|
} |
|
|
|
|
|
|
|
int32_t XYRobotCtrlModule::move_to(int32_t x, int32_t y, int32_t speed, action_cb_status_t status_cb) { |
|
|
|
zlock_guard lock(m_lock); |
|
|
|
if (!m_enable) enable(true); |
|
|
|
ZLOGI(TAG, "move_to x:%d y:%d", x, y); |
|
|
|
int runspeed = speed; |
|
|
|
if (speed == 0) { |
|
|
@ -85,6 +86,7 @@ int32_t XYRobotCtrlModule::move_to(int32_t x, int32_t y, int32_t speed, action_c |
|
|
|
|
|
|
|
int32_t XYRobotCtrlModule::move_by_no_limit(int32_t dx, int32_t dy, int32_t speed, action_cb_status_t status_cb) { |
|
|
|
zlock_guard lock(m_lock); |
|
|
|
if (!m_enable) enable(true); |
|
|
|
ZLOGI(TAG, "move_by_no_limit dx:%d dy:%d", dx, dy); |
|
|
|
|
|
|
|
m_thread.stop(); |
|
|
@ -117,6 +119,8 @@ int32_t XYRobotCtrlModule::move_by_no_limit(int32_t dx, int32_t dy, int32_t spee |
|
|
|
|
|
|
|
int32_t XYRobotCtrlModule::move_by(int32_t dx, int32_t dy, int32_t speed, action_cb_status_t status_cb) { |
|
|
|
zlock_guard lock(m_lock); |
|
|
|
if (!m_enable) enable(true); |
|
|
|
|
|
|
|
ZLOGI(TAG, "move_by dx:%d dy:%d %d", dx, dy, speed); |
|
|
|
|
|
|
|
m_thread.stop(); |
|
|
|