diff --git a/MDK-ARM/.vscode/keil-assistant.log b/MDK-ARM/.vscode/keil-assistant.log index 3f8afd7..646e173 100644 --- a/MDK-ARM/.vscode/keil-assistant.log +++ b/MDK-ARM/.vscode/keil-assistant.log @@ -96,3 +96,7 @@ [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 + diff --git a/MDK-ARM/.vscode/uv4.log b/MDK-ARM/.vscode/uv4.log index fc45d57..f5e09e6 100644 --- a/MDK-ARM/.vscode/uv4.log +++ b/MDK-ARM/.vscode/uv4.log @@ -1,10 +1,8 @@ *** Using Compiler 'V5.06 update 7 (build 960)', folder: 'D:\keil\ARM\ARMCC\Bin' Build target 'R1' -compiling shoot.cpp... compiling ball.cpp... -compiling shootTask.cpp... linking... -Program Size: Code=32968 RO-data=1832 RW-data=268 ZI-data=32220 +Program Size: Code=32904 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:06 +Build Time Elapsed: 00:00:05 diff --git a/MDK-ARM/.vscode/uv4.log.lock b/MDK-ARM/.vscode/uv4.log.lock index 76228fa..287f658 100644 --- a/MDK-ARM/.vscode/uv4.log.lock +++ b/MDK-ARM/.vscode/uv4.log.lock @@ -1 +1 @@ -2025/7/1 14:54:30 \ No newline at end of file +2025/7/2 14:06:43 \ No newline at end of file diff --git a/MDK-ARM/R1.uvoptx b/MDK-ARM/R1.uvoptx index 53306b8..4f9d677 100644 --- a/MDK-ARM/R1.uvoptx +++ b/MDK-ARM/R1.uvoptx @@ -153,47 +153,49 @@ -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 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 +964,7 @@ User/device - 1 + 0 0 0 0 @@ -1054,7 +1056,7 @@ User/module - 0 + 1 0 0 0 @@ -1086,7 +1088,7 @@ User/task - 0 + 1 0 0 0 diff --git a/User/device/nuc.c b/User/device/nuc.c index 1fbcaaa..130b3ac 100644 --- a/User/device/nuc.c +++ b/User/device/nuc.c @@ -33,22 +33,8 @@ int8_t NUC_Init(NUC_t *nuc) 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) { - 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, sizeof(nucbuf)) == HAL_OK) return DEVICE_OK; @@ -63,7 +49,7 @@ int8_t NUC_Restart(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); } diff --git a/User/module/ball.cpp b/User/module/ball.cpp index af89813..411937d 100644 --- a/User/module/ball.cpp +++ b/User/module/ball.cpp @@ -356,6 +356,7 @@ void Ball::ballHadling(void) break; case BALL_FORWARD: + osDelay(300); // 不放太快 HAL_GPIO_WritePin(CLOSE_GPIO_Port, CLOSE_Pin, GPIO_PIN_SET); // 打开气缸爪子 osDelay(5); HAL_GPIO_WritePin(DOWN_GPIO_Port, DOWN_Pin, GPIO_PIN_SET); // 打开下气缸 diff --git a/User/module/shoot.cpp b/User/module/shoot.cpp index a3680bc..62765dd 100644 --- a/User/module/shoot.cpp +++ b/User/module/shoot.cpp @@ -58,7 +58,7 @@ Shoot::Shoot() go1.K_P = 1.0f, go1.K_W = 0.05, go1.Pos = 0, // 上电先到一个舒服的位置 - go1.W = 0, + go1.W = 0, go1.T = 0, limit_speed = TO_TOP; // 快速上去 @@ -162,8 +162,6 @@ void Shoot::rc_mode() { is_ready = true; BSP_Buzzer_Stop(); - - } else { @@ -392,7 +390,6 @@ void Shoot::RemoveError() #if ONE_CONTROL - void Shoot::shoot_control() { @@ -436,11 +433,11 @@ void Shoot::shoot_control() t_posSet = Tigger_ZERO; if (feedback.fd_tpos >= Tigger_ZERO - 20) { - + BSP_Buzzer_Stop(); currentState = SHOOT_IDLE; osThreadFlagsClear(EXTEND_OK); - osThreadFlagsClear(READY_TELL); //蓄力标志位 + osThreadFlagsClear(READY_TELL); // 蓄力标志位 shoot_wait = 0; } } @@ -484,7 +481,7 @@ void Shoot::shoot_control() break; case DOWN1: - if (shoot_thread & EXTEND_OK ) + if (shoot_thread & EXTEND_OK) { if (shoot_wait == 1) { @@ -495,7 +492,7 @@ void Shoot::shoot_control() BSP_Buzzer_Stop(); currentState = SHOOT_IDLE; osThreadFlagsClear(EXTEND_OK); - osThreadFlagsClear(READY_TELL); //蓄力标志位 + osThreadFlagsClear(READY_TELL); // 蓄力标志位 shoot_wait = 0; } } diff --git a/User/task/ballTask.cpp b/User/task/ballTask.cpp index 168d0c1..6408282 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(); @@ -34,15 +34,12 @@ void FunctionBall(void *argument) #endif //abc=HAL_GPIO_ReadPin(up_ball_GPIO_Port, up_ball_Pin); - abc=HAL_GPIO_ReadPin(BALL_GPIO_Port, BALL_Pin); // 0为到位 + abc=HAL_GPIO_ReadPin(BALL_GPIO_Port, BALL_Pin); // 0为到位 ball.rc_mode(); // 遥控器模式 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; // CAN_XiaoMi(1,&ball.xiaomi,&hcan2);