liyi месяцев назад: 8
Родитель
Сommit
e651630e7e
2 измененных файлов с 102 добавлено и 14 удалено
  1. 101 13
      f427/applications/ui/menu.c
  2. 1 1
      f427/applications/web.c

+ 101 - 13
f427/applications/ui/menu.c

@@ -154,7 +154,8 @@ static int is_ph3_2_out(menu_handle_t *h)
 		}
     return 0;
 }
-static int get_input(menu_handle_t *h, int ph, total_t *ttl)
+
+static int get_input(menu_handle_t *h, int ph, total_t *ttl)//20260103
 {
     power_all_t all;
     
@@ -162,10 +163,87 @@ static int get_input(menu_handle_t *h, int ph, total_t *ttl)
     if(all.chs==0 || !ttl) {
         return -1;
     }
-		if(ph > 0)
-			*ttl = all.ttl.total[ph-1];
-		else
-			*ttl = all.ttl.total[ph];
+		paras_data_t *p=paras_get();
+		if (p->prod.type == PDU_AC_I3O3)
+		{
+			if(ph > 0)
+			{
+				*ttl = all.ttl.total[ph-1];
+			}else
+			{
+				memset(ttl,0,sizeof(total_t));
+				for(int i = 0; i < 3 ;i++)
+				{
+					ttl->current += all.ttl.total[i].current;
+					ttl->power += all.ttl.total[i].power;
+					ttl->consump += all.ttl.total[i].consump;
+					ttl->voltage = ttl->voltage > all.ttl.total[i].voltage ? ttl->voltage:all.ttl.total[i].voltage; 																																							
+					ttl->active += all.ttl.total[i].active;
+					ttl->reactive+=all.ttl.total[i].reactive;
+				}
+				ttl->voltage=ttl->voltage*1.73;
+				ttl->factor=ttl->reactive > 0 ? ttl->power /ttl->reactive:0;		
+			}
+			
+		}else if(p->prod.type == PDU_AC_I3O2)
+		{
+			 if(ph>0)
+		   {
+				*ttl = all.ttl.total[ph-1];				
+			 }else
+			 {
+					memset(ttl,0,sizeof(total_t));
+					for(int i = 0; i < 3 ;i++)
+					{
+						ttl->current += all.ttl.total[i].current;
+						ttl->power += all.ttl.total[i].power;
+						ttl->consump += all.ttl.total[i].consump;
+						ttl->voltage = ttl->voltage > all.ttl.total[i].voltage ? ttl->voltage:all.ttl.total[i].voltage; 																																							
+						ttl->active += all.ttl.total[i].active;
+						ttl->reactive+=all.ttl.total[i].reactive;
+					}
+						ttl->factor=ttl->reactive > 0 ? ttl->power /ttl->reactive:0;			
+											
+			 }
+		}else if(p->prod.type == PDU_AC_I3O1 || p->prod.type == PDU_AC_I3O1_H)
+		{
+			 if(ph>0)
+		   {
+				*ttl = all.ttl.total[ph-1];				
+			 }else
+			 {
+					memset(ttl,0,sizeof(total_t));
+					for(int i = 0; i < 3 ;i++)
+					{
+						ttl->current += all.ttl.total[i].current;
+						ttl->power += all.ttl.total[i].power;
+						ttl->consump += all.ttl.total[i].consump;
+						ttl->voltage = ttl->voltage > all.ttl.total[i].voltage ? ttl->voltage:all.ttl.total[i].voltage; 																																							
+						ttl->active += all.ttl.total[i].active;
+						ttl->reactive+=all.ttl.total[i].reactive;
+					}
+				ttl->factor=ttl->reactive > 0 ? ttl->power /ttl->reactive:0;		
+											
+			 }			
+		}
+		else if(p->prod.type == PDU_DC_I1O1)
+		{
+			*ttl = all.ttl.total[0];
+		}else
+		{
+			*ttl = all.ttl.total[0];
+		}
+		
+		
+		
+//		if(ph > 0)
+//			*ttl = all.ttl.total[ph-1];
+//		else//×ܵçÁ÷  ¹¦ÂÊ...
+//		{
+//			//
+//			
+//			*ttl = all.ttl.total[ph];
+//		}
     return 0;
 }
 static int get_output(menu_handle_t *h, int ch, int ph, power_ch_t *pwr_ch)
@@ -241,9 +319,9 @@ static void menu_input_paint(menu_handle_t *h, int font1, int font2, int item_h,
 {
     int r;
     char tmp[100];
-    total_t *pttl,ttl;
+    total_t *pttl;
 
-    pttl = &ttl;
+    //pttl = &ttl;
     sprintf(tmp, "%s", lang_get_str(h->lang, STR_ID_INPUT));
 
     r = get_input(h, h->ph_in, pttl);
@@ -413,14 +491,24 @@ static void menu_output_paint(menu_handle_t *h, int font1, int font2, int item_h
 				current = all->pch[h->ch_out+1].power[id].current/100.0;
 				power = all->pch[h->ch_out+1].power[id].power/100.0;
 				factor = all->pch[h->ch_out+1].power[id].factor/100.0;
-				consumer = all->pch[h->ch_out+1].power[id].consump/100.0;				
+				consumer = all->pch[h->ch_out+1].power[id].consump/100.0;	
 			}
 			else
 			{
-				current = all->pch[h->ch_out+1].power[0].current/100.0;
-				power = all->pch[h->ch_out+1].power[0].power/100.0;
-				factor = all->pch[h->ch_out+1].power[0].factor/100.0;
-				consumer = all->pch[h->ch_out+1].power[0].consump/100.0;				
+//				current = all->pch[h->ch_out+1].power[0].current/100.0;
+//				power = all->pch[h->ch_out+1].power[0].power/100.0;
+//				factor = all->pch[h->ch_out+1].power[0].factor/100.0;
+//				consumer = all->pch[h->ch_out+1].power[0].consump/100.0;	
+
+				int val = 0;
+		    for(int i=0;i<3;i++){
+					current += all->pch[h->ch_out+1].power[i].current/100.0;
+					consumer += all->pch[h->ch_out+1].power[i].consump/100.0;	
+					all->pch[h->ch_out+1].power[i].factor>0? val+=(all->pch[h->ch_out+1].power[i].power/all->pch[h->ch_out+1].power[i].factor):0;
+					power += all->pch[h->ch_out+1].power[i].power/100.0;
+				}
+				val>0? factor=power/val:0;
+				
 			}			
 		}else if(all->ttl.type == PDU_AC_I3O2)
 		{
@@ -2281,7 +2369,7 @@ static int menu_key_handle(menu_handle_t *h, key_val_t *kv)
                         h->menu.menu_id++;
                     }
                 }
-            }else if(kv->key==KEY_UP && kv->type==TYPE_LONG)
+            }else if(kv->key==KEY_OK && kv->type==TYPE_LONG)
 						{
 							int val = is_ph3_2_out(h);
 							if(val == 1)

+ 1 - 1
f427/applications/web.c

@@ -962,7 +962,7 @@ static void web_thread(void *arg)
 		
 		
     while(th->quit==0) {
-        mg_mgr_poll(&h->mgr, 200);
+        mg_mgr_poll(&h->mgr, 100);
     }
     mg_mgr_free(&h->mgr);
 }