From 0322865af1f8d2423ad3cc6751fe81b6a8c25116 Mon Sep 17 00:00:00 2001 From: kyz Date: Wed, 14 Jan 2026 13:57:28 +0800 Subject: [PATCH] =?utf8?q?=E4=BF=AE=E6=94=B9=E6=8B=A7=E7=B4=A7=E5=90=AF?= =?utf8?q?=E5=8A=A8=E5=88=A4=E6=96=AD=E5=8E=8B=E5=8A=9B=E9=98=88=E5=80=BC?= =?utf8?q?=E4=B8=BA=E7=9B=AE=E6=A0=87=E5=8E=8B=E5=8A=9B=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- QiDong/APP/src/model.c | 22 ++++++++++++++ QiDong/BSP/src/bsp.c | 2 +- QiDong/BSP/src/bsp_usart.c | 2 +- QiDong/System/WrenchManage.c | 59 +++++++++++++++++++++++++++++++++--- QiDong/debug_tools/main.py | 2 +- 5 files changed, 79 insertions(+), 8 deletions(-) diff --git a/QiDong/APP/src/model.c b/QiDong/APP/src/model.c index ca6275b..16babed 100644 --- a/QiDong/APP/src/model.c +++ b/QiDong/APP/src/model.c @@ -379,7 +379,15 @@ uint32_t setSensorPresetTorValVarFlag1(uint8_t Unit,uint32_t* presetvalue) //10 Period_Cnt xishi Y uint32_t getOutDutyData(float press) { +#if 1 + uint32_t duty; + + duty = (press/10000/0.01*MAXMPA); //Êä³ö¶ÔÓ¦µçѹµÄÕ¼¿Õ±È×°ÔØÖµ + duty += duty*5/100; //TODO: ¹Ì¶¨¼Ó%5²¹³¥ÓÃÓÚ²âÊÔ£¬ ºóÃæ°´ÐèÒª¸Ä³É²ÎÊý¿ÉÅäÖÃ, 2026/1/13 + return duty; +#else return (press/10000/0.01*MAXMPA); //Êä³ö¶ÔÓ¦µçѹµÄÕ¼¿Õ±È×°ÔØÖµ +#endif /* ´úÂëÀí½â£º °´Ö®Ç°getPressValue¼ÆË㣬ÊäÈëµÄ²ÎÊýpressÊÇÄ¿±êŤ¾Ø/×î´óŤ¾Ø*10Íò£¬×î´óŤ¾Ø¶ÔÓ¦µ½Ñ¹Á¦6.25Bar£¬ @@ -533,7 +541,21 @@ uint32_t setBoltGradeValVarFlag (uint8_t*GardeNum,uint8_t*DiamNum,Computer_BoltD strncpy((char*)ModifyVarStructVar.BoltGardeArr_M,(char*)Data->Metric_Grade[j],12); } } +#if 1 + //TODO: ¼ì²é¶ÔÓ¦²úÆ·ÐͺŵÄ×î´óÖµºÍ×îСֵ£¬³¬³ö·¶Î§µÄ·µ»Ø0 + BoltTorqueVal = Data->Metric_parameter[*GardeNum-1][*DiamNum-1]; //µÃµ½Ö±¾¶ºÍµÈ¼¶¶ÔÓ¦µÄŤ¾ØÖµ + //range: [SpannerType[k].TorqueMinDate SpannerType[k].TorqueMaxDate] + if( BoltTorqueVal < SpannerType[ModifyVarStructVar.fabricName-1].TorqueMinDate + || BoltTorqueVal > SpannerType[ModifyVarStructVar.fabricName-1].TorqueMaxDate ){ + + printf( "BoltTorqueVal %d /(%d,%d) -> 0\n", BoltTorqueVal, + SpannerType[ModifyVarStructVar.fabricName-1].TorqueMinDate, + SpannerType[ModifyVarStructVar.fabricName-1].TorqueMaxDate ); + BoltTorqueVal = 0; + } +#else BoltTorqueVal = Data->Metric_parameter[*GardeNum-1][*DiamNum-1]; //µÃµ½Ö±¾¶ºÍµÈ¼¶¶ÔÓ¦µÄŤ¾ØÖµ +#endif return BoltTorqueVal; } return BoltTorqueVal; diff --git a/QiDong/BSP/src/bsp.c b/QiDong/BSP/src/bsp.c index d8e5694..5ed7fcb 100644 --- a/QiDong/BSP/src/bsp.c +++ b/QiDong/BSP/src/bsp.c @@ -249,7 +249,7 @@ static void test_5msTask(void) WrenchManage_MainTask();//°âÊÖ²Ù×÷ÈÎÎñ LED_5msMainFunction();//ledÈÎÎñ Beep_5msMainFunction();//·äÃùÆ÷ÈÎÎñ - if(turn_flag == 0) +// if(turn_flag == 0) { Screen_Sleep(); } diff --git a/QiDong/BSP/src/bsp_usart.c b/QiDong/BSP/src/bsp_usart.c index 0ca0519..5ba3c5a 100644 --- a/QiDong/BSP/src/bsp_usart.c +++ b/QiDong/BSP/src/bsp_usart.c @@ -501,7 +501,7 @@ u16 USART2Read(u8 *buf, u16 len) u8 USART2Write(u8 *buf ,u16 len) //·¢ËÍ { u16 i=0; - for(i=0;i<=len;i++) + for(i=0;i temppress * compareFac ){ + Matchine_SetMachine(0); + } + break; + case 0: - ADCGetPress[0] = GetPress(); + +#if 1 + if(qiya < (temppress) * compareFac && SleepState == 1 && niujupress == 0 && Adjusting_torque_flag == 1) //°âÊÖ°´Ï ÕâÀïÈç¹ûÏÖ³¡ÆøÑ¹Ò»Ö±±È½ÏµÍ£¬ÉèÖõÄѹÁ¦Èç¹û¸ß ¾ÍûÓа취¼ì²âµ½°âÊÖ°´ÏµÄ״̬ + { + turn_flag = 1; + if(wrench_device.rotate_start_count++ >= ROTATE_START_NUM_5MS) + { + LED_SetLedStatus(LED_ID_DETECT_WORK,1); //LED¼ì²â¹¤×÷״̬µÆÁÁ + Beep_SetbeepStatus(BEEP_ID_DETECT_WORK,1); //·äÃùÆ÷¼ì²â¹¤×÷״̬Ïì + Matchine_SetMachine(1); //Çл»×´Ì¬»úÒ³Ãæ + wrench_device.rotate_start_count = 0; + wrench_device.rotate_work_timeout_count = 0; + } + } + else + { + wrench_device.rotate_start_count = 0; + turn_flag = 0; + } +#else if(temppress > 20000) { qiya = ADCGetPress[0]*10000; @@ -283,6 +312,8 @@ static void Machine_DoPress(void) //״̬ } //printf("state machine:%d\r\n",machine_step); } + +#endif break; case 1: @@ -441,7 +472,7 @@ static void Machine_DoPress(void) //״̬ if(delay_cnt ++ >= 600) { delay_cnt = 0; - Matchine_SetMachine(0); + Matchine_SetMachine(8); wrench_device.wrench_device_status = DEVICE_STANDBY; //printf("state machine:%d\r\n",machine_step); turn_flag = 0; @@ -748,7 +779,9 @@ static uint8_t WrenchMode_Select(uint8_t mode) Ret = 1; } - }break; + } + + break; case 2: if(First[2] == 0) //ÂÝ˨ģʽ @@ -909,6 +942,22 @@ static uint8_t WrenchMode_Select(uint8_t mode) } }break; } +#if 1 + { + //ÆôÍ£ãÐÖµÐÞ¸ÄΪĿ±êŤ¾Ø¶ÔÓ¦µÄѹÁ¦ + //SetPress_TorqueÊǶÔÓ¦×î´óŤ¾ØµÄѹÁ¦6.25BarµÄ±ÈÀýÖµ*100000£¬ÕâÀï x 6.25Bar ¼ÆËãµÃµ½Ä¿±êѹÁ¦Öµ + //ºóÃæ±È½ÏµÄÖµÊÇadc¶ÁÈ¡µ½Ñ¹Á¦ÓÖ³ËÒÔ10000£¬ ËùÒÔÕâÀïºóÃæÓÖ³ËÒÔ10000. + if( mode == 1 ){ + temppress = ResetPress.SetPress_Torque/100000 * 6.25 * 10000; + }else if( mode == 2 ){ + temppress = ResetPress.SetPress_Bolt/100000 * 6.25 * 10000; + }else if( mode == 3 ){ + temppress = ResetPress.SetPress_Gear/100000 * 6.25 * 10000; + }else { + + } + } +#endif return Ret; } diff --git a/QiDong/debug_tools/main.py b/QiDong/debug_tools/main.py index 614dc50..9f77cd8 100644 --- a/QiDong/debug_tools/main.py +++ b/QiDong/debug_tools/main.py @@ -250,7 +250,7 @@ class page_devst( QWidget, ui_devst.Ui_Form): if self.ui_update_counter >= self.ui_update_interval or (current_time - self.last_update_time > 0.1): # 更新表格 - step_str = [u"0.待机",u"1.启动", u"2.", u"3.", u"4.", u"5.",u"6.通知", u"7.结束"] + step_str = [u"0.待机",u"1.启动", u"2.", u"3.", u"4.", u"5.",u"6.通知", u"7.结束", u"8.其他"] self.tableWidget_devinfo.item(0, 0).setText(f"{tick*5/1000:.3f}") self.tableWidget_devinfo.item(0, 1).setText(f"{target/10.0*6.25:.3f}") self.tableWidget_devinfo.item(0, 2).setText(f"{thresold:.3f}") -- 2.34.1