Browse Source

fix some bug

master
zhaohe 2 years ago
parent
commit
43beaedd3e
  1. 13
      components/single_axis_motor_control/single_axis_motor_control.cpp

13
components/single_axis_motor_control/single_axis_motor_control.cpp

@ -178,7 +178,10 @@ icps::error_t SingleAxisMotorControler::runToHome() {
*/
m_step_scheduler.pushActionAction([this](StepActionContext* context) { //
ZLOGI(m_name, "runToHome step 2 move away from zero point");
regGpioIrqProcesser(nullptr);
regGpioIrqProcesser([this](ZGPIO* GPIO_Pin, ZGPIO::IrqTypeEvent_t irqevent) {
if (GPIO_Pin != m_homegpio) return;
m_motor->stop();
});
motor_moveBy(cfg_runtohome_leave_zero_point_distance->getValue(), //
cfg_runhome_velocity->getValue(), //
cfg_acc->getValue(), //
@ -197,10 +200,10 @@ icps::error_t SingleAxisMotorControler::runToHome() {
m_runToHomeContext.zeroPointPos = m_motor->getXACTUAL();
m_motor->stop();
});
motor_moveBy(-cfg_runtohome_leave_zero_point_distance->getValue() * 1.5, //
cfg_runhome_velocity->getValue(), //
cfg_acc->getValue(), //
cfg_runtohome_dec->getValue()); // 此时处于零点位置,先离开原点一定位置
motor_moveBy(-cfg_runtohome_leave_zero_point_distance->getValue(), //
cfg_runhome_velocity->getValue(), //
cfg_acc->getValue(), //
cfg_runtohome_dec->getValue()); // 此时处于零点位置,先离开原点一定位置
});
m_step_scheduler.pushActionIsDone([this](StepActionContext* context) {
if (motorIsStop(context)) {

Loading…
Cancel
Save