فهرست منبع

feature:修改多个设备的掉线问题,去掉日志

zeng.chen 6 ماه پیش
والد
کامیت
487bc36cd5
4فایلهای تغییر یافته به همراه15 افزوده شده و 9 حذف شده
  1. 8 2
      devices/ble_manager.js
  2. 1 1
      devices/cmd_key_event.js
  3. 5 5
      pages/piano/cropper/cropper.js
  4. 1 1
      pages/piano/wallpaper/wallpaper.js

+ 8 - 2
devices/ble_manager.js

@@ -449,7 +449,10 @@ class bleManager {
         deviceId: deviceId,
         success: (res) => {
           console.log('成功断开连接', res);
-          that.publicDevice = null;
+          let publicDevice = that.publicDevice ?? {}
+          if (deviceId == publicDevice.deviceId) {
+            that.publicDevice = null;
+          }
           resolve(res);
         },
         fail: (err) => {
@@ -485,7 +488,10 @@ class bleManager {
           } else {
             that.isConnecting = false;
             that.errorDisconnect(false)
-            that.publicDevice = null
+            let publicDevice = that.publicDevice ?? {}
+            if (device.deviceId == publicDevice.deviceId) {
+              that.publicDevice = null;
+            }
           }
           console.error('连接失败:', err);
           resolve(false);

+ 1 - 1
devices/cmd_key_event.js

@@ -367,7 +367,7 @@ class CmdEvent {
     }
     static wallPaperData({ value, kind }) {
         const event = new CmdEvent({ cmdEvent: EnumCmdEvent.wallPaperData });
-        console.log("wallPaperData", value, kind)
+        // console.log("wallPaperData", value, kind)
         event.wallpaper = value;
         event.heiJiaoKind = kind;
         return event;

+ 5 - 5
pages/piano/cropper/cropper.js

@@ -359,10 +359,10 @@ Page({
     return md5
   },
   sendImageMD5() {
-    let lengthCode = this.data._chunks.length
-    console.log("发送壁纸MD5 1:", lengthCode, this.data._imgMD5)
+    // let lengthCode = this.data._chunks.length
+    // console.log("发送壁纸MD5 1:", lengthCode, this.data._imgMD5)
     let value = BtCmd.sendWiFiInfo("99", this.data._imgMD5)
-    console.log("发送壁纸MD5 2:", value)
+    // console.log("发送壁纸MD5 2:", value)
     BtHelper.sendCallBack(BtCmd.wallPaperMD5(value), function (res) {
       if (!res) {
         wx.hideLoading()
@@ -405,7 +405,7 @@ Page({
     const chunk = chunks[index];
     _this.data._imgNext += (chunk.byteLength ?? chunk.length);
 
-    console.log("发送壁纸数据1:", index, ":", _this.data._imgNext, ":", chunk.length, ":", chunk.byteLength, ":", total, chunks.length)
+    // console.log("发送壁纸数据1:", index, ":", _this.data._imgNext, ":", chunk.length, ":", chunk.byteLength, ":", total, chunks.length)
     _this.data._imgIndex += 1;
     let res = await btHelper.wallPaperSyncData(chunk);
     // let res = true;
@@ -562,7 +562,7 @@ Page({
       let name = event.cmdEvent;
       let value = event.wallpaper;
       let kind = event.heiJiaoKind;
-      console.log("裁剪页:", name, value, kind)
+      // console.log("裁剪页:", name, value, kind)
 
       switch (name) {
         case EnumCmdEvent.onoffline:

+ 1 - 1
pages/piano/wallpaper/wallpaper.js

@@ -90,7 +90,7 @@ Page({
       console.log("壁纸列表", data.length, "空", localImgList);
       let allImgs = []
       if (localImgList) {
-        console.log("壁纸列表2", res.length, "空", localImgList, "空");
+        console.log("壁纸列表2", res.length, "空", JSON.stringify(localImgList), "空");
         allImgs = localImgList.concat(data)
       }
       _this.data._allImageList = allImgs;