From 572e45cb2bea505fee117cd92fe264306887667b Mon Sep 17 00:00:00 2001 From: kyz Date: Wed, 21 Jan 2026 18:06:15 +0800 Subject: [PATCH] =?utf8?q?=E6=B0=94=E5=8A=A8=E5=86=B2=E5=87=BB=E6=89=B3?= =?utf8?q?=E6=89=8B=EF=BC=8C=E4=BD=BF=E7=94=A8=E5=9B=BA=E5=AE=9A=E6=B0=94?= =?utf8?q?=E5=8E=8B=E5=8C=BA=E9=97=B4=E5=8F=82=E6=95=B0=E8=B0=83=E8=AF=95?= =?utf8?q?=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- QiDong/APP/inc/model.h | 5 +- QiDong/APP/src/model.c | 341 ++++++++--------------------------- QiDong/APP/src/screen_app.c | 3 +- QiDong/BSP/src/bsp_host.c | 317 +------------------------------- QiDong/System/WrenchManage.c | 40 ++-- 5 files changed, 100 insertions(+), 606 deletions(-) diff --git a/QiDong/APP/inc/model.h b/QiDong/APP/inc/model.h index b18aebe..4aef788 100644 --- a/QiDong/APP/inc/model.h +++ b/QiDong/APP/inc/model.h @@ -8,6 +8,10 @@ #include "screen_driver.h" //#include "dflashm.h" + +//ÊÇ·ñ¿ªÆôŤ¾Ø·¶Î§µ÷ÊÔ ¿ªÆôµ÷ÊÔʹÓù̶¨µÄ²ÎÊý±íת»»Å¤¾Øµ½ÆøÑ¹£¬ºÍ°´²ÎÊý±íÖвÎÊýÉ趨Æô¶¯ãÐÖµ +#define TOR_RANGE_DEBUG 1 + /**********************************************************************************************************/ ///extern uint16_t productKind ; extern uint8_t gearKind; @@ -73,7 +77,6 @@ void AdjustSensorMode(void); float tor_to_pressure(uint32_t tor); extern uint32_t getOutDutyData(float press); -extern float getPressValue(uint32_t factor,uint32_t torquevalue); float setTargetTorqueValVarFlag1(uint8_t TorqueUint,uint32_t *targetTorVal) ; extern float setTargetTorqueValVarFlag(uint8_t TorqueUint,uint32_t *targetTorVal); extern uint32_t setSensorPresetTorValVarFlag(uint8_t Unit,uint32_t* presetvalue); diff --git a/QiDong/APP/src/model.c b/QiDong/APP/src/model.c index e30c930..0db1368 100644 --- a/QiDong/APP/src/model.c +++ b/QiDong/APP/src/model.c @@ -16,6 +16,7 @@ /*********************************************************************************************************/ + ///uint16_t productKind = 0; uint8_t gearKind = 0 ; @@ -23,215 +24,42 @@ TorquePattern TorquePatternVar[50] = {0}; GearPattern GearPatternVar[70] = {0}; -#if 0 - -/* -********************************************************************************************************* -* º¯ Êý Ãû: AdjustTorqueMode -* ¹¦ÄÜ˵Ã÷: -* ÐÎ ²Î: ¿Õ -* ·µ »Ø Öµ: ¿Õ -********************************************************************************************************* -*/ -void AdjustTorqueMode(void) -{ - SetScreen(1); - - if(ModifyVarStructVar.TorqueUint == 0) - { - SetTextInt32(1,3, ModifyVarStructVar.TartorVal_TorMode,0,0); - SetTextValue(1,4,(uint8_t*)"N.m"); - } - else - { - SetTextValue(1,4,(uint8_t*)"ft.lbs"); - SetTextInt32(1,3, ROUND_TO_UINT32(ModifyVarStructVar.TartorVal_TorMode/1.3549),0,0); - } - - switch(ModifyVarStructVar.pressUint) - { - case 0: SetTextValue(1,5,(uint8_t*)"Bar");break; - case 1: SetTextValue(1,5,(uint8_t*)"Mpa");break; - case 2: SetTextValue(1,5,(uint8_t*)"Psi");break; - } - - SetTextValue(1,1,(uint8_t*)TorquePatternVar[ModifyVarStructVar.fabricName-1].ProductType); //ÏÔʾ²úÆ·Ãû³Æ - ModifyVarStructVar.MaxtorVal_TorMode = TorquePatternVar[ModifyVarStructVar.fabricName-1].Factor*MAXMPA ; - - if(ModifyVarStructVar.TorqueUint == 0) - { - SetTextValue(1,2,(uint8_t*)"N.m"); - SetTextInt32(1,6, ModifyVarStructVar.MaxtorVal_TorMode,0,0); - } - else - { - SetTextValue(1,2,(uint8_t*)"ft.lbs"); - SetTextInt32(1,6, ROUND_TO_UINT32(ModifyVarStructVar.MaxtorVal_TorMode/1.3549),0,0); - } -} - - - - /* -********************************************************************************************************* -* º¯ Êý Ãû: AdjustBoltMode -* ¹¦ÄÜ˵Ã÷: -* ÐÎ ²Î: ¿Õ -* ·µ »Ø Öµ: ¿Õ -********************************************************************************************************* -*/ -void AdjustBoltMode(void) -{ - SetScreen(2); - - if(ModifyVarStructVar.ChartType == 0) - { - SetTextValue(2,2,(uint8_t*) ModifyVarStructVar.BoltDiameterArr); - SetTextValue(2,3,(uint8_t*) ModifyVarStructVar.BoltGardeArr); - } - if(ModifyVarStructVar.ChartType == 1) - { - SetTextValue(2,2,(uint8_t*) ModifyVarStructVar.BoltDiameterArr_M); - SetTextValue(2,3,(uint8_t*) ModifyVarStructVar.BoltGardeArr_M); - } - - if(ModifyVarStructVar.TorqueUint == 0) - { - SetTextInt32(2,5, ModifyVarStructVar.TartorVal_BoltMode,0,0); - SetTextValue(2,4,(uint8_t*)"N.m"); - } - if(ModifyVarStructVar.TorqueUint == 1) - { - SetTextInt32(2,5, ROUND_TO_UINT32(ModifyVarStructVar.TartorVal_BoltMode/1.3549),0,0); - SetTextValue(2,4,(uint8_t*)"ft.lbs"); - } - - SetTextValue(2,1,(uint8_t*)TorquePatternVar[ModifyVarStructVar.fabricName-1].ProductType); //ÏÔʾ²úÆ·Ãû³Æ - -} - -/* -********************************************************************************************************* -* º¯ Êý Ãû: AdjustGearMode -* ¹¦ÄÜ˵Ã÷: -* ÐÎ ²Î: ¿Õ -* ·µ »Ø Öµ: ¿Õ -********************************************************************************************************* -*/ -void AdjustGearMode(void) -{ - SetScreen(4); - - SetTextValue(4,1,(uint8_t*)TorquePatternVar[ModifyVarStructVar.fabricName-1].ProductType); //ÏÔʾ²úÆ·Ãû³Æ - switch(ModifyVarStructVar.pressUint) - { - case 0: SetTextValue(4,4,(uint8_t*)"Bar");break; - case 1: SetTextValue(4,4,(uint8_t*)"Mpa");break; - case 2: SetTextValue(4,4,(uint8_t*)"Psi");break; - } - - SetTextInt32(4,2, GearPatternVar[ModifyVarStructVar.gear-1].gear,0,0); - - if(ModifyVarStructVar.TorqueUint == 0) - { - SetTextInt32(4,5, ModifyVarStructVar.geartor,0,0); - SetTextValue(4,3,(uint8_t*)"N.m"); - } - else - { - SetTextValue(4,3,(uint8_t*)"ft.lbs"); - SetTextInt32(4,5, ROUND_TO_UINT32(ModifyVarStructVar.geartor/1.3549),0,0); - } -} - - -/* -********************************************************************************************************* -* º¯ Êý Ãû: AdjustAngleMode -* ¹¦ÄÜ˵Ã÷: -* ÐÎ ²Î: ¿Õ -* ·µ »Ø Öµ: ¿Õ -********************************************************************************************************* -*/ -void AdjustAngleMode(void) -{ - SetScreen(3); - SetTextInt32(3,4,ModifyVarStructVar.Angle,0,0); // - - switch(ModifyVarStructVar.pressUint) - { - case 0: SetTextValue(3,5,(uint8_t*)"Bar");break; - case 1: SetTextValue(3,5,(uint8_t*)"Mpa");break; - case 2: SetTextValue(3,5,(uint8_t*)"Psi");break; - } - - SetTextValue(3,1,(uint8_t*)TorquePatternVar[ModifyVarStructVar.fabricName-1].ProductType); //ÏÔʾ²úÆ·Ãû³Æ - - ModifyVarStructVar.MaxtorVal_TorMode = TorquePatternVar[ModifyVarStructVar.fabricName-1].Factor*MAXMPA ; - - if(ModifyVarStructVar.TorqueUint==0) - { - SetTextInt32(3,2,ModifyVarStructVar.MaxtorVal_TorMode,0,0); - SetTextValue(3,3,(uint8_t*)"N.m"); - } - else - { - SetTextInt32(3,2,ROUND_TO_UINT32(ModifyVarStructVar.MaxtorVal_TorMode/1.3549),0,0); - SetTextValue(3,3,(uint8_t*)"ft.lbs"); - } -} - +#if TOR_RANGE_DEBUG /* -********************************************************************************************************* -* º¯ Êý Ãû: AdjustSensorMode -* ¹¦ÄÜ˵Ã÷: -* ÐÎ ²Î: ¿Õ -* ·µ »Ø Öµ: ¿Õ -********************************************************************************************************* +2026/1/21 ¿Í»§Ìṩ²âÊÔ²ÎÊý +Æø¶¯³å»÷°âÊÖ +Ť¾Ø Éè¶¨ÆøÑ¹ ¿ÕÔØ ¶ÂÆøÆøÑ¹ ¶ÂÆø/É趨=±ÈÀý +45 1.25 1.1 1.16 0.93 +72 2 1.76 1.89 0.95 +90 2.5 2.2 2.35 0.94 +109 3 2.7 2.8 0.93 +127 3.5 3.1 3.34 0.95 +145 4 3.2 3.8 0.95 +163 4.5 3.5 4.27 0.95 +181 5 3.8 4.5 0.90 +200 5.5 3.8 4.5 0.82 */ -void AdjustSensorMode(void) -{ - SetScreen(5); - - switch(ModifyVarStructVar.pressUint) - { - case 0: SetTextValue(5,6,(uint8_t*)"Bar");break; - case 1: SetTextValue(5,6,(uint8_t*)"Mpa");break; - case 2: SetTextValue(5,6,(uint8_t*)"Psi");break; - } - - if(ModifyVarStructVar.TorqueUint==0) - { - SetTextValue(5,3,(uint8_t*)"N.m"); - SetTextInt32(5,2,ModifyVarStructVar.presettor_sensor,0,0); - } - else - { - SetTextValue(5,3,(uint8_t*)"ft.lbs"); - SetTextInt32(5,2,ROUND_TO_UINT32(ModifyVarStructVar.presettor_sensor/1.3549),0,0); - } - - if(ModifyVarStructVar.fabricName==0) - { - ModifyVarStructVar.fabricName = 1; - } - SetTextValue(5,1,(uint8_t*)TorquePatternVar[ModifyVarStructVar.fabricName-1].ProductType); //ÏÔʾ²úÆ·Ãû³Æ - ModifyVarStructVar.tartor_sensor = TorquePatternVar[ModifyVarStructVar.fabricName-1].SensorTor; - - if(ModifyVarStructVar.TorqueUint==0) - { - SetTextInt32(5,4,ModifyVarStructVar.tartor_sensor,0,0); - SetTextValue(5,5,(uint8_t*)"N.m"); - } - - if(ModifyVarStructVar.TorqueUint==1) - { - SetTextInt32(5,4,ROUND_TO_UINT32(ModifyVarStructVar.tartor_sensor/1.3549),0,0); - SetTextValue(5,5,(uint8_t*)"ft.lbs"); - } -} +typedef struct { + uint16_t torque; + float press; + float threshold; +}tor_para_t; + +tor_para_t debg_tor_para[9] = { + {45,1.25,0.93}, + {72,2.0,0.95}, + {90,2.5,0.94}, + {109,3.0,0.93}, + {127,3.5,0.95}, + {145,4.0,0.95}, + {163,4.5,0.95}, + {181,5.0,0.90}, + {200,5.5,0.82} +}; + +#define TORQUE_PARA_MUN (sizeof(debg_tor_para)/sizeof(tor_para_t)) -#endif +#endif /* @@ -299,76 +127,51 @@ uint32_t setSensorPresetTorValVarFlag1(uint8_t Unit,uint32_t* presetvalue) return press; } -/* -************************************************************************** -* º¯ Êý Ãû: getOutDutyData -* ¹¦ÄÜ˵Ã÷: DACÊä³öѹÁ¦¶ÔÓ¦µÄÕ¼¿Õ±È -* ÐÎ ²Î: press£ºÑ¹Á¦Öµ,bar -* ·µ »Ø Öµ: дÈëDACÊý¾Ý¼Ä´æÆ÷µÄÊý¾ÝÖµ -* Press: 10bar = 1Mpa = 145 Psi 1 Bar = 14.5 Psi 1 bar¶ÔÓ¦1V -* V: 0¡ª¡ª10V -* Duty: 0¡ª¡ª100% -* -************************************************************************** -*/ +#if TOR_RANGE_DEBUG -/* -10KHZ = 10000 -10V 10000 -0.01 100 - - -(uint16_t)press -*/ - -#define Period_Cnt 1000 -#define xishi 0.01 -//10 Period_Cnt xishi Y -uint32_t getOutDutyData(float press) +float pressure_threshold( float pressure ) { -#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£¬ - pwmÖÜÆÚ1000£¬±È½ÏÆ÷ccr2 ÉèÖõ½1000¾ÍÊÇ10Bar£¬ ÕâÀïÏÞÖÆ×î´óÉèÖõ½625¶ÔÓ¦6.25Bar - Èç¹ûÄ¿±êŤ¾ØÊÇ6.25Bar£¬ÄÇôÊäÈëpressÊÇ6.25/6.25*100000£¬ÕâÀïccr2±È½ÏÆ÷ÉèÖÃ625¿ØÖÆÑ¹Á¦·§Êä³ö6.25Bar - Èç¹ûÄ¿±êŤ¾ØÊÇ3.125Bar£¬ÄÇôÊäÈëpressÊÇ3.125/6.25*100000£¬ÕâÀïccr2±È½ÏÆ÷ÉèÖÃ313¿ØÖÆÑ¹Á¦·§Êä³ö3.13Bar - - getPressValue()º¯Êý,·µ»ØµÄÊǸö±ÈÀýÖµ£¬²»¹»Ö±¹Û£¬Ó¦µ±»»Ëã³ÉѹÁ¦Öµ£¬ÕâÑùºóÃæÒ×ÓÚʹÓôúÂëÒ²ÈÝÒ×Àí½â - 2025/12/29 - - */ -} - - - + //¸ù¾ÝÊäÈëµÄѹÁ¦Öµ£¬²éÕÒ¶ÔӦѹÁ¦ãÐÖµ°Ù·Ö±È + int i; + float percent; -/* -************************************************************************** -* º¯ Êý Ãû: getPressValue -* ¹¦ÄÜ˵Ã÷: ·µ»ØÑ¹Á¦Öµ¡£À©´ó10Íò±¶,°´ÕÕbarµÄ±ê×¼ -* ÐÎ ²Î: factor²úƷϵÊý - torquevalue:É趨µÄŤ¾ØÖµ -* ·µ »Ø Öµ: É趨µÄŤ¾ØÖµ¶ÔÓ¢µÄѹÁ¦,bar -************************************************************************** -*/ -float getPressValue(uint32_t factor,uint32_t torquevalue) -{ - return (torquevalue*100000/factor); -// return (torquevalue * 100000); + percent = debg_tor_para[TORQUE_PARA_MUN-1].threshold; + for( i = 1; i < TORQUE_PARA_MUN; i++) + { + if(pressure < debg_tor_para[i].press ) + { + percent = debg_tor_para[i-1].threshold; + break; + } + } + return pressure * percent; } +#endif //TOR_RANGE_DEBUG //Ť¾Ø»»Ëã³ÉѹÁ¦£¬°´²ÎÊý±í²éÕÒ×îСŤ¾Ø/ѹÁ¦ºÍ×î´óŤ¾ØÑ¹Á¦£¬½«ÊäÈë²ÎÊýŤ¾Ø»»Ëã³ÉѹÁ¦·µ»Ø float tor_to_pressure(uint32_t tor) { +#if TOR_RANGE_DEBUG + //Æô¶¯³å»÷µ÷ÊÔ¹¦ÄÜ + //¸ù¾ÝÊäÈëµÄŤ¾ØÖµ£¬²éÕÒ¶ÔӦѹÁ¦Öµ + int i; + float pressure = 0; + + if( tor < debg_tor_para[0].torque ) + return debg_tor_para[0].press; + else if( tor >= debg_tor_para[TORQUE_PARA_MUN-1].torque ) + return debg_tor_para[TORQUE_PARA_MUN-1].press; + + for( i = 1; i < TORQUE_PARA_MUN; i++) + { + if(tor < debg_tor_para[i].torque ) + { + pressure = debg_tor_para[i-1].press + (debg_tor_para[i].press - debg_tor_para[i-1].press) * (tor - debg_tor_para[i-1].torque) / (debg_tor_para[i].torque - debg_tor_para[i-1].torque); + break; + } + } + return pressure; +#else //ÊäÈëtor²ÎÊýÊÇN.m£¬·µ»ØÖµµ¥Î»ÊÇBar uint32_t tor_min, tor_max; @@ -401,6 +204,8 @@ float tor_to_pressure(uint32_t tor) return 0; return press_min + (press_max - press_min) * (tor - tor_min) / (tor_max - tor_min); + +#endif } /* ************************************************************************** diff --git a/QiDong/APP/src/screen_app.c b/QiDong/APP/src/screen_app.c index 217c853..47ce7f2 100644 --- a/QiDong/APP/src/screen_app.c +++ b/QiDong/APP/src/screen_app.c @@ -1889,8 +1889,7 @@ void MemuFour(void) if(ResetPress.SetPress_Gear==0) { - //ResetPress.SetPress_Gear = ModifyVarStructVar.gearpress*10; - ResetPress.SetPress_Gear = getPressValue(SpannerType[ModifyVarStructVar.fabricName-1].TorqueMaxDate,ModifyVarStructVar.geartor); + ResetPress.SetPress_Gear = tor_to_pressure(ModifyVarStructVar.geartor); PressMem = 1; if(SaveFlag[ScreenMem] == 0) { diff --git a/QiDong/BSP/src/bsp_host.c b/QiDong/BSP/src/bsp_host.c index 9cf758f..479a2e1 100644 --- a/QiDong/BSP/src/bsp_host.c +++ b/QiDong/BSP/src/bsp_host.c @@ -1729,13 +1729,9 @@ int handle_host_cmd( pkt_t *pkt ) */ void Host_SetCmd(void) { - unsigned char i = 0,j = 0; - unsigned int crc = 0; - unsigned char crch = 0,crcl = 0; - u16 len = 0,cnt = 0; + u16 len = 0; u8 buf[2048] = {0}; - u32 Cmd_adress = 0; - // printf("hello \r\n"); + if(flagFrame) //Ö¡½ÓÊÕÍê³É±êÖ¾£¬¼´½ÓÊÕµ½Ò»Ö¡ÐÂÊý¾Ý { flagFrame=0; //Ö¡½ÓÊÕÍê³É±êÖ¾ÇåÁã @@ -1759,315 +1755,6 @@ void Host_SetCmd(void) } return; } -#if 0 - if((buf[0]==0x5A)&&(buf[1]==0xA5)) //ÅжϵØÖ·ÊDz»ÊÇÖ¡Í· - { - crc=GetCRC16(buf,len-2); //¼ÆËãCRCУÑéÖµ£¬³öÈ¥CRCУÑéÖµ - crch=crc>>8; //crc¸ßλ - crcl=crc&0xFF; //crcµÍλ - - if((buf[len-2]==crch)&&(buf[len-1]==crcl)) //ÅжÏCRCУÑéÊÇ·ñÕýÈ· - { - if(buf[4]!=0x0c) - { - USART2Write(buf,len); //·¢ËÍÏìÓ¦Ö¡ - OSTimeDly(1); - } - - switch (buf[4]) //°´¹¦ÄÜÂëÖ´ÐвÙ×÷ - { - case 0x01: //ÉèÖÃʱ¼ä - RTC_EnterConfigMode(); - calendar.w_year = PTR2U16(&buf[7]); - calendar.w_month = buf[9]; - calendar.w_date = buf[10]; - calendar.hour = buf[11]; - calendar.min = buf[12]; - calendar.sec = buf[13] + 1; - RTC_Set(calendar.w_year,calendar.w_month,calendar.w_date,calendar.hour,calendar.min,calendar.sec); - RTC_ExitConfigMode(); //Í˳öÅäÖÃģʽ - break; - case 0x02: - len -= 2; - break; - case 0x03: //ÉèÖóö³§±àºÅ - memset(TmsKeyData.FactoryNumber,0,sizeof(TmsKeyData.FactoryNumber)); - TmsKeyData.FactoryNumberLen = PTR2U16(&buf[5]); //»ñÈ¡É豸Ãû³ÆÊý¾Ý³¤¶È - for(i = 0;i= ROTATE_START_NUM_5MS) @@ -197,9 +204,9 @@ static void Machine_DoPress(void) //״̬ ucCount200ms = 0; //ÇåÁã //Èç¹ûADC²É¼¯Ñ¹Á¦´óµÈÓÚÓû§É趨ѹÁ¦µÄ0.9 ²¢ÇҲɼ¯µÄÁ÷Á¿´óÓÚÉèÖõÄÁ÷Á¿µÄX% #ifdef ENABLE_FLOW - if(((ADCGetPress[0])>= temppress*compareFac) && ((ADCGetFlow[0]*10000) >=UserSetFlow) ) + if(((ADCGetPress[0])>= pressure_threshold(temppress)) && ((ADCGetFlow[0]*10000) >=UserSetFlow) ) #else - if(((ADCGetPress[0])>= temppress*compareFac)) + if(((ADCGetPress[0])>= pressure_threshold(temppress))) #endif { //ÒÔϼÆÊýROTATE_STOP_NUM_5MS ËÆºõ²»Õý³££¬ÒòÎªÇ°Ãæ»¹Óиö¼ÆÊýÆ÷MS_COUNT_200 @@ -210,7 +217,7 @@ static void Machine_DoPress(void) //״̬ //Flash_RecordData(); printf("upUsingStructVar.UsingTimeupUsingStructVar.UsingTime\r\n"); SysMemoryParaVar.tigresult = 1; //±íʾš½ôÁË - SysMemoryParaVar.WorkPress = temppress *compareFac *100; + SysMemoryParaVar.WorkPress = pressure_threshold(temppress) *100; if(SaveFlag[UsingTimesMem] == 0) { @@ -225,7 +232,7 @@ static void Machine_DoPress(void) //״̬ else { SysMemoryParaVar.tigresult = 0; - SysMemoryParaVar.WorkPress = ADCGetPress[0] *compareFac *100; //δš½ô£¬È¡µ±Ç°Ñ¹Á¦ÖµÓÃÓÚ´æ´¢¡£ + SysMemoryParaVar.WorkPress = ADCGetPress[0] *100; //δš½ô£¬È¡µ±Ç°Ñ¹Á¦ÖµÓÃÓÚ´æ´¢¡£ // LED_SetLedStatus(LED_ID_LOWER_FLOW,1); // Beep_SetbeepStatus(BEEP_ID_LOWER_FLOW,1);//¼ÓÉϵÍѹָʾ } @@ -236,7 +243,7 @@ static void Machine_DoPress(void) //״̬ wrench_device.rotate_work_timeout_count = 0; SysMemoryParaVar.tigresult = 0;//³¬¹ý10SûÓдﵽĿ±ê ¾Í²»ºÏ¸ñ printf("disqualification!!!\r\n"); - if(ADCGetPress[0]< temppress*compareFac) + if(ADCGetPress[0]< pressure_threshold(temppress)) { LED_SetLedStatus(LED_ID_LOWER_FLOW,1); Beep_SetbeepStatus(BEEP_ID_LOWER_FLOW,1);//¼ÓÉϵÍѹָʾ @@ -322,7 +329,6 @@ static void Machine_DoPress(void) //״̬ */ static uint8_t WrenchMode_Select(uint8_t mode) { - uint8_t i = 0; static uint8_t First[6] = {0}; static uint8_t StartCaiji[6] = {0}; static uint8_t Ret = 0; @@ -358,7 +364,7 @@ static uint8_t WrenchMode_Select(uint8_t mode) Ret = 0; StartCaiji[1] = 1; niujupress = 0; - Sys_setpress(1); + Sys_setpress( mode ); } if(StartCaiji[1] == 1) @@ -396,7 +402,7 @@ static uint8_t WrenchMode_Select(uint8_t mode) Ret = 0; StartCaiji[2] = 1; niujupress = 0; - Sys_setpress(2); + Sys_setpress( mode ); } if(StartCaiji[2] == 1) @@ -431,7 +437,7 @@ static uint8_t WrenchMode_Select(uint8_t mode) Ret = 0; StartCaiji[3] = 1; niujupress = 0; - Sys_setpress(3); + Sys_setpress( mode ); } if(StartCaiji[3] == 1) @@ -466,10 +472,7 @@ static uint8_t WrenchMode_Select(uint8_t mode) Ret = 0; StartCaiji[4] = 1; niujupress = 0; - for(i = 0; i< 10; i++) - { - TIM_SetCompare2(TIM4, getOutDutyData(ResetPress.SetPress_Angle)); - } + Sys_setpress( mode ); } if(StartCaiji[4] == 1) @@ -494,17 +497,14 @@ static uint8_t WrenchMode_Select(uint8_t mode) niujupress = 1; First[5] = 1; First[4] = 0; - for(i = 0; i< 10; i++) - { - TIM_SetCompare2(TIM4, getOutDutyData(ResetPress.SetPress_Sensor)); - } + Sys_setpress(mode); } if(niujupress ==1) //Óû§É趨ʱŤ¾Ø·¢Éú±ä»¯ { Ret = 0; StartCaiji[5] = 1; niujupress = 0; - Sys_setpress(5); + Sys_setpress( mode ); } if(StartCaiji[5] == 1) @@ -572,7 +572,7 @@ void WrenchManage_MainTask(void) //״̬ #if HOST_DEBUG { extern int host_debug_send_info( uint8_t step, float target_pressure, float check_pressure, float current_pressure, uint32_t valve_output); - host_debug_send_info( machine_step, temppress, temppress*compareFac, ADCGetPress[0], TIM_GetCapture2(TIM4)); + host_debug_send_info( machine_step, temppress, pressure_threshold(temppress), ADCGetPress[0], TIM_GetCapture2(TIM4)); } #endif } -- 2.34.1