diff --git a/MDK-ARM/R1.uvoptx b/MDK-ARM/R1.uvoptx index 53306b8..73eea2c 100644 --- a/MDK-ARM/R1.uvoptx +++ b/MDK-ARM/R1.uvoptx @@ -158,42 +158,27 @@ 0 1 - shoot,0x0A + rc_ctrl,0x0A 1 1 - nucData,0x0A + shoot,0x0A 2 1 - nucbuf + ball,0x0A 3 1 - wzcsb,0x0A + nucbuf 4 1 - nuc_v - - - 5 - 1 - abc,0x0A - - - 6 - 1 - shoot_wait,0x0A - - - 7 - 1 - error_code + cmd_fromnuc @@ -962,7 +947,7 @@ User/device - 1 + 0 0 0 0 @@ -1054,7 +1039,7 @@ User/module - 0 + 1 0 0 0 @@ -1086,7 +1071,7 @@ User/task - 0 + 1 0 0 0 diff --git a/User/module/ball.cpp b/User/module/ball.cpp index 3911d37..cce6747 100644 --- a/User/module/ball.cpp +++ b/User/module/ball.cpp @@ -9,10 +9,13 @@ extern RC_ctrl_t rc_ctrl; extern int ball_exit; +// 外死点168 外163 中150 内127 限位124.8 // 伸缩 -#define I_ANGLE 147 -#define O_ANGLE 187 -#define WAIT_POS 170 +#define I_ANGLE 127 +#define O_ANGLE 163 +#define WAIT_POS 150 +#define IN 124.8 +#define OUT 168 // PE11 气缸 @@ -75,7 +78,7 @@ void Ball::rc_mode() } if (rc_ctrl.sw[5] == 200) { - ready_key = 0; // 默认不准备 + ready_key = DE; // 默认不准备 } } @@ -234,17 +237,17 @@ void Ball::ball_control() ballHadling(); break; } + Send_control(); } // 防守 - else + if(ready_key == DEFENSE) { xiaomi.position = I_ANGLE; // 保持收回 HAL_GPIO_WritePin(CLOSE_GPIO_Port, CLOSE_Pin, GPIO_PIN_RESET); // 确保爪气缸关闭 HAL_GPIO_WritePin(DOWN_GPIO_Port, DOWN_Pin, GPIO_PIN_RESET); // 确保下气缸关闭 + Send_control(); } - // 发送小米电机控制数据 - Send_control(); } // 任务通知来作全过程 diff --git a/User/module/ball.hpp b/User/module/ball.hpp index f92b606..4a0a678 100644 --- a/User/module/ball.hpp +++ b/User/module/ball.hpp @@ -39,7 +39,8 @@ typedef enum DOWN2, IN, OUT, - SIDE + SIDE, + DE }ball_rc_mode; // 定义光电传感器检测宏 diff --git a/User/task/ballTask.cpp b/User/task/ballTask.cpp index 168d0c1..c50162a 100644 --- a/User/task/ballTask.cpp +++ b/User/task/ballTask.cpp @@ -22,7 +22,7 @@ void FunctionBall(void *argument) const uint32_t delay_tick = osKernelGetTickFreq() / TASK_FREQ_BALL; - osDelay(6000);//等待极致控制板启动 + osDelay(6000);//等待极致控制板启动 XiaomiWait_init(1,&hcan2); //小米电机初始化 uint32_t tick = osKernelGetTickCount();