From 7ac8b1f5804eceec245b48821434da43820b28d3 Mon Sep 17 00:00:00 2001 From: Lizongdi <1210855344@qq.com> Date: Fri, 16 Oct 2026 16:35:48 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E7=BC=96=E8=AF=91=E9=80=9A=E8=BF=87?= =?UTF-8?q?=E3=80=91=E5=BD=93=E5=89=8D=E9=9B=B7=E8=B5=9B=E7=94=B5=E6=9C=BA?= =?UTF-8?q?=E9=80=9F=E5=BA=A6=E5=85=A8=E5=B1=80=E8=BF=98=E6=B2=A1=E8=B5=8B?= =?UTF-8?q?=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Core/BASE/Src/MSP/msp_LeiSai_485.c | 6 +++--- .../BHBF_Robot_Lifting_Lug/Core/Src/FSM.c | 20 ++++++++++++------- .../BHBF_Robot_Lifting_Lug/Core/Src/main.c | 13 +++++++----- .../Core/Src/robot_state.c | 7 +------ 4 files changed, 25 insertions(+), 21 deletions(-) diff --git a/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/BASE/Src/MSP/msp_LeiSai_485.c b/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/BASE/Src/MSP/msp_LeiSai_485.c index 9c1830b..d178b8e 100644 --- a/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/BASE/Src/MSP/msp_LeiSai_485.c +++ b/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/BASE/Src/MSP/msp_LeiSai_485.c @@ -42,7 +42,7 @@ void LS_485Motor_loop() &LS_485Motors_handler->TxCount, LS_485Motors_slave_id, 0x6208, 0x02);//PR1为速度模式 LS_485Motors_handler->AddSendList(LS_485Motors_handler, - LS_485Motors_handler->Tx_Buf, LS_485Motors_handler->TxCount, OneLineWaitTime, + LS_485Motors_handler->Tx_Buf, LS_485Motors_handler->TxCount, 50, NULL); speedModeSet=0; @@ -52,14 +52,14 @@ void LS_485Motor_loop() &LS_485Motors_handler->TxCount, LS_485Motors_slave_id, 0x620B, LS_485Motors_Speed);//PR1速度 LS_485Motors_handler->AddSendList(LS_485Motors_handler, - LS_485Motors_handler->Tx_Buf, LS_485Motors_handler->TxCount, OneLineWaitTime, + LS_485Motors_handler->Tx_Buf, LS_485Motors_handler->TxCount, 50, NULL); MB_WriteHoldingReg(&LS_485Motors_handler->Tx_Buf, &LS_485Motors_handler->TxCount, LS_485Motors_slave_id, 0x6002, 0x11);//PR1运行 LS_485Motors_handler->AddSendList(LS_485Motors_handler, - LS_485Motors_handler->Tx_Buf, LS_485Motors_handler->TxCount, OneLineWaitTime, + LS_485Motors_handler->Tx_Buf, LS_485Motors_handler->TxCount, 50, NULL); diff --git a/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/FSM.c b/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/FSM.c index 64bbb9b..1ce58c0 100644 --- a/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/FSM.c +++ b/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/FSM.c @@ -145,28 +145,34 @@ void Mode_Control() } extern uint8_t Pin2; -extern uint8_t Pin3; - +extern uint8_t Test1; void IO_Control() { - GF_BSP_GPIO_SetIO(4, 1); + //GF_BSP_GPIO_SetIO(4, 1); if(StrongGrindingMachineCurrentState == STRONG_GRINDING_MACHINE_MOTION_STATE) { - GF_BSP_GPIO_SetIO(5, 0); + //GF_BSP_GPIO_SetIO(5, 0); } else if(StrongGrindingMachineCurrentState == STRONG_GRINDING_MACHINE_HALT_STATE) { - GF_BSP_GPIO_SetIO(5, 1); + //GF_BSP_GPIO_SetIO(5, 1); } else{ } Pin2 = GF_BSP_GPIO_ReadIO(2); - Pin3 = GF_BSP_GPIO_ReadIO(3); - + Test1 = GF_BSP_GPIO_ReadIO(3); + if (!Test1) + { + GF_BSP_GPIO_SetIO(5, 0); + } + else + { + GF_BSP_GPIO_SetIO(5, 1); + } } void Automatic_Init() diff --git a/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/main.c b/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/main.c index c1c4338..6d71f4e 100644 --- a/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/main.c +++ b/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/main.c @@ -154,7 +154,7 @@ int main(void) MX_LPUART1_UART_Init(); MX_ADC2_Init(); /* USER CODE BEGIN 2 */ - GF_BSP_GPIO_SetIO(5,1); + //GF_BSP_GPIO_SetIO(5,1); DLT_LOG_ENABLE_LEVEL=0;//7 send all information 0 send nothing Error_Detect_Intialzie(3000);//every 1 seconds HAL_Delay(5000); @@ -276,9 +276,9 @@ void CV_GV_Init() strong_grinding_machine_cmd = 0; // 电磁é˜?默认关闭 GF_BSP_GPIO_SetIO(3, 1); - GF_BSP_GPIO_SetIO(4, 1); + //GF_BSP_GPIO_SetIO(4, 1); // 冷却通气é˜?默认关闭,动作与主轴同步 - GF_BSP_GPIO_SetIO(5, 1); + //GF_BSP_GPIO_SetIO(5, 1); //Error Config SystemErrorData= &GV.SystemErrorData;//send to upper computer @@ -338,10 +338,13 @@ void GF_Robot_Init() - SlideMotor_Controller_intialize_CAN2(&FD_CAN_2_Handler);//雷赛电机 + //SlideMotor_Controller_intialize_CAN2(&FD_CAN_2_Handler);//雷赛电机 // ï¿??光测距传感器ï¿??115200 - zhr29_200_laser_sensor_intialize(&RS_485_3_UART_Handler); + //zhr29_200_laser_sensor_intialize(&RS_485_3_UART_Handler); + + // 雷赛485电机 + LS_485Motors_intialize(&RS_485_3_UART_Handler); // 强磨æœ? strong_grinding_machine_intialize(&RS_485_2_UART_Handler); diff --git a/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/robot_state.c b/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/robot_state.c index 732b328..6ccb4ea 100644 --- a/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/robot_state.c +++ b/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/robot_state.c @@ -360,7 +360,7 @@ const uint32_t up_limit = 6200; const uint8_t down_limit = 0; uint8_t Pin2 = -1; //上限位,为0表示限位触发 -uint8_t Pin3 = -1; //下限位,为0表示限位触发 +uint8_t Test1 = 0; int32_t KinfePosition = 1000; // 初始化为一个不合理的大值,等于1000时显示为未标定 int StrongSingleShotFlag = 0; @@ -371,11 +371,6 @@ extern uint8_t Mode_Init;// 初始化时第一次升刀的流程 static void LimitDownPosition(void) { - if (!Pin3) - { - GV.LS_FrontEnd_Motor.Target_Velcity = 0; - } - if (GV.LS_FrontEnd_Motor.Real_Position - KinfePosition >= SAFE_MOTOR_COUNT) { GV.LS_FrontEnd_Motor.Target_Velcity = 0; // 电机脉冲数急停