From a056dbcb8aace3071fdd1c6e66de451a5a7208fb Mon Sep 17 00:00:00 2001
From: ws <1621320660@qq.com>
Date: Wed, 2 Jul 2025 19:47:00 +0800
Subject: [PATCH] =?UTF-8?q?=E7=A3=81=E7=8E=AF=E6=9D=BE=E4=BA=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
MDK-ARM/.vscode/uv4.log | 8 ++++++--
MDK-ARM/.vscode/uv4.log.lock | 2 +-
MDK-ARM/R1.uvoptx | 19 +------------------
User/module/ball.cpp | 19 ++++++++++++-------
User/module/ball.hpp | 3 ++-
5 files changed, 22 insertions(+), 29 deletions(-)
diff --git a/MDK-ARM/.vscode/uv4.log b/MDK-ARM/.vscode/uv4.log
index f5e09e6..e27e2d8 100644
--- a/MDK-ARM/.vscode/uv4.log
+++ b/MDK-ARM/.vscode/uv4.log
@@ -1,8 +1,12 @@
*** Using Compiler 'V5.06 update 7 (build 960)', folder: 'D:\keil\ARM\ARMCC\Bin'
Build target 'R1'
+compiling nuc.c...
+compiling shootTask.cpp...
compiling ball.cpp...
+compiling ballTask.cpp...
+compiling shoot.cpp...
linking...
-Program Size: Code=32904 RO-data=1832 RW-data=268 ZI-data=32220
+Program Size: Code=32916 RO-data=1832 RW-data=268 ZI-data=32220
FromELF: creating hex file...
"R1\R1.axf" - 0 Error(s), 0 Warning(s).
-Build Time Elapsed: 00:00:05
+Build Time Elapsed: 00:00:08
diff --git a/MDK-ARM/.vscode/uv4.log.lock b/MDK-ARM/.vscode/uv4.log.lock
index 287f658..c647268 100644
--- a/MDK-ARM/.vscode/uv4.log.lock
+++ b/MDK-ARM/.vscode/uv4.log.lock
@@ -1 +1 @@
-2025/7/2 14:06:43
\ No newline at end of file
+2025/7/2 19:36:56
\ No newline at end of file
diff --git a/MDK-ARM/R1.uvoptx b/MDK-ARM/R1.uvoptx
index 4f9d677..73eea2c 100644
--- a/MDK-ARM/R1.uvoptx
+++ b/MDK-ARM/R1.uvoptx
@@ -153,24 +153,7 @@
-U00160029510000164E574E32 -O2254 -SF10000 -C0 -A0 -I0 -HNlocalhost -HP7184 -P1 -N00("ARM CoreSight SW-DP (ARM Core") -D00(2BA01477) -L00(0) -TO131090 -TC10000000 -TT10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC800 -FN1 -FF0STM32F4xx_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F407IGHx$CMSIS\Flash\STM32F4xx_1024.FLM)
-
-
- 0
- 0
- 94
- 1
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- ../Core/Src/main.c
-
-
-
-
+
0
diff --git a/User/module/ball.cpp b/User/module/ball.cpp
index 411937d..9136a96 100644
--- a/User/module/ball.cpp
+++ b/User/module/ball.cpp
@@ -10,9 +10,12 @@ extern RC_ctrl_t rc_ctrl;
extern int ball_exit;
// 伸缩
-#define I_ANGLE 147
-#define O_ANGLE 187
-#define WAIT_POS 170
+//外死点168 外163 中150 内127 限位124.8
+#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 = DEF; // 默认不准备
}
}
@@ -234,17 +237,19 @@ void Ball::ball_control()
ballHadling();
break;
}
+
+ Send_control();
}
// 防守
- else
+ else if(ready_key == DEF)
{
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..8595c5f 100644
--- a/User/module/ball.hpp
+++ b/User/module/ball.hpp
@@ -39,7 +39,8 @@ typedef enum
DOWN2,
IN,
OUT,
- SIDE
+ SIDE,
+ DEF
}ball_rc_mode;
// 定义光电传感器检测宏