//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£¬
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;
#define FLOW_COVERT_VALUE 4.6154 //ѹÁ¦ÓëÆøÁ¿µÄת»»ÏµÊý 1.3bar-6m3/h 6.5bar-30m3/h 30/6.5Ô¼=4.6154
//#define ENABLE_FLOW //Çø·Ö²úÆ·ÊÇ·ñ´øÆøÁ¿´«¸ÐÆ÷£¬
/**********************************************************************************************************/
-static uint8_t machine_step = 0;
-static float compareFac = 0.90;
+static uint8_t machine_step = 8;
+//static float compareFac = 0.90;
+#define compareFac 0.85 // ¸Ä³É85%£¬ 2026/1/13
float temppress = 0 ;
float firstpress = 0;
float ADCGetPress[10] = {0.0};
static uint16_t delay_cnt = 0;
ADCGetPress[0] = GetPress(); //ADC²»¶Ï²É¼¯Ñ¹Á¦
ADCGetFlow[0] = GetFlow();
+ qiya = ADCGetPress[0]*10000;
+
switch(machine_step)
{
+ case 8:
+ //ÆøÑ¹µÍµÈ´ýÆøÑ¹»Ö¸´×´Ì¬
+ if( qiya > 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;
}
//printf("state machine:%d\r\n",machine_step);
}
+
+#endif
break;
case 1:
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;
Ret = 1;
}
- }break;
+ }
+
+ break;
case 2:
if(First[2] == 0) //ÂÝ˨ģʽ
}
}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;
}
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}")