diff --git a/MDK-ARM/.vscode/keil-assistant.log b/MDK-ARM/.vscode/keil-assistant.log index 81941b6..8c58596 100644 --- a/MDK-ARM/.vscode/keil-assistant.log +++ b/MDK-ARM/.vscode/keil-assistant.log @@ -76,9 +76,13 @@ [info] Log at : 2025/6/26|03:33:46|GMT+0800 +<<<<<<< HEAD [info] Log at : 2025/6/27|10:05:14|GMT+0800 [info] Log at : 2025/6/27|23:24:18|GMT+0800 [info] Log at : 2025/6/28|01:53:31|GMT+0800 +======= +[info] Log at : 2025/6/26|15:46:24|GMT+0800 +>>>>>>> 7b54a46bd3c69e44a04ffd669bb7d3b115fc9e9b diff --git a/MDK-ARM/.vscode/uv4.log b/MDK-ARM/.vscode/uv4.log index 1514023..a8a2b29 100644 --- a/MDK-ARM/.vscode/uv4.log +++ b/MDK-ARM/.vscode/uv4.log @@ -1,5 +1,6 @@ *** Using Compiler 'V5.06 update 7 (build 960)', folder: 'D:\keil\ARM\ARMCC\Bin' Build target 'R1' +<<<<<<< HEAD compiling ballTask.cpp... compiling ball.cpp... linking... @@ -7,3 +8,11 @@ Program Size: Code=28860 RO-data=1832 RW-data=276 ZI-data=32252 FromELF: creating hex file... "R1\R1.axf" - 0 Error(s), 0 Warning(s). Build Time Elapsed: 00:00:05 +======= +compiling ball.cpp... +linking... +Program Size: Code=31096 RO-data=1832 RW-data=276 ZI-data=32252 +FromELF: creating hex file... +"R1\R1.axf" - 0 Error(s), 0 Warning(s). +Build Time Elapsed: 00:00:04 +>>>>>>> 7b54a46bd3c69e44a04ffd669bb7d3b115fc9e9b diff --git a/MDK-ARM/.vscode/uv4.log.lock b/MDK-ARM/.vscode/uv4.log.lock index 1cb57f9..27e15e3 100644 --- a/MDK-ARM/.vscode/uv4.log.lock +++ b/MDK-ARM/.vscode/uv4.log.lock @@ -1 +1,5 @@ -2025/6/28 2:01:18 \ No newline at end of file +<<<<<<< HEAD +2025/6/28 2:01:18 +======= +2025/6/26 4:03:58 +>>>>>>> 7b54a46bd3c69e44a04ffd669bb7d3b115fc9e9b diff --git a/User/module/ball.cpp b/User/module/ball.cpp index c8f9ab2..c00c01d 100644 --- a/User/module/ball.cpp +++ b/User/module/ball.cpp @@ -77,17 +77,14 @@ void Ball::rc_mode() extern_key=OUT; } - // if (rc_ctrl.sw[5] == 200 && last_sw5 == 1800) // 只在1800->200的瞬间触发 - // { - // rc_key = DOWN2; - // } - // else - // { - // rc_key = 0; // 其他情况不触发 - // } - // last_sw5 = rc_ctrl.sw[5]; - - + if(rc_ctrl.sw[5]==1800) + { + ready_key=SIDE; + } + if(rc_ctrl.sw[5]==200) + { + ready_key=0; //默认不准备 + } } void Ball::Send_control() @@ -178,65 +175,31 @@ void Ball::ball_control() Move_Extend(); - switch (currentState1) - { - case BALL_IDLE: + switch (rc_key){ + case MIDDLE2: HAL_GPIO_WritePin(CLOSE_GPIO_Port, CLOSE_Pin, GPIO_PIN_RESET); //确保爪气缸关闭 - HAL_GPIO_WritePin(DOWN_GPIO_Port, DOWN_Pin, GPIO_PIN_RESET); // 确保下气缸关闭 - if (rc_key == DOWN2) // 检测按键是否被按下 + HAL_GPIO_WritePin(DOWN_GPIO_Port, DOWN_Pin, GPIO_PIN_RESET); // 确保下气缸关闭 + if (currentState1 == BALL_FINISH) { - currentState1 = BALL_FORWARD; + currentState1 = BALL_IDLE; + } + else { + currentState1 = BALL_IDLE; // 默认回到空闲状态 } break; - case BALL_FORWARD: - HAL_GPIO_WritePin(CLOSE_GPIO_Port, CLOSE_Pin, GPIO_PIN_SET); // 打开气缸爪子 - osDelay(5); - HAL_GPIO_WritePin(DOWN_GPIO_Port, DOWN_Pin, GPIO_PIN_SET); // 打开下气缸 - currentState1 = BALL_DROP; // 切换到球下落状态 + case UP2: + ballDown(); break; - case BALL_DROP: - osDelay(100); // 延时 100ms - HAL_GPIO_WritePin(DOWN_GPIO_Port, DOWN_Pin, GPIO_PIN_RESET); // 关闭下气缸 - // 一直检测有球(ball_state == 0),等球离开 - if (ball_state == 1 && last_ball_state == 0) // 球离开 - { - currentState1 = BALL_FLAG; - } - last_ball_state = ball_state; - break; - - case BALL_FLAG: - osDelay(10); // 延时 50ms - // 等待球弹回再次检测到球 - if (ball_state == 0 && last_ball_state == 1) // 球弹回 - { - currentState1 = BALL_CLOSE; - } - last_ball_state = ball_state; - break; - - case BALL_CLOSE: - osDelay(100); - HAL_GPIO_WritePin(CLOSE_GPIO_Port, CLOSE_Pin, GPIO_PIN_RESET); // 闭合气缸爪子 - currentState1 = BALL_FINISH; // 切换到反转状态 - break; - - case BALL_FINISH: - osDelay(50); // 延时 50ms - HAL_GPIO_WritePin(CLOSE_GPIO_Port, CLOSE_Pin, GPIO_PIN_RESET); // 确保气缸爪子闭合 - HAL_GPIO_WritePin(DOWN_GPIO_Port, DOWN_Pin, GPIO_PIN_RESET); // 确保下气缸关闭 - - currentState1 = BALL_IDLE; // 回到空闲状态 + case DOWN2: + ballHadling(); + //test_Handling(); break; - default: - currentState1 = BALL_IDLE; // 默认回到空闲状态 - break; + } - Send_control(); }