Pārlūkot izejas kodu

1、做成一键打包
2、继续完善mqtt代码

guohui 2 gadi atpakaļ
vecāks
revīzija
fe62c19112

+ 100 - 0
cust_data/cfg/cfg_anderson.h

@@ -0,0 +1,100 @@
+#ifndef __CONFIG_Hx__
+#define __CONFIG_Hx__
+
+
+#define VERSION                         "V0.0.1"
+
+
+#define PROD_ID                         1
+#define PROD_TYPE                       1
+#define PROD_POWER_TYPE                 1
+
+
+#define LANGUAGE                        0
+#define SMPLE_TIME                      100         //ms
+#define SAVE_TIME                       1000        //ms
+#define CASCADE_CNT                     5
+
+#define MAX_CHN_COUNT                   16
+#define PHASE_GROUP_CNT                 8
+#define CHANNEL_DELAY_SEC               8
+
+#define USE_SMTP
+#define SMTP_SEND_BUILTIN
+
+/////////////customer demannd//////////////////////
+//#define PRJ_XIAN_GOM037
+//#define PRJ_USA_SL
+#define PRJ_ANDERSON
+//#define PRJ_HYPERTEC
+//#define PRJ_RUSSIA_ITK
+//#define PRJ_TEST
+
+
+#ifdef PRJ_TEST
+    #undef MAX_CHN_COUNT
+    #define MAX_CHN_COUNT               24
+#endif
+
+
+#ifdef PRJ_XIAN_GOM037
+    #define GOM037_PDU_GC10_08K_80H        //ac_in1_out1_40a_p8_5ch_nologo_cn
+    //#define GOM037PDU_GC20_04K_125H        //ac_in1_out1_40a_p4_5ch_nologo_cn
+  
+
+    #ifdef GOM037PDU_GC20_04K_125H
+        #undef CHANNEL_DELAY_SEC
+        #define CHANNEL_DELAY_SEC        5
+    #endif
+#endif
+
+#ifdef PRJ_USA_SL
+    #define PDU_GC40_03K_125H           //ac_in3_out3_40a_p8_12ch_nologo_en
+
+    //#define PDU_GC60_04K_125H         //ac_in3_out1_40a_p4_24ch_nologo_en
+#endif
+
+
+#ifdef PRJ_RUSSIA_ITK
+    #define SMTP_SEND_BUILTIN
+#endif
+
+
+#ifdef PRJ_ANDERSON
+    #define USE_MQTT
+    //#define MQTT_SERVER_BUILTIN
+
+    #define SMTP_SEND_BUILTIN
+
+
+    //#define USE_NETSWITCH
+
+    #define SW_STATIC_PORT_START
+    #define SW_PORT_INDEX_START         0
+    #define SW_PORT_INDEX_END           21
+
+    //#define SW_STATIC_IP
+    #ifdef SW_STATIC_IP
+        #define SW_HOST_IP              "192.168.234.1"
+        #define SW_PDU_IP               "192.168.234.132"
+    #endif
+    
+    #undef MAX_CHN_COUNT
+    #define MAX_CHN_COUNT               4//24
+#endif
+
+
+#ifdef PRJ_HYPERTEC
+    //ac_in3_out1_36ch_nologo_en_hypertec
+    
+    #undef PHASE_GROUP_CNT
+    #undef CHANNEL_DELAY_SEC
+
+    #define PHASE_GROUP_CNT             6
+    #define CHANNEL_DELAY_SEC           6
+#endif
+
+
+#endif
+
+

+ 101 - 0
cust_data/cfg/cfg_general.h

@@ -0,0 +1,101 @@
+#ifndef __CONFIG_Hx__
+#define __CONFIG_Hx__
+
+
+#define VERSION                         "V0.0.1"
+
+
+#define PROD_ID                         1
+#define PROD_TYPE                       1
+#define PROD_POWER_TYPE                 1
+
+
+#define LANGUAGE                        0
+#define SMPLE_TIME                      100         //ms
+#define SAVE_TIME                       1000        //ms
+#define CASCADE_CNT                     5
+
+#define MAX_CHN_COUNT                   16
+#define PHASE_GROUP_CNT                 8
+#define CHANNEL_DELAY_SEC               8
+
+#define USE_SMTP
+#define SMTP_SEND_BUILTIN
+
+/////////////customer demannd//////////////////////
+//#define PRJ_XIAN_GOM037
+//#define PRJ_USA_SL
+//#define PRJ_ANDERSON
+//#define PRJ_HYPERTEC
+//#define PRJ_RUSSIA_ITK
+#define PRJ_GENERAL
+//#define PRJ_TEST
+
+
+#ifdef PRJ_TEST
+    #undef MAX_CHN_COUNT
+    #define MAX_CHN_COUNT               24
+#endif
+
+
+#ifdef PRJ_XIAN_GOM037
+    #define GOM037_PDU_GC10_08K_80H        //ac_in1_out1_40a_p8_5ch_nologo_cn
+    //#define GOM037PDU_GC20_04K_125H        //ac_in1_out1_40a_p4_5ch_nologo_cn
+  
+
+    #ifdef GOM037PDU_GC20_04K_125H
+        #undef CHANNEL_DELAY_SEC
+        #define CHANNEL_DELAY_SEC        5
+    #endif
+#endif
+
+#ifdef PRJ_USA_SL
+    #define PDU_GC40_03K_125H           //ac_in3_out3_40a_p8_12ch_nologo_en
+
+    //#define PDU_GC60_04K_125H         //ac_in3_out1_40a_p4_24ch_nologo_en
+#endif
+
+
+#ifdef PRJ_RUSSIA_ITK
+    #define SMTP_SEND_BUILTIN
+#endif
+
+
+#ifdef PRJ_ANDERSON
+    #define USE_MQTT
+    //#define MQTT_SERVER_BUILTIN
+
+    #define SMTP_SEND_BUILTIN
+
+
+    //#define USE_NETSWITCH
+
+    #define SW_STATIC_PORT_START
+    #define SW_PORT_INDEX_START         0
+    #define SW_PORT_INDEX_END           21
+
+    //#define SW_STATIC_IP
+    #ifdef SW_STATIC_IP
+        #define SW_HOST_IP              "192.168.234.1"
+        #define SW_PDU_IP               "192.168.234.132"
+    #endif
+    
+    #undef MAX_CHN_COUNT
+    #define MAX_CHN_COUNT               4//24
+#endif
+
+
+#ifdef PRJ_HYPERTEC
+    //ac_in3_out1_36ch_nologo_en_hypertec
+    
+    #undef PHASE_GROUP_CNT
+    #undef CHANNEL_DELAY_SEC
+
+    #define PHASE_GROUP_CNT             6
+    #define CHANNEL_DELAY_SEC           6
+#endif
+
+
+#endif
+
+

+ 100 - 0
cust_data/cfg/cfg_hypertec.h

@@ -0,0 +1,100 @@
+#ifndef __CONFIG_Hx__
+#define __CONFIG_Hx__
+
+
+#define VERSION                         "V0.0.1"
+
+
+#define PROD_ID                         1
+#define PROD_TYPE                       1
+#define PROD_POWER_TYPE                 1
+
+
+#define LANGUAGE                        0
+#define SMPLE_TIME                      100         //ms
+#define SAVE_TIME                       1000        //ms
+#define CASCADE_CNT                     5
+
+#define MAX_CHN_COUNT                   16
+#define PHASE_GROUP_CNT                 8
+#define CHANNEL_DELAY_SEC               8
+
+#define USE_SMTP
+#define SMTP_SEND_BUILTIN
+
+/////////////customer demannd//////////////////////
+//#define PRJ_XIAN_GOM037
+//#define PRJ_USA_SL
+//#define PRJ_ANDERSON
+#define PRJ_HYPERTEC
+//#define PRJ_RUSSIA_ITK
+//#define PRJ_TEST
+
+
+#ifdef PRJ_TEST
+    #undef MAX_CHN_COUNT
+    #define MAX_CHN_COUNT               24
+#endif
+
+
+#ifdef PRJ_XIAN_GOM037
+    #define GOM037_PDU_GC10_08K_80H        //ac_in1_out1_40a_p8_5ch_nologo_cn
+    //#define GOM037PDU_GC20_04K_125H        //ac_in1_out1_40a_p4_5ch_nologo_cn
+  
+
+    #ifdef GOM037PDU_GC20_04K_125H
+        #undef CHANNEL_DELAY_SEC
+        #define CHANNEL_DELAY_SEC        5
+    #endif
+#endif
+
+#ifdef PRJ_USA_SL
+    #define PDU_GC40_03K_125H           //ac_in3_out3_40a_p8_12ch_nologo_en
+
+    //#define PDU_GC60_04K_125H         //ac_in3_out1_40a_p4_24ch_nologo_en
+#endif
+
+
+#ifdef PRJ_RUSSIA_ITK
+    #define SMTP_SEND_BUILTIN
+#endif
+
+
+#ifdef PRJ_ANDERSON
+    #define USE_MQTT
+    //#define MQTT_SERVER_BUILTIN
+
+    #define SMTP_SEND_BUILTIN
+
+
+    //#define USE_NETSWITCH
+
+    #define SW_STATIC_PORT_START
+    #define SW_PORT_INDEX_START         0
+    #define SW_PORT_INDEX_END           21
+
+    //#define SW_STATIC_IP
+    #ifdef SW_STATIC_IP
+        #define SW_HOST_IP              "192.168.234.1"
+        #define SW_PDU_IP               "192.168.234.132"
+    #endif
+    
+    #undef MAX_CHN_COUNT
+    #define MAX_CHN_COUNT               4//24
+#endif
+
+
+#ifdef PRJ_HYPERTEC
+    //ac_in3_out1_36ch_nologo_en_hypertec
+    
+    #undef PHASE_GROUP_CNT
+    #undef CHANNEL_DELAY_SEC
+
+    #define PHASE_GROUP_CNT             6
+    #define CHANNEL_DELAY_SEC           6
+#endif
+
+
+#endif
+
+

+ 100 - 0
cust_data/cfg/cfg_russia_itk.h

@@ -0,0 +1,100 @@
+#ifndef __CONFIG_Hx__
+#define __CONFIG_Hx__
+
+
+#define VERSION                         "V0.0.1"
+
+
+#define PROD_ID                         1
+#define PROD_TYPE                       1
+#define PROD_POWER_TYPE                 1
+
+
+#define LANGUAGE                        0
+#define SMPLE_TIME                      100         //ms
+#define SAVE_TIME                       1000        //ms
+#define CASCADE_CNT                     5
+
+#define MAX_CHN_COUNT                   16
+#define PHASE_GROUP_CNT                 8
+#define CHANNEL_DELAY_SEC               8
+
+#define USE_SMTP
+#define SMTP_SEND_BUILTIN
+
+/////////////customer demannd//////////////////////
+//#define PRJ_XIAN_GOM037
+//#define PRJ_USA_SL
+//#define PRJ_ANDERSON
+//#define PRJ_HYPERTEC
+#define PRJ_RUSSIA_ITK
+//#define PRJ_TEST
+
+
+#ifdef PRJ_TEST
+    #undef MAX_CHN_COUNT
+    #define MAX_CHN_COUNT               24
+#endif
+
+
+#ifdef PRJ_XIAN_GOM037
+    #define GOM037_PDU_GC10_08K_80H        //ac_in1_out1_40a_p8_5ch_nologo_cn
+    //#define GOM037PDU_GC20_04K_125H        //ac_in1_out1_40a_p4_5ch_nologo_cn
+  
+
+    #ifdef GOM037PDU_GC20_04K_125H
+        #undef CHANNEL_DELAY_SEC
+        #define CHANNEL_DELAY_SEC        5
+    #endif
+#endif
+
+#ifdef PRJ_USA_SL
+    #define PDU_GC40_03K_125H           //ac_in3_out3_40a_p8_12ch_nologo_en
+
+    //#define PDU_GC60_04K_125H         //ac_in3_out1_40a_p4_24ch_nologo_en
+#endif
+
+
+#ifdef PRJ_RUSSIA_ITK
+    #define SMTP_SEND_BUILTIN
+#endif
+
+
+#ifdef PRJ_ANDERSON
+    #define USE_MQTT
+    //#define MQTT_SERVER_BUILTIN
+
+    #define SMTP_SEND_BUILTIN
+
+
+    //#define USE_NETSWITCH
+
+    #define SW_STATIC_PORT_START
+    #define SW_PORT_INDEX_START         0
+    #define SW_PORT_INDEX_END           21
+
+    //#define SW_STATIC_IP
+    #ifdef SW_STATIC_IP
+        #define SW_HOST_IP              "192.168.234.1"
+        #define SW_PDU_IP               "192.168.234.132"
+    #endif
+    
+    #undef MAX_CHN_COUNT
+    #define MAX_CHN_COUNT               4//24
+#endif
+
+
+#ifdef PRJ_HYPERTEC
+    //ac_in3_out1_36ch_nologo_en_hypertec
+    
+    #undef PHASE_GROUP_CNT
+    #undef CHANNEL_DELAY_SEC
+
+    #define PHASE_GROUP_CNT             6
+    #define CHANNEL_DELAY_SEC           6
+#endif
+
+
+#endif
+
+

+ 100 - 0
cust_data/cfg/cfg_test.h

@@ -0,0 +1,100 @@
+#ifndef __CONFIG_Hx__
+#define __CONFIG_Hx__
+
+
+#define VERSION                         "V0.0.1"
+
+
+#define PROD_ID                         1
+#define PROD_TYPE                       1
+#define PROD_POWER_TYPE                 1
+
+
+#define LANGUAGE                        0
+#define SMPLE_TIME                      100         //ms
+#define SAVE_TIME                       1000        //ms
+#define CASCADE_CNT                     5
+
+#define MAX_CHN_COUNT                   16
+#define PHASE_GROUP_CNT                 8
+#define CHANNEL_DELAY_SEC               8
+
+#define USE_SMTP
+#define SMTP_SEND_BUILTIN
+
+/////////////customer demannd//////////////////////
+//#define PRJ_XIAN_GOM037
+//#define PRJ_USA_SL
+//#define PRJ_ANDERSON
+//#define PRJ_HYPERTEC
+//#define PRJ_RUSSIA_ITK
+#define PRJ_TEST
+
+
+#ifdef PRJ_TEST
+    #undef MAX_CHN_COUNT
+    #define MAX_CHN_COUNT               24
+#endif
+
+
+#ifdef PRJ_XIAN_GOM037
+    #define GOM037_PDU_GC10_08K_80H        //ac_in1_out1_40a_p8_5ch_nologo_cn
+    //#define GOM037PDU_GC20_04K_125H        //ac_in1_out1_40a_p4_5ch_nologo_cn
+  
+
+    #ifdef GOM037PDU_GC20_04K_125H
+        #undef CHANNEL_DELAY_SEC
+        #define CHANNEL_DELAY_SEC        5
+    #endif
+#endif
+
+#ifdef PRJ_USA_SL
+    #define PDU_GC40_03K_125H           //ac_in3_out3_40a_p8_12ch_nologo_en
+
+    //#define PDU_GC60_04K_125H         //ac_in3_out1_40a_p4_24ch_nologo_en
+#endif
+
+
+#ifdef PRJ_RUSSIA_ITK
+    #define SMTP_SEND_BUILTIN
+#endif
+
+
+#ifdef PRJ_ANDERSON
+    #define USE_MQTT
+    //#define MQTT_SERVER_BUILTIN
+
+    #define SMTP_SEND_BUILTIN
+
+
+    //#define USE_NETSWITCH
+
+    #define SW_STATIC_PORT_START
+    #define SW_PORT_INDEX_START         0
+    #define SW_PORT_INDEX_END           21
+
+    //#define SW_STATIC_IP
+    #ifdef SW_STATIC_IP
+        #define SW_HOST_IP              "192.168.234.1"
+        #define SW_PDU_IP               "192.168.234.132"
+    #endif
+    
+    #undef MAX_CHN_COUNT
+    #define MAX_CHN_COUNT               4//24
+#endif
+
+
+#ifdef PRJ_HYPERTEC
+    //ac_in3_out1_36ch_nologo_en_hypertec
+    
+    #undef PHASE_GROUP_CNT
+    #undef CHANNEL_DELAY_SEC
+
+    #define PHASE_GROUP_CNT             6
+    #define CHANNEL_DELAY_SEC           6
+#endif
+
+
+#endif
+
+

+ 100 - 0
cust_data/cfg/cfg_usa_sl.h

@@ -0,0 +1,100 @@
+#ifndef __CONFIG_Hx__
+#define __CONFIG_Hx__
+
+
+#define VERSION                         "V0.0.1"
+
+
+#define PROD_ID                         1
+#define PROD_TYPE                       1
+#define PROD_POWER_TYPE                 1
+
+
+#define LANGUAGE                        0
+#define SMPLE_TIME                      100         //ms
+#define SAVE_TIME                       1000        //ms
+#define CASCADE_CNT                     5
+
+#define MAX_CHN_COUNT                   16
+#define PHASE_GROUP_CNT                 8
+#define CHANNEL_DELAY_SEC               8
+
+#define USE_SMTP
+#define SMTP_SEND_BUILTIN
+
+/////////////customer demannd//////////////////////
+//#define PRJ_XIAN_GOM037
+#define PRJ_USA_SL
+//#define PRJ_ANDERSON
+//#define PRJ_HYPERTEC
+//#define PRJ_RUSSIA_ITK
+//#define PRJ_TEST
+
+
+#ifdef PRJ_TEST
+    #undef MAX_CHN_COUNT
+    #define MAX_CHN_COUNT               24
+#endif
+
+
+#ifdef PRJ_XIAN_GOM037
+    #define GOM037_PDU_GC10_08K_80H        //ac_in1_out1_40a_p8_5ch_nologo_cn
+    //#define GOM037PDU_GC20_04K_125H        //ac_in1_out1_40a_p4_5ch_nologo_cn
+  
+
+    #ifdef GOM037PDU_GC20_04K_125H
+        #undef CHANNEL_DELAY_SEC
+        #define CHANNEL_DELAY_SEC        5
+    #endif
+#endif
+
+#ifdef PRJ_USA_SL
+    #define PDU_GC40_03K_125H           //ac_in3_out3_40a_p8_12ch_nologo_en
+
+    //#define PDU_GC60_04K_125H         //ac_in3_out1_40a_p4_24ch_nologo_en
+#endif
+
+
+#ifdef PRJ_RUSSIA_ITK
+    #define SMTP_SEND_BUILTIN
+#endif
+
+
+#ifdef PRJ_ANDERSON
+    #define USE_MQTT
+    //#define MQTT_SERVER_BUILTIN
+
+    #define SMTP_SEND_BUILTIN
+
+
+    //#define USE_NETSWITCH
+
+    #define SW_STATIC_PORT_START
+    #define SW_PORT_INDEX_START         0
+    #define SW_PORT_INDEX_END           21
+
+    //#define SW_STATIC_IP
+    #ifdef SW_STATIC_IP
+        #define SW_HOST_IP              "192.168.234.1"
+        #define SW_PDU_IP               "192.168.234.132"
+    #endif
+    
+    #undef MAX_CHN_COUNT
+    #define MAX_CHN_COUNT               4//24
+#endif
+
+
+#ifdef PRJ_HYPERTEC
+    //ac_in3_out1_36ch_nologo_en_hypertec
+    
+    #undef PHASE_GROUP_CNT
+    #undef CHANNEL_DELAY_SEC
+
+    #define PHASE_GROUP_CNT             6
+    #define CHANNEL_DELAY_SEC           6
+#endif
+
+
+#endif
+
+

+ 100 - 0
cust_data/cfg/cfg_xian_p4.h

@@ -0,0 +1,100 @@
+#ifndef __CONFIG_Hx__
+#define __CONFIG_Hx__
+
+
+#define VERSION                         "V0.0.1"
+
+
+#define PROD_ID                         1
+#define PROD_TYPE                       1
+#define PROD_POWER_TYPE                 1
+
+
+#define LANGUAGE                        0
+#define SMPLE_TIME                      100         //ms
+#define SAVE_TIME                       1000        //ms
+#define CASCADE_CNT                     5
+
+#define MAX_CHN_COUNT                   16
+#define PHASE_GROUP_CNT                 8
+#define CHANNEL_DELAY_SEC               8
+
+#define USE_SMTP
+#define SMTP_SEND_BUILTIN
+
+/////////////customer demannd//////////////////////
+#define PRJ_XIAN_GOM037
+//#define PRJ_USA_SL
+//#define PRJ_ANDERSON
+//#define PRJ_HYPERTEC
+//#define PRJ_RUSSIA_ITK
+//#define PRJ_TEST
+
+
+#ifdef PRJ_TEST
+    #undef MAX_CHN_COUNT
+    #define MAX_CHN_COUNT               24
+#endif
+
+
+#ifdef PRJ_XIAN_GOM037
+    //#define GOM037_PDU_GC10_08K_80H        //ac_in1_out1_40a_p8_5ch_nologo_cn
+    #define GOM037PDU_GC20_04K_125H        //ac_in1_out1_40a_p4_5ch_nologo_cn
+  
+
+    #ifdef GOM037PDU_GC20_04K_125H
+        #undef CHANNEL_DELAY_SEC
+        #define CHANNEL_DELAY_SEC        5
+    #endif
+#endif
+
+#ifdef PRJ_USA_SL
+    #define PDU_GC40_03K_125H           //ac_in3_out3_40a_p8_12ch_nologo_en
+
+    //#define PDU_GC60_04K_125H         //ac_in3_out1_40a_p4_24ch_nologo_en
+#endif
+
+
+#ifdef PRJ_RUSSIA_ITK
+    #define SMTP_SEND_BUILTIN
+#endif
+
+
+#ifdef PRJ_ANDERSON
+    #define USE_MQTT
+    //#define MQTT_SERVER_BUILTIN
+
+    #define SMTP_SEND_BUILTIN
+
+
+    //#define USE_NETSWITCH
+
+    #define SW_STATIC_PORT_START
+    #define SW_PORT_INDEX_START         0
+    #define SW_PORT_INDEX_END           21
+
+    //#define SW_STATIC_IP
+    #ifdef SW_STATIC_IP
+        #define SW_HOST_IP              "192.168.234.1"
+        #define SW_PDU_IP               "192.168.234.132"
+    #endif
+    
+    #undef MAX_CHN_COUNT
+    #define MAX_CHN_COUNT               4//24
+#endif
+
+
+#ifdef PRJ_HYPERTEC
+    //ac_in3_out1_36ch_nologo_en_hypertec
+    
+    #undef PHASE_GROUP_CNT
+    #undef CHANNEL_DELAY_SEC
+
+    #define PHASE_GROUP_CNT             6
+    #define CHANNEL_DELAY_SEC           6
+#endif
+
+
+#endif
+
+

+ 100 - 0
cust_data/cfg/cfg_xian_p8.h

@@ -0,0 +1,100 @@
+#ifndef __CONFIG_Hx__
+#define __CONFIG_Hx__
+
+
+#define VERSION                         "V0.0.1"
+
+
+#define PROD_ID                         1
+#define PROD_TYPE                       1
+#define PROD_POWER_TYPE                 1
+
+
+#define LANGUAGE                        0
+#define SMPLE_TIME                      100         //ms
+#define SAVE_TIME                       1000        //ms
+#define CASCADE_CNT                     5
+
+#define MAX_CHN_COUNT                   16
+#define PHASE_GROUP_CNT                 8
+#define CHANNEL_DELAY_SEC               8
+
+#define USE_SMTP
+#define SMTP_SEND_BUILTIN
+
+/////////////customer demannd//////////////////////
+#define PRJ_XIAN_GOM037
+//#define PRJ_USA_SL
+//#define PRJ_ANDERSON
+//#define PRJ_HYPERTEC
+//#define PRJ_RUSSIA_ITK
+//#define PRJ_TEST
+
+
+#ifdef PRJ_TEST
+    #undef MAX_CHN_COUNT
+    #define MAX_CHN_COUNT               24
+#endif
+
+
+#ifdef PRJ_XIAN_GOM037
+    #define GOM037_PDU_GC10_08K_80H        //ac_in1_out1_40a_p8_5ch_nologo_cn
+    //#define GOM037PDU_GC20_04K_125H        //ac_in1_out1_40a_p4_5ch_nologo_cn
+  
+
+    #ifdef GOM037PDU_GC20_04K_125H
+        #undef CHANNEL_DELAY_SEC
+        #define CHANNEL_DELAY_SEC        5
+    #endif
+#endif
+
+#ifdef PRJ_USA_SL
+    #define PDU_GC40_03K_125H           //ac_in3_out3_40a_p8_12ch_nologo_en
+
+    //#define PDU_GC60_04K_125H         //ac_in3_out1_40a_p4_24ch_nologo_en
+#endif
+
+
+#ifdef PRJ_RUSSIA_ITK
+    #define SMTP_SEND_BUILTIN
+#endif
+
+
+#ifdef PRJ_ANDERSON
+    #define USE_MQTT
+    //#define MQTT_SERVER_BUILTIN
+
+    #define SMTP_SEND_BUILTIN
+
+
+    //#define USE_NETSWITCH
+
+    #define SW_STATIC_PORT_START
+    #define SW_PORT_INDEX_START         0
+    #define SW_PORT_INDEX_END           21
+
+    //#define SW_STATIC_IP
+    #ifdef SW_STATIC_IP
+        #define SW_HOST_IP              "192.168.234.1"
+        #define SW_PDU_IP               "192.168.234.132"
+    #endif
+    
+    #undef MAX_CHN_COUNT
+    #define MAX_CHN_COUNT               4//24
+#endif
+
+
+#ifdef PRJ_HYPERTEC
+    //ac_in3_out1_36ch_nologo_en_hypertec
+    
+    #undef PHASE_GROUP_CNT
+    #undef CHANNEL_DELAY_SEC
+
+    #define PHASE_GROUP_CNT             6
+    #define CHANNEL_DELAY_SEC           6
+#endif
+
+
+#endif
+
+

+ 21 - 28
pro/config/cfg.h

@@ -23,23 +23,23 @@
 #define SMTP_SEND_BUILTIN
 
 /////////////customer demannd//////////////////////
-//#define CUST_GOM037     //xian
-//#define CUST_USASL
-#define CUST_ANDERSON
-//#define CUST_HYPERTEC
-//#define CUST_ITK
-//#define CUST_TEST
+//#define PRJ_XIAN_GOM037
+//#define PRJ_USA_SL
+#define PRJ_ANDERSON
+//#define PRJ_HYPERTEC
+//#define PRJ_RUSSIA_ITK
+//#define PRJ_TEST
 
 
-#ifdef CUST_TEST
+#ifdef PRJ_TEST
     #undef MAX_CHN_COUNT
     #define MAX_CHN_COUNT               24
 #endif
 
 
-#ifdef CUST_GOM037      //xian
+#ifdef PRJ_XIAN_GOM037
     //#define GOM037_PDU_GC10_08K_80H        //ac_in1_out1_40a_p8_5ch_nologo_cn
-    //#define GOM037PDU_GC20_04K_125H        //ac_in1_out1_40a_p4_5ch_nologo_cn
+    #define GOM037PDU_GC20_04K_125H        //ac_in1_out1_40a_p4_5ch_nologo_cn
   
 
     #ifdef GOM037PDU_GC20_04K_125H
@@ -48,21 +48,26 @@
     #endif
 #endif
 
-#ifdef CUST_USASL
+#ifdef PRJ_USA_SL
     #define PDU_GC40_03K_125H           //ac_in3_out3_40a_p8_12ch_nologo_en
 
     //#define PDU_GC60_04K_125H         //ac_in3_out1_40a_p4_24ch_nologo_en
 #endif
 
 
-#ifdef CUST_ITK
+#ifdef PRJ_RUSSIA_ITK
     #define SMTP_SEND_BUILTIN
 #endif
 
 
-#ifdef CUST_ANDERSON
-    //#define USE_MQTT
-    #define USE_NETSWITCH
+#ifdef PRJ_ANDERSON
+    #define USE_MQTT
+    //#define MQTT_SERVER_BUILTIN
+
+    #define SMTP_SEND_BUILTIN
+
+
+    //#define USE_NETSWITCH
 
     #define SW_STATIC_PORT_START
     #define SW_PORT_INDEX_START         0
@@ -73,20 +78,13 @@
         #define SW_HOST_IP              "192.168.234.1"
         #define SW_PDU_IP               "192.168.234.132"
     #endif
-
-    #define SMTP_SEND_BUILTIN
-
-    #ifdef USE_MQTT
-        #define MQTT_SERVER_BUILTIN
-    #endif
-
     
     #undef MAX_CHN_COUNT
-    #define MAX_CHN_COUNT               24
+    #define MAX_CHN_COUNT               4//24
 #endif
 
 
-#ifdef CUST_HYPERTEC
+#ifdef PRJ_HYPERTEC
     //ac_in3_out1_36ch_nologo_en_hypertec
     
     #undef PHASE_GROUP_CNT
@@ -97,11 +95,6 @@
 #endif
 
 
-
-////////////////////////////////////////////////////
-
-
-
 #endif
 
 

+ 1 - 1
pro/src/app.c

@@ -1308,7 +1308,7 @@ void* sensor_thread(void* arg)
                 // printf("get \n");
                 float temperature = 0.0;
                 float humidity = 0.0;
-#ifdef CUST_ANDERSON
+#ifdef PRJ_ANDERSON
                 ret = _g_sensor_get_temperature_value_ANDERSON((void *)&_globalDeviceManager->sensor_modbus_manager,
                                                       _globalSensorMangerTemp->sensor_addr,
                                                       &temperature,

+ 9 - 5
pro/src/main.c

@@ -4,22 +4,26 @@
 #include "thread.h"
 
 
+#define MEM_THRD  20
 int main(int argc,char* argv[])
 {
     uint32_t cnt=0;
-
+    int freeMB;
+    
     sys_init();
     _global_device_manage_init(&__globalDeviceManage);
 
     while(1) {
         cnt++;
-
-        //printf("main loop %d\n", cnt);
         if(cnt%60==0) {
-            if(!sys_mem_enough(50*MB)) {
-                printf("$$$ mem less than 50MB, reboot now ...\n");
+            freeMB = sys_mem_get_free_MB();
+            if(freeMB<MEM_THRD) {
+                printf("___$$$___ free mem less than %dMB, reboot now ...\n", MEM_THRD);
                 sys_reboot();
             }
+            else {
+                printf("___$$$___ free mem more than %dMB\n", MEM_THRD);
+            }
         }
         sleep(1);
     }

+ 114 - 29
pro/src/mqtt.c

@@ -1,4 +1,5 @@
 #include <regex.h>
+#include <time.h>
 #include "common.h"
 #include "cJSON.h"
 #include "mqtt.h"
@@ -9,6 +10,7 @@
 #include "sys.h"
 #include "cfg.h"
 #include "xlist.h"
+#include "switch_ctrl.h"
 #include "sqlite_handle.h"
 
 #if 0
@@ -123,12 +125,33 @@ static int get_id(mqtt_handle_t *h, mqtt_server_t *ser)
     }
     return -1;
 }
-static char *get_str(int n)
+static char *get_int_str(int n)
 {
     static char tmp[32];
     snprintf(tmp, sizeof(tmp), "%d", n);
     return tmp;
 }
+static char *get_float_str(float n)
+{
+    static char tmp[32];
+    snprintf(tmp, sizeof(tmp), "%f", n);
+    return tmp;
+}
+static int get_date_time(char *d, char *t)
+{
+    time_t now;
+    struct tm* tm;
+
+    time(&now);
+    tm = localtime(&now);
+    if(!tm) {
+        return -1;
+    }
+    sprintf(d, "%04d-%02d-%02d", tm->tm_year+1990, tm->tm_mon+1, tm->tm_mday);
+    sprintf(t, "%02d:%02d:%02d", tm->tm_hour, tm->tm_min, tm->tm_sec);
+    return 0;
+}
+
 static mqtt_conn_t* get_conn(mqtt_handle_t *h, mg_conn_t *c)
 {
     int i;
@@ -203,6 +226,50 @@ static char *get_url(mqtt_server_t *ser)
     char *url=ser->server[0]?ser->server:(ser->ip[0]?ser->ip:NULL);
     return url;
 }
+static GlobalPowerManger* get_power(mqtt_handle_t *h, int ch)
+{
+    GlobalPowerManger *tmp=NULL;
+    list_for_each_entry(tmp, &h->dm->_globalPowerManger.list, list)
+    {
+        if(tmp->product_ch_id==ch) {
+            return tmp;
+        }
+    }
+
+    return NULL;
+}
+static int set_ch(mqtt_handle_t *h, int ch, int flag)
+{
+    int sendAddr=0;
+    GlobalPowerManger *tmp=NULL;
+    list_for_each_entry(tmp, &h->dm->_globalPowerManger.list, list)
+    {
+        if(tmp->product_saddr==sendAddr) continue;
+        sendAddr = tmp->product_saddr;
+
+        if(tmp->product_ch_id==ch) {
+            g_switch_set_all_chn_ctrl(&h->dm->_globalRelaySampManger, tmp, tmp->product_saddr, tmp->product_ch_addr, flag, false);
+            break;
+        }
+
+        if(ch==0xff) {
+            g_switch_set_all_ctrl(&h->dm->_globalRelaySampManger, tmp->product_ch_type, tmp->product_saddr, flag);
+        }
+    }
+    return 0;
+}
+static int get_sensor(mqtt_handle_t *h, int type, int id)
+{
+
+
+    return 0;
+}
+
+
+
+//////////////////////////////////////////////////////////////
+
+
 static int my_conn(mqtt_handle_t *h, mqtt_info_t *info)
 {
     int i,j,r=-1;
@@ -284,8 +351,8 @@ static void mqtt_fn(mg_conn_t *c, int ev, void *ev_data)
 
         case MG_EV_CONNECT:
         {
-            char path[200];
-            sys_get_path(path, "emqxsl-ca.crt");
+            //char path[200];
+            //sys_get_path(path, "emqxsl-ca.crt");
             if (mg_url_is_ssl(mc->ser.server)) {
 
                 struct mg_tls_opts opts = {.ca = mg_str(ca_cert),
@@ -407,9 +474,10 @@ int mqtt_post(int type, int id, void *data)
     int r=-1;
 
 #ifdef USE_MQTT
-    char topic[512];
+    char topic[256];
     char* content=NULL;
     mqtt_handle_t *h=&mqHandle;
+    char date[40],time[40];
 
     if(!h->inited || type<0 || type>=MQTT_PUB_MAX) {
         return -1;
@@ -421,6 +489,7 @@ int mqtt_post(int type, int id, void *data)
     else {
         snprintf(topic, sizeof(topic), topic_pub[type], h->prod_id);
     }
+    get_date_time(date, time);
 
     switch(type) {
         case MQTT_PUB_INFO_DEVICE:
@@ -430,12 +499,14 @@ int mqtt_post(int type, int id, void *data)
                 cJSON_AddStringToObject(root,"Topic", topic);
                 cJSON* data=cJSON_CreateObject();
                 if(data) {
-                    cJSON_AddStringToObject(data,"id", get_str(id));
+                    cJSON_AddStringToObject(data,"id", get_int_str(id));
                     cJSON_AddStringToObject(data,"name", "Gowone smartPDU");
                     cJSON_AddStringToObject(data,"type", "smartPDU AC");
                     cJSON_AddStringToObject(data,"firmware", VERSION);
                     cJSON_AddStringToObject(data,"channel_num", "8");
                     cJSON_AddStringToObject(data,"sensor_num", "10");
+                    cJSON_AddStringToObject(data,"date", date);
+                    cJSON_AddStringToObject(data,"time", time);
 
                     cJSON_AddItemToObject(root, "Data", data);
                 }
@@ -489,10 +560,12 @@ int mqtt_post(int type, int id, void *data)
                         cJSON_AddStringToObject(data,"wifi_ipv6_mask", "");
                     }
 
-                    cJSON_AddStringToObject(data,"modbus_address", get_str(h->dm->_globalDevInfo._gmodbus_info.product_modbus_addr));
-                    cJSON_AddStringToObject(data,"modbus_baud", get_str(h->dm->_globalDevInfo._gmodbus_info.product_modbus_baud));
-                    cJSON_AddStringToObject(data,"modbus_mode", get_str(h->dm->_globalDevInfo._gmodbus_info.product_modbus_type));
+                    cJSON_AddStringToObject(data,"modbus_address", get_int_str(h->dm->_globalDevInfo._gmodbus_info.product_modbus_addr));
+                    cJSON_AddStringToObject(data,"modbus_baud", get_int_str(h->dm->_globalDevInfo._gmodbus_info.product_modbus_baud));
+                    cJSON_AddStringToObject(data,"modbus_mode", get_int_str(h->dm->_globalDevInfo._gmodbus_info.product_modbus_type));
                     cJSON_AddStringToObject(data,"vpn_enable", "0");
+                    cJSON_AddStringToObject(data,"date", date);
+                    cJSON_AddStringToObject(data,"time", time);
 
                     cJSON_AddItemToObject(root, "Data", data);
                 }
@@ -510,6 +583,7 @@ int mqtt_post(int type, int id, void *data)
                 cJSON_AddStringToObject(root,"Topic", topic);
                 cJSON* data=cJSON_CreateObject();
                 if(data) {
+                    //h->dm->_globalPowerManger
                     cJSON_AddStringToObject(data,"voltage", "");
                     cJSON_AddStringToObject(data,"current", "");
                     cJSON_AddStringToObject(data,"power", "");
@@ -517,8 +591,8 @@ int mqtt_post(int type, int id, void *data)
                     cJSON_AddStringToObject(data,"pactive_power", "");
                     cJSON_AddStringToObject(data,"reactive_power", "");
                     cJSON_AddStringToObject(data,"apparent_power", "");
-                    cJSON_AddStringToObject(data,"date", "");
-                    cJSON_AddStringToObject(data,"time", "");
+                    cJSON_AddStringToObject(data,"date", date);
+                    cJSON_AddStringToObject(data,"time", time);
 
                     cJSON_AddItemToObject(root, "Data", data);
                 }
@@ -536,19 +610,22 @@ int mqtt_post(int type, int id, void *data)
                 cJSON_AddStringToObject(root,"Topic", topic);
                 cJSON* data=cJSON_CreateObject();
                 if(data) {
-                    cJSON_AddStringToObject(data,"name", "app server channel");
-                    cJSON_AddStringToObject(data,"status", "1");
-                    cJSON_AddStringToObject(data,"voltage", "");
-                    cJSON_AddStringToObject(data,"current", "");
-                    cJSON_AddStringToObject(data,"power", "");
-                    cJSON_AddStringToObject(data,"power_freq", "");
-                    cJSON_AddStringToObject(data,"consumption", "");
-                    cJSON_AddStringToObject(data,"power_factor", "");
-                    cJSON_AddStringToObject(data,"pactive_power", "");
-                    cJSON_AddStringToObject(data,"reactive_power", "");
-                    cJSON_AddStringToObject(data,"apparent_power", "");
-                    cJSON_AddStringToObject(data,"date", "");
-                    cJSON_AddStringToObject(data,"time", "");
+                    GlobalPowerManger *tmp=get_power(h, id);
+                    if(tmp) {
+                        cJSON_AddStringToObject(data,"name", "app server channel");
+                        cJSON_AddStringToObject(data,"status", get_int_str(tmp->_PowerInfo.status));
+                        cJSON_AddStringToObject(data,"voltage", get_float_str(tmp->_PowerInfo.voltage));
+                        cJSON_AddStringToObject(data,"current", get_float_str(tmp->_PowerInfo.current));
+                        cJSON_AddStringToObject(data,"power", get_float_str(tmp->_PowerInfo.power));
+                        cJSON_AddStringToObject(data,"power_freq", get_float_str(tmp->_PowerInfo.freq));
+                        cJSON_AddStringToObject(data,"consumption", get_float_str(tmp->_PowerInfo.consumption));
+                        cJSON_AddStringToObject(data,"power_factor", get_float_str(tmp->_PowerInfo.factor));
+                        cJSON_AddStringToObject(data,"pactive_power", "");
+                        cJSON_AddStringToObject(data,"reactive_power", "");
+                        cJSON_AddStringToObject(data,"apparent_power", "");
+                    }
+                    cJSON_AddStringToObject(data,"date", date);
+                    cJSON_AddStringToObject(data,"time", time);
 
                     cJSON_AddItemToObject(root, "Data", data);
                 }
@@ -574,8 +651,8 @@ int mqtt_post(int type, int id, void *data)
                     cJSON_AddStringToObject(data,"value_num", "");
                     cJSON_AddStringToObject(data,"value1", "");
                     cJSON_AddStringToObject(data,"value2", "");
-                    cJSON_AddStringToObject(data,"date", "");
-                    cJSON_AddStringToObject(data,"time", "");
+                    cJSON_AddStringToObject(data,"date", date);
+                    cJSON_AddStringToObject(data,"time", time);
 
                     cJSON_AddItemToObject(root, "Data", data);
                 }
@@ -603,6 +680,8 @@ int mqtt_post(int type, int id, void *data)
                     cJSON_AddStringToObject(data,"mqtt", "1");
                     cJSON_AddStringToObject(data,"cloud", "1");
                     cJSON_AddStringToObject(data,"ntp", "1");
+                    cJSON_AddStringToObject(data,"date", date);
+                    cJSON_AddStringToObject(data,"time", time);
 
                     cJSON_AddItemToObject(root, "Data", data);
                 }
@@ -626,8 +705,8 @@ int mqtt_post(int type, int id, void *data)
                     cJSON_AddStringToObject(data,"context", "");
                     cJSON_AddStringToObject(data,"action", "1");
                     cJSON_AddStringToObject(data,"action_para", "7");
-                    cJSON_AddStringToObject(data,"date", "");
-                    cJSON_AddStringToObject(data,"time", "");
+                    cJSON_AddStringToObject(data,"date", date);
+                    cJSON_AddStringToObject(data,"time", time);
 
                     cJSON_AddItemToObject(root, "Data", data);
                 }
@@ -732,8 +811,11 @@ static int my_recv(char *topic, char *data)
             switch(i) {
                 case MQTT_SUB_CMD_POWER_ALL:
                 {
-                    LOGD("___ MQTT_SUB_CMD_POWER_ALL\n");
                     cmd = get_cmd(data);
+                    LOGD("___ MQTT_SUB_CMD_POWER_ALL, %d\n", cmd);
+                    if(cmd==0 || cmd==1) {
+                        set_ch(h, 0xff, cmd);
+                    }
                 }
                 break;
 
@@ -741,8 +823,11 @@ static int my_recv(char *topic, char *data)
                 {
                     int ch=atoi(topic+strlen(temp));
                     cmd = get_cmd(data);
-
                     LOGD("___ MQTT_SUB_CMD_POWER_CHN, %d\n", ch);
+
+                    if(cmd==0 || cmd==1) {
+                        set_ch(h, ch, cmd);
+                    }
                 }
                 break;
 

+ 20 - 0
pro/src/sys.c

@@ -1048,6 +1048,26 @@ int sys_mem_enough(uint32_t len)
 }
 
 
+int sys_mem_get_free_MB(void)
+{
+    int value=0;
+    char buff[32];
+
+    FILE *fp = fopen("/proc/meminfo", "r");
+    if(!fp) {
+        return -1;
+    }
+
+    fscanf(fp, "MemTotal: %s kB\n", buff);
+    fscanf(fp, "MemFree: %s kB\n", buff);
+    value = atol(buff)/1024;
+    fclose(fp);
+
+    return value;
+}
+
+
+
 int sys_init(void)
 {
     //userShellInit();

+ 1 - 0
pro/src/sys.h

@@ -22,6 +22,7 @@ int sys_reboot(void);
 int sys_set_factory(void);
 
 int sys_mem_enough(uint32_t len);
+int sys_mem_get_free_MB(void);
 int sys_is_running(char *prog);
 int sys_get_path(char *path, char *name);
 int sys_get_net(NetworkInfo_t *para, int ipVersion);

+ 100 - 46
pub

@@ -1,15 +1,21 @@
-#  1:  XIAN_GOM037
-#  2:  RUSSIA_ITK
-#  3:  RUSSIA_ITK_DC
-#  4:  GOWONE_CN
-#  5:  LITECH_I1_O1
-#  6:  LITECH_I3_O1
-#  7:  NEUTER_CN
-#  8:  ANDERSON_EN
-#  9:  USA_SL
-# 10:  HYPERTEC_EN
-
-cust=8
+
+#PRJ="PRJ_XIAN_P4"
+#PRJ="PRJ_XIAN_P8"
+#PRJ="PRJ_ITK_AC_I1_O1"
+#PRJ="PRJ_ITK_AC_I3_O1"
+#PRJ="PRJ_LITECH_AC_I1_O1"
+#PRJ="PRJ_LITECH_AC_I3_O1"
+PRJ="PRJ_ANDERSON"
+#PRJ="PRJ_USASL_AC_I3_O1"
+#PRJ="PRJ_USASL_AC_I3_O3"
+#PRJ="PRJ_HYPERTEC"
+#PRJ="PRJ_INSPUR"
+#PRJ="PRJ_GOWONE_AC_I1_O1"
+#PRJ="PRJ_GOWONE_AC_I3_O1"
+#PRJ="PRJ_GOWONE_AC_I3_O3"
+#PRJ="PRJ_TEST"
+
+
 
 cmp_flag=1
 if [ $# -gt 0 ]; then
@@ -21,6 +27,7 @@ fulldir=$(realpath $0)
 curdir=$(dirname $fulldir)
 
 custdir=$curdir/cust_data
+name=null
 
 function do_copy()
 {
@@ -28,75 +35,109 @@ function do_copy()
     
     rm -f $curdir/output/t113i/etc/network/interfaces
     mkdir -p $curdir/output/t113i/root/run/app/image
-    if [ $cust -eq 1 ]; then
-        rm -rf  $curdir/output/t113i/root/run/web
+    rm -rf  $curdir/output/t113i/root/run/web
+    
+    if [ "$PRJ" = "PRJ_XIAN_P4" ]; then
+        name=ac_in1_out1_p4_xian
         cp -rf $custdir/web/general  $curdir/output/t113i/root/run/web
+        cp -rf $custdir/cfg/cfg_xian_p4.h  $curdir/pro/config/cfg.h
 
         cp -f $custdir/db/ac_i1_o1_chinese.db $curdir/output/t113i/root/run/app/pdu_dat.db
-        #cp -f $custdir/db/ac_i3_o1_chinese.db $curdir/output/t113i/root/run/app/pdu_dat.db
-	#cp -f $custdir/db/ac_i3_o3_chinese.db $curdir/output/t113i/root/run/app/pdu_dat.db
         cp -f $custdir/logo/logo_neuter.png $curdir/output/t113i/root/run/app/image/logo.png
-    elif [ $cust -eq 2 ]; then
-        rm -rf  $curdir/output/t113i/root/run/web
+    elif [ "$PRJ" = "PRJ_XIAN_P8" ]; then
+        name=ac_in1_out1_p8_xian
+        cp -rf $custdir/web/general  $curdir/output/t113i/root/run/web
+        cp -rf $custdir/cfg/cfg_xian_p8.h  $curdir/pro/config/cfg.h
+        
+        cp -f $custdir/db/ac_i1_o1_chinese.db $curdir/output/t113i/root/run/app/pdu_dat.db
+        cp -f $custdir/logo/logo_neuter.png $curdir/output/t113i/root/run/app/image/logo.png
+    elif [ "$PRJ" = "PRJ_ITK_AC_I1_O1" ]; then
+        name=ac_in1_out1_itk
         cp -rf $custdir/web/general  $curdir/output/t113i/root/run/web
+        cp -rf $custdir/cfg/cfg_russia_itk.h  $curdir/pro/config/cfg.h
 
-        cp -f $custdir/db/ac_i3_o1_russian.db $curdir/output/t113i/root/run/app/pdu_dat.db
+        cp -f $custdir/db/ac_i1_o1_russian.db $curdir/output/t113i/root/run/app/pdu_dat.db
         cp -f $custdir/logo/logo_itk.png $curdir/output/t113i/root/run/app/image/logo.png
-    elif [ $cust -eq 3 ]; then
-        rm -rf  $curdir/output/t113i/root/run/web
+    elif [ "$PRJ" = "PRJ_ITK_AC_I3_O1" ]; then
+        name=ac_in3_out1_itk
         cp -rf $custdir/web/general  $curdir/output/t113i/root/run/web
+        cp -rf $custdir/cfg/cfg_russia_itk.h  $curdir/pro/config/cfg.h
 
-        cp -f $custdir/db/ac_i1_o1_russian.db $curdir/output/t113i/root/run/app/pdu_dat.db
+        cp -f $custdir/db/ac_i3_o1_russian.db $curdir/output/t113i/root/run/app/pdu_dat.db
         cp -f $custdir/logo/logo_itk.png $curdir/output/t113i/root/run/app/image/logo.png
-    elif [ $cust -eq 4 ]; then
-        rm -rf  $curdir/output/t113i/root/run/web
+    elif [ "$PRJ" = "PRJ_GOWONE_AC_I1_O1" ]; then
+        name=ac_in1_out1_gowone
         cp -rf $custdir/web/general  $curdir/output/t113i/root/run/web
+        cp -rf $custdir/cfg/cfg_general.h  $curdir/pro/config/cfg.h
 
         cp -f $custdir/db/ac_i1_o1_chinese.db $curdir/output/t113i/root/run/app/pdu_dat.db
         cp -f $custdir/logo/logo_gowone.png $curdir/output/t113i/root/run/app/image/logo.png
-    elif [ $cust -eq 5 ]; then
-        rm -rf  $curdir/output/t113i/root/web
+    elif [ "$PRJ" = "PRJ_GOWONE_AC_I3_O1" ]; then
+        name=ac_in3_out1_gowone
+        cp -rf $custdir/web/general  $curdir/output/t113i/root/run/web
+        cp -rf $custdir/cfg/cfg_general.h  $curdir/pro/config/cfg.h
+
+        cp -f $custdir/db/ac_i3_o1_chinese.db $curdir/output/t113i/root/run/app/pdu_dat.db
+        cp -f $custdir/logo/logo_gowone.png $curdir/output/t113i/root/run/app/image/logo.png
+    elif [ "$PRJ" = "PRJ_GOWONE_AC_I3_O3" ]; then
+        name=ac_in3_out3_gowone
+        cp -rf $custdir/web/general  $curdir/output/t113i/root/run/web
+        cp -rf $custdir/cfg/cfg_general.h  $curdir/pro/config/cfg.h
+
+        cp -f $custdir/db/ac_i3_o3_chinese.db $curdir/output/t113i/root/run/app/pdu_dat.db
+        cp -f $custdir/logo/logo_gowone.png $curdir/output/t113i/root/run/app/image/logo.png
+    elif [ "$PRJ" = "PRJ_LITECH_AC_I1_O1" ]; then
+        name=ac_in1_out1_litech
         cp -rf $custdir/web/general  $curdir/output/t113i/root/run/web
+        cp -rf $custdir/cfg/cfg_general.h  $curdir/pro/config/cfg.h
 
         cp -f $custdir/db/ac_i1_o1_english.db $curdir/output/t113i/root/run/app/pdu_dat.db
         cp -f $custdir/logo/logo_litech.png $curdir/output/t113i/root/run/app/image/logo.png
-    elif [ $cust -eq 6 ]; then
-        rm -rf  $curdir/output/t113i/root/run/web
+    elif [ "$PRJ" = "PRJ_LITECH_AC_I3_O1" ]; then
+        name=ac_in3_out1_litech
         cp -rf $custdir/web/general  $curdir/output/t113i/root/run/web
+        cp -rf $custdir/cfg/cfg_general.h  $curdir/pro/config/cfg.h
 
         cp -f $custdir/db/ac_i3_o1_english.db $curdir/output/t113i/root/run/app/pdu_dat.db
         cp -f $custdir/logo/logo_litech.png $curdir/output/t113i/root/run/app/image/logo.png
-    elif [ $cust -eq 7 ]; then
-        rm -rf  $curdir/output/t113i/root/run/web
-        cp -rf $custdir/web/general  $curdir/output/t113i/root/run/web
-
-        #cp -f $custdir/db/dc_i_dc_o_chinese.db $curdir/output/t113i/root/run/app/pdu_dat.db
-        #cp -f $custdir/db/ac_i1_o1_chinese.db $curdir/output/t113i/root/run/app/pdu_dat.db
-        #cp -f $custdir/db/ac_i3_o1_chinese.db $curdir/output/t113i/root/run/app/pdu_dat.db
-        cp -f $custdir/db/ac_i3_o3_chinese.db $curdir/output/t113i/root/run/app/pdu_dat.db
-        cp -f $custdir/logo/logo_neuter.png $curdir/output/t113i/root/run/app/image/logo.png
-    elif [ $cust -eq 8 ]; then
-        rm -rf  $curdir/output/t113i/root/run/web
+    elif [ "$PRJ" = "PRJ_ANDERSON" ]; then
+        name=ac_in3_out3_anderson
         cp -rf $custdir/web/anderson  $curdir/output/t113i/root/run/web
+        cp -rf $custdir/cfg/cfg_anderson.h  $curdir/pro/config/cfg.h
         
         #cp -f $custdir/etc/interfaces $curdir/output/t113i/etc/network/
         cp -f $custdir/db/ac_i3_o3_english.db $curdir/output/t113i/root/run/app/pdu_dat.db
         cp -f $custdir/logo/logo_neuter.png $curdir/output/t113i/root/run/app/image/logo.png
-    elif [ $cust -eq 9 ]; then
-        rm -rf  $curdir/output/t113i/root/run/web
+    elif [ "$PRJ" = "PRJ_USASL_AC_I3_O1" ]; then
+        name=ac_in3_out1_usa_sl
         cp -rf $custdir/web/general  $curdir/output/t113i/root/run/web
+        cp -rf $custdir/cfg/cfg_usa_sl.h  $curdir/pro/config/cfg.h
+        
+        cp -f $custdir/db/ac_i3_o1_english.db $curdir/output/t113i/root/run/app/pdu_dat.db
+        cp -f $custdir/logo/logo_neuter.png $curdir/output/t113i/root/run/app/image/logo.png
+    elif [ "$PRJ" = "PRJ_USASL_AC_I3_O3" ]; then
+        name=ac_in3_out3_usa_sl
+        cp -rf $custdir/web/general  $curdir/output/t113i/root/run/web
+        cp -rf $custdir/cfg/cfg_hypertec.h  $curdir/pro/config/cfg.h
         
-        #cp -f $custdir/db/ac_i3_o1_english.db $curdir/output/t113i/root/run/app/pdu_dat.db
         cp -f $custdir/db/ac_i3_o3_english.db $curdir/output/t113i/root/run/app/pdu_dat.db
         cp -f $custdir/logo/logo_neuter.png $curdir/output/t113i/root/run/app/image/logo.png
-    elif [ $cust -eq 10 ]; then
-        rm -rf  $curdir/output/t113i/root/run/web
+    elif [ "$PRJ" = "PRJ_HYPERTEC" ]; then
+        name=ac_in3_out1_hypertec
+        cp -rf $custdir/cfg/cfg_hypertec.h  $curdir/pro/config/cfg.h
         cp -rf $custdir/web/general  $curdir/output/t113i/root/run/web
         
         cp -f $custdir/db/ac_i3_o1_english.db $curdir/output/t113i/root/run/app/pdu_dat.db
         cp -f $custdir/logo/logo_hypertec.png $curdir/output/t113i/root/run/app/image/logo.png
+    elif [ "$PRJ" = "PRJ_INSPUR" ]; then
+        name=dc_in1_out1_hypertec
+        cp -rf $custdir/web/general  $curdir/output/t113i/root/run/web
+        cp -rf $custdir/cfg/cfg_general.h  $curdir/pro/config/cfg.h
+        
+        cp -f $custdir/db/dc_i_dc_o_chinese.db $curdir/output/t113i/root/run/app/pdu_dat.db
+        cp -f $custdir/logo/logo_neuter.png $curdir/output/t113i/root/run/app/image/logo.png
     else
-        echo error!  customer value is wrong!!!
+        echo error! RPJ is wrong!!!
         exit 1
     fi
 }
@@ -121,10 +162,23 @@ function do_pack()
     $curdir/output/pack.sh
 }
 
+function do_zip()
+{
+    echo do_zip ...
+    
+    tim=`date +%Y%m%d_%H%M%S`
+    zname="upgrade_"$tim"_$name"
+    echo ---$tim---$zname
+    
+    files="$curdir/output/push/push.bat $curdir/output/push/pdutar $curdir/output/push/tools"
+    
+    zip -q $curdir/output/$zname.zip $files
+}
+
 do_copy
 do_compile $cmp_flag
 do_pack
-
+do_zip