Browse Source

change some api

master
zhaohe 2 years ago
parent
commit
a2c4579230
  1. 10
      components/xy_robot_ctrl_module/xy_robot_ctrl_module.cpp
  2. 7
      components/xy_robot_ctrl_module/xy_robot_ctrl_module.hpp

10
components/xy_robot_ctrl_module/xy_robot_ctrl_module.cpp

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

7
components/xy_robot_ctrl_module/xy_robot_ctrl_module.hpp

@ -32,10 +32,9 @@ class XYRobotCtrlModule : public I_XYRobotCtrlModule {
public:
void initialize(IStepperMotor* stepM1, //
IStepperMotor* stepM2, //
ZGPIO* Xgpio, //
ZGPIO* Ygpio, //
float scale);
IStepperMotor* stepM2, //
ZGPIO* Xgpio, //
ZGPIO* Ygpio);
virtual int32_t move_to(int32_t x, int32_t y, action_cb_status_t status_cb) override;
virtual int32_t move_by(int32_t dx, int32_t dy, action_cb_status_t status_cb) override;

Loading…
Cancel
Save