串口收数提示
This commit is contained in:
commit
bf3d376b60
8
MDK-ARM/.vscode/keil-assistant.log
vendored
8
MDK-ARM/.vscode/keil-assistant.log
vendored
@ -94,3 +94,11 @@
|
|||||||
|
|
||||||
[info] Log at : 2025/6/30|10:24:59|GMT+0800
|
[info] Log at : 2025/6/30|10:24:59|GMT+0800
|
||||||
|
|
||||||
|
[info] Log at : 2025/7/1|10:57:51|GMT+0800
|
||||||
|
|
||||||
|
[info] Log at : 2025/7/2|02:59:15|GMT+0800
|
||||||
|
|
||||||
|
[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",
|
"buzzer.h": "c",
|
||||||
"calc_lib.h": "c",
|
"calc_lib.h": "c",
|
||||||
"usertask.h": "c",
|
"usertask.h": "c",
|
||||||
"detect.h": "c"
|
"detect.h": "c",
|
||||||
|
"nuc.h": "c"
|
||||||
}
|
}
|
||||||
}
|
}
|
79
MDK-ARM/.vscode/uv4.log
vendored
79
MDK-ARM/.vscode/uv4.log
vendored
@ -1,76 +1,13 @@
|
|||||||
*** Using Compiler 'V5.06 update 7 (build 960)', folder: 'D:\keil\ARM\ARMCC\Bin'
|
*** Using Compiler 'V5.06 update 7 (build 960)', folder: 'D:\keil\ARM\ARMCC\Bin'
|
||||||
Rebuild target 'R1'
|
Build target 'R1'
|
||||||
assembling startup_stm32f407xx.s...
|
|
||||||
compiling dma.c...
|
|
||||||
compiling spi.c...
|
|
||||||
compiling gpio.c...
|
|
||||||
compiling stm32f4xx_hal_msp.c...
|
|
||||||
compiling tim.c...
|
|
||||||
compiling stm32f4xx_it.c...
|
|
||||||
compiling stm32f4xx_hal_rcc.c...
|
|
||||||
compiling freertos.c...
|
|
||||||
compiling main.c...
|
|
||||||
compiling usart.c...
|
|
||||||
compiling stm32f4xx_hal_can.c...
|
|
||||||
compiling crc.c...
|
|
||||||
compiling can.c...
|
|
||||||
compiling stm32f4xx_hal_gpio.c...
|
|
||||||
compiling stm32f4xx_hal_flash_ramfunc.c...
|
|
||||||
compiling stm32f4xx_hal_flash_ex.c...
|
|
||||||
compiling stm32f4xx_hal_flash.c...
|
|
||||||
compiling stm32f4xx_hal_rcc_ex.c...
|
|
||||||
compiling stm32f4xx_hal_cortex.c...
|
|
||||||
compiling stm32f4xx_hal_pwr_ex.c...
|
|
||||||
compiling stm32f4xx_hal_dma.c...
|
|
||||||
compiling stm32f4xx_hal_crc.c...
|
|
||||||
compiling stm32f4xx_hal.c...
|
|
||||||
compiling stm32f4xx_hal_pwr.c...
|
|
||||||
compiling croutine.c...
|
|
||||||
compiling stm32f4xx_hal_exti.c...
|
|
||||||
compiling event_groups.c...
|
|
||||||
compiling list.c...
|
|
||||||
compiling stm32f4xx_hal_dma_ex.c...
|
|
||||||
compiling queue.c...
|
|
||||||
compiling stream_buffer.c...
|
|
||||||
compiling timers.c...
|
|
||||||
compiling tasks.c...
|
|
||||||
compiling heap_4.c...
|
|
||||||
compiling system_stm32f4xx.c...
|
|
||||||
compiling port.c...
|
|
||||||
compiling stm32f4xx_hal_spi.c...
|
|
||||||
compiling stm32f4xx_hal_uart.c...
|
|
||||||
compiling stm32f4xx_hal_tim_ex.c...
|
|
||||||
compiling stm32f4xx_hal_tim.c...
|
|
||||||
compiling calc_lib.c...
|
|
||||||
compiling crc_ccitt.c...
|
|
||||||
compiling kalman.c...
|
|
||||||
compiling cmsis_os2.c...
|
|
||||||
compiling bsp_buzzer.c...
|
|
||||||
compiling bsp_delay.c...
|
|
||||||
compiling can_init.c...
|
|
||||||
compiling can_it.c...
|
|
||||||
compiling gpio_it.c...
|
|
||||||
compiling uart_it.c...
|
|
||||||
compiling filter.c...
|
|
||||||
compiling pid.c...
|
|
||||||
compiling user_math.c...
|
|
||||||
compiling buzzer.c...
|
|
||||||
compiling userTask.c...
|
|
||||||
compiling detect.c...
|
|
||||||
compiling shoot.cpp...
|
|
||||||
compiling vofa.c...
|
|
||||||
compiling remote_control.c...
|
|
||||||
compiling djiMotor.c...
|
|
||||||
compiling GO_M8010_6_Driver.c...
|
|
||||||
compiling nuc.c...
|
|
||||||
compiling ball.cpp...
|
|
||||||
compiling initTask.c...
|
|
||||||
compiling ballTask.cpp...
|
|
||||||
compiling encodeCan.cpp...
|
|
||||||
compiling nucTask.cpp...
|
|
||||||
compiling shootTask.cpp...
|
compiling shootTask.cpp...
|
||||||
|
compiling nuc.c...
|
||||||
|
compiling initTask.c...
|
||||||
|
compiling ball.cpp...
|
||||||
|
compiling nucTask.cpp...
|
||||||
|
compiling shoot.cpp...
|
||||||
linking...
|
linking...
|
||||||
Program Size: Code=32916 RO-data=1832 RW-data=276 ZI-data=32220
|
Program Size: Code=32960 RO-data=1832 RW-data=268 ZI-data=32220
|
||||||
FromELF: creating hex file...
|
FromELF: creating hex file...
|
||||||
"R1\R1.axf" - 0 Error(s), 0 Warning(s).
|
"R1\R1.axf" - 0 Error(s), 0 Warning(s).
|
||||||
Build Time Elapsed: 00:04:01
|
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/6/30 14:27:15
|
2025/7/4 9:21:52
|
@ -178,7 +178,22 @@
|
|||||||
<Ww>
|
<Ww>
|
||||||
<count>4</count>
|
<count>4</count>
|
||||||
<WinNumber>1</WinNumber>
|
<WinNumber>1</WinNumber>
|
||||||
<ItemText>cmd_fromnuc</ItemText>
|
<ItemText>nuc_v</ItemText>
|
||||||
|
</Ww>
|
||||||
|
<Ww>
|
||||||
|
<count>5</count>
|
||||||
|
<WinNumber>1</WinNumber>
|
||||||
|
<ItemText>abc,0x0A</ItemText>
|
||||||
|
</Ww>
|
||||||
|
<Ww>
|
||||||
|
<count>6</count>
|
||||||
|
<WinNumber>1</WinNumber>
|
||||||
|
<ItemText>shoot_wait,0x0A</ItemText>
|
||||||
|
</Ww>
|
||||||
|
<Ww>
|
||||||
|
<count>7</count>
|
||||||
|
<WinNumber>1</WinNumber>
|
||||||
|
<ItemText>error_code</ItemText>
|
||||||
</Ww>
|
</Ww>
|
||||||
</WatchWindow1>
|
</WatchWindow1>
|
||||||
<MemoryWindow4>
|
<MemoryWindow4>
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
static osThreadId_t thread_alert;
|
static osThreadId_t thread_alert;
|
||||||
|
|
||||||
static volatile uint32_t drop_message = 0;
|
volatile uint32_t drop_message = 0;
|
||||||
|
|
||||||
uint8_t nucbuf[16];
|
uint8_t nucbuf[16];
|
||||||
uint8_t packet[32]; // 假设最大数据包长度为 32 字节
|
uint8_t packet[32]; // 假设最大数据包长度为 32 字节
|
||||||
@ -13,10 +13,11 @@ static void NUC_CBLTCallback(void)
|
|||||||
{
|
{
|
||||||
osThreadFlagsSet(thread_alert, SIGNAL_NUC_RAW_REDY);
|
osThreadFlagsSet(thread_alert, SIGNAL_NUC_RAW_REDY);
|
||||||
}
|
}
|
||||||
|
uint32_t error_code;
|
||||||
static void NUC_ERRORCALLBACK(void)
|
static void NUC_ERRORCALLBACK(void)
|
||||||
{
|
{
|
||||||
NUC_Restart();
|
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));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -33,22 +34,8 @@ int8_t NUC_Init(NUC_t *nuc)
|
|||||||
return DEVICE_OK;
|
return DEVICE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
// static void NUC_IdleCallback(void) {
|
|
||||||
// osThreadFlagsSet(thread_alert,SIGNAL_NUC_RAW_REDY);
|
|
||||||
|
|
||||||
// }
|
|
||||||
|
|
||||||
// int8_t NUC_Init(NUC_t *nuc){
|
|
||||||
// if(nuc == NULL) return DEVICE_ERR_NULL;
|
|
||||||
// if((thread_alert = osThreadGetId()) == NULL ) return DEVICE_ERR_NULL;
|
|
||||||
// BSP_UART_RegisterCallback(BSP_UART_AI,BSP_UART_IDLE_LINE_CB,
|
|
||||||
// NUC_IdleCallback);
|
|
||||||
|
|
||||||
// return DEVICE_OK;
|
|
||||||
// }
|
|
||||||
|
|
||||||
int8_t NUC_StartReceiving(void) {
|
int8_t NUC_StartReceiving(void) {
|
||||||
if (HAL_UARTEx_ReceiveToIdle_DMA(BSP_UART_GetHandle(BSP_UART_AI),
|
if (HAL_UART_Receive_DMA(BSP_UART_GetHandle(BSP_UART_AI),
|
||||||
(uint8_t *)nucbuf,
|
(uint8_t *)nucbuf,
|
||||||
sizeof(nucbuf)) == HAL_OK)
|
sizeof(nucbuf)) == HAL_OK)
|
||||||
return DEVICE_OK;
|
return DEVICE_OK;
|
||||||
@ -63,7 +50,7 @@ int8_t NUC_Restart(void) {
|
|||||||
|
|
||||||
|
|
||||||
bool_t NUC_WaitDmaCplt(void) {
|
bool_t NUC_WaitDmaCplt(void) {
|
||||||
return (osThreadFlagsWait(SIGNAL_NUC_RAW_REDY, osFlagsWaitAll,500) ==
|
return (osThreadFlagsWait(SIGNAL_NUC_RAW_REDY, osFlagsWaitAll,20) ==
|
||||||
SIGNAL_NUC_RAW_REDY);
|
SIGNAL_NUC_RAW_REDY);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -94,7 +81,7 @@ int8_t NUC_SendPacket(void *data, uint16_t length) {
|
|||||||
|
|
||||||
return DEVICE_OK; // 发送成功
|
return DEVICE_OK; // 发送成功
|
||||||
}
|
}
|
||||||
int wzcsb=0;
|
|
||||||
int8_t NUC_RawParse(NUC_t *n) {
|
int8_t NUC_RawParse(NUC_t *n) {
|
||||||
if (n == NULL) return DEVICE_ERR_NULL;
|
if (n == NULL) return DEVICE_ERR_NULL;
|
||||||
union {
|
union {
|
||||||
@ -112,12 +99,10 @@ int8_t NUC_RawParse(NUC_t *n) {
|
|||||||
case VISION:
|
case VISION:
|
||||||
/* 协议格式
|
/* 协议格式
|
||||||
0xFF HEAD
|
0xFF HEAD
|
||||||
0x09
|
0x07
|
||||||
控制帧
|
控制帧
|
||||||
0x01 相机帧
|
0x01 相机帧
|
||||||
x fp32
|
x fp32
|
||||||
y fp32
|
|
||||||
z fp32
|
|
||||||
0xFE TAIL
|
0xFE TAIL
|
||||||
*/
|
*/
|
||||||
if (nucbuf[7] != TAIL) goto error;
|
if (nucbuf[7] != TAIL) goto error;
|
||||||
@ -146,7 +131,7 @@ int8_t NUC_RawParse(NUC_t *n) {
|
|||||||
|
|
||||||
|
|
||||||
error:
|
error:
|
||||||
wzcsb++;
|
drop_message++;
|
||||||
return DEVICE_ERR;
|
return DEVICE_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ extern "C" {
|
|||||||
#include "struct_typedef.h"
|
#include "struct_typedef.h"
|
||||||
#include "device.h"
|
#include "device.h"
|
||||||
#include "uart_it.h"
|
#include "uart_it.h"
|
||||||
|
#include "main.h"
|
||||||
|
|
||||||
// 帧头针尾
|
// 帧头针尾
|
||||||
#define HEAD (0xFF)
|
#define HEAD (0xFF)
|
||||||
@ -15,7 +16,7 @@ extern "C" {
|
|||||||
|
|
||||||
#define ODOM (0x04)
|
#define ODOM (0x04)
|
||||||
#define PICK (0x06)
|
#define PICK (0x06)
|
||||||
#define VISION (0x09)
|
#define VISION (0x07)
|
||||||
#define SEND (0X07)
|
#define SEND (0X07)
|
||||||
|
|
||||||
// 写结构体存入视觉信息
|
// 写结构体存入视觉信息
|
||||||
|
@ -11,6 +11,7 @@ extern int ball_exit;
|
|||||||
|
|
||||||
// 外死点168 外163 中150 内127 限位124.8
|
// 外死点168 外163 中150 内127 限位124.8
|
||||||
// 伸缩
|
// 伸缩
|
||||||
|
//外死点168 外163 中150 内127 限位124.8
|
||||||
#define I_ANGLE 127
|
#define I_ANGLE 127
|
||||||
#define O_ANGLE 163
|
#define O_ANGLE 163
|
||||||
#define WAIT_POS 150
|
#define WAIT_POS 150
|
||||||
@ -78,7 +79,7 @@ void Ball::rc_mode()
|
|||||||
}
|
}
|
||||||
if (rc_ctrl.sw[5] == 200)
|
if (rc_ctrl.sw[5] == 200)
|
||||||
{
|
{
|
||||||
ready_key = DE; // 默认不准备
|
ready_key = DEF; // 默认不准备
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -237,14 +238,16 @@ void Ball::ball_control()
|
|||||||
ballHadling();
|
ballHadling();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Send_control();
|
Send_control();
|
||||||
}
|
}
|
||||||
// 防守
|
// 防守
|
||||||
if(ready_key == DEFENSE)
|
else if(ready_key == DEF)
|
||||||
{
|
{
|
||||||
xiaomi.position = I_ANGLE; // 保持收回
|
xiaomi.position = I_ANGLE; // 保持收回
|
||||||
HAL_GPIO_WritePin(CLOSE_GPIO_Port, CLOSE_Pin, GPIO_PIN_RESET); // 确保爪气缸关闭
|
HAL_GPIO_WritePin(CLOSE_GPIO_Port, CLOSE_Pin, GPIO_PIN_RESET); // 确保爪气缸关闭
|
||||||
HAL_GPIO_WritePin(DOWN_GPIO_Port, DOWN_Pin, GPIO_PIN_RESET); // 确保下气缸关闭
|
HAL_GPIO_WritePin(DOWN_GPIO_Port, DOWN_Pin, GPIO_PIN_RESET); // 确保下气缸关闭
|
||||||
|
|
||||||
Send_control();
|
Send_control();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -286,6 +289,7 @@ void Ball::ballDown(void)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case EXTEND_FINISH:
|
case EXTEND_FINISH:
|
||||||
|
HAL_GPIO_WritePin(CLOSE_GPIO_Port, CLOSE_Pin, GPIO_PIN_RESET);
|
||||||
xiaomi.position = O_ANGLE; // 一直保持伸出
|
xiaomi.position = O_ANGLE; // 一直保持伸出
|
||||||
// 等待拨杆复位(如切到MIDDLE2),Idle_control会负责回位
|
// 等待拨杆复位(如切到MIDDLE2),Idle_control会负责回位
|
||||||
break;
|
break;
|
||||||
@ -358,6 +362,7 @@ void Ball::ballHadling(void)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case BALL_FORWARD:
|
case BALL_FORWARD:
|
||||||
|
osDelay(300); // 不放太快
|
||||||
HAL_GPIO_WritePin(CLOSE_GPIO_Port, CLOSE_Pin, GPIO_PIN_SET); // 打开气缸爪子
|
HAL_GPIO_WritePin(CLOSE_GPIO_Port, CLOSE_Pin, GPIO_PIN_SET); // 打开气缸爪子
|
||||||
osDelay(5);
|
osDelay(5);
|
||||||
HAL_GPIO_WritePin(DOWN_GPIO_Port, DOWN_Pin, GPIO_PIN_SET); // 打开下气缸
|
HAL_GPIO_WritePin(DOWN_GPIO_Port, DOWN_Pin, GPIO_PIN_SET); // 打开下气缸
|
||||||
|
@ -40,7 +40,7 @@ typedef enum
|
|||||||
IN,
|
IN,
|
||||||
OUT,
|
OUT,
|
||||||
SIDE,
|
SIDE,
|
||||||
DE
|
DEF
|
||||||
}ball_rc_mode;
|
}ball_rc_mode;
|
||||||
|
|
||||||
// 定义光电传感器检测宏
|
// 定义光电传感器检测宏
|
||||||
|
@ -148,71 +148,6 @@ int Shoot::GO_SendData(float pos, float limit)
|
|||||||
// B键 sw[3]👆 200 开 中 1000 👇1800 关
|
// B键 sw[3]👆 200 开 中 1000 👇1800 关
|
||||||
// sw[5] 👆 200 👇1800
|
// sw[5] 👆 200 👇1800
|
||||||
// 左旋 sw[7] 200 --1800
|
// 左旋 sw[7] 200 --1800
|
||||||
// void Shoot::rc_mode()
|
|
||||||
// {
|
|
||||||
// if (rc_ctrl.sw[1] == 200)
|
|
||||||
// {
|
|
||||||
// rc_key = UP1;
|
|
||||||
// }
|
|
||||||
// if (rc_ctrl.sw[1] == 1800 && rc_ctrl.sw[2] == 200)
|
|
||||||
// {
|
|
||||||
// rc_key = MIDDLE1;
|
|
||||||
// }
|
|
||||||
// if (rc_ctrl.sw[2] == 1800 && rc_ctrl.sw[1] == 1800)
|
|
||||||
// {
|
|
||||||
// rc_key = DOWN1;
|
|
||||||
// }
|
|
||||||
// if (rc_ctrl.sw[0] == 1800)
|
|
||||||
// {
|
|
||||||
// mode_key = PASS;
|
|
||||||
// }
|
|
||||||
// if (rc_ctrl.sw[0] == 200)
|
|
||||||
// {
|
|
||||||
// mode_key = VSION;
|
|
||||||
// }
|
|
||||||
// // if(rc_ctrl.sw[5]==200)
|
|
||||||
// // {
|
|
||||||
// // mode_key=OUT;
|
|
||||||
// // }
|
|
||||||
// if (rc_ctrl.sw[5] == 1800)
|
|
||||||
// {
|
|
||||||
// ready_key = OFFENSIVE;
|
|
||||||
// }
|
|
||||||
// else if (rc_ctrl.sw[5] == 200)
|
|
||||||
// {
|
|
||||||
// ready_key = DEFENSE;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // //旋钮增量
|
|
||||||
// // static int last_knob_value = 0; // 记录旋钮的上一次值
|
|
||||||
// // int current_knob_value = rc_ctrl.sw[7]; // 获取当前旋钮值
|
|
||||||
|
|
||||||
// // // 计算旋钮增量
|
|
||||||
// // if (current_knob_value >= 200 && current_knob_value <= 1800) {
|
|
||||||
// // knob_increment = (current_knob_value - last_knob_value) / 15.0f; // 每80单位对应一个增量
|
|
||||||
// // } else {
|
|
||||||
// // knob_increment = 0; // 如果旋钮值超出范围,不产生增量
|
|
||||||
// // }
|
|
||||||
|
|
||||||
// // 旋钮物理范围
|
|
||||||
// const int knob_min = 200;
|
|
||||||
// const int knob_max = 1800;
|
|
||||||
|
|
||||||
// // 目标映射范围
|
|
||||||
// const float map_min = 130.0f;
|
|
||||||
// const float map_max = -60.0f;
|
|
||||||
|
|
||||||
// int current_knob_value = rc_ctrl.sw[7];
|
|
||||||
|
|
||||||
// // 限制范围
|
|
||||||
// if (current_knob_value < knob_min)
|
|
||||||
// current_knob_value = knob_min;
|
|
||||||
// if (current_knob_value > knob_max)
|
|
||||||
// current_knob_value = knob_max;
|
|
||||||
|
|
||||||
// // 线性映射
|
|
||||||
// knob_increment = map_min + (map_max - map_min) * (current_knob_value - knob_min) / (knob_max - knob_min);
|
|
||||||
// }
|
|
||||||
|
|
||||||
void Shoot::rc_mode()
|
void Shoot::rc_mode()
|
||||||
{
|
{
|
||||||
@ -226,12 +161,12 @@ void Shoot::rc_mode()
|
|||||||
if (bottom_sensor == 0)
|
if (bottom_sensor == 0)
|
||||||
{
|
{
|
||||||
is_ready = true;
|
is_ready = true;
|
||||||
|
BSP_Buzzer_Stop();
|
||||||
// 可选:蜂鸣器提示“归零成功”
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// 未到位,所有按键无效,直接返回
|
BSP_Buzzer_Start();
|
||||||
|
BSP_Buzzer_Set(1, 5000);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -455,7 +390,6 @@ void Shoot::RemoveError()
|
|||||||
|
|
||||||
#if ONE_CONTROL
|
#if ONE_CONTROL
|
||||||
|
|
||||||
int shoot_wait = 0;
|
|
||||||
void Shoot::shoot_control()
|
void Shoot::shoot_control()
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -503,6 +437,7 @@ void Shoot::shoot_control()
|
|||||||
BSP_Buzzer_Stop();
|
BSP_Buzzer_Stop();
|
||||||
currentState = SHOOT_IDLE;
|
currentState = SHOOT_IDLE;
|
||||||
osThreadFlagsClear(EXTEND_OK);
|
osThreadFlagsClear(EXTEND_OK);
|
||||||
|
osThreadFlagsClear(READY_TELL); // 蓄力标志位
|
||||||
shoot_wait = 0;
|
shoot_wait = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -557,6 +492,7 @@ void Shoot::shoot_control()
|
|||||||
BSP_Buzzer_Stop();
|
BSP_Buzzer_Stop();
|
||||||
currentState = SHOOT_IDLE;
|
currentState = SHOOT_IDLE;
|
||||||
osThreadFlagsClear(EXTEND_OK);
|
osThreadFlagsClear(EXTEND_OK);
|
||||||
|
osThreadFlagsClear(READY_TELL); // 蓄力标志位
|
||||||
shoot_wait = 0;
|
shoot_wait = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -112,6 +112,8 @@ private:
|
|||||||
|
|
||||||
float limit_speed;//go电机限速
|
float limit_speed;//go电机限速
|
||||||
|
|
||||||
|
int shoot_wait;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -40,9 +40,6 @@ void FunctionBall(void *argument)
|
|||||||
|
|
||||||
ball.ball_control(); // 控制球的动作
|
ball.ball_control(); // 控制球的动作
|
||||||
|
|
||||||
// HAL_GPIO_WritePin(CLOSE_GPIO_Port, CLOSE_Pin, GPIO_PIN_SET); // 确保气缸爪子闭合
|
|
||||||
// HAL_GPIO_WritePin(DOWN_GPIO_Port, DOWN_Pin, GPIO_PIN_SET); // 确保下气缸关闭
|
|
||||||
|
|
||||||
// ball.xiaomi.position = aaaa;
|
// ball.xiaomi.position = aaaa;
|
||||||
// CAN_XiaoMi(1,&ball.xiaomi,&hcan2);
|
// CAN_XiaoMi(1,&ball.xiaomi,&hcan2);
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include "FreeRTOS.h"
|
#include "FreeRTOS.h"
|
||||||
#include <cmsis_os2.h>
|
#include <cmsis_os2.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include "bsp_buzzer.h"
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
|
||||||
@ -20,8 +21,6 @@ void Function_nuc(void *argument)
|
|||||||
|
|
||||||
NUC_Init(&cmd_fromnuc);
|
NUC_Init(&cmd_fromnuc);
|
||||||
|
|
||||||
HAL_GPIO_WritePin(LED_G_GPIO_Port,LED_G_Pin,GPIO_PIN_SET);
|
|
||||||
|
|
||||||
uint32_t tick = osKernelGetTickCount();
|
uint32_t tick = osKernelGetTickCount();
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
@ -44,20 +43,25 @@ void Function_nuc(void *argument)
|
|||||||
// NUC_HandleOffline(&cmd_fromnuc);
|
// NUC_HandleOffline(&cmd_fromnuc);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// 假设你在主循环或任务里这样用
|
|
||||||
if (NUC_RawParse(&cmd_fromnuc) == DEVICE_OK)
|
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); // 清空消息队列
|
osMessageQueueReset(task_struct.msgq.nuc); // 清空消息队列
|
||||||
osMessageQueuePut(task_struct.msgq.nuc, &(cmd_fromnuc), 0, 0);
|
osMessageQueuePut(task_struct.msgq.nuc, &(cmd_fromnuc), 0, 0);
|
||||||
}
|
}
|
||||||
else
|
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);
|
NUC_HandleOffline(&cmd_fromnuc);
|
||||||
}
|
}
|
||||||
osDelay(2);
|
|
||||||
|
|
||||||
tick += delay_tick; /* 计算下一个唤醒时刄1ķ*/
|
tick += delay_tick; /* 计算下一个唤醒时刄1ķ*/
|
||||||
osDelayUntil(tick);
|
osDelayUntil(tick);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user