Просмотр исходного кода

feature:增加OTA的型号判断

zeng.chen 7 месяцев назад
Родитель
Сommit
57cddd8220
5 измененных файлов с 11 добавлено и 6 удалено
  1. 2 1
      devices/bluetooth/bt_cmd.js
  2. 0 1
      devices/bt_helper.js
  3. 4 1
      pages/deviceDetail/detail.js
  4. 4 2
      pages/index/index.js
  5. 1 1
      pages/ota/ota.js

+ 2 - 1
devices/bluetooth/bt_cmd.js

@@ -314,7 +314,8 @@ class BtCmd {
         }
 
         for (let i = 0; i < cmd.length; i++) {
-            const cmdStr = `${this._int2HexString(cmd[i])}`.padStart(2, "0");
+            var cmdStr = `${this._int2HexString(cmd[i])}`.padStart(2, "0");
+            cmdStr += ":"
             result += cmdStr;
         }
         if (isSend) {

+ 0 - 1
devices/bt_helper.js

@@ -448,7 +448,6 @@ class BtHelper {
   }
   async send(cmd, type) {
     if (cmd) {
-      console.log("发送数据:", cmd)
       this.queueManager.addTask(cmd)
     }
     // QueueManager.instance.addTask({ task: cmd });

+ 4 - 1
pages/deviceDetail/detail.js

@@ -107,7 +107,10 @@ Page({
     })
 
     const btHelper = BtHelper.getInstance();
-    btHelper.getVersion()
+    let isShowOta = device.clientType === 'MW-S2(BLE)' || device.clientType === 'MW-S2'
+    if (isShowOta) {
+      btHelper.getVersion()
+    }
     btHelper.getPauseSleep()
 
     let _this = this;

+ 4 - 2
pages/index/index.js

@@ -121,7 +121,7 @@ Page({
               that.addConnectBlueDevice(connectDevice);
             }
           })
-        } else {}
+        } else { }
       })
     }
   },
@@ -920,7 +920,8 @@ Page({
       deviceId: newDevice.deviceId,
       name: newDevice.name,
       state: "online",
-      ProdModel: 1,
+      ProdModel: newDevice.ProdModel,
+      clientType: newDevice.ProdModel,
       devName: newDevice.name,
       mac: newDevice.mac,
       img: newDevice.img,
@@ -1047,6 +1048,7 @@ Page({
     that.setData({
       deviceList: finalList
     });
+    console.log("更新设备列表:", finalList);
     getApp().globalData.deviceList = finalList;
   },
 

+ 1 - 1
pages/ota/ota.js

@@ -286,7 +286,7 @@ Page({
     this.setData({
       otaData: otaData,
       device: device,
-      isShowOta: device.clientType === 'MW-S2(BLE)'
+      isShowOta: device.clientType === 'MW-S2(BLE)' || device.clientType === 'MW-S2'
     })
 
     let _this = this;