Bladeren bron

feature:修改指令解析的问题

zeng.chen 8 maanden geleden
bovenliggende
commit
3626e25604

+ 2 - 2
devices/bluetooth/bt_cmd.js

@@ -129,8 +129,8 @@ class BtCmd {
             const hours = Math.floor(time / day);
             const minutes = Math.floor((time % day) / hour);
             const seconds = Math.floor((time % day % hour));
-            console.log(`${hours.toString().padStart(2, '0')}:${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`);
-
+//            console.log(`${hours.toString().padStart(2, '0')}:${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`);
+            console.log("休眠:", hour, minutes, seconds)
             return this._build(CmdRtc.setSleepAfterPlayPause, [hours, minutes, seconds]);
         } else {
             return this._build(CmdRtc.setSleepAfterPlayPause, [-1]);

+ 11 - 2
devices/bluetooth/bt_parse.js

@@ -69,7 +69,7 @@ class BtParse {
                 // 查询版本号后校验设备
                 else if (type === CmdBase.queryVersion) {
                     const version = CmdBase.parseVersion(value);
-                    EventManager.fire(CmdEvent.version(version));
+                    EventManager.fire(CmdEvent.version({ version }));
                     EventManager.fire(CmdEvent.getDeviceInfo());
                 } else if (BtParse._getDataHeader(cmd)) {
                     // 控制指令
@@ -406,7 +406,16 @@ class BtParse {
             // 查询自动休眠状态
             case CmdRtc.querySleepAfterPlayPause:
             case CmdRtc.setSleepAfterPlayPause:
-                EventManager.fire(CmdEvent.pauseSleep({ pauseSleep: value }));
+                {
+                    console.log("pauseSleep=====", value);
+                    const hour = parseInt(cmd[8], 16) ?? 0;
+                    const minutes = parseInt(cmd[9], 16) ?? 0;
+                    const seconds = parseInt(cmd[10], 16) ?? 0;
+                    console.log("hour=====", hour, "minutes=====", minutes, "seconds=====", seconds)
+                    let allSeconds = hour * 3600 + minutes * 60 + seconds;
+                    //            [84, 68, 68, 72, 1, 12, 90, 4, 0, 14, 0, 72]
+                    EventManager.fire(CmdEvent.pauseSleep({ pauseSleep: allSeconds }));
+                }
                 break;
 
             // 查询休眠

+ 6 - 3
pages/deviceDetail/detail.js

@@ -24,7 +24,8 @@ Page({
   },
   checkOtaVersion(device) {
     let _this = this;
-    deviceVersion(device.clienlType, device.connectType, device.version).then(res => {
+          console.log("OTA:", device);
+    deviceVersion(device.clientType, device.connectType, device.version).then(res => {
       console.log("OTA:", res);
       let updateData = res.data ?? {};
       let hasNewVersion = updateData.isEnforcement === 1 || updateData.isEnforcement === 2;
@@ -89,6 +90,8 @@ Page({
    */
   onLoad: function (options) {
     let device = JSON.parse(options.param);
+    device.clientType = device.clientType ?? device.ProdModel
+
     console.log("设备详情", device)
     let isConnect = device.state === 'online'
     if (!isConnect) {
@@ -116,9 +119,9 @@ Page({
           _this.checkOtaVersion(_this.data.device);
           break;
              case EnumCmdEvent.setPauseSleep:
-             let value = event.value;
+             let value = event.pauseSleep;
       _this.setData({
-         powerOpen: (value??-1) > -1
+         powerOpen: (value??-1) > 0
        })
           break;
       }

+ 13 - 6
pages/piano/wallpaper/wallpaper.js

@@ -19,10 +19,10 @@ Page({
    */
   data: {
     topImg:
-     {
-//      pic: "",
-//      id: "",
-//      name: ""
+    {
+      //      pic: "",
+      //      id: "",
+      //      name: ""
     },
     imageList: [
 
@@ -33,6 +33,7 @@ Page({
       title: '壁纸设置', //导航栏 中间的标题
     },
     src: '',
+    showCrop: false,
     width: 250,//宽度
     height: 250,//高度
     _imageBuffer: null,
@@ -45,7 +46,7 @@ Page({
       sourceType: ['album'], // 从相册选择
       success: function (res) {
         const tempFilePaths = res.tempFilePaths;
-//         console.log('获取图片信息成功', res);
+        //         console.log('获取图片信息成功', res);
         // wx.cropImage({
         //   src: tempFilePaths[0], // 图片路径
         //   cropScale: '1:1', // 裁剪比例
@@ -66,6 +67,7 @@ Page({
             //开始裁剪
             that.setData({
               src: imageInfo.path,//要裁剪的图片
+              showCrop: true
             })
 
           },
@@ -149,7 +151,12 @@ Page({
 
     })
   },
-
+  hideCut(e) {
+    this.setData({
+      src: "",//要裁剪的图片
+      showCrop: false
+    })
+  },
   startImage() {
     BtHelper.sendData(BtCmd.wallPaper(1));
   },

+ 2 - 1
pages/piano/wallpaper/wallpaper.wxml

@@ -14,7 +14,8 @@
         <image src="../../../images/common/icon_add.png" mode="aspectFill" />
         <view>上传图片</view>
     </view>
-    <image-cropper wx:if="{{scr}}" imageSrc="{{src}}" bind:cropSuccess="cropSuccess" bind:cropCancel="cropCancel" bind:cropClose="cropClose" :showCropper="showCropper" :cropRatio="cropRatio" :cropWidth="cropWidth" :cropHeight="cropHeight" :cropTop="cropTop" :cropLeft="cropLeft" :cropBgColor="cropBgColor" :cropBgImage></image-cropper>
+    <!-- <image-cropper wx:if="{{scr}}" imageSrc="{{src}}"></image-cropper> -->
+    <my-cropper bind:close="hideCut" cutRatio="1" wx:if="{{showCrop}}" imageSrc="{{src}}" />
     <!-- <view wx:if="{{src}}" class='bottom'>
         <button catchtap='updateImage'>更换照片</button>
         <button type="primary" bindtap='submit'>确定裁剪</button>