From 43beaedd3e6c3b1b45cd8796e496902c03699a28 Mon Sep 17 00:00:00 2001 From: zhaohe Date: Tue, 1 Aug 2023 15:20:14 +0800 Subject: [PATCH] fix some bug --- .../single_axis_motor_control/single_axis_motor_control.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/components/single_axis_motor_control/single_axis_motor_control.cpp b/components/single_axis_motor_control/single_axis_motor_control.cpp index 3c61b87..0f81a05 100644 --- a/components/single_axis_motor_control/single_axis_motor_control.cpp +++ b/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)) {