|
@@ -117,25 +117,27 @@ static int is_ph3_out(menu_handle_t *h)
|
|
|
}
|
|
}
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
-static int get_input(menu_handle_t *h, int ph, power_t *power)
|
|
|
|
|
|
|
+static int get_input(menu_handle_t *h, int ph, total_t *ttl)
|
|
|
{
|
|
{
|
|
|
- int i=0;
|
|
|
|
|
- power_ch_t *pch=NULL;
|
|
|
|
|
-
|
|
|
|
|
- if (is_ph3_in(h) && ph>0) {
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
- //*pwr = h->dm->_globalPowerManger._PowerInfo;
|
|
|
|
|
|
|
+ power_data_t pd=power_data_get();
|
|
|
|
|
+ if(pd.chs==0 || !ttl) {
|
|
|
|
|
+ return -1;
|
|
|
}
|
|
}
|
|
|
- return -1;
|
|
|
|
|
|
|
+ *ttl = pd.ttl.total[ph];
|
|
|
|
|
+ return 0;
|
|
|
}
|
|
}
|
|
|
-static int get_output(menu_handle_t *h, int ch, int ph, power_t *power)
|
|
|
|
|
|
|
+static int get_output(menu_handle_t *h, int ch, int ph, power_t *pwr)
|
|
|
{
|
|
{
|
|
|
int i=-1,j=0;
|
|
int i=-1,j=0;
|
|
|
-
|
|
|
|
|
|
|
+ paras_data_t *p=paras_get();
|
|
|
|
|
+ power_data_t pd=power_data_get();
|
|
|
|
|
|
|
|
- return -1;
|
|
|
|
|
|
|
+ if(ch>pd.chs==0 || !pwr || ch>pd.chs) {
|
|
|
|
|
+ return -1;
|
|
|
|
|
+ }
|
|
|
|
|
+ *pwr = pd.pch[ch].power[ph];
|
|
|
|
|
+
|
|
|
|
|
+ return 0;
|
|
|
}
|
|
}
|
|
|
static void refresh_handler(void *arg, int last)
|
|
static void refresh_handler(void *arg, int last)
|
|
|
{
|
|
{
|
|
@@ -168,7 +170,7 @@ static void menu_system_paint(menu_handle_t *h, int font1, int font2, int item_h
|
|
|
{
|
|
{
|
|
|
char time[40],tmp[60];
|
|
char time[40],tmp[60];
|
|
|
|
|
|
|
|
- lcd_fill(COLOR_BLACK);
|
|
|
|
|
|
|
+ //lcd_fill(COLOR_BLACK);
|
|
|
sprintf(tmp, "SmartPDU");
|
|
sprintf(tmp, "SmartPDU");
|
|
|
lcd_draw_string(0, 0, LCD_WIDTH, item_h, tmp, font1, COLOR_WHITE, COLOR_BLACK, HORIZONTAL_CENTER, VERTICAL_CENTER);
|
|
lcd_draw_string(0, 0, LCD_WIDTH, item_h, tmp, font1, COLOR_WHITE, COLOR_BLACK, HORIZONTAL_CENTER, VERTICAL_CENTER);
|
|
|
|
|
|
|
@@ -181,48 +183,47 @@ static void menu_system_paint(menu_handle_t *h, int font1, int font2, int item_h
|
|
|
|
|
|
|
|
sprintf(tmp, "IP:%s", "11.11.11.11");//getLocalIpAddress("eth0"));
|
|
sprintf(tmp, "IP:%s", "11.11.11.11");//getLocalIpAddress("eth0"));
|
|
|
lcd_draw_string(0, item_h*3, LCD_WIDTH, item_h, tmp, font2, COLOR_WHITE, COLOR_BLACK, HORIZONTAL_LEFT, VERTICAL_CENTER);
|
|
lcd_draw_string(0, item_h*3, LCD_WIDTH, item_h, tmp, font2, COLOR_WHITE, COLOR_BLACK, HORIZONTAL_LEFT, VERTICAL_CENTER);
|
|
|
- lcd_refresh();
|
|
|
|
|
|
|
+ //lcd_refresh();
|
|
|
}
|
|
}
|
|
|
static void menu_input_paint(menu_handle_t *h, int font1, int font2, int item_h, key_val_t *kv)
|
|
static void menu_input_paint(menu_handle_t *h, int font1, int font2, int item_h, key_val_t *kv)
|
|
|
{
|
|
{
|
|
|
int r;
|
|
int r;
|
|
|
char tmp[100];
|
|
char tmp[100];
|
|
|
- power_t *pwr,info={0};
|
|
|
|
|
|
|
+ total_t *pttl,ttl;
|
|
|
|
|
|
|
|
- pwr = &info;
|
|
|
|
|
|
|
+ pttl = &ttl;
|
|
|
sprintf(tmp, "%s", lang_get_str(h->lang, STR_ID_INPUT));
|
|
sprintf(tmp, "%s", lang_get_str(h->lang, STR_ID_INPUT));
|
|
|
|
|
|
|
|
- r = get_input(h, h->ph_in, &info);
|
|
|
|
|
|
|
+ r = get_input(h, h->ph_in, pttl);
|
|
|
if(r==0) {
|
|
if(r==0) {
|
|
|
if(h->menu.menu_lv==1 && h->ph_in>0) {
|
|
if(h->menu.menu_lv==1 && h->ph_in>0) {
|
|
|
sprintf(tmp, "%s-L%d", lang_get_str(h->lang, STR_ID_INPUT), h->ph_in);
|
|
sprintf(tmp, "%s-L%d", lang_get_str(h->lang, STR_ID_INPUT), h->ph_in);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- lcd_fill(COLOR_BLACK);
|
|
|
|
|
lcd_draw_string(0, 0, LCD_WIDTH, item_h, tmp, font1, COLOR_WHITE, COLOR_BLACK, HORIZONTAL_CENTER, VERTICAL_CENTER);
|
|
lcd_draw_string(0, 0, LCD_WIDTH, item_h, tmp, font1, COLOR_WHITE, COLOR_BLACK, HORIZONTAL_CENTER, VERTICAL_CENTER);
|
|
|
|
|
|
|
|
#ifdef TEXT_ALIGN
|
|
#ifdef TEXT_ALIGN
|
|
|
- sprintf(tmp, "%s:%0.2f", lang_get_str(h->lang, STR_ID_VOLTAGE), pwr->voltage);
|
|
|
|
|
|
|
+ sprintf(tmp, "%s:%0.2f", lang_get_str(h->lang, STR_ID_VOLTAGE), pttl->voltage);
|
|
|
lcd_draw_string(0, item_h, LCD_WIDTH/2, item_h, tmp, font2, COLOR_WHITE, COLOR_BLACK, HORIZONTAL_LEFT, VERTICAL_CENTER);
|
|
lcd_draw_string(0, item_h, LCD_WIDTH/2, item_h, tmp, font2, COLOR_WHITE, COLOR_BLACK, HORIZONTAL_LEFT, VERTICAL_CENTER);
|
|
|
- sprintf(tmp, "%s:%0.2f", lang_get_str(h->lang, STR_ID_CURRENT), pwr->current);
|
|
|
|
|
|
|
+ sprintf(tmp, "%s:%0.2f", lang_get_str(h->lang, STR_ID_CURRENT), pttl->current);
|
|
|
lcd_draw_string(LCD_WIDTH/2, item_h, LCD_WIDTH/2, item_h, tmp, font2, COLOR_WHITE, COLOR_BLACK, HORIZONTAL_LEFT, VERTICAL_CENTER);
|
|
lcd_draw_string(LCD_WIDTH/2, item_h, LCD_WIDTH/2, item_h, tmp, font2, COLOR_WHITE, COLOR_BLACK, HORIZONTAL_LEFT, VERTICAL_CENTER);
|
|
|
|
|
|
|
|
- sprintf(tmp, "%s:%0.2f", lang_get_str(h->lang, STR_ID_POWER), pwr->power);
|
|
|
|
|
|
|
+ sprintf(tmp, "%s:%0.2f", lang_get_str(h->lang, STR_ID_POWER), pttl->power);
|
|
|
lcd_draw_string(0, item_h*2, LCD_WIDTH/2, item_h, tmp, font2, COLOR_WHITE, COLOR_BLACK, HORIZONTAL_LEFT, VERTICAL_CENTER);
|
|
lcd_draw_string(0, item_h*2, LCD_WIDTH/2, item_h, tmp, font2, COLOR_WHITE, COLOR_BLACK, HORIZONTAL_LEFT, VERTICAL_CENTER);
|
|
|
- sprintf(tmp, "%s:%0.2f", lang_get_str(h->lang, STR_ID_FACTOR), pwr->factor);
|
|
|
|
|
|
|
+ sprintf(tmp, "%s:%0.2f", lang_get_str(h->lang, STR_ID_FACTOR), pttl->total[0].factor);
|
|
|
lcd_draw_string(LCD_WIDTH/2, item_h*2, LCD_WIDTH/2, item_h, tmp, font2, COLOR_WHITE, COLOR_BLACK, HORIZONTAL_LEFT, VERTICAL_CENTER);
|
|
lcd_draw_string(LCD_WIDTH/2, item_h*2, LCD_WIDTH/2, item_h, tmp, font2, COLOR_WHITE, COLOR_BLACK, HORIZONTAL_LEFT, VERTICAL_CENTER);
|
|
|
#else
|
|
#else
|
|
|
- sprintf(tmp, "%s:%0.2f %s:%0.2f", lang_get_str(h->lang, STR_ID_VOLTAGE), pwr->voltage, lang_get_str(h->lang, STR_ID_CURRENT), pwr->current);
|
|
|
|
|
|
|
+ sprintf(tmp, "%s:%0.2f %s:%0.2f", lang_get_str(h->lang, STR_ID_VOLTAGE), pttl->voltage, lang_get_str(h->lang, STR_ID_CURRENT), pttl->current);
|
|
|
lcd_draw_string(0, item_h, LCD_WIDTH, item_h, tmp, font2, COLOR_WHITE, COLOR_BLACK, HORIZONTAL_LEFT, VERTICAL_CENTER);
|
|
lcd_draw_string(0, item_h, LCD_WIDTH, item_h, tmp, font2, COLOR_WHITE, COLOR_BLACK, HORIZONTAL_LEFT, VERTICAL_CENTER);
|
|
|
|
|
|
|
|
- sprintf(tmp, "%s:%0.2f %s:%0.2f", lang_get_str(h->lang, STR_ID_POWER), pwr->power, lang_get_str(h->lang, STR_ID_FACTOR), pwr->factor);
|
|
|
|
|
|
|
+ sprintf(tmp, "%s:%0.2f %s:%0.2f", lang_get_str(h->lang, STR_ID_POWER), pttl->power, lang_get_str(h->lang, STR_ID_FACTOR), pttl->factor);
|
|
|
lcd_draw_string(0, item_h*2, LCD_WIDTH, item_h, tmp, font2, COLOR_WHITE, COLOR_BLACK, HORIZONTAL_LEFT, VERTICAL_CENTER);
|
|
lcd_draw_string(0, item_h*2, LCD_WIDTH, item_h, tmp, font2, COLOR_WHITE, COLOR_BLACK, HORIZONTAL_LEFT, VERTICAL_CENTER);
|
|
|
#endif
|
|
#endif
|
|
|
- sprintf(tmp, "%s:%0.2f", lang_get_str(h->lang, STR_ID_CONSUMP), pwr->consump);
|
|
|
|
|
|
|
+ sprintf(tmp, "%s:%0.2f", lang_get_str(h->lang, STR_ID_CONSUMP), pttl->consump);
|
|
|
lcd_draw_string(0, item_h*3, LCD_WIDTH, item_h, tmp, font2, COLOR_WHITE, COLOR_BLACK, HORIZONTAL_LEFT, VERTICAL_CENTER);
|
|
lcd_draw_string(0, item_h*3, LCD_WIDTH, item_h, tmp, font2, COLOR_WHITE, COLOR_BLACK, HORIZONTAL_LEFT, VERTICAL_CENTER);
|
|
|
|
|
|
|
|
- lcd_refresh();
|
|
|
|
|
|
|
+ //lcd_refresh();
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
static void menu_output_paint(menu_handle_t *h, int font1, int font2, int item_h, key_val_t *kv)
|
|
static void menu_output_paint(menu_handle_t *h, int font1, int font2, int item_h, key_val_t *kv)
|
|
@@ -239,7 +240,7 @@ static void menu_output_paint(menu_handle_t *h, int font1, int font2, int item_h
|
|
|
sprintf(tmp, "%s CH%d", lang_get_str(h->lang, STR_ID_OUTPUT), h->ch_out+1);
|
|
sprintf(tmp, "%s CH%d", lang_get_str(h->lang, STR_ID_OUTPUT), h->ch_out+1);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- lcd_fill(COLOR_BLACK);
|
|
|
|
|
|
|
+ //lcd_fill(COLOR_BLACK);
|
|
|
lcd_draw_string(0, 0, LCD_WIDTH, item_h, tmp, font1, COLOR_WHITE, COLOR_BLACK, HORIZONTAL_CENTER, VERTICAL_CENTER);
|
|
lcd_draw_string(0, 0, LCD_WIDTH, item_h, tmp, font1, COLOR_WHITE, COLOR_BLACK, HORIZONTAL_CENTER, VERTICAL_CENTER);
|
|
|
|
|
|
|
|
char *pon=((pwr->status)?lang_get_str(h->lang, STR_ID_ON):lang_get_str(h->lang, STR_ID_OFF));
|
|
char *pon=((pwr->status)?lang_get_str(h->lang, STR_ID_ON):lang_get_str(h->lang, STR_ID_OFF));
|
|
@@ -263,14 +264,14 @@ static void menu_output_paint(menu_handle_t *h, int font1, int font2, int item_h
|
|
|
sprintf(tmp, "%s:%0.2f", lang_get_str(h->lang, STR_ID_CONSUMP), pwr->consump);
|
|
sprintf(tmp, "%s:%0.2f", lang_get_str(h->lang, STR_ID_CONSUMP), pwr->consump);
|
|
|
lcd_draw_string(0, item_h*3, LCD_WIDTH, item_h, tmp, font2, COLOR_WHITE, COLOR_BLACK, HORIZONTAL_LEFT, VERTICAL_CENTER);
|
|
lcd_draw_string(0, item_h*3, LCD_WIDTH, item_h, tmp, font2, COLOR_WHITE, COLOR_BLACK, HORIZONTAL_LEFT, VERTICAL_CENTER);
|
|
|
|
|
|
|
|
- lcd_refresh();
|
|
|
|
|
|
|
+ //lcd_refresh();
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
static void menu_sensor_paint(menu_handle_t *h, int font1, int font2, int item_h, key_val_t *kv)
|
|
static void menu_sensor_paint(menu_handle_t *h, int font1, int font2, int item_h, key_val_t *kv)
|
|
|
{
|
|
{
|
|
|
char tmp[100];
|
|
char tmp[100];
|
|
|
|
|
|
|
|
- lcd_fill(COLOR_BLACK);
|
|
|
|
|
|
|
+ //lcd_fill(COLOR_BLACK);
|
|
|
sprintf(tmp, "%s/%s", lang_get_str(h->lang, STR_ID_TEMP), lang_get_str(h->lang, STR_ID_HUMI));
|
|
sprintf(tmp, "%s/%s", lang_get_str(h->lang, STR_ID_TEMP), lang_get_str(h->lang, STR_ID_HUMI));
|
|
|
lcd_draw_string(0, 0, LCD_WIDTH, item_h, tmp, font1, COLOR_WHITE, COLOR_BLACK, HORIZONTAL_CENTER, VERTICAL_CENTER);
|
|
lcd_draw_string(0, 0, LCD_WIDTH, item_h, tmp, font1, COLOR_WHITE, COLOR_BLACK, HORIZONTAL_CENTER, VERTICAL_CENTER);
|
|
|
|
|
|
|
@@ -292,7 +293,7 @@ static void menu_sensor_paint(menu_handle_t *h, int font1, int font2, int item_h
|
|
|
lcd_draw_string(0, item_h*2, LCD_WIDTH, item_h, tmp, font2, COLOR_WHITE, COLOR_BLACK, HORIZONTAL_LEFT, VERTICAL_CENTER);
|
|
lcd_draw_string(0, item_h*2, LCD_WIDTH, item_h, tmp, font2, COLOR_WHITE, COLOR_BLACK, HORIZONTAL_LEFT, VERTICAL_CENTER);
|
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
- lcd_refresh();
|
|
|
|
|
|
|
+ //lcd_refresh();
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
static void menu_modbus_paint(menu_handle_t *h, int font1, int font2, int item_h, key_val_t *kv)
|
|
static void menu_modbus_paint(menu_handle_t *h, int font1, int font2, int item_h, key_val_t *kv)
|
|
@@ -306,7 +307,7 @@ static void menu_modbus_paint(menu_handle_t *h, int font1, int font2, int item_h
|
|
|
flash_cnt++;
|
|
flash_cnt++;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- lcd_fill(COLOR_BLACK);
|
|
|
|
|
|
|
+ //lcd_fill(COLOR_BLACK);
|
|
|
|
|
|
|
|
sprintf(tmp, "MODBUS %s", lang_get_str(h->lang, STR_ID_SETT));
|
|
sprintf(tmp, "MODBUS %s", lang_get_str(h->lang, STR_ID_SETT));
|
|
|
lcd_draw_string(0, 0, LCD_WIDTH, item_h, tmp, font1, COLOR_WHITE, COLOR_BLACK, HORIZONTAL_CENTER, VERTICAL_CENTER);
|
|
lcd_draw_string(0, 0, LCD_WIDTH, item_h, tmp, font1, COLOR_WHITE, COLOR_BLACK, HORIZONTAL_CENTER, VERTICAL_CENTER);
|
|
@@ -357,7 +358,7 @@ static void menu_modbus_paint(menu_handle_t *h, int font1, int font2, int item_h
|
|
|
}
|
|
}
|
|
|
lcd_draw_string(LCD_WIDTH/2, item_h*3, LCD_WIDTH/2, item_h, tmp, font2, font_color, COLOR_BLACK, HORIZONTAL_CENTER, VERTICAL_CENTER);
|
|
lcd_draw_string(LCD_WIDTH/2, item_h*3, LCD_WIDTH/2, item_h, tmp, font2, font_color, COLOR_BLACK, HORIZONTAL_CENTER, VERTICAL_CENTER);
|
|
|
|
|
|
|
|
- lcd_refresh();
|
|
|
|
|
|
|
+ //lcd_refresh();
|
|
|
}
|
|
}
|
|
|
/////////////////////////////////////////////////
|
|
/////////////////////////////////////////////////
|
|
|
|
|
|