|
|
@ -6,7 +6,7 @@ |
|
|
|
#include "sdk/components/errorcode/errorcode.hpp"
|
|
|
|
#include "sdk\components\flash\znvs.hpp"
|
|
|
|
using namespace iflytop; |
|
|
|
#define TAG "StepMotorCtrlModule"
|
|
|
|
#define TAG "SMCM"
|
|
|
|
void StepMotorCtrlModule::initialize(int id, IStepperMotor* stepM, ZGPIO iotable[], int nio, const char* flashmark) { |
|
|
|
m_id = id; |
|
|
|
m_stepM1 = stepM; |
|
|
@ -624,6 +624,7 @@ int32_t StepMotorCtrlModule::module_get_last_exec_status(int32_t* status) { |
|
|
|
return 0; |
|
|
|
} |
|
|
|
int32_t StepMotorCtrlModule::module_get_status(int32_t* status) { |
|
|
|
//ZLOGI(TAG, "[%d]-module_get_status %d", m_id, m_thread.isworking());
|
|
|
|
*status = m_thread.isworking() ? 1 : 0; |
|
|
|
return 0; |
|
|
|
} |
|
|
@ -818,6 +819,7 @@ int32_t StepMotorCtrlModule::motor_move_to(int32_t tox, int32_t motor_velocity, |
|
|
|
call_exec_status_cb(0, nullptr); |
|
|
|
}, |
|
|
|
[this, tox]() { _motor_stop(); }); |
|
|
|
//ZLOGI(TAG, "m%d motor_move_to %d end", m_id, tox);
|
|
|
|
return 0; |
|
|
|
} |
|
|
|
int32_t StepMotorCtrlModule::motor_rotate_with_torque(int32_t direction, int32_t torque) { return err::koperation_not_support; } |
|
|
@ -901,7 +903,6 @@ int32_t StepMotorCtrlModule::motor_easy_move_by(int32_t distance) { |
|
|
|
m_status_cb = nullptr; |
|
|
|
m_thread.stop(); |
|
|
|
return motor_move_by(distance, m_param.maxspeed, m_param.acc); |
|
|
|
|
|
|
|
}; |
|
|
|
int32_t StepMotorCtrlModule::motor_easy_move_to(int32_t position) { |
|
|
|
zlock_guard lock(m_lock); |
|
|
|