From 8ea27c86201aa9f699b59f1249f0ed84fed800a8 Mon Sep 17 00:00:00 2001 From: ws <1621320660@qq.com> Date: Fri, 4 Jul 2025 16:04:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=80=E6=AC=A1=E8=BF=90=E7=90=83=E5=AE=8C?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E6=94=BE=E7=90=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- User/module/ball.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/User/module/ball.cpp b/User/module/ball.cpp index b004a4d..8d98ee1 100644 --- a/User/module/ball.cpp +++ b/User/module/ball.cpp @@ -236,6 +236,10 @@ void Ball::ball_control() case DOWN2: ballHadling(); + if(hand_thread & HANDING_FINISH) + { + ballDown(); + } break; } @@ -259,7 +263,7 @@ void Ball::ballDown(void) { switch (currentState1) { - case BALL_IDLE: + case BALL_FINISH: xiaomi.position = I_ANGLE; // 保持收回 if (feedback->position_deg >= I_ANGLE - 0.8 && feedback->position_deg <= I_ANGLE + 0.8) { @@ -306,6 +310,7 @@ void Ball::Idle_control() HAL_GPIO_WritePin(DOWN_GPIO_Port, DOWN_Pin, GPIO_PIN_RESET); // 确保下气缸关闭 osThreadFlagsClear(EXTEND_OK); + osThreadFlagsClear(HANDING_FINISH); if (ready_key == SIDE) // 检测是否准备好 { @@ -399,11 +404,11 @@ void Ball::ballHadling(void) case BALL_FINISH: osDelay(50); // 延时 50ms - // osThreadFlagsSet(task_struct.thread.ball, HANDING_FINISH); + osThreadFlagsSet(task_struct.thread.ball, HANDING_FINISH); HAL_GPIO_WritePin(CLOSE_GPIO_Port, CLOSE_Pin, GPIO_PIN_RESET); // 确保气缸爪子闭合 HAL_GPIO_WritePin(DOWN_GPIO_Port, DOWN_Pin, GPIO_PIN_RESET); // 确保下气缸关闭 - break; + break; default: currentState1 = BALL_IDLE; // 默认回到空闲状态 break;