Sfoglia il codice sorgente

添加升级错误提示信息

guohui 1 anno fa
parent
commit
48ecdde93c
5 ha cambiato i file con 18 aggiunte e 24 eliminazioni
  1. 2 3
      pro/config/cfg.h
  2. 5 7
      pro/src/appweb_handle.c
  3. 1 1
      pro/src/cascade.c
  4. 7 10
      pro/src/json_handle.c
  5. 3 3
      pub

+ 2 - 3
pro/config/cfg.h

@@ -33,11 +33,10 @@
 #define MAIL_SEND_BUILTIN
 
 
-#define     CHIP_T113i   0
-#define     CHIP_T113s   1
+#define CHIP_T113i   0
+#define CHIP_T113s   1
 
 
-//#define CHIP_TYPE
 #define USE_MQTT
 #define MQTT_SERVER_BUILTIN
 

+ 5 - 7
pro/src/appweb_handle.c

@@ -5819,16 +5819,14 @@ static void controlBoardUpgradeUpload(void *conn)
 
             printf("_____ board upgrade now ...\n");
             r = upg_board_file_check(path);
-            if(r==UPG_OK) {
-                upg_board_start(path);
-                code = 200;
+            if(r!=UPG_OK) {
+                ack_str = upg_chk_to_json(r);
+                http_reply(conn, 500, ack_str);
+                cJSON_free(ack_str);
             }
             else {
-                code = 500;
+                upg_board_start(path);
             }
-            ack_str = upg_chk_to_json(r);
-            http_reply(conn, code, ack_str);
-            cJSON_free(ack_str);
         }
     }
 }

+ 1 - 1
pro/src/cascade.c

@@ -1910,7 +1910,7 @@ int cascade_init(void)
         addr = dm->_globalDevInfo.cascade.addr;
     }
 
-    dm->md_tcp = tcp_modbus_init(net.ip_address,CASCADE_SLAVE_PORT,addr,dm->_globalDevInfo.product.pwr_type);
+    dm->md_tcp = tcp_modbus_init("0.0.0.0",CASCADE_SLAVE_PORT,addr,dm->_globalDevInfo.product.pwr_type);
     if(dm->md_tcp)
         thread_start(THREAD_ID_TCP, tcp_modbus_thread, NULL);
     else

+ 7 - 10
pro/src/json_handle.c

@@ -1611,26 +1611,23 @@ char *upg_chk_to_json(int r)
     int code=200;
     cJSON* root = cJSON_CreateObject(); 
 
-    if(r!=UPG_OK) {
-        code = 500;
+    if(r==UPG_OK) {
+        return NULL;
     }
-    
+
     if(r>UPG_OK) {
         if(r==UPG_BUSYING) {
-            cJSON_AddStringToObject(root, "msg", "upgrading now"); 
+            cJSON_AddStringToObject(root, "msg", "upgrading"); 
         }
         else if(r==UPG_HDR_FAIL || r==UPG_MD5_FAIL) {
-            cJSON_AddStringToObject(root, "msg", "invalid upgrade file"); 
+            cJSON_AddStringToObject(root, "msg", "invalid file"); 
         }
     }
-    else if(r<0) {
-        cJSON_AddStringToObject(root, "msg", "failed");
-    }
     else {
-        cJSON_AddStringToObject(root, "msg", "ok");
+        cJSON_AddStringToObject(root, "msg", "error");
     }
     
-    cJSON_AddNumberToObject(root, "code", code);       
+    cJSON_AddNumberToObject(root, "code", 500);       
     str = cJSON_Print(root);
     cJSON_Delete(root);
     return str;

+ 3 - 3
pub

@@ -2,7 +2,7 @@
 #PRJS="PRJ_XIAN_AC_I1_O1_P4"
 #PRJS="PRJ_XIAN_AC_I1_O1_P8"
 #PRJS="PRJ_ITK_AC_I1_O1"
-PRJS="PRJ_ITK_AC_I3_O1"
+#PRJS="PRJ_ITK_AC_I3_O1"
 #PRJS="PRJ_LITECH_AC_I1_O1"
 #PRJS="PRJ_LITECH_AC_I3_O1"
 #PRJS="PRJ_ANDERSON_AC_I3_O3"
@@ -16,13 +16,13 @@ PRJS="PRJ_ITK_AC_I3_O1"
 #PRJS="PRJ_RELEASE_AC_I3_O3"
 #PRJS="PRJ_STSC_I3_O3"
 #PRJS="PRJ_SG_I3_O3"
-#PRJS="PRJ_TEST"
+PRJS="PRJ_TEST"
 #PRJS="PRJ_TEST_AC_I1_O1"
 #PRJS="PRJ_TEST_AC_I3_O1"
 
 #PRJS="PRJ_USASL_AC_I3_O1 PRJ_USASL_AC_I3_O3"
 #PRJS="PRJ_XIAN_AC_I1_O1_P4 PRJ_XIAN_AC_I1_O1_P8"
-PRJS="PRJ_ITK_AC_I1_O1 PRJ_ITK_AC_I3_O1"
+#PRJS="PRJ_ITK_AC_I1_O1 PRJ_ITK_AC_I3_O1"
 #PRJS="PRJ_TEST_AC_I1_O1 PRJ_TEST_AC_I3_O1"
 #PRJS="PRJ_LITECH_AC_I1_O1 PRJ_LITECH_AC_I3_O1"
 #PRJS="PRJ_RELEASE_DC_I_DC_O PRJ_RELEASE_AC_I1_O1 PRJ_RELEASE_AC_I3_O1 PRJ_RELEASE_AC_I3_O3"