Просмотр исходного кода

4路自锁,1路自锁,按键没有按下,网页端可以控制通道开关

liyi 1 год назад
Родитель
Сommit
3512f4b3a3

+ 9 - 2
truing_control/PDU-AC_ADA_NEW_6/hardware/detection/detection.c

@@ -310,6 +310,10 @@ static void detection_opt(void)
 						board->handle_input_pt[0] = 1;
 						board->handle_input_pt[0] = 1;
 						for(uint8_t k = 0; k < PT_SUB_COUNT;k++)
 						for(uint8_t k = 0; k < PT_SUB_COUNT;k++)
 						{
 						{
+#if SUPPORT_SELF_LOCK
+							if(board->val_key[k] == 0)
+									continue;
+#endif
 							async_data da = {0};
 							async_data da = {0};
 							da.channel =k;
 							da.channel =k;
 							da.fire_or_zero = _FIRE;
 							da.fire_or_zero = _FIRE;
@@ -497,8 +501,11 @@ static void self_lock_opt(void)
 		{
 		{
 			if(board->handle_k_status[i] == 0)
 			if(board->handle_k_status[i] == 0)
 			{
 			{
-				da.status = RELAY_OPEN;
-				set_relay_sta_async(&da);		
+				if(board->md_data.r_data.detection & 0x1)
+				{
+					da.status = RELAY_OPEN;
+					set_relay_sta_async(&da);
+				}
 				board->handle_k_status[i] = 1;
 				board->handle_k_status[i] = 1;
 			}				
 			}				
 		}
 		}

+ 31 - 6
truing_control/PDU-AC_ADA_NEW_6/modbus/BARE/port/port.c

@@ -249,13 +249,34 @@ eMBRegHoldingCB( UCHAR * pucRegBuffer, USHORT usAddress, USHORT usNRegs, eMBRegi
 								{
 								{
 									if(WusNRegs == RelaySlaveChaNum && start == 0)
 									if(WusNRegs == RelaySlaveChaNum && start == 0)
 									{
 									{
-										for(uint8_t j = 0; j < PT_SUB_COUNT;j++)
+										if((RelaySlaveChaNum == 1) && ((usRegHoldBuf[WiRegIndex] & (1<<11))==0) && ((usRegHoldBuf[WiRegIndex] & (1<<12))==0))
 										{
 										{
-											da.channel = 	j;
-											da.method = DELAY_CTRL;
-											da.reg = &board->relay_staging_staus[j];
-											da.status = (usRegHoldBuf[WiRegIndex+j] & 0x1);
-											set_relay_sta_async(&da);									
+											for(uint8_t j = 0; j < RelaySlaveChaNum;j++)
+											{
+#if SUPPORT_SELF_LOCK
+												if(board->val_key[j] == 0)
+													continue;
+#endif
+												da.channel = 	j;
+												da.method = PROMPT_CTRL;
+												da.reg = &board->relay_staging_staus[j];
+												da.status = (usRegHoldBuf[WiRegIndex+j] & 0x1);
+												set_relay_sta_async(&da);									
+											}												
+										}else
+										{
+											for(uint8_t j = 0; j < PT_SUB_COUNT;j++)
+											{
+#if SUPPORT_SELF_LOCK
+												if(board->val_key[j] == 0)
+													continue;										
+#endif
+												da.channel = 	j;
+												da.method = DELAY_CTRL;
+												da.reg = &board->relay_staging_staus[j];
+												da.status = (usRegHoldBuf[WiRegIndex+j] & 0x1);
+												set_relay_sta_async(&da);									
+											}	
 										}										
 										}										
 									}else
 									}else
 									{
 									{
@@ -271,6 +292,10 @@ eMBRegHoldingCB( UCHAR * pucRegBuffer, USHORT usAddress, USHORT usNRegs, eMBRegi
 											}
 											}
 											for(uint8_t j = 0; j < count;j++)
 											for(uint8_t j = 0; j < count;j++)
 											{
 											{
+#if SUPPORT_SELF_LOCK
+												if(board->val_key[start+j] == 0)
+													continue;										
+#endif
 												da.channel = 	start + j;
 												da.channel = 	start + j;
 												da.method = PROMPT_CTRL;
 												da.method = PROMPT_CTRL;
 												da.reg = &board->relay_staging_staus[start+j];
 												da.reg = &board->relay_staging_staus[start+j];

+ 3 - 3
truing_control/PDU-AC_ADA_NEW_6/user/board_cfg.h

@@ -15,7 +15,7 @@
 
 
 
 
 
 
-#define OPEN_WATCH_DOG  				0
+#define OPEN_WATCH_DOG  				1
 #define OPEN_NOT_READ_EN				0
 #define OPEN_NOT_READ_EN				0
 
 
 
 
@@ -61,11 +61,11 @@
 #define 	PRJ_DC_8									0
 #define 	PRJ_DC_8									0
 #define   PRJ_6_NEW                 0
 #define   PRJ_6_NEW                 0
 #define   PRJ_3_NEW                 0
 #define   PRJ_3_NEW                 0
-#define 	PRJ_5_NEW									1
+#define 	PRJ_5_NEW									0
 #define 	PRJ_4_SELF_LOCK       	  0
 #define 	PRJ_4_SELF_LOCK       	  0
 #define   PRJ_4_BASE                0
 #define   PRJ_4_BASE                0
 #define   PRJ_1_BASE                0
 #define   PRJ_1_BASE                0
-#define 	PRJ_1_SELF_LOCK       	  0
+#define 	PRJ_1_SELF_LOCK       	  1
 
 
 #if PRJ_8					
 #if PRJ_8					
 	#define   POWER_TYPE                (POWER_AC)
 	#define   POWER_TYPE                (POWER_AC)

+ 2 - 2
truing_control/PDU-AC_ADA_NEW_6/user/main.c

@@ -50,7 +50,7 @@ int main(){
 	led_init();
 	led_init();
 	lock_init();
 	lock_init();
 	detection_init();
 	detection_init();
-	key_init();
+	
 	relay_init();
 	relay_init();
 	haddr_init();
 	haddr_init();
 	eeprom_init();
 	eeprom_init();
@@ -58,7 +58,7 @@ int main(){
 	electricity_init();
 	electricity_init();
 	time_init();
 	time_init();
 	query_init();
 	query_init();
-	
+	key_init();
 	//device
 	//device
 	
 	
 	fwdgt_Init();
 	fwdgt_Init();