Compare commits
2 Commits
b022b46730
...
1cb37c4dac
Author | SHA1 | Date | |
---|---|---|---|
1cb37c4dac | |||
a056dbcb8a |
2
MDK-ARM/.vscode/keil-assistant.log
vendored
2
MDK-ARM/.vscode/keil-assistant.log
vendored
@ -100,3 +100,5 @@
|
||||
|
||||
[info] Log at : 2025/7/2|17:15:33|GMT+0800
|
||||
|
||||
[info] Log at : 2025/7/4|09:10:46|GMT+0800
|
||||
|
||||
|
3
MDK-ARM/.vscode/settings.json
vendored
3
MDK-ARM/.vscode/settings.json
vendored
@ -5,6 +5,7 @@
|
||||
"buzzer.h": "c",
|
||||
"calc_lib.h": "c",
|
||||
"usertask.h": "c",
|
||||
"detect.h": "c"
|
||||
"detect.h": "c",
|
||||
"nuc.h": "c"
|
||||
}
|
||||
}
|
9
MDK-ARM/.vscode/uv4.log
vendored
9
MDK-ARM/.vscode/uv4.log
vendored
@ -1,8 +1,13 @@
|
||||
*** Using Compiler 'V5.06 update 7 (build 960)', folder: 'D:\keil\ARM\ARMCC\Bin'
|
||||
Build target 'R1'
|
||||
compiling shootTask.cpp...
|
||||
compiling nuc.c...
|
||||
compiling initTask.c...
|
||||
compiling ball.cpp...
|
||||
compiling nucTask.cpp...
|
||||
compiling shoot.cpp...
|
||||
linking...
|
||||
Program Size: Code=32904 RO-data=1832 RW-data=268 ZI-data=32220
|
||||
Program Size: Code=32960 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:02:09
|
||||
|
2
MDK-ARM/.vscode/uv4.log.lock
vendored
2
MDK-ARM/.vscode/uv4.log.lock
vendored
@ -1 +1 @@
|
||||
2025/7/2 14:06:43
|
||||
2025/7/4 9:21:52
|
@ -153,24 +153,7 @@
|
||||
<Name>-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)</Name>
|
||||
</SetRegEntry>
|
||||
</TargetDriverDllRegistry>
|
||||
<Breakpoint>
|
||||
<Bp>
|
||||
<Number>0</Number>
|
||||
<Type>0</Type>
|
||||
<LineNumber>94</LineNumber>
|
||||
<EnabledFlag>1</EnabledFlag>
|
||||
<Address>0</Address>
|
||||
<ByteObject>0</ByteObject>
|
||||
<HtxType>0</HtxType>
|
||||
<ManyObjects>0</ManyObjects>
|
||||
<SizeOfObject>0</SizeOfObject>
|
||||
<BreakByAccess>0</BreakByAccess>
|
||||
<BreakIfRCount>0</BreakIfRCount>
|
||||
<Filename>../Core/Src/main.c</Filename>
|
||||
<ExecCommand></ExecCommand>
|
||||
<Expression></Expression>
|
||||
</Bp>
|
||||
</Breakpoint>
|
||||
<Breakpoint/>
|
||||
<WatchWindow1>
|
||||
<Ww>
|
||||
<count>0</count>
|
||||
@ -197,6 +180,16 @@
|
||||
<WinNumber>1</WinNumber>
|
||||
<ItemText>cmd_fromnuc</ItemText>
|
||||
</Ww>
|
||||
<Ww>
|
||||
<count>5</count>
|
||||
<WinNumber>1</WinNumber>
|
||||
<ItemText>drop_message,0x0A</ItemText>
|
||||
</Ww>
|
||||
<Ww>
|
||||
<count>6</count>
|
||||
<WinNumber>1</WinNumber>
|
||||
<ItemText>error_code,0x0A</ItemText>
|
||||
</Ww>
|
||||
</WatchWindow1>
|
||||
<MemoryWindow4>
|
||||
<Mm>
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
static osThreadId_t thread_alert;
|
||||
|
||||
static volatile uint32_t drop_message = 0;
|
||||
volatile uint32_t drop_message = 0;
|
||||
|
||||
uint8_t nucbuf[16];
|
||||
uint8_t packet[32]; // 假设最大数据包长度为 32 字节
|
||||
@ -13,10 +13,11 @@ static void NUC_CBLTCallback(void)
|
||||
{
|
||||
osThreadFlagsSet(thread_alert, SIGNAL_NUC_RAW_REDY);
|
||||
}
|
||||
uint32_t error_code;
|
||||
static void NUC_ERRORCALLBACK(void)
|
||||
{
|
||||
NUC_Restart();
|
||||
uint32_t error_code = HAL_UART_GetError(BSP_UART_GetHandle(BSP_UART_AI));
|
||||
error_code = HAL_UART_GetError(BSP_UART_GetHandle(BSP_UART_AI));
|
||||
|
||||
}
|
||||
|
||||
@ -80,7 +81,7 @@ int8_t NUC_SendPacket(void *data, uint16_t length) {
|
||||
|
||||
return DEVICE_OK; // 发送成功
|
||||
}
|
||||
int wzcsb=0;
|
||||
|
||||
int8_t NUC_RawParse(NUC_t *n) {
|
||||
if (n == NULL) return DEVICE_ERR_NULL;
|
||||
union {
|
||||
@ -98,12 +99,10 @@ int8_t NUC_RawParse(NUC_t *n) {
|
||||
case VISION:
|
||||
/* 协议格式
|
||||
0xFF HEAD
|
||||
0x09
|
||||
0x07
|
||||
控制帧
|
||||
0x01 相机帧
|
||||
x fp32
|
||||
y fp32
|
||||
z fp32
|
||||
0xFE TAIL
|
||||
*/
|
||||
if (nucbuf[7] != TAIL) goto error;
|
||||
@ -132,7 +131,7 @@ int8_t NUC_RawParse(NUC_t *n) {
|
||||
|
||||
|
||||
error:
|
||||
wzcsb++;
|
||||
drop_message++;
|
||||
return DEVICE_ERR;
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,7 @@ extern "C" {
|
||||
#include "struct_typedef.h"
|
||||
#include "device.h"
|
||||
#include "uart_it.h"
|
||||
#include "main.h"
|
||||
|
||||
// 帧头针尾
|
||||
#define HEAD (0xFF)
|
||||
@ -15,7 +16,7 @@ extern "C" {
|
||||
|
||||
#define ODOM (0x04)
|
||||
#define PICK (0x06)
|
||||
#define VISION (0x09)
|
||||
#define VISION (0x07)
|
||||
#define SEND (0X07)
|
||||
|
||||
// 写结构体存入视觉信息
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
// 任务通知来作全过程
|
||||
|
@ -39,7 +39,8 @@ typedef enum
|
||||
DOWN2,
|
||||
IN,
|
||||
OUT,
|
||||
SIDE
|
||||
SIDE,
|
||||
DEF
|
||||
}ball_rc_mode;
|
||||
|
||||
// 定义光电传感器检测宏
|
||||
|
@ -1,10 +1,11 @@
|
||||
#include "nucTask.hpp"
|
||||
#include "nuc.h"
|
||||
#include "userTask.h"
|
||||
#include "TopDefine.h"//事件组的一些东西
|
||||
#include "TopDefine.h" //事件组的一些东西
|
||||
#include "FreeRTOS.h"
|
||||
#include <cmsis_os2.h>
|
||||
#include <stdio.h>
|
||||
#include "bsp_buzzer.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
|
||||
@ -20,20 +21,18 @@ void Function_nuc(void *argument)
|
||||
|
||||
NUC_Init(&cmd_fromnuc);
|
||||
|
||||
HAL_GPIO_WritePin(LED_G_GPIO_Port,LED_G_Pin,GPIO_PIN_SET);
|
||||
|
||||
uint32_t tick = osKernelGetTickCount();
|
||||
|
||||
while(1)
|
||||
while (1)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
task_struct.stack_water_mark.nuc = osThreadGetStackSpace(osThreadGetId());
|
||||
#endif
|
||||
NUC_StartReceiving();
|
||||
|
||||
//NUC_RawParse(&cmd_fromnuc);
|
||||
//NUC_SendPacket(&send, sizeof(send)); // 发送数据包
|
||||
//掉线处理有空写
|
||||
// NUC_RawParse(&cmd_fromnuc);
|
||||
// NUC_SendPacket(&send, sizeof(send)); // 发送数据包
|
||||
// 掉线处理有空写
|
||||
// if(NUC_WaitDmaCplt())
|
||||
// {
|
||||
// NUC_RawParse(&cmd_fromnuc);
|
||||
@ -44,20 +43,25 @@ void Function_nuc(void *argument)
|
||||
// NUC_HandleOffline(&cmd_fromnuc);
|
||||
// }
|
||||
|
||||
// 假设你在主循环或任务里这样用
|
||||
if (NUC_RawParse(&cmd_fromnuc) == DEVICE_OK)
|
||||
{
|
||||
//BSP_Buzzer_Stop();
|
||||
HAL_GPIO_WritePin(LED_G_GPIO_Port, LED_G_Pin, GPIO_PIN_SET);
|
||||
HAL_GPIO_WritePin(LED_R_GPIO_Port, LED_R_Pin, GPIO_PIN_RESET);
|
||||
osMessageQueueReset(task_struct.msgq.nuc); // 清空消息队列
|
||||
osMessageQueuePut(task_struct.msgq.nuc,&(cmd_fromnuc),0,0);
|
||||
osMessageQueuePut(task_struct.msgq.nuc, &(cmd_fromnuc), 0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
// BSP_Buzzer_Start();
|
||||
// BSP_Buzzer_Set(1, 5000);
|
||||
HAL_GPIO_WritePin(LED_G_GPIO_Port, LED_G_Pin, GPIO_PIN_RESET);
|
||||
HAL_GPIO_WritePin(LED_R_GPIO_Port, LED_R_Pin, GPIO_PIN_SET);
|
||||
NUC_HandleOffline(&cmd_fromnuc);
|
||||
}
|
||||
osDelay(2);
|
||||
|
||||
tick += delay_tick; /* 计算下一个唤醒时刄1ķ*/
|
||||
osDelayUntil(tick);
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user