Explorar el Código

从值班屏蔽按键功能

liyi hace 1 año
padre
commit
d7ef3cc632

+ 45 - 23
truing_control/PDU-AC/hardware/detection/detection.c

@@ -130,17 +130,17 @@ void EXTI4_15_IRQHandler(void){
 		{
 			if(gpio_input_bit_get(KEY_TEST_IO,KEY_TEST) != 0)
 			{
-					for(uint8_t k = 0; k < RelaySlaveChaNum;k++)
-					{
-						async_data da = {0};
-						da.channel =k;
-						da.fire_or_zero = _FIRE;
-						da.method = DELAY_CTRL;
-						da.reg = &board->relay_staging_staus[k];
-						da.status = RELAY_CLOSE;
-						da.w_eep_flag = FLAG_W_EEP;
-						set_relay_sta_async(&da);
-					}				
+//					for(uint8_t k = 0; k < RelaySlaveChaNum;k++)
+//					{
+//						async_data da = {0};
+//						da.channel =k;
+//						da.fire_or_zero = _FIRE;
+//						da.method = DELAY_CTRL;
+//						da.reg = &board->relay_staging_staus[k];
+//						da.status = RELAY_CLOSE;
+//						da.w_eep_flag = FLAG_W_EEP;
+//						set_relay_sta_async(&da);
+//					}				
 				
 			}
 			
@@ -169,17 +169,17 @@ void EXTI2_3_IRQHandler(void)
 		{
 			if(gpio_input_bit_get(KEY_RST_IO,KEY_RST) != 0)
 			{
-					for(uint8_t k = 0; k < RelaySlaveChaNum;k++)
-					{
-						async_data da = {0};
-						da.channel =k;
-						da.fire_or_zero = _FIRE;
-						da.method = DELAY_CTRL;
-						da.reg = &board->relay_staging_staus[k];
-						da.status = RELAY_OPEN;
-						da.w_eep_flag = FLAG_W_EEP;
-						set_relay_sta_async(&da);
-					}						
+//					for(uint8_t k = 0; k < RelaySlaveChaNum;k++)
+//					{
+//						async_data da = {0};
+//						da.channel =k;
+//						da.fire_or_zero = _FIRE;
+//						da.method = DELAY_CTRL;
+//						da.reg = &board->relay_staging_staus[k];
+//						da.status = RELAY_OPEN;
+//						da.w_eep_flag = FLAG_W_EEP;
+//						set_relay_sta_async(&da);
+//					}						
 			}
 		}
 	}
@@ -517,6 +517,17 @@ static void detection_opt(void)
 					board->handle_input_pt[0] = 1;
 					for(uint8_t k = 0; k < RelaySlaveChaNum;k++)
 					{
+						if(board->md_data.rw_data.rw_d.chn_ctrl[k] == 0)
+						{
+							
+						}else if(board->md_data.rw_data.rw_d.chn_ctrl[k] == 1)
+						{
+							if(board->md_data.rw_data.rw_d.relay_status[k] == RELAY_OPEN)
+								continue;
+						}else if(board->md_data.rw_data.rw_d.chn_ctrl[k] == 2)
+						{
+							continue;
+						}
 							async_data da = {0};
 							da.channel =k;
 							da.fire_or_zero = _FIRE;
@@ -525,7 +536,6 @@ static void detection_opt(void)
 							da.status = board->handle_status[k];
 							da.w_eep_flag = FLAG_N_W_EEP;
 							set_relay_sta_async(&da);
-						//	set_relay_status_async(&board->relay_staging_staus[k],DELAY_CTRL,board->handle_status[k]);
 					}
 #if (ZERO_CONTRL  == ZERO_LINE_CTRL_YES)		
 					for(uint8_t k = 0; k < ZERO_CTRL_NUM;k++)
@@ -546,8 +556,20 @@ static void detection_opt(void)
 				if(board->handle_input_pt[0] == 1)
 				{
 					board->handle_input_pt[0] = 0;
+
 					for(uint8_t k = 0; k < RelaySlaveChaNum;k++)
 					{
+						if(board->md_data.rw_data.rw_d.chn_ctrl[k] == 0)
+						{
+							
+						}else if(board->md_data.rw_data.rw_d.chn_ctrl[k] == 1)
+						{
+								continue;
+						}else if(board->md_data.rw_data.rw_d.chn_ctrl[k] == 2)
+						{
+							if(board->md_data.rw_data.rw_d.relay_status[k] == RELAY_CLOSE)
+								continue;
+						}
 							board->handle_status[k] = board->md_data.rw_data.rw_d.relay_status[k];
 							async_data da = {0};
 							da.channel =k;

+ 4 - 2
truing_control/PDU-AC/modbus/BARE/port/port.c

@@ -304,7 +304,6 @@ eMBRegHoldingCB( UCHAR * pucRegBuffer, USHORT usAddress, USHORT usNRegs, eMBRegi
 											set_relay_sta_async(&da);											
 										}
 										board->relay_combin_staging_status[j+T_cnt] = usRegHoldBuf[WiRegIndex+j];
-									//	board->md_data.rw_data.rw_d.combin_relay_status[j+T_cnt] = board->relay_combin_staging_status[j+T_cnt];
 									}
 								}
 #elif ((POWER_TYPE == POWER_AC_3_2))
@@ -313,6 +312,8 @@ eMBRegHoldingCB( UCHAR * pucRegBuffer, USHORT usAddress, USHORT usNRegs, eMBRegi
 								if(board->md_data.rw_data.rw_d.chn_ctrl[j  ] == 0 && 
 											board->md_data.rw_data.rw_d.chn_ctrl[j + PT_SUB_COUNT] == 0)
 								{
+									if(board->md_data.r_data.r_d.detection == 0x3)
+									{
 											async_data da = {0};
 											da.channel = j;
 											da.fire_or_zero = _FIRE;
@@ -328,7 +329,8 @@ eMBRegHoldingCB( UCHAR * pucRegBuffer, USHORT usAddress, USHORT usNRegs, eMBRegi
 											da.reg = &board->relay_staging_staus[j+PT_SUB_COUNT];
 											da.status = usRegHoldBuf[WiRegIndex+j];
 											da.w_eep_flag = FLAG_W_EEP;
-											set_relay_sta_async(&da);												
+											set_relay_sta_async(&da);	
+										}
 								}
 							}
 #endif