Bläddra i källkod

适配欧姆龙继电器的冲击问题。

liyi 7 månader sedan
förälder
incheckning
c806144510
1 ändrade filer med 19 tillägg och 8 borttagningar
  1. 19 8
      truing_control/PDU-AC_ADA_NEW_6/hardware/detection/detection.c

+ 19 - 8
truing_control/PDU-AC_ADA_NEW_6/hardware/detection/detection.c

@@ -205,12 +205,17 @@ void EXTI4_15_IRQHandler(void){
 
 	if(RESET != exti_interrupt_flag_get(DERECTION_IO_1_EXIT))
 	{
+		exti_interrupt_flag_clear(DERECTION_IO_1_EXIT);
 		if(board)
 		{
-			board->detection_1_value = 1;
-			board->detection_1_count = 0;
+			//for(int i = 0;i <20;i++);
+			if(gpio_input_bit_get(DERECTION_GPIO_1,DERECTION_IO_1) == 0)
+			{
+				board->detection_1_value = 1;
+				board->detection_1_count = 0;
+			}
 		}
-		exti_interrupt_flag_clear(DERECTION_IO_1_EXIT);
+		
 	}
 
 }
@@ -279,12 +284,17 @@ void EXTI2_3_IRQHandler(void)
 #if SURPPORT_2_PT
 	if(RESET != exti_interrupt_flag_get(DERECTION_IO_2_EXIT))
 	{
+		exti_interrupt_flag_clear(DERECTION_IO_2_EXIT);
 		if(board)
 		{
-			board->detection_2_value = 1;
-			board->detection_2_count = 0;
+			//for(int i = 0;i <20;i++);
+			if(gpio_input_bit_get(DERECTION_GPIO_2,DERECTION_IO_2) == 0)
+			{
+				board->detection_2_value = 1;
+				board->detection_2_count = 0;
+			}
 		}
-		exti_interrupt_flag_clear(DERECTION_IO_2_EXIT);
+		
 	}	
 #endif
 }
@@ -319,7 +329,7 @@ static void detection_opt(void)
 				{
 					if(board->handle_input_pt[0] == 0)
 					{
-						board->handle_input_pt[0] = 1;
+						
 						for(uint8_t k = 0; k < PT_SUB_COUNT;k++)
 						{
 #if SUPPORT_SELF_LOCK
@@ -341,6 +351,7 @@ static void detection_opt(void)
 							da.w_eep_flag = FLAG_N_W_EEP;
 							set_relay_sta_async(&da);
 						}
+						board->handle_input_pt[0] = 1;
 					}
 				}else
 				{
@@ -372,7 +383,6 @@ static void detection_opt(void)
 				{
 					if(board->handle_input_pt[1] == 0)
 					{
-						board->handle_input_pt[1] = 1;
 						for(uint8_t k = PT_SUB_COUNT; k < RelaySlaveChaNum;k++)
 						{
 							async_data da = {0};
@@ -384,6 +394,7 @@ static void detection_opt(void)
 							da.w_eep_flag = FLAG_N_W_EEP;
 							set_relay_sta_async(&da);
 						}
+						board->handle_input_pt[1] = 1;
 					}
 				}else
 				{