|
@ -9,8 +9,7 @@ using namespace std; |
|
|
void XYRobotCtrlModule::initialize(IStepperMotor* stepM1, //
|
|
|
void XYRobotCtrlModule::initialize(IStepperMotor* stepM1, //
|
|
|
IStepperMotor* stepM2, //
|
|
|
IStepperMotor* stepM2, //
|
|
|
ZGPIO* Xgpio, //
|
|
|
ZGPIO* Xgpio, //
|
|
|
ZGPIO* Ygpio, //
|
|
|
|
|
|
float scale) { |
|
|
|
|
|
|
|
|
ZGPIO* Ygpio) { |
|
|
m_stepM1 = stepM1; |
|
|
m_stepM1 = stepM1; |
|
|
m_stepM2 = stepM2; |
|
|
m_stepM2 = stepM2; |
|
|
m_Xgpio = Xgpio; |
|
|
m_Xgpio = Xgpio; |
|
@ -19,9 +18,10 @@ void XYRobotCtrlModule::initialize(IStepperMotor* stepM1, // |
|
|
ZASSERT(m_stepM2); |
|
|
ZASSERT(m_stepM2); |
|
|
ZASSERT(m_Xgpio); |
|
|
ZASSERT(m_Xgpio); |
|
|
ZASSERT(m_Ygpio); |
|
|
ZASSERT(m_Ygpio); |
|
|
m_stepM1->setScale(scale); |
|
|
|
|
|
m_stepM2->setScale(scale); |
|
|
|
|
|
|
|
|
|
|
|
m_lock.init(); |
|
|
m_lock.init(); |
|
|
|
|
|
create_default_cfg(m_cfg); |
|
|
|
|
|
set_base_param(m_cfg); |
|
|
// m_statu_lock.init();
|
|
|
// m_statu_lock.init();
|
|
|
m_thread.init("XYRobotCtrlModule", 1024, osPriorityNormal); |
|
|
m_thread.init("XYRobotCtrlModule", 1024, osPriorityNormal); |
|
|
} |
|
|
} |
|
@ -29,7 +29,7 @@ void XYRobotCtrlModule::initialize(IStepperMotor* stepM1, // |
|
|
int32_t XYRobotCtrlModule::move_to(int32_t x, int32_t y, action_cb_status_t status_cb) { |
|
|
int32_t XYRobotCtrlModule::move_to(int32_t x, int32_t y, action_cb_status_t status_cb) { |
|
|
zlock_guard lock(m_lock); |
|
|
zlock_guard lock(m_lock); |
|
|
ZLOGI(TAG, "move_to x:%d y:%d", x, y); |
|
|
ZLOGI(TAG, "move_to x:%d y:%d", x, y); |
|
|
//int32_t m1pos, m2pos;
|
|
|
|
|
|
|
|
|
// int32_t m1pos, m2pos;
|
|
|
m_thread.stop(); |
|
|
m_thread.stop(); |
|
|
/**
|
|
|
/**
|
|
|
* @TODO:Ìí¼ÓÏÞλ¼ì²é |
|
|
* @TODO:Ìí¼ÓÏÞλ¼ì²é |
|
|