|
@@ -249,7 +249,7 @@ Page({
|
|
});
|
|
});
|
|
},
|
|
},
|
|
async startImage(imageBuffer) {
|
|
async startImage(imageBuffer) {
|
|
- this.sliceDataIntoChunks(imageBuffer, 32);
|
|
|
|
|
|
+ this.sliceDataIntoChunks(imageBuffer, 128);
|
|
|
|
|
|
BtHelper.sendCallBack(BtCmd.wallPaper(1), function (res) {
|
|
BtHelper.sendCallBack(BtCmd.wallPaper(1), function (res) {
|
|
if (!res) {
|
|
if (!res) {
|
|
@@ -276,12 +276,17 @@ Page({
|
|
let _this = this
|
|
let _this = this
|
|
|
|
|
|
wx.hideLoading()
|
|
wx.hideLoading()
|
|
- let chunks = this.data._chunks
|
|
|
|
|
|
+ let chunks = _this.data._chunks
|
|
let next = 0;
|
|
let next = 0;
|
|
- let total = this.data._imageBufferLength;
|
|
|
|
|
|
+ let total = _this.data._imageBufferLength;
|
|
let btHelper = BtHelper.getInstance();
|
|
let btHelper = BtHelper.getInstance();
|
|
let i = 0;
|
|
let i = 0;
|
|
- this._timer = setInterval(async () => {
|
|
|
|
|
|
+ _this.data._timer = setInterval(async () => {
|
|
|
|
+ if (i >= chunks.length) {
|
|
|
|
+ clearInterval(_this.data._timer);
|
|
|
|
+ console.log("发送图片数据完成:", i, total)
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
const chunk = chunks[i];
|
|
const chunk = chunks[i];
|
|
i++;
|
|
i++;
|
|
next += chunk.byteLength;
|
|
next += chunk.byteLength;
|