Quellcode durchsuchen

F427适配3相进单相出,3相进3相出,单相

liyi vor 9 Monaten
Ursprung
Commit
7242cc24ac

+ 4 - 4
f427/applications/cascade.c

@@ -738,10 +738,10 @@ void cascade_scan_thread(void *arg)
 				slave_info.chache->north.data.ac_3.dev_cnt = (p_data->prod.type << 8 | channels);
 				for(int i = A_P; i <= C_P;i++)
 				{
-					slave_info.chache->north.data.ac_3.ac_3_all_pw[i].consumer = all.ttl.total[i].consump *10;
-					slave_info.chache->north.data.ac_3.ac_3_all_pw[i].current  = all.ttl.total[i].current *10;
-					slave_info.chache->north.data.ac_3.ac_3_all_pw[i].power    = all.ttl.total[i].power *10;
-					slave_info.chache->north.data.ac_3.ac_3_all_pw[i].voltage  = all.ttl.total[i].voltage *10;
+					slave_info.chache->north.data.ac_3.ac_3_all_pw[i].consumer = all.ttl.total[i].consump *1000;
+					slave_info.chache->north.data.ac_3.ac_3_all_pw[i].current  = all.ttl.total[i].current *1000;
+					slave_info.chache->north.data.ac_3.ac_3_all_pw[i].power    = all.ttl.total[i].power *1000;
+					slave_info.chache->north.data.ac_3.ac_3_all_pw[i].voltage  = all.ttl.total[i].voltage *1000;
 				}
 				int cnt = all.chs > POWER_SLAVE_CH_MAX ? POWER_SLAVE_CH_MAX : channels;
 				for(int i = 0; i < cnt;i++)

+ 3 - 2
f427/applications/cfg.h

@@ -49,8 +49,9 @@
     
     #define CHANNEL_DELAY                       8
 
-    //#define PROD_TYPE                           PDU_AC_I3O3
-    #define PROD_TYPE                           PDU_AC_I1O1
+    #define PROD_TYPE                           PDU_AC_I3O3
+    //#define PROD_TYPE                           PDU_AC_I1O1
+		//#define PROD_TYPE                             PDU_AC_I3O1
     //#define PROD_TYPE 													 PDU_DC_I1O1
     #define USE_UI
     #define ROTATE                             90

+ 1 - 1
f427/applications/dflt.c

@@ -81,7 +81,7 @@ const paras_data_t DFLT_PARAS={
 					.trapmode = 1,
 					.nms_ip = "127.0.0.1",
 				},
-				.phase_seq="11111111222222223333333311111111",
+				.phase_seq="33333333222222223333333311111111",
 				.phase_seq_2={
 					.phase_left="11111111222222223333333311111111",
 					.phase_right="22222222333333331111111122222222",				

+ 25 - 0
f427/applications/main.c

@@ -17,6 +17,7 @@
 #include "net.h"
 #include "wanning.h"
 #include "sensor.h"
+#include "gpio.h"
 
 //https://embedded-rd.blog.csdn.net/article/details/109643188
 
@@ -113,14 +114,38 @@ static int user_init(void)
     return 0;
 }
 
+#define LEDR_GPIO    GET_PIN(D, 1)
+
+uint8_t flah_status = 1;
+
+
+void flash_clear()
+{
+	gpio_set(LEDR_GPIO,0);
+}
+
 
 
 int main(void)
 {
     sys_init();
     user_init();
+		int flag = 0;
+
     while (1) {
 			//sensor_query();
 			sleep(1);
+			if(flah_status)
+			{
+				if(flag)
+				{
+					gpio_set(LEDR_GPIO,1);
+					flag=0;
+				}else
+				{
+					gpio_set(LEDR_GPIO,0);
+					flag = 1;
+				}
+			}
     }
 }

+ 4 - 3
f427/applications/net.c

@@ -392,20 +392,21 @@ int net_ipaddr_set(network_data_t *data)
 	{
 		if(data->mode == 1)
 		{
-			ip_save(data);
 			struct netdev *netdev = RT_NULL;
 			//netifapi_dhcp_stop(handle_net.netif);
 			netdev = netdev_get_by_name("e0");
 			if (netdev == RT_NULL) {
 					rt_kprintf("bad network interface device name(e0).\n");
 			}
-
+			
+			para->netwk.mode = data->mode;
+			ip_save(data);
 			netdev_dhcp_enabled(netdev, RT_FALSE);
 			
 			sleep(1);
 			ip_set_static();
 			LOG_D("mode dhcp 2 static\n");
-			ip_save(data);
+			
 		}else
 		{
 //			netifapi_dhcp_stop(handle_net.netif);

+ 347 - 57
f427/applications/power.c

@@ -292,7 +292,7 @@ static int get_key(power_handle_t *h, uint8_t addr, board_key_t *key)
     int i,r;
     uint16_t tmp[2];
     
-    if(h->prod->type==PDU_AC_I1O1 || h->prod->type==PDU_AC_I3O1_H) {
+    if(h->prod->type==PDU_AC_I1O1 || h->prod->type==PDU_AC_I3O1_H || h->prod->type==PDU_AC_I3O1) {
         r = read_reg(h, addr, POWER_AC_GET_INFO, tmp, 1);
         if(r==0) {
             key->type = (tmp[0]>>8)&0xFF;
@@ -510,8 +510,97 @@ static int total_proc(power_handle_t *h)
     lock_on(h->lck);
     if(h->prod->type==PDU_AC_I3O3) times = 3;
 		
-
-
+		// calculate 
+		
+		 if(h->prod->type==PDU_AC_I3O1 || h->prod->type==PDU_AC_I3O1_H)
+		 {
+			 float chn_total_p = 0.0;
+			 for(int i = 1; i < h->chs;i++)
+			 {
+				 int k = h->pch[i]->info.ph_id - 1;
+				 chn_total_p = (  h->pch[i]->power[k].factor == 0 ? 0 : ( h->pch[i]->power[k].power/100.0 /  h->pch[i]->power[k].factor * 100.0));
+				 tmp[k].consump += (h->pch[i]->power[k].consump/100.0);
+				 tmp[k].voltage = (tmp[k].voltage > h->pch[i]->power[k].voltage/100.0 ) ? tmp[k].voltage : h->pch[i]->power[k].voltage/100.0;
+				 tmp[k].current += ( h->pch[i]->power[k].current/100.0);
+				 tmp[k].power   += h->pch[i]->power[k].power/100.0; 
+				 tmp[k].reactive += chn_total_p;
+				 tmp[k].active +=(chn_total_p-(h->pch[i]->power[k].power/100.0));
+			 }
+			 
+		 }else if(h->prod->type==PDU_AC_I3O3)
+		 {
+				for(int i = 1 ;i < h->chs;i++)
+				{
+					float chn_total_p = 0.0;
+					for(k=0; k<3; k++) {
+						chn_total_p = (  h->pch[i]->power[k].factor == 0 ? 0 : ( h->pch[i]->power[k].power/100.0 /  h->pch[i]->power[k].factor * 100.0));
+						tmp[k].consump += (h->pch[i]->power[k].consump/100.0);
+						tmp[k].voltage = (tmp[k].voltage > h->pch[i]->power[k].voltage/100.0 ) ? tmp[k].voltage : h->pch[i]->power[k].voltage/100.0;
+						tmp[k].current += ( h->pch[i]->power[k].current/100.0);
+						tmp[k].power   += h->pch[i]->power[k].power/100.0; 
+						tmp[k].reactive += chn_total_p;
+						tmp[k].active +=(chn_total_p-(h->pch[i]->power[k].power/100.0));
+					}
+				}		
+			 
+	   }else if(h->prod->type==PDU_AC_I3O2)
+		 {
+			 float chn_total_p = 0.0;
+			 float chn_total_p_1 = 0.0;
+			 int left = h->pch[i]->info.ph_id -1;
+			 int right = h->pch[i]->info.ph_val -1;
+			 
+			 for(int i = 1 ;i < h->chs;i++)
+			 {
+				 int left = h->pch[i]->info.ph_id -1;
+			   int right = h->pch[i]->info.ph_val -1;
+				 chn_total_p = (  h->pch[i]->power[left].factor == 0 ? 0 : ( h->pch[i]->power[left].power/100.0 /  h->pch[i]->power[left].factor * 100.0));
+				 tmp[left].consump += (h->pch[i]->power[left].consump/100.0);
+				 tmp[left].voltage = (tmp[k].voltage > h->pch[i]->power[left].voltage/100.0 ) ? tmp[k].voltage : h->pch[i]->power[left].voltage/100.0;
+				 tmp[left].current += ( h->pch[i]->power[left].current/100.0);
+				 tmp[left].power   += h->pch[i]->power[left].power/100.0; 
+				 tmp[left].reactive += chn_total_p;
+				 tmp[left].active +=(chn_total_p-(h->pch[i]->power[left].power/100.0));		
+				 
+				 
+				 chn_total_p = (  h->pch[i]->power[right].factor == 0 ? 0 : ( h->pch[i]->power[right].power/100.0 /  h->pch[i]->power[right].factor * 100.0));
+				 tmp[right].consump += (h->pch[i]->power[right].consump/100.0);
+				 tmp[right].voltage = (tmp[k].voltage > h->pch[i]->power[right].voltage/100.0 ) ? tmp[k].voltage : h->pch[i]->power[right].voltage/100.0;
+				 tmp[right].current += ( h->pch[i]->power[right].current/100.0);
+				 tmp[right].power   += h->pch[i]->power[right].power/100.0; 
+				 tmp[right].reactive += chn_total_p;
+				 tmp[right].active +=(chn_total_p-(h->pch[i]->power[right].power/100.0));		
+			 }				 
+			 
+		 }else if(PDU_AC_I1O1 == h->prod->type)
+		 {
+			 float chn_total_p = 0.0;
+			 for(int i = 1; i < h->chs;i++)
+			 {
+				 chn_total_p = (  h->pch[i]->power[0].factor == 0 ? 0 : ( h->pch[i]->power[0].power/100.0 /  h->pch[i]->power[0].factor * 100.0));
+				 tmp[0].consump += (h->pch[i]->power[0].consump/100.0);
+				 tmp[0].voltage = (tmp[0].voltage > h->pch[i]->power[0].voltage/100.0 ) ? tmp[0].voltage : h->pch[i]->power[0].voltage/100.0;
+				 tmp[0].current += ( h->pch[i]->power[0].current/100.0);
+				 tmp[0].reactive += chn_total_p;
+				 tmp[0].power   += h->pch[i]->power[0].power/100.0; 
+				 tmp[0].active +=(chn_total_p-(h->pch[i]->power[0].power/100.0));
+			 }		 
+		 }else if(PDU_DC_I1O1 == h->prod->type)
+		 {
+			 for(int i = 1; i < h->chs;i++)
+			 {
+
+				 tmp[0].consump += (h->pch[i]->power[0].consump/100.0);
+				 tmp[0].voltage = (tmp[k].voltage > h->pch[i]->power[0].voltage/100.0 ) ? tmp[k].voltage : h->pch[i]->power[0].voltage/100.0;
+				 tmp[0].current += ( h->pch[i]->power[0].current/100.0);
+				 tmp[0].power   += h->pch[i]->power[0].power/100.0; 
+				 tmp[0].reactive += h->pch[i]->power[0].power/100.0;
+				 tmp[0].active += 0;
+			 }			 
+		 }
+		
+		
+#if 0
 		for(int i = 1 ;i < h->chs;i++)
 		{
 			float chn_total_p = 0.0;
@@ -526,7 +615,7 @@ static int total_proc(power_handle_t *h)
 			}
 		}
 		
-
+#endif
 //    for(i=0; i<h->brd_max; i++) {
 //        if(h->pbrd[i]) {
 //            for (j=0; i<h->pbrd[i]->chs; i++) {
@@ -550,7 +639,7 @@ static int total_proc(power_handle_t *h)
 //    }
     
     h->ttl.type = h->prod->type;
-    for(k=0; k<times; k++) {
+    for(k=0; k<3; k++) {
         h->ttl.total[k].voltage = tmp[k].voltage;
         h->ttl.total[k].current = tmp[k].current;
         h->ttl.total[k].power = tmp[k].power;
@@ -697,7 +786,13 @@ static int board_read(power_handle_t *h, board_data_t *pbrd,uint8_t flag)
 								
                 for (i=0; i<pbrd->chs; i++) {
                     int idx = i * 12;
-                    pwr = &pbrd->pch[i].power[0];
+										if(h->prod->type == PDU_AC_I3O1 || h->prod->type == PDU_AC_I3O1_H)
+										{
+											uint8_t _id = pbrd->pch[i].info.ph_id - 1;
+											pwr = &pbrd->pch[i].power[_id];
+											
+										}else
+												pwr = &pbrd->pch[i].power[0];
                     
                     val = (tmp[1 + idx] << 16) | tmp[0 + idx];
                     pwr->voltage = val / 10;
@@ -732,17 +827,73 @@ static int board_read(power_handle_t *h, board_data_t *pbrd,uint8_t flag)
                     pch = &pbrd->pch[i];
                     //pch->power[0].status = tmp[i] & (0x01);
 										pch->status = tmp[i] & (0x01);
-										old_l1_v_upper = pch->alarm.l1_v_upper;
-										old_l1_v_lower = pch->alarm.l1_v_lower;
-										old_l1_c_upper = pch->alarm.l1_c_upper;
-										old_l1_p_upper = pch->alarm.l1_p_upper;
-										old_l1_w_upper = pch->alarm.l1_w_upper;
+
 									
-                    pch->alarm.l1_v_upper   = (tmp[i] & BIT(2))?1:0;
-                    pch->alarm.l1_v_lower   = (tmp[i] & BIT(4))?1:0;
-                    pch->alarm.l1_c_upper   = (tmp[i] & BIT(6))?1:0;
-                    pch->alarm.l1_p_upper   = (tmp[i] & BIT(8))?1:0;
-                    pch->alarm.l1_w_upper   = (tmp[i] & BIT(10))?1:0;
+										if(h->prod->type == PDU_AC_I3O1 || h->prod->type == PDU_AC_I3O1_H)
+										{
+											uint8_t _id = pch->info.ph_id -1;
+											switch(_id)
+											{
+												case 0:
+												{
+													old_l1_v_upper = pch->alarm.l1_v_upper;
+													old_l1_v_lower = pch->alarm.l1_v_lower;
+													old_l1_c_upper = pch->alarm.l1_c_upper;
+													old_l1_p_upper = pch->alarm.l1_p_upper;
+													old_l1_w_upper = pch->alarm.l1_w_upper;
+													pch->alarm.l1_v_upper   = (tmp[i] & BIT(2))?1:0;
+													pch->alarm.l1_v_lower   = (tmp[i] & BIT(4))?1:0;
+													pch->alarm.l1_c_upper   = (tmp[i] & BIT(6))?1:0;
+													pch->alarm.l1_p_upper   = (tmp[i] & BIT(8))?1:0;
+													pch->alarm.l1_w_upper   = (tmp[i] & BIT(10))?1:0;															
+												}
+												break;
+												case 1:
+												{
+													old_l2_v_upper = pch->alarm.l2_v_upper;
+													old_l2_v_lower = pch->alarm.l2_v_lower;
+													old_l2_c_upper = pch->alarm.l2_c_upper;
+													old_l2_p_upper = pch->alarm.l2_p_upper;
+													old_l2_w_upper = pch->alarm.l2_w_upper;
+													pch->alarm.l2_v_upper   = (tmp[i] & BIT(2))?1:0;
+													pch->alarm.l2_v_lower   = (tmp[i] & BIT(4))?1:0;
+													pch->alarm.l2_c_upper   = (tmp[i] & BIT(6))?1:0;
+													pch->alarm.l2_p_upper   = (tmp[i] & BIT(8))?1:0;
+													pch->alarm.l2_w_upper   = (tmp[i] & BIT(10))?1:0;															
+												}
+												break;
+												case 2:
+												{
+													old_l3_v_upper = pch->alarm.l3_v_upper;
+													old_l3_v_lower = pch->alarm.l3_v_lower;
+													old_l3_c_upper = pch->alarm.l3_c_upper;
+													old_l3_p_upper = pch->alarm.l3_p_upper;
+													old_l3_w_upper = pch->alarm.l3_w_upper;
+													pch->alarm.l3_v_upper   = (tmp[i] & BIT(2))?1:0;
+													pch->alarm.l3_v_lower   = (tmp[i] & BIT(4))?1:0;
+													pch->alarm.l3_c_upper   = (tmp[i] & BIT(6))?1:0;
+													pch->alarm.l3_p_upper   = (tmp[i] & BIT(8))?1:0;
+													pch->alarm.l3_w_upper   = (tmp[i] & BIT(10))?1:0;																
+												}
+													break;
+												default:
+													break;
+											}
+										}else
+										{
+											old_l1_v_upper = pch->alarm.l1_v_upper;
+											old_l1_v_lower = pch->alarm.l1_v_lower;
+											old_l1_c_upper = pch->alarm.l1_c_upper;
+											old_l1_p_upper = pch->alarm.l1_p_upper;
+											old_l1_w_upper = pch->alarm.l1_w_upper;
+											pch->alarm.l1_v_upper   = (tmp[i] & BIT(2))?1:0;
+											pch->alarm.l1_v_lower   = (tmp[i] & BIT(4))?1:0;
+											pch->alarm.l1_c_upper   = (tmp[i] & BIT(6))?1:0;
+											pch->alarm.l1_p_upper   = (tmp[i] & BIT(8))?1:0;
+											pch->alarm.l1_w_upper   = (tmp[i] & BIT(10))?1:0;										
+										}
+										
+
 									
 										info.id = i;
 										info.wanning_type = ALARM_TYPE_POWER;
@@ -750,47 +901,185 @@ static int board_read(power_handle_t *h, board_data_t *pbrd,uint8_t flag)
 										if(h->prod->type == PDU_AC_I3O1 || h->prod->type == PDU_AC_I3O1_H)
 										{
 											info.ph_info = pch->info.ph_id;
-										}
-										if(!old_l1_v_upper && pch->alarm.l1_v_upper)
-										{	
-											info.ele_info = STR_POWER_ID_VOL;
-											info.max_min  = STR_POWER_ID_MAXS;
-											info.over = STR_POWER_ID_OVER;
-											wanning_operation(&info,pch->info.name);
-										}
-									
-										if(!old_l1_v_lower && pch->alarm.l1_v_lower)
-										{
-											info.ele_info = STR_POWER_ID_VOL;
-											info.max_min  = STR_POWER_ID_MIN;
-											info.over = STR_POWER_ID_LOW;
-											wanning_operation(&info,pch->info.name);
-										}									
-									
-										if(!old_l1_c_upper && pch->alarm.l1_c_upper)
-										{
-											info.ele_info = STR_POWER_ID_CUR;
-											info.max_min  = STR_POWER_ID_MAXS;
-											info.over     = STR_POWER_ID_OVER;
-											wanning_operation(&info,pch->info.name);
-										}										
-
-										if(!old_l1_p_upper && pch->alarm.l1_p_upper)
+											uint8_t _id = pch->info.ph_id -1;
+											switch(_id)
+											{
+												case 0:
+												{
+													if(!old_l1_v_upper && pch->alarm.l1_v_upper)
+													{	
+														info.ele_info = STR_POWER_ID_VOL;
+														info.max_min  = STR_POWER_ID_MAXS;
+														info.over = STR_POWER_ID_OVER;
+														wanning_operation(&info,pch->info.name);
+													}
+												
+													if(!old_l1_v_lower && pch->alarm.l1_v_lower)
+													{
+														info.ele_info = STR_POWER_ID_VOL;
+														info.max_min  = STR_POWER_ID_MIN;
+														info.over = STR_POWER_ID_LOW;
+														wanning_operation(&info,pch->info.name);
+													}									
+												
+													if(!old_l1_c_upper && pch->alarm.l1_c_upper)
+													{
+														info.ele_info = STR_POWER_ID_CUR;
+														info.max_min  = STR_POWER_ID_MAXS;
+														info.over     = STR_POWER_ID_OVER;
+														wanning_operation(&info,pch->info.name);
+													}										
+
+													if(!old_l1_p_upper && pch->alarm.l1_p_upper)
+													{
+														info.ele_info = STR_POWER_ID_POWER;
+														info.max_min  = STR_POWER_ID_MAXS;
+														info.over     = STR_POWER_ID_OVER;
+														wanning_operation(&info,pch->info.name);
+													}				
+
+													if(!old_l1_w_upper && pch->alarm.l1_w_upper)
+													{
+														info.ele_info = STR_POWER_ID_CONSUMER;
+														info.max_min  = STR_POWER_ID_MAXS;
+														info.over     = STR_POWER_ID_OVER;
+														wanning_operation(&info,pch->info.name);
+													}														
+												}
+													break;
+												case 1:
+												{
+													if(!old_l2_v_upper && pch->alarm.l2_v_upper)
+													{	
+														info.ele_info = STR_POWER_ID_VOL;
+														info.max_min  = STR_POWER_ID_MAXS;
+														info.over = STR_POWER_ID_OVER;
+														wanning_operation(&info,pch->info.name);
+													}
+												
+													if(!old_l2_v_lower && pch->alarm.l2_v_lower)
+													{
+														info.ele_info = STR_POWER_ID_VOL;
+														info.max_min  = STR_POWER_ID_MIN;
+														info.over = STR_POWER_ID_LOW;
+														wanning_operation(&info,pch->info.name);
+													}									
+												
+													if(!old_l2_c_upper && pch->alarm.l2_c_upper)
+													{
+														info.ele_info = STR_POWER_ID_CUR;
+														info.max_min  = STR_POWER_ID_MAXS;
+														info.over     = STR_POWER_ID_OVER;
+														wanning_operation(&info,pch->info.name);
+													}										
+
+													if(!old_l2_p_upper && pch->alarm.l2_p_upper)
+													{
+														info.ele_info = STR_POWER_ID_POWER;
+														info.max_min  = STR_POWER_ID_MAXS;
+														info.over     = STR_POWER_ID_OVER;
+														wanning_operation(&info,pch->info.name);
+													}				
+
+													if(!old_l2_w_upper && pch->alarm.l2_w_upper)
+													{
+														info.ele_info = STR_POWER_ID_CONSUMER;
+														info.max_min  = STR_POWER_ID_MAXS;
+														info.over     = STR_POWER_ID_OVER;
+														wanning_operation(&info,pch->info.name);
+													}	
+												}
+													break;
+												case 2:
+												{
+													if(!old_l3_v_upper && pch->alarm.l3_v_upper)
+													{	
+														info.ele_info = STR_POWER_ID_VOL;
+														info.max_min  = STR_POWER_ID_MAXS;
+														info.over = STR_POWER_ID_OVER;
+														wanning_operation(&info,pch->info.name);
+													}
+												
+													if(!old_l3_v_lower && pch->alarm.l3_v_lower)
+													{
+														info.ele_info = STR_POWER_ID_VOL;
+														info.max_min  = STR_POWER_ID_MIN;
+														info.over = STR_POWER_ID_LOW;
+														wanning_operation(&info,pch->info.name);
+													}									
+												
+													if(!old_l3_c_upper && pch->alarm.l3_c_upper)
+													{
+														info.ele_info = STR_POWER_ID_CUR;
+														info.max_min  = STR_POWER_ID_MAXS;
+														info.over     = STR_POWER_ID_OVER;
+														wanning_operation(&info,pch->info.name);
+													}										
+
+													if(!old_l3_p_upper && pch->alarm.l3_p_upper)
+													{
+														info.ele_info = STR_POWER_ID_POWER;
+														info.max_min  = STR_POWER_ID_MAXS;
+														info.over     = STR_POWER_ID_OVER;
+														wanning_operation(&info,pch->info.name);
+													}				
+
+													if(!old_l3_w_upper && pch->alarm.l3_w_upper)
+													{
+														info.ele_info = STR_POWER_ID_CONSUMER;
+														info.max_min  = STR_POWER_ID_MAXS;
+														info.over     = STR_POWER_ID_OVER;
+														wanning_operation(&info,pch->info.name);
+													}	
+												}
+													break;
+												default:
+													break;
+											}
+											
+										}else
 										{
-											info.ele_info = STR_POWER_ID_POWER;
-											info.max_min  = STR_POWER_ID_MAXS;
-											info.over     = STR_POWER_ID_OVER;
-											wanning_operation(&info,pch->info.name);
-										}				
+											if(!old_l1_v_upper && pch->alarm.l1_v_upper)
+											{	
+												info.ele_info = STR_POWER_ID_VOL;
+												info.max_min  = STR_POWER_ID_MAXS;
+												info.over = STR_POWER_ID_OVER;
+												wanning_operation(&info,pch->info.name);
+											}
+										
+											if(!old_l1_v_lower && pch->alarm.l1_v_lower)
+											{
+												info.ele_info = STR_POWER_ID_VOL;
+												info.max_min  = STR_POWER_ID_MIN;
+												info.over = STR_POWER_ID_LOW;
+												wanning_operation(&info,pch->info.name);
+											}									
+										
+											if(!old_l1_c_upper && pch->alarm.l1_c_upper)
+											{
+												info.ele_info = STR_POWER_ID_CUR;
+												info.max_min  = STR_POWER_ID_MAXS;
+												info.over     = STR_POWER_ID_OVER;
+												wanning_operation(&info,pch->info.name);
+											}										
 
-										if(!old_l1_w_upper && pch->alarm.l1_w_upper)
-										{
-											info.ele_info = STR_POWER_ID_CONSUMER;
-											info.max_min  = STR_POWER_ID_MAXS;
-											info.over     = STR_POWER_ID_OVER;
-											wanning_operation(&info,pch->info.name);
-										}														
+											if(!old_l1_p_upper && pch->alarm.l1_p_upper)
+											{
+												info.ele_info = STR_POWER_ID_POWER;
+												info.max_min  = STR_POWER_ID_MAXS;
+												info.over     = STR_POWER_ID_OVER;
+												wanning_operation(&info,pch->info.name);
+											}				
 
+											if(!old_l1_w_upper && pch->alarm.l1_w_upper)
+											{
+												info.ele_info = STR_POWER_ID_CONSUMER;
+												info.max_min  = STR_POWER_ID_MAXS;
+												info.over     = STR_POWER_ID_OVER;
+												wanning_operation(&info,pch->info.name);
+											}														
+											
+										}
                 }
 
 								if(flag)
@@ -2240,14 +2529,14 @@ int power_scan(void)
                 }else if(h->prod->type == PDU_AC_I3O2)
 								{
 									pch[j].info.ch  = ch_idx+j;
-									pch[j].info.ph_id = p->phase_seq_2.phase_left[ch_idx-1] -'0';
-									pch[j].info.ph_val = p->phase_seq_2.phase_right[ch_idx-1] -'0';						//作为双火线的右边相
+									pch[j].info.ph_id = p->phase_seq_2.phase_left[pch[j].info.ch -1] -'0';
+									pch[j].info.ph_val = p->phase_seq_2.phase_right[pch[j].info.ch -1] -'0';						//作为双火线的右边相
 								}
                 else {
                     pch[j].info.ch  = ch_idx+j;         //序号从1开始, 发给控制板需从0开始
                     if(h->prod->type==PDU_AC_I3O1 || h->prod->type == PDU_AC_I3O1_H)
 										{
-											pch[j].info.ph_id = p->phase_seq.phase_seq[ch_idx-1] -'0';
+											pch[j].info.ph_id = p->phase_seq.phase_seq[pch[j].info.ch-1] -'0';
 										}	else
 											pch[j].info.ph_id = 0;
                 }
@@ -3085,6 +3374,7 @@ int power_set_ph_cfg(power_ch_t *pch)
 	switch(h->prod->type)
 	{
 		case PDU_AC_I3O1:
+		case PDU_AC_I3O1_H:
 		{
 			h->pbrd[pch->info.addr]->pch[pch->info.sch].info.ph_id = pch->info.ph_id;					//ph
 			p->phase_seq.phase_seq[pch->info.ch-1] = pch->info.ph_id+'0';

+ 11 - 2
f427/applications/ui/led.c

@@ -36,6 +36,10 @@ typedef struct {
     led_data_t  data[LED_ID_MAX];
 }led_handle_t;
 
+extern uint8_t flah_status;
+extern void flash_clear();
+
+
 static led_para_t led_para[LED_MODE_MAX]={
 #if 0
     {LED_ID_GREEN,  1000,0,     -1,   0},     //LED_MODE_NORMAL
@@ -81,11 +85,13 @@ static void led_handler(void *arg, int last)
         else {
             gpio_set(h->io, h->info->off_level);
         }
-
+				flah_status = 1;
 //        led_reset();
     } 
 }
 //////////////////////////////////////////////////
+
+
 int led_init(void)
 {
     int i;
@@ -124,7 +130,8 @@ int led_deinit(void)
 int led_set(int mode)
 {
     led_handle_t *h=&ledHandle;
-
+		flah_status = 0;
+		flash_clear();
     h->mode = mode;
     return led_set_ex(&led_para[h->mode]);
 }
@@ -135,6 +142,7 @@ int led_set_ex(led_para_t *para)
     int r=0;
     led_handle_t *h=&ledHandle;
     misc_data_t *misc=&paras_get()->misc;
+		
     
 //    if(!misc->led || !para || (para->on_ms<=0 && para->off_ms<=0) || para->times==0) {
 //        return -1;
@@ -177,6 +185,7 @@ int led_reset(void)
 
     h->mode = -1;
     timer_stop(h->tmr);
+		flah_status = 1;
     gpio_set(h->data[LED_ID_GREEN].io, led_info[LED_ID_GREEN].off_level);
     return 0;
 }